This repository has been archived by the owner on Mar 31, 2023. It is now read-only.
forked from apache/geode
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
07884e8
commit 5aa6bc7
Showing
4 changed files
with
128 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...ache/wan/internal/txgrouping/parallel/TxGroupingParallelGatewaySenderTypeFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work for additional information regarding | ||
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. You may obtain a | ||
* copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package org.apache.geode.cache.wan.internal.txgrouping.parallel; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatNoException; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import org.junit.Test; | ||
|
||
import org.apache.geode.internal.cache.wan.GatewaySenderException; | ||
import org.apache.geode.internal.cache.wan.MutableGatewaySenderAttributes; | ||
|
||
public class TxGroupingParallelGatewaySenderTypeFactoryTest { | ||
|
||
final TxGroupingParallelGatewaySenderTypeFactory factory = | ||
new TxGroupingParallelGatewaySenderTypeFactory(); | ||
|
||
@Test | ||
public void validateThrowsIfBatchConflationEnabled() { | ||
final MutableGatewaySenderAttributes attributes = mock(MutableGatewaySenderAttributes.class); | ||
when(attributes.isBatchConflationEnabled()).thenReturn(true); | ||
|
||
assertThatThrownBy(() -> factory.validate(attributes)) | ||
.isInstanceOf(GatewaySenderException.class) | ||
.hasMessageContaining( | ||
"both group transaction events set to true and batch conflation enabled"); | ||
} | ||
|
||
@Test | ||
public void validateDoesNotThrowsIfBatchConflationDisabled() { | ||
final MutableGatewaySenderAttributes attributes = mock(MutableGatewaySenderAttributes.class); | ||
when(attributes.isBatchConflationEnabled()).thenReturn(false); | ||
|
||
assertThatNoException().isThrownBy(() -> factory.validate(attributes)); | ||
} | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
...de/cache/wan/internal/txgrouping/serial/TxGroupingSerialGatewaySenderTypeFactoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license | ||
* agreements. See the NOTICE file distributed with this work for additional information regarding | ||
* copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance with the License. You may obtain a | ||
* copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package org.apache.geode.cache.wan.internal.txgrouping.serial; | ||
|
||
import static org.assertj.core.api.Assertions.assertThatNoException; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import org.junit.Test; | ||
|
||
import org.apache.geode.internal.cache.wan.GatewaySenderException; | ||
import org.apache.geode.internal.cache.wan.MutableGatewaySenderAttributes; | ||
|
||
public class TxGroupingSerialGatewaySenderTypeFactoryTest { | ||
|
||
final TxGroupingSerialGatewaySenderTypeFactory factory = | ||
new TxGroupingSerialGatewaySenderTypeFactory(); | ||
|
||
final MutableGatewaySenderAttributes attributes = mock(MutableGatewaySenderAttributes.class); | ||
|
||
@Test | ||
public void validateThrowsIfBatchConflationEnabled() { | ||
when(attributes.isBatchConflationEnabled()).thenReturn(true); | ||
|
||
assertThatThrownBy(() -> factory.validate(attributes)) | ||
.isInstanceOf(GatewaySenderException.class) | ||
.hasMessageContaining( | ||
"both group transaction events set to true and batch conflation enabled"); | ||
} | ||
|
||
@Test | ||
public void validateDoesNotThrowsIfBatchConflationDisabled() { | ||
when(attributes.isBatchConflationEnabled()).thenReturn(false); | ||
|
||
assertThatNoException().isThrownBy(() -> factory.validate(attributes)); | ||
} | ||
|
||
@Test | ||
public void validateThrowsIfDispatcherThreadsGreaterThan1() { | ||
when(attributes.getDispatcherThreads()).thenReturn(2); | ||
|
||
assertThatThrownBy(() -> factory.validate(attributes)) | ||
.isInstanceOf(GatewaySenderException.class).hasMessageContaining( | ||
"cannot be created with group transaction events set to true when dispatcher threads is greater than 1"); | ||
} | ||
|
||
@Test | ||
public void validateDoesNotThrow() { | ||
when(attributes.getDispatcherThreads()).thenReturn(1); | ||
|
||
assertThatNoException().isThrownBy(() -> factory.validate(attributes)); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters