import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.opendaylight.transportpce.servicehandler.utils.ConstraintsUtils.buildHardConstraint;
import static org.opendaylight.transportpce.servicehandler.utils.ConstraintsUtils.buildSoftConstraint;
import java.util.Set;
import org.hamcrest.collection.IsMapContaining;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.DiversityConstraints.DiversityType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.common.constraints.LinkIdentifierKey;
public class DowngradeConstraintsTest {
@Test
- public void testUpdateSoftConstraintsForCustomerCode() {
+ void testUpdateSoftConstraintsForCustomerCode() {
// test no addition when hard customer-code is null or empty
HardConstraints initialHardConstraints =
buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertNull("updated soft constraints should contain no customer code",
- generatedSoftConstraints.getCustomerCode());
+ assertNull(generatedSoftConstraints.getCustomerCode(),
+ "updated soft constraints should contain no customer code");
Set<String> softCustomerCode = Set.of("soft-customer-code 3", "soft-customer-code 4");
initialSoftConstraints =
buildSoftConstraint(softCustomerCode, false, null, null, null, null, false, false, null, null);
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should contain the customer code of hard constraint",
- generatedSoftConstraints.getCustomerCode(),
- initialHardConstraints.getCustomerCode());
+ assertEquals(generatedSoftConstraints.getCustomerCode(),initialHardConstraints.getCustomerCode(),
+ "updated soft constraints should contain the customer code of hard constraint");
// test addition of hard customer-code when existing soft customer-code
initialSoftConstraints =
buildSoftConstraint(softCustomerCode, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
- initialHardConstraints, initialSoftConstraints);
+ initialHardConstraints, initialSoftConstraints);
assertThat("updated soft constraints should contain 4 customer code",
generatedSoftConstraints.getCustomerCode(), hasSize(4));
assertThat(generatedSoftConstraints.getCustomerCode(),
}
@Test
- public void testUpdateSoftConstraintsForDiversity() {
+ void testUpdateSoftConstraintsForDiversity() {
HardConstraints initialHardConstraints =
buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertNull("updated soft constraints should contain no diversity constraint",
- generatedSoftConstraints.getDiversity());
+ assertNull(generatedSoftConstraints.getDiversity(),
+ "updated soft constraints should contain no diversity constraint");
Set<String> softDiversityServiceid = Set.of("soft-service 3");
initialSoftConstraints =
buildSoftConstraint(null, false, softDiversityServiceid, null, null, null, false, false, null, null);
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should contain the diversity of hard constraint",
- generatedSoftConstraints.getDiversity(),
- initialHardConstraints.getDiversity());
+ assertEquals(generatedSoftConstraints.getDiversity(), initialHardConstraints.getDiversity(),
+ "updated soft constraints should contain the diversity of hard constraint");
// test addition of hard diversity when existing soft diversity
initialSoftConstraints =
initialHardConstraints, initialSoftConstraints);
assertThat("updated soft constraints should contain diversity with 3 services",
generatedSoftConstraints.getDiversity().getServiceIdentifierList().size(), is(3));
- assertEquals("updated soft constraints should have diversity type of serial",
- DiversityType.Serial,
- generatedSoftConstraints.getDiversity().getDiversityType());
+ assertEquals(DiversityType.Serial, generatedSoftConstraints.getDiversity().getDiversityType(),
+ "updated soft constraints should have diversity type of serial");
assertThat(generatedSoftConstraints.getDiversity().getServiceIdentifierList(),
IsMapContaining.hasKey(new ServiceIdentifierListKey("hard-service 1")));
assertThat(generatedSoftConstraints.getDiversity().getServiceIdentifierList(),
}
@Test
- public void testUpdateSoftConstraintsForExclude() {
+ void testUpdateSoftConstraintsForExclude() {
HardConstraints initialHardConstraints =
buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertNull("updated soft constraints should contain no exclude constraint",
- generatedSoftConstraints.getExclude());
+ assertNull(generatedSoftConstraints.getExclude(),
+ "updated soft constraints should contain no exclude constraint");
initialSoftConstraints = buildSoftConstraint(null, false, null, "link", null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should not be changed",
- initialSoftConstraints.getExclude(), generatedSoftConstraints.getExclude());
+ assertEquals(initialSoftConstraints.getExclude(), generatedSoftConstraints.getExclude(),
+ "updated soft constraints should not be changed");
// test addition of hard exclude with fiber list when no soft exclude
initialHardConstraints =
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should contain the exclude constraint of hard constraint",
- generatedSoftConstraints.getExclude(), initialHardConstraints.getExclude());
+ assertEquals(generatedSoftConstraints.getExclude(), initialHardConstraints.getExclude(),
+ "updated soft constraints should contain the exclude constraint of hard constraint");
// test addition of hard exclude with fiber list when existing soft
// exclude with fiber list
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should contain the exclude constraint of hard constraint",
- generatedSoftConstraints.getExclude(), initialHardConstraints.getExclude());
+ assertEquals(generatedSoftConstraints.getExclude(), initialHardConstraints.getExclude(),
+ "updated soft constraints should contain the exclude constraint of hard constraint");
// test addition of hard exclude with link list when existing soft
// exclude with link list
}
@Test
- public void testUpdateSoftConstraintsForInclude() {
+ void testUpdateSoftConstraintsForInclude() {
HardConstraints initialHardConstraints =
buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertNull("updated soft constraints should contain no include constraint",
- generatedSoftConstraints.getInclude());
+ assertNull(generatedSoftConstraints.getInclude(),
+ "updated soft constraints should contain no include constraint");
initialSoftConstraints = buildSoftConstraint(null, false, null, null, "link", null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should not be changed",
- initialSoftConstraints.getInclude(), generatedSoftConstraints.getInclude());
+ assertEquals(initialSoftConstraints.getInclude(), generatedSoftConstraints.getInclude(),
+ "updated soft constraints should not be changed");
// test addition of hard include with fiber list when no soft include
initialHardConstraints =
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should contain the include constraint of hard constraint",
- generatedSoftConstraints.getInclude(), initialHardConstraints.getInclude());
+ assertEquals(generatedSoftConstraints.getInclude(), initialHardConstraints.getInclude(),
+ "updated soft constraints should contain the include constraint of hard constraint");
// test addition of hard include with fiber list when existing soft
// include with fiber list
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should contain the include constraint of hard constraint",
- generatedSoftConstraints.getInclude(), initialHardConstraints.getInclude());
+ assertEquals(generatedSoftConstraints.getInclude(), initialHardConstraints.getInclude(),
+ "updated soft constraints should contain the include constraint of hard constraint");
// test addition of hard include with link list when existing soft
// include with link list
}
@Test
- public void testUpdateSoftConstraintsForLatency() {
+ void testUpdateSoftConstraintsForLatency() {
HardConstraints initialHardConstraints =
buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertNull("updated soft constraints should contain no latency constraint",
- generatedSoftConstraints.getLatency());
+ assertNull(generatedSoftConstraints.getLatency(),
+ "updated soft constraints should contain no latency constraint");
initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, Double.valueOf(12.2), false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should not be changed",
- initialSoftConstraints.getLatency(), generatedSoftConstraints.getLatency());
- assertEquals("updated soft constraints value should be '12.2'",
- (float) 12.2, generatedSoftConstraints.getLatency().getMaxLatency().floatValue(), 0.0f);
+ assertEquals(initialSoftConstraints.getLatency(), generatedSoftConstraints.getLatency(),
+ "updated soft constraints should not be changed");
+ assertEquals((float) 12.2, generatedSoftConstraints.getLatency().getMaxLatency().floatValue(), 0.0f,
+ "updated soft constraints value should be '12.2'");
// test addition of hard latency when no soft latency
initialHardConstraints =
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints value should be '16.59'",
- (float) 16.59, generatedSoftConstraints.getLatency().getMaxLatency().floatValue(), 0.0f);
+ assertEquals((float) 16.59, generatedSoftConstraints.getLatency().getMaxLatency().floatValue(), 0.0f,
+ "updated soft constraints value should be '16.59'");
// test addition of hard latency when existing different soft latency
initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, Double.valueOf(12.2), false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints value should be '12.2'",
- (float) 12.2, generatedSoftConstraints.getLatency().getMaxLatency().floatValue(), 0.0f);
+ assertEquals((float) 12.2, generatedSoftConstraints.getLatency().getMaxLatency().floatValue(), 0.0f,
+ "updated soft constraints value should be '12.2'");
}
@Test
- public void testUpdateSoftConstraintsForDistance() {
+ void testUpdateSoftConstraintsForDistance() {
HardConstraints initialHardConstraints =
buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertNull("updated soft constraints should contain no distance constraint",
- generatedSoftConstraints.getDistance());
+ assertNull(generatedSoftConstraints.getDistance(),
+ "updated soft constraints should contain no distance constraint");
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, "750.2", null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should not be changed",
- initialSoftConstraints.getDistance(), generatedSoftConstraints.getDistance());
- assertEquals("updated soft constraints value should be '750.2'",
- (float) 750.2, generatedSoftConstraints.getDistance().getMaxDistance().floatValue(), 0.0f);
+ assertEquals(initialSoftConstraints.getDistance(), generatedSoftConstraints.getDistance(),
+ "updated soft constraints should not be changed");
+ assertEquals((float) 750.2, generatedSoftConstraints.getDistance().getMaxDistance().floatValue(), 0.0f,
+ "updated soft constraints value should be '750.2'");
// test addition of hard distance when no soft distance
initialHardConstraints = buildHardConstraint(null, false, null, null, null, null, false, false, "555.5", null);
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints value should be '555.5'",
- (float) 555.5, generatedSoftConstraints.getDistance().getMaxDistance().floatValue(), 0.0f);
+ assertEquals((float) 555.5, generatedSoftConstraints.getDistance().getMaxDistance().floatValue(), 0.0f,
+ "updated soft constraints value should be '555.5'");
// test addition of hard distance when existing different soft distance
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, "750.2", null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints value should be '555.5'",
- (float) 555.5, generatedSoftConstraints.getDistance().getMaxDistance().floatValue(), 0.0f);
+ assertEquals((float) 555.5, generatedSoftConstraints.getDistance().getMaxDistance().floatValue(), 0.0f,
+ "updated soft constraints value should be '555.5'");
}
@Test
- public void testUpdateSoftConstraintsForHopCountAndTEmetric() {
+ void testUpdateSoftConstraintsForHopCountAndTEmetric() {
HardConstraints initialHardConstraints =
buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertNull("updated soft constraints should contain no hop-count constraint",
- generatedSoftConstraints.getHopCount());
+ assertNull(generatedSoftConstraints.getHopCount(),
+ "updated soft constraints should contain no hop-count constraint");
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, true, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should not be changed",
- initialSoftConstraints.getHopCount(), generatedSoftConstraints.getHopCount());
- assertEquals("updated soft constraints max-wdm-hop-count should be '3'",
- 3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue());
- assertEquals("updated soft constraints max-otn-hop-count should be '5'",
- 5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue());
- assertEquals("updated soft constraints max-wdm-TE-metric should be '8'",
- 8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue());
- assertEquals("updated soft constraints max-otn-TE-metric should be '11'",
- 11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue());
+ assertEquals(initialSoftConstraints.getHopCount(), generatedSoftConstraints.getHopCount(),
+ "updated soft constraints should not be changed");
+ assertEquals(3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue(),
+ "updated soft constraints max-wdm-hop-count should be '3'");
+ assertEquals(5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue(),
+ "updated soft constraints max-otn-hop-count should be '5'");
+ assertEquals(8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue(),
+ "updated soft constraints max-wdm-TE-metric should be '8'");
+ assertEquals(11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue(),
+ "updated soft constraints max-otn-TE-metric should be '11'");
// test addition of hard hop-count when no soft hop-count
initialHardConstraints = buildHardConstraint(null, false, null, null, null, null, true, true, null, null);
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should contain hard constraint",
- initialHardConstraints.getHopCount(), generatedSoftConstraints.getHopCount());
- assertEquals("updated soft constraints max-wdm-hop-count should be '3'",
- 3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue());
- assertEquals("updated soft constraints max-otn-hop-count should be '5'",
- 5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue());
- assertEquals("updated soft constraints max-wdm-TE-metric should be '8'",
- 8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue());
- assertEquals("updated soft constraints max-otn-TE-metric should be '11'",
- 11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue());
+ assertEquals(initialHardConstraints.getHopCount(), generatedSoftConstraints.getHopCount(),
+ "updated soft constraints should contain hard constraint");
+ assertEquals(3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue(),
+ "updated soft constraints max-wdm-hop-count should be '3'");
+ assertEquals(5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue(),
+ "updated soft constraints max-otn-hop-count should be '5'");
+ assertEquals(8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue(),
+ "updated soft constraints max-wdm-TE-metric should be '8'");
+ assertEquals(11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue(),
+ "updated soft constraints max-otn-TE-metric should be '11'");
// test addition of hard hop-count when existing soft hop-count
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, true, true, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints max-wdm-hop-count should be '3'",
- 3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue());
- assertEquals("updated soft constraints max-otn-hop-count should be '5'",
- 5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue());
- assertEquals("updated soft constraints max-wdm-TE-metric should be '8'",
- 8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue());
- assertEquals("updated soft constraints max-otn-TE-metric should be '11'",
- 11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue());
+ assertEquals(3, generatedSoftConstraints.getHopCount().getMaxWdmHopCount().intValue(),
+ "updated soft constraints max-wdm-hop-count should be '3'");
+ assertEquals(5, generatedSoftConstraints.getHopCount().getMaxOtnHopCount().intValue(),
+ "updated soft constraints max-otn-hop-count should be '5'");
+ assertEquals(8, generatedSoftConstraints.getTEMetric().getMaxWdmTEMetric().intValue(),
+ "updated soft constraints max-wdm-TE-metric should be '8'");
+ assertEquals(11, generatedSoftConstraints.getTEMetric().getMaxOtnTEMetric().intValue(),
+ "updated soft constraints max-otn-TE-metric should be '11'");
}
@Test
- public void testUpdateSoftConstraintsForCoRouting() {
+ void testUpdateSoftConstraintsForCoRouting() {
HardConstraints initialHardConstraints =
buildHardConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
SoftConstraints generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertNull("updated soft constraints should contain no co-routing constraint",
- generatedSoftConstraints.getCoRouting());
+ assertNull(generatedSoftConstraints.getCoRouting(),
+ "updated soft constraints should contain no co-routing constraint");
initialSoftConstraints =
buildSoftConstraint(null, false, null, null, null, null, true, false, null, "coRouting1");
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should not be changed",
- initialSoftConstraints.getCoRouting(), generatedSoftConstraints.getCoRouting());
- assertEquals("updated soft constraints should contain 2 co-routed services",
- 2, generatedSoftConstraints.getCoRouting().getServiceIdentifierList().size());
+ assertEquals(initialSoftConstraints.getCoRouting(), generatedSoftConstraints.getCoRouting(),
+ "updated soft constraints should not be changed");
+ assertEquals(2, generatedSoftConstraints.getCoRouting().getServiceIdentifierList().size(),
+ "updated soft constraints should contain 2 co-routed services");
assertTrue(generatedSoftConstraints.getCoRouting().getServiceIdentifierList()
.get(new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
.routing.ServiceIdentifierListKey("service 1"))
initialSoftConstraints = buildSoftConstraint(null, false, null, null, null, null, false, false, null, null);
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should contain hard constraint",
- initialHardConstraints.getCoRouting(), generatedSoftConstraints.getCoRouting());
- assertEquals("updated soft constraints should contain 1 co-routed service",
- 1, generatedSoftConstraints.getCoRouting().getServiceIdentifierList().size());
+ assertEquals(initialHardConstraints.getCoRouting(), generatedSoftConstraints.getCoRouting(),
+ "updated soft constraints should contain hard constraint");
+ assertEquals(1, generatedSoftConstraints.getCoRouting().getServiceIdentifierList().size(),
+ "updated soft constraints should contain 1 co-routed service");
assertTrue(generatedSoftConstraints.getCoRouting().getServiceIdentifierList()
.get(new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
.routing.ServiceIdentifierListKey("service 3"))
buildSoftConstraint(null, false, null, null, null, null, true, false, null, "coRouting1");
generatedSoftConstraints = DowngradeConstraints.updateSoftConstraints(
initialHardConstraints, initialSoftConstraints);
- assertEquals("updated soft constraints should contain 3 co-routed service",
- 3, generatedSoftConstraints.getCoRouting().getServiceIdentifierList().size());
+ assertEquals(3, generatedSoftConstraints.getCoRouting().getServiceIdentifierList().size(),
+ "updated soft constraints should contain 3 co-routed service");
assertThat(generatedSoftConstraints.getCoRouting().getServiceIdentifierList(),
IsMapContaining.hasKey(
new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co
}
@Test
- public void testDowngradeHardConstraints() {
+ void testDowngradeHardConstraints() {
HardConstraints initialHardConstraints = null;
HardConstraints genHardConstraints = DowngradeConstraints.downgradeHardConstraints(initialHardConstraints);
- assertNotNull("generated hard-constraints should be empty, not null", genHardConstraints);
+ assertNotNull(genHardConstraints, "generated hard-constraints should be empty, not null");
initialHardConstraints = new HardConstraintsBuilder().build();
genHardConstraints = DowngradeConstraints.downgradeHardConstraints(initialHardConstraints);
- assertNotNull("generated hard-constraints should be empty, not null", genHardConstraints);
+ assertNotNull(genHardConstraints, "generated hard-constraints should be empty, not null");
initialHardConstraints = buildHardConstraint(null, false, null, "link1", null, Double.valueOf(12.8), false,
false, null, null);
genHardConstraints = DowngradeConstraints.downgradeHardConstraints(initialHardConstraints);
- assertEquals("Latency value should be 12.8",
- (long) 12.8, genHardConstraints.getLatency().getMaxLatency().longValue());
- assertNull("generated hard constraints should only contain max-latency value",
- genHardConstraints.getCoRouting());
- assertNull("generated hard constraints should only contain max-latency value",
- genHardConstraints.getExclude());
- assertNull("generated hard constraints should only contain max-latency value",
- genHardConstraints.getInclude());
+ assertEquals((long) 12.8, genHardConstraints.getLatency().getMaxLatency().longValue(),
+ "Latency value should be 12.8");
+ assertNull(genHardConstraints.getCoRouting(),
+ "generated hard constraints should only contain max-latency value");
+ assertNull(genHardConstraints.getExclude(), "generated hard constraints should only contain max-latency value");
+ assertNull(genHardConstraints.getInclude(), "generated hard constraints should only contain max-latency value");
}
@Test
- public void testConvertToSoftConstraints() {
+ void testConvertToSoftConstraints() {
HardConstraints initialHardConstraints = null;
SoftConstraints genSoftConstraints = DowngradeConstraints.convertToSoftConstraints(initialHardConstraints);
- assertNotNull("generated soft constraints should never be null", genSoftConstraints);
- assertNull("generated soft constraints should be empty", genSoftConstraints.getExclude());
- assertNull("generated soft constraints should be empty", genSoftConstraints.getCoRouting());
- assertNull("generated soft constraints should be empty", genSoftConstraints.getLatency());
+ assertNotNull(genSoftConstraints, "generated soft constraints should never be null");
+ assertNull(genSoftConstraints.getExclude(), "generated soft constraints should be empty");
+ assertNull(genSoftConstraints.getCoRouting(), "generated soft constraints should be empty");
+ assertNull(genSoftConstraints.getLatency(), "generated soft constraints should be empty");
Set<String> hardCustomerCode = Set.of("customer-code 1", "customer-code 2");
initialHardConstraints =
buildHardConstraint(hardCustomerCode, false, null, "link1", "node", null, false, false, null, null);
genSoftConstraints = DowngradeConstraints.convertToSoftConstraints(initialHardConstraints);
- assertEquals("generated soft constraints should contain customer-code items", 2,
- genSoftConstraints.getCustomerCode().size());
+ assertEquals(2, genSoftConstraints.getCustomerCode().size(),
+ "generated soft constraints should contain customer-code items");
assertTrue(genSoftConstraints.getCustomerCode().contains("customer-code 1"));
assertTrue(genSoftConstraints.getCustomerCode().contains("customer-code 2"));
- assertNotNull("generated soft constraints should contain exclude constraint", genSoftConstraints.getExclude());
- assertEquals("generated soft constraints should contain exclude constraint with one link-id",
- 1, genSoftConstraints.getExclude().getLinkIdentifier().values().size());
+ assertNotNull(genSoftConstraints.getExclude(), "generated soft constraints should contain exclude constraint");
+ assertEquals(1, genSoftConstraints.getExclude().getLinkIdentifier().values().size(),
+ "generated soft constraints should contain exclude constraint with one link-id");
assertEquals("link-id 1",
genSoftConstraints.getExclude().getLinkIdentifier().values().stream().findAny().get().getLinkId());
assertEquals("openroadm-topology",
genSoftConstraints.getExclude().getLinkIdentifier().values().stream().findAny().get().getLinkNetworkId());
- assertNotNull("generated soft constraints should contain include constraint", genSoftConstraints.getInclude());
- assertEquals("generated soft constraints should contain include constraint with two node-id",
- 2, genSoftConstraints.getInclude().getNodeId().size());
+ assertNotNull(genSoftConstraints.getInclude(), "generated soft constraints should contain include constraint");
+ assertEquals(2, genSoftConstraints.getInclude().getNodeId().size(),
+ "generated soft constraints should contain include constraint with two node-id");
assertTrue(genSoftConstraints.getInclude().getNodeId().contains(new NodeIdType("node-id-1")));
assertTrue(genSoftConstraints.getInclude().getNodeId().contains(new NodeIdType("node-id-3")));
- assertNull("generated soft constraints should not contain any latency constraint",
- genSoftConstraints.getLatency());
- assertNull("generated soft constraints should not contain any max-distance constraint",
- genSoftConstraints.getDistance());
- assertNull("generated soft constraints should not contain any co-routing constraint",
- genSoftConstraints.getCoRouting());
+ assertNull(genSoftConstraints.getLatency(),
+ "generated soft constraints should not contain any latency constraint");
+ assertNull(genSoftConstraints.getDistance(),
+ "generated soft constraints should not contain any max-distance constraint");
+ assertNull(genSoftConstraints.getCoRouting(),
+ "generated soft constraints should not contain any co-routing constraint");
}
}
*/
package org.opendaylight.transportpce.servicehandler;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
import org.opendaylight.transportpce.test.AbstractTest;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutput;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220808.PathComputationRequestOutputBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommon;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.CoRoutingBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.ServicesKey;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirectionBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParameters;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParametersBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.response.parameters.PathDescriptionBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
private CountDownLatch endSignal;
private static final int NUM_THREADS = 5;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
endSignal = new CountDownLatch(1);
}
- @After
- public void tearDown() {
+ @AfterEach
+ void tearDown() {
executorService.shutdownNow();
}
private ServiceReconfigureInput buildServiceConfigurationInput() {
- DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx");
- OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC);
- OffsetDateTime offsetDateTime2 = offsetDateTime.plusDays(10);
- return new ServiceReconfigureInputBuilder().setNewServiceName("service 1")
- .setServiceName("service 1").setCommonId("common id").setConnectionType(ConnectionType.Service)
- .setCustomer("customer").setCustomerContact("customer contact").setDueDate(new DateAndTime(
- dtf.format(offsetDateTime)))
- .setEndDate(new DateAndTime(dtf.format(offsetDateTime2)))
+ return new ServiceReconfigureInputBuilder()
+ .setNewServiceName("service 1").setServiceName("service 1").setCommonId("common id")
+ .setConnectionType(ConnectionType.Service).setCustomer("customer").setCustomerContact("customer contact")
+ .setDueDate(new DateAndTime(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx")
+ .format(OffsetDateTime.now(ZoneOffset.UTC))))
+ .setEndDate(new DateAndTime(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx")
+ .format(OffsetDateTime.now(ZoneOffset.UTC).plusDays(10))))
.setNcCode("nc node").setNciCode("nci node").setSecondaryNciCode("secondry").setOperatorContact("operator")
.setServiceAEnd(ServiceDataUtils.getServiceAEndBuildReconfigure().build())
.setServiceZEnd(ServiceDataUtils.getServiceZEndBuildReconfigure().build())
}
private PathComputationRequestOutput buildPathComputationOutput() {
- ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
- .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
- .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
- ResponseParameters responseParameters = new ResponseParametersBuilder()
- .setPathDescription(new PathDescriptionBuilder()
- .setAToZDirection(new AToZDirectionBuilder().setAToZWavelengthNumber(Uint32.valueOf(1))
- .setRate(Uint32.valueOf(1)).build())
- .setZToADirection(new ZToADirectionBuilder().setZToAWavelengthNumber(Uint32.valueOf(1))
- .setRate(Uint32.valueOf(1)).build()).build())
+ return new PathComputationRequestOutputBuilder()
+ .setConfigurationResponseCommon(new ConfigurationResponseCommonBuilder()
+ .setRequestId("request 1")
+ .setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
+ .setResponseCode(ResponseCodes.RESPONSE_OK)
+ .setResponseMessage("PCE calculation in progress")
+ .build())
+ .setResponseParameters(new ResponseParametersBuilder()
+ .setPathDescription(new PathDescriptionBuilder()
+ .setAToZDirection(new AToZDirectionBuilder()
+ .setAToZWavelengthNumber(Uint32.valueOf(1))
+ .setRate(Uint32.valueOf(1))
+ .build())
+ .setZToADirection(new ZToADirectionBuilder()
+ .setZToAWavelengthNumber(Uint32.valueOf(1))
+ .setRate(Uint32.valueOf(1))
+ .build())
+ .build())
+ .build())
.build();
- return new PathComputationRequestOutputBuilder().setConfigurationResponseCommon(configurationResponseCommon)
- .setResponseParameters(responseParameters).build();
}
@Test
//TODO : is this unit test relevant ?
- public void mappingServicesNullServiceCreateInput() {
+ void mappingServicesNullServiceCreateInput() {
Services services = ModelMappingUtils.mappingServices(null, null);
- Assert.assertEquals(new ServicesBuilder().withKey(new ServicesKey("unknown")).build(), services);
+ assertEquals(new ServicesBuilder().withKey(new ServicesKey("unknown")).build(), services);
}
@Test
- public void mappingServiceNotNullServiceReconfigureInput() {
+ void mappingServiceNotNullServiceReconfigureInput() {
Services services = ModelMappingUtils.mappingServices(null, buildServiceConfigurationInput());
- Assert.assertEquals("service 1", services.getServiceName());
+ assertEquals("service 1", services.getServiceName());
}
@Test
- public void mappingServiceValid() {
- Services services = ModelMappingUtils.mappingServices(ServiceDataUtils.buildServiceCreateInput(),
- null);
- Assert.assertEquals("service 1", services.getServiceName());
+ void mappingServiceValid() {
+ Services services = ModelMappingUtils.mappingServices(ServiceDataUtils.buildServiceCreateInput(), null);
+ assertEquals("service 1", services.getServiceName());
}
@Test
//TODO : is this unit test relevant ?
- public void mappingServicesPathNullServiceCreateInput() {
+ void mappingServicesPathNullServiceCreateInput() {
ServicePaths services = ModelMappingUtils.mappingServicePaths(null, buildPathComputationOutput());
- Assert.assertEquals(new ServicePathsBuilder().withKey(new ServicePathsKey("unknown")).build(), services);
+ assertEquals(new ServicePathsBuilder().withKey(new ServicePathsKey("unknown")).build(), services);
}
@Test
- public void mappingServicePathWithServiceInputWithHardConstraints() {
+ void mappingServicePathWithServiceInputWithHardConstraints() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInputWithHardConstraints();
ServiceInput serviceInput = new ServiceInput(createInput);
ServicePaths services = ModelMappingUtils.mappingServicePaths(serviceInput, buildPathComputationOutput());
- Assert.assertEquals(serviceInput.getServiceName(), services.getServicePathName());
- Assert.assertNotNull(services.getHardConstraints());
+ assertEquals(serviceInput.getServiceName(), services.getServicePathName());
+ assertNotNull(services.getHardConstraints());
}
@Test
- public void mappingServicePathWithServiceInputWithSoftConstraints() {
+ void mappingServicePathWithServiceInputWithSoftConstraints() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInputWithSoftConstraints();
ServiceInput serviceInput = new ServiceInput(createInput);
ServicePaths services = ModelMappingUtils.mappingServicePaths(serviceInput, buildPathComputationOutput());
- Assert.assertEquals(serviceInput.getServiceName(), services.getServicePathName());
- Assert.assertNotNull(services.getSoftConstraints());
+ assertEquals(serviceInput.getServiceName(), services.getServicePathName());
+ assertNotNull(services.getSoftConstraints());
}
@Test
- public void createServiceDeleteInputWithServiceRerouteInput() {
+ void createServiceDeleteInputWithServiceRerouteInput() {
ServiceRerouteInput serviceRerouteinput = new ServiceRerouteInputBuilder().setServiceName("reroute").build();
Services services = new ServicesBuilder()
- .withKey(new ServicesKey("reroute"))
- .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("123").build()).build();
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
- serviceDeleteInput =
- ModelMappingUtils.createServiceDeleteInput(serviceRerouteinput, services);
- Assert.assertEquals("reroute", serviceDeleteInput.getServiceName());
- Assert.assertEquals("123", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
+ .withKey(new ServicesKey("reroute"))
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("123").build())
+ .build();
+ var serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(serviceRerouteinput, services);
+ assertEquals("reroute", serviceDeleteInput.getServiceName());
+ assertEquals("123", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
}
@Test
- public void createServiceDeleteInputWithServiceReconfigureInput() {
- ServiceReconfigureInput serviceReconfigureInput = new ServiceReconfigureInputBuilder()
- .setServiceName("reconf").build();
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
- serviceDeleteInput =
- ModelMappingUtils.createServiceDeleteInput(serviceReconfigureInput);
- Assert.assertEquals("reconf", serviceDeleteInput.getServiceName());
- Assert.assertEquals("reconf-reconfigure", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
+ void createServiceDeleteInputWithServiceReconfigureInput() {
+ ServiceReconfigureInput serviceReconfigureInput = new ServiceReconfigureInputBuilder()
+ .setServiceName("reconf")
+ .build();
+ var serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(serviceReconfigureInput);
+ assertEquals("reconf", serviceDeleteInput.getServiceName());
+ assertEquals("reconf-reconfigure", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
}
@Test
- public void createServiceDeleteInputWithServiceRestorationInput() {
+ void createServiceDeleteInputWithServiceRestorationInput() {
Services services = new ServicesBuilder()
.withKey(new ServicesKey("rest"))
- .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("123").build()).build();
- ServiceRestorationInput serviceRestorationInput =
- new ServiceRestorationInputBuilder().setServiceName("rest").build();
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
- serviceDeleteInput =
- ModelMappingUtils.createServiceDeleteInput(serviceRestorationInput, services);
- Assert.assertEquals("rest", serviceDeleteInput.getServiceName());
- Assert.assertEquals("123", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("123").build())
+ .build();
+ ServiceRestorationInput serviceRestorationInput = new ServiceRestorationInputBuilder()
+ .setServiceName("rest")
+ .build();
+ var serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(serviceRestorationInput, services);
+ assertEquals("rest", serviceDeleteInput.getServiceName());
+ assertEquals("123", serviceDeleteInput.getServiceHandlerHeader().getRequestId());
}
@Test
- public void createDeleteServiceReplyWithServiceDeleteInputWithSdncHeader()
- throws ExecutionException, InterruptedException {
+ void createDeleteServiceReplyWithServiceDeleteInputWithSdncHeader()
+ throws ExecutionException, InterruptedException {
ServiceDeleteInput input = new ServiceDeleteInputBuilder()
- .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build())
+ .build();
ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDeleteOutputF =
ModelMappingUtils.createDeleteServiceReply(input, "ack", "message", "200");
serviceDeleteOutputF.addListener(new Runnable() {
endSignal.await();
RpcResult<ServiceDeleteOutput> serviceDeleteOutput = serviceDeleteOutputF.get();
- Assert.assertEquals("200", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals(
- "ack", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(
- "message", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
- Assert.assertEquals("12", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getRequestId());
+ assertEquals("200", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals("ack", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals("message", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
+ assertEquals("12", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getRequestId());
}
@Test
- public void createDeleteServiceReplyWithServiceDeleteInputWithoutSdncHeader()
+ void createDeleteServiceReplyWithServiceDeleteInputWithoutSdncHeader()
throws ExecutionException, InterruptedException {
ServiceDeleteInput input = new ServiceDeleteInputBuilder().build();
ListenableFuture<RpcResult<ServiceDeleteOutput>> serviceDeleteOutputF =
endSignal.await();
RpcResult<ServiceDeleteOutput> serviceDeleteOutput = serviceDeleteOutputF.get();
- Assert.assertEquals("200", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals(
- "ack", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(
- "message", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
- Assert.assertNull(serviceDeleteOutput.getResult().getConfigurationResponseCommon().getRequestId());
+ assertEquals("200", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals("ack", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals("message", serviceDeleteOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
+ assertNull(serviceDeleteOutput.getResult().getConfigurationResponseCommon().getRequestId());
}
@Test
- public void createCreateServiceReplyWithServiceCreatInputWithSdncRequestHeader()
+ void createCreateServiceReplyWithServiceCreatInputWithSdncRequestHeader()
throws ExecutionException, InterruptedException {
- ServiceCreateInput input =
- new ServiceCreateInputBuilder()
- .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
+ ServiceCreateInput input = new ServiceCreateInputBuilder()
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build())
+ .build();
ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreatOutputF =
ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
serviceCreatOutputF.addListener(new Runnable() {
endSignal.await();
RpcResult<ServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
- Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals(
- "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(
- "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
- Assert.assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
+ assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals("ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals("message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
+ assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
}
@Test
- public void createCreateServiceReplyWithServiceCreatInputWithoutSdncRequestHeader()
+ void createCreateServiceReplyWithServiceCreatInputWithoutSdncRequestHeader()
throws ExecutionException, InterruptedException {
ServiceCreateInput input = new ServiceCreateInputBuilder().build();
ListenableFuture<RpcResult<ServiceCreateOutput>> serviceCreatOutputF =
endSignal.await();
RpcResult<ServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
- Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals(
- "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(
- "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
- Assert.assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
+ assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals("ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals("message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
+ assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
}
@Test
- public void createCreateServiceReplyWithTempServiceCreatInputWithSdncRequestHeader()
+ void createCreateServiceReplyWithTempServiceCreatInputWithSdncRequestHeader()
throws ExecutionException, InterruptedException {
- TempServiceCreateInput input =
- new TempServiceCreateInputBuilder()
- .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
+ TempServiceCreateInput input = new TempServiceCreateInputBuilder()
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build())
+ .build();
ListenableFuture<RpcResult<TempServiceCreateOutput>> serviceCreatOutputF =
ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
serviceCreatOutputF.addListener(new Runnable() {
endSignal.await();
RpcResult<TempServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
- Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals(
- "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(
- "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
- Assert.assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
+ assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals("ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals("message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
+ assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
}
@Test
- public void createCreateServiceReplyWithTempServiceCreatInputWithoutSdncRequestHeader()
+ void createCreateServiceReplyWithTempServiceCreatInputWithoutSdncRequestHeader()
throws ExecutionException, InterruptedException {
TempServiceCreateInput input = new TempServiceCreateInputBuilder().build();
ListenableFuture<RpcResult<TempServiceCreateOutput>> serviceCreatOutputF =
endSignal.await();
RpcResult<TempServiceCreateOutput> serviceCreatOutput = serviceCreatOutputF.get();
- Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals(
- "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(
- "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
- Assert.assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
+ assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals("ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals("message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
+ assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
}
@Test
- public void createCreateServiceReplyWithServiceFeasibilityCheckInputWithSdncRequestHeader()
+ void createCreateServiceReplyWithServiceFeasibilityCheckInputWithSdncRequestHeader()
throws ExecutionException, InterruptedException {
- ServiceFeasibilityCheckInput input =
- new ServiceFeasibilityCheckInputBuilder()
- .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build()).build();
+ ServiceFeasibilityCheckInput input = new ServiceFeasibilityCheckInputBuilder()
+ .setSdncRequestHeader(new SdncRequestHeaderBuilder().setRequestId("12").build())
+ .build();
ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceCreatOutputF =
ModelMappingUtils.createCreateServiceReply(input, "ack", "message", "200");
serviceCreatOutputF.addListener(new Runnable() {
endSignal.await();
RpcResult<ServiceFeasibilityCheckOutput> serviceCreatOutput = serviceCreatOutputF.get();
- Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals(
- "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(
- "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
- Assert.assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
+ assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals("ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals("message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
+ assertEquals("12", serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
}
@Test
- public void createCreateServiceReplyWithServiceFeasibilityCheckInputWithoutSdncRequestHeader()
+ void createCreateServiceReplyWithServiceFeasibilityCheckInputWithoutSdncRequestHeader()
throws ExecutionException, InterruptedException {
ServiceFeasibilityCheckInput input = new ServiceFeasibilityCheckInputBuilder().build();
ListenableFuture<RpcResult<ServiceFeasibilityCheckOutput>> serviceCreatOutputF =
endSignal.await();
RpcResult<ServiceFeasibilityCheckOutput> serviceCreatOutput = serviceCreatOutputF.get();
- Assert.assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals(
- "ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(
- "message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
- Assert.assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
+ assertEquals("200", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals("ack", serviceCreatOutput.getResult().getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals("message", serviceCreatOutput.getResult().getConfigurationResponseCommon().getResponseMessage());
+ assertNull(serviceCreatOutput.getResult().getConfigurationResponseCommon().getRequestId());
}
@Test
- public void testCreateRestoreServiceReply() throws ExecutionException, InterruptedException {
+ void testCreateRestoreServiceReply() throws ExecutionException, InterruptedException {
ListenableFuture<RpcResult<ServiceRestorationOutput>> serviceRestorationOutputF =
ModelMappingUtils.createRestoreServiceReply("message");
serviceRestorationOutputF.addListener(new Runnable() {
*/
package org.opendaylight.transportpce.servicehandler;
-import org.junit.Assert;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.Test;
public class ServiceEndpointTypeTest {
@Test
- public void testgetIntValue() {
- Assert.assertEquals(1, ServiceEndpointType.SERVICEAEND.getIntValue());
- Assert.assertEquals(2, ServiceEndpointType.SERVICEZEND.getIntValue());
+ void testgetIntValue() {
+ assertEquals(1, ServiceEndpointType.SERVICEAEND.getIntValue());
+ assertEquals(2, ServiceEndpointType.SERVICEZEND.getIntValue());
}
@Test
- public void testForValue() {
- Assert.assertEquals(ServiceEndpointType.SERVICEAEND, ServiceEndpointType.forValue(1));
- Assert.assertEquals(ServiceEndpointType.SERVICEZEND, ServiceEndpointType.forValue(2));
+ void testForValue() {
+ assertEquals(ServiceEndpointType.SERVICEAEND, ServiceEndpointType.forValue(1));
+ assertEquals(ServiceEndpointType.SERVICEZEND, ServiceEndpointType.forValue(2));
}
-
-}
+}
\ No newline at end of file
*/
package org.opendaylight.transportpce.servicehandler.impl;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import static org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl.LogMessages;
import com.google.common.util.concurrent.Futures;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.transportpce.pce.service.PathComputationService;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.Uint32;
+@ExtendWith(MockitoExtension.class)
public class ServicehandlerImplTest extends AbstractTest {
@Mock
private PathComputationService pathComputationService;
-
@Mock
private RendererServiceOperations rendererServiceOperations;
-
@Mock
private NotificationPublishService notificationPublishService;
-
@Mock
private PceListenerImpl pceListenerImpl;
-
@Mock
private RendererListenerImpl rendererListenerImpl;
-
@Mock
private NetworkModelListenerImpl networkModelListenerImpl;
private CountDownLatch endSignal;
private static final int NUM_THREADS = 5;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(NUM_THREADS));
endSignal = new CountDownLatch(1);
- MockitoAnnotations.openMocks(this);
this.serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(getNewDataBroker());
serviceCreateInput = ServiceDataUtils.buildServiceCreateInput();
serviceDeleteInput = ServiceDataUtils.buildServiceDeleteInput();
}
@Test
- public void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
- ServicehandlerImpl servicehandlerImpl =
- new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
- notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations);
- ListenableFuture<RpcResult<ServiceCreateOutput>> result =
- servicehandlerImpl.serviceCreate(new ServiceCreateInputBuilder().build());
+ void createServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
+ rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
+ networkModelListenerImpl, serviceDataStoreOperations);
+ ListenableFuture<RpcResult<ServiceCreateOutput>> result = servicehandlerImpl
+ .serviceCreate(new ServiceCreateInputBuilder().build());
result.addListener(() -> endSignal.countDown(), executorService);
-
endSignal.await();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_FAILED,
- result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void createServiceShouldBeFailedWithServiceAlreadyExist() throws ExecutionException,
+ void createServiceShouldBeFailedWithServiceAlreadyExist() throws ExecutionException,
InterruptedException {
final ServiceDataStoreOperations serviceDSOperations = mock(ServiceDataStoreOperations.class);
- Mockito.when(serviceDSOperations.getService(serviceCreateInput.getServiceName()))
+ when(serviceDSOperations.getService(serviceCreateInput.getServiceName()))
.thenReturn(Optional.of(
new ServicesBuilder()
.setServiceName(serviceCreateInput.getServiceName())
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void createServiceShouldBeSuccessfulWhenPerformPCESuccessful()
+ void createServiceShouldBeSuccessfulWhenPerformPCESuccessful()
throws ExecutionException, InterruptedException {
- Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
+ when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_OK, result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_OK,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ void deleteServiceShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_FAILED,
- result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void deleteServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
+ void deleteServiceShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
ServicehandlerImpl servicehandlerImpl =
new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_FAILED,
- result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void deleteServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
- Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
+ void deleteServiceShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
+ when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_OK, result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_OK,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ void serviceFeasibilityCheckShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void serviceFeasibilityCheckShouldBeSuccessfulWhenPerformPCESuccessful()
+ void serviceFeasibilityCheckShouldBeSuccessfulWhenPerformPCESuccessful()
throws ExecutionException, InterruptedException {
- Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
+ when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_OK, result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_OK,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ void serviceReconfigureShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
@Test
- public void serviceReconfigureShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
+ void serviceReconfigureShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
//action -> service reconfigure
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
}
@Test
- public void serviceReconfigureShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
+ void serviceReconfigureShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
// serviceReconfigure is calling service delete method in renderer
- Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
+ when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
//create service to reconfigure
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
}
@Test
- public void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ void serviceReRestorationShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
- ListenableFuture<RpcResult<ServiceRestorationOutput>> result =
- servicehandlerImpl.serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
+ ListenableFuture<RpcResult<ServiceRestorationOutput>> result = servicehandlerImpl
+ .serviceRestoration(new ServiceRestorationInputBuilder().setServiceName("").build());
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
@Test
- public void serviceRestorationShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
+ void serviceRestorationShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
//action -> service restore
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
}
@Test
- public void serviceRestorationShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
+ void serviceRestorationShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
// serviceRestoration is calling service delete method in renderer
- Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
+ when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
//create service to restore
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
}
@Test
- public void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ void serviceRerouteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
endSignal.await();
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void serviceRerouteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
+ void serviceRerouteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
//action -> service reconfigure
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
- ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl.serviceReroute(
- serviceRerouteInput);
+ ListenableFuture<RpcResult<ServiceRerouteOutput>> result = servicehandlerImpl
+ .serviceReroute(serviceRerouteInput);
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void serviceRerouteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
- Mockito.when(pathComputationService.pathComputationRerouteRequest(any()))
- .thenReturn(Futures.immediateFuture(new PathComputationRerouteRequestOutputBuilder()
- .setConfigurationResponseCommon(new ConfigurationResponseCommonBuilder()
- .setResponseCode(ResponseCodes.RESPONSE_OK)
- .build())
- .build()));
+ void serviceRerouteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
+ when(pathComputationService.pathComputationRerouteRequest(any()))
+ .thenReturn(Futures.immediateFuture(new PathComputationRerouteRequestOutputBuilder()
+ .setConfigurationResponseCommon(new ConfigurationResponseCommonBuilder()
+ .setResponseCode(ResponseCodes.RESPONSE_OK)
+ .build())
+ .build()));
Map<AToZKey, AToZ> atoz = Map.of(
new AToZKey("0"),
new AToZBuilder()
endSignal.await();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_OK, result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_OK,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ void tempServiceDeleteShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
endSignal.await();
RpcResult<TempServiceDeleteOutput> rpcResult = result.get();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_FAILED,
- rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals(
- LogMessages.SERVICE_NON_COMPLIANT,
- rpcResult.getResult().getConfigurationResponseCommon().getResponseMessage());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ rpcResult.getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ LogMessages.SERVICE_NON_COMPLIANT,
+ rpcResult.getResult().getConfigurationResponseCommon().getResponseMessage());
}
@Test
- public void tempServiceDeleteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
+ void tempServiceDeleteShouldBeFailedWithNonExistService() throws ExecutionException, InterruptedException {
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void tempServiceDeleteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
- Mockito.when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
+ void tempServiceDeleteShouldBeSuccessForExistingService() throws ExecutionException, InterruptedException {
+ when(rendererServiceOperations.serviceDelete(any(), any())).thenReturn(Futures.immediateFuture(any()));
//create temp service to delete in the temp delete action
- ServicehandlerImpl servicehandlerImpl =
- new ServicehandlerImpl(getNewDataBroker(), pathComputationService, rendererServiceOperations,
- notificationPublishService, pceListenerImpl, rendererListenerImpl, networkModelListenerImpl,
- serviceDataStoreOperations);
+ ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
+ rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
+ networkModelListenerImpl, serviceDataStoreOperations);
TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
serviceDataStoreOperations.createTempService(createInput);
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_OK, result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_OK,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
@Test
- public void tempServiceCreateShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
+ void tempServiceCreateShouldBeFailedWithEmptyInput() throws ExecutionException, InterruptedException {
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
networkModelListenerImpl, serviceDataStoreOperations);
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_FAILED,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
-
@Test
- public void tempServiceCreateShouldBeSuccessfulWhenPerformPCESuccessful()
+ void tempServiceCreateShouldBeSuccessfulWhenPerformPCESuccessful()
throws ExecutionException, InterruptedException {
- Mockito.when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
+ when(pathComputationService.pathComputationRequest(any())).thenReturn(Futures.immediateFuture(any()));
ServicehandlerImpl servicehandlerImpl = new ServicehandlerImpl(getNewDataBroker(), pathComputationService,
rendererServiceOperations, notificationPublishService, pceListenerImpl, rendererListenerImpl,
result.addListener(() -> endSignal.countDown(), executorService);
endSignal.await();
- Assert.assertEquals(
- ResponseCodes.RESPONSE_OK, result.get().getResult().getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ ResponseCodes.RESPONSE_OK,
+ result.get().getResult().getConfigurationResponseCommon().getResponseCode());
}
-
-}
+}
\ No newline at end of file
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.transportpce.servicehandler.listeners.NetworkModelListenerImpl;
import org.opendaylight.transportpce.servicehandler.listeners.PceListenerImpl;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
import org.opendaylight.transportpce.test.AbstractTest;
+@ExtendWith(MockitoExtension.class)
public class ServicehandlerProviderTest extends AbstractTest {
@Mock
RpcProviderService rpcProviderRegistry;
-
@Mock
ServiceDataStoreOperations serviceDataStoreOperations;
-
@Mock
PceListenerImpl pceListenerImpl;
-
@Mock
ServiceListener serviceListener;
-
@Mock
RendererListenerImpl rendererListenerImpl;
-
@Mock
NetworkModelListenerImpl networkModelListenerImpl;
-
@Mock
ServicehandlerImpl servicehandler;
- private AutoCloseable closeable;
-
- @Before
- public void openMocks() {
- closeable = MockitoAnnotations.openMocks(this);
- }
-
@Test
- public void testInitRegisterServiceHandlerToRpcRegistry() {
+ void testInitRegisterServiceHandlerToRpcRegistry() {
ServicehandlerProvider provider = new ServicehandlerProvider(
getDataBroker(), rpcProviderRegistry,
getNotificationService() , serviceDataStoreOperations, pceListenerImpl, serviceListener,
provider.init();
- verify(rpcProviderRegistry, times(1))
- .registerRpcImplementation(any(), any(ServicehandlerImpl.class));
+ verify(rpcProviderRegistry, times(1)).registerRpcImplementation(any(), any(ServicehandlerImpl.class));
}
-
- @After public void releaseMocks() throws Exception {
- closeable.close();
- }
-
-}
+}
\ No newline at end of file
package org.opendaylight.transportpce.servicehandler.listeners;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doCallRealMethod;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.Mockito;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.transportpce.common.OperationResult;
import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsBuilder;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsKey;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public class NetworkModelListenerImplTest {
@Mock
private static PathDescription pathDescription;
private NetworkModelListenerImpl networkModelListener;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
pathDescription = new PathDescriptionBuilder()
.setAToZDirection(new AToZDirectionBuilder().setAToZ(new HashMap<>(createMapAtoZ())).build())
.setZToADirection(new ZToADirectionBuilder().setZToA(new HashMap<>(createMapZtoA())).build())
}
@Test
- public void testChangePathElementStateZAShouldNotModifyPathDescriptionsElementStates() {
+ void testChangePathElementStateZAShouldNotModifyPathDescriptionsElementStates() {
Map<TopologyChangesKey, TopologyChanges> topologyChanges = Map.of(
new TopologyChangesKey("tpNodeIdA", "TpIdA1"),
new TopologyChangesBuilder()
.build()
);
- assertEquals(pathDescription.getZToADirection().getZToA(),
- networkModelListener.changePathElementStateZA(topologyChanges, pathDescription));
+ assertEquals(
+ pathDescription.getZToADirection().getZToA(),
+ networkModelListener.changePathElementStateZA(topologyChanges, pathDescription));
}
@Test
- public void testChangePathElementStateZAShouldModifyPathDescriptionsElementStates() {
+ void testChangePathElementStateZAShouldModifyPathDescriptionsElementStates() {
Map<TopologyChangesKey, TopologyChanges> topologyChanges = Map.of(
new TopologyChangesKey("tpNodeIdA", "TpIdA1"),
new TopologyChangesBuilder()
}
@Test
- public void testChangePathElementStateAZShouldNotModifyPathDescriptionsElementStates() {
+ void testChangePathElementStateAZShouldNotModifyPathDescriptionsElementStates() {
Map<TopologyChangesKey, TopologyChanges> topologyChanges = Map.of(
new TopologyChangesKey("tpNodeIdA", "TpIdA1"),
new TopologyChangesBuilder()
.setState(State.InService)
.build());
- assertEquals(pathDescription.getAToZDirection().getAToZ(),
- networkModelListener.changePathElementStateAZ(topologyChanges, pathDescription));
+ assertEquals(
+ pathDescription.getAToZDirection().getAToZ(),
+ networkModelListener.changePathElementStateAZ(topologyChanges, pathDescription));
}
@Test
- public void testChangePathElementStateAZShouldModifyPathDescriptionsElementStates() {
+ void testChangePathElementStateAZShouldModifyPathDescriptionsElementStates() {
Map<TopologyChangesKey, TopologyChanges> topologyChanges = Map.of(
new TopologyChangesKey("tpNodeIdA", "TpIdA1"),
new TopologyChangesBuilder()
}
@Test
- public void testAllElementsinPathinServiceShouldReturnFalse() {
+ void testAllElementsinPathinServiceShouldReturnFalse() {
Map<AToZKey, AToZ> atozmap = pathDescription.getAToZDirection().getAToZ();
atozmap.computeIfPresent(
new AToZKey("0"),
}
@Test
- public void testAllElementsinPathinServiceShouldReturnTrue() {
+ void testAllElementsinPathinServiceShouldReturnTrue() {
assertTrue(networkModelListener.allElementsinPathinService(pathDescription.getAToZDirection().getAToZ(),
pathDescription.getZToADirection().getZToA()));
}
@Test
- public void testUpdateServicePathsShouldNotModifyServiceState() {
+ void testUpdateServicePathsShouldNotModifyServiceState() {
Map<ServicePathsKey, ServicePaths> servicePathMap = Map.of(new ServicePathsKey("service-path 1"),
new ServicePathsBuilder()
.setServicePathName("service-path 1")
.setPathDescription(pathDescription)
.build());
- when(serviceDataStoreOperations.getServicePaths()).thenReturn(Optional.of(new ServicePathListBuilder()
- .setServicePaths(servicePathMap).build()));
+ when(serviceDataStoreOperations.getServicePaths())
+ .thenReturn(Optional.of(new ServicePathListBuilder().setServicePaths(servicePathMap).build()));
when(serviceDataStoreOperations.modifyServicePath(any(PathDescription.class), anyString()))
- .thenReturn(OperationResult.ok(""));
- when(serviceDataStoreOperations.getService(anyString())).thenReturn(Optional.of(
- new ServicesBuilder().setServiceName("serviceTest")
- .setOperationalState(State.InService)
- .setAdministrativeState(AdminStates.InService)
- .build()));
+ .thenReturn(OperationResult.ok(""));
+ when(serviceDataStoreOperations.getService(anyString()))
+ .thenReturn(Optional.of(new ServicesBuilder()
+ .setServiceName("serviceTest")
+ .setOperationalState(State.InService)
+ .setAdministrativeState(AdminStates.InService)
+ .build()));
Map<TopologyChangesKey, TopologyChanges> topologyChanges = Map.of(
new TopologyChangesKey("tpNodeIdC", "TpIdC1"),
networkModelListener.updateServicePaths(new TopologyUpdateResultBuilder()
.setTopologyChanges(topologyChanges).build());
- verify(serviceDataStoreOperations,
- never()).modifyService(anyString(), any(State.class), any(AdminStates.class));
+ verify(serviceDataStoreOperations, never())
+ .modifyService(anyString(), any(State.class), any(AdminStates.class));
}
@Test
- public void testUpdateServicePathsShouldModifyServiceState() {
+ void testUpdateServicePathsShouldModifyServiceState() {
Map<ServicePathsKey, ServicePaths> servicePathMap = Map.of(
new ServicePathsKey("service-path 1"),
new ServicePathsBuilder()
.setPathDescription(pathDescription)
.build());
- when(serviceDataStoreOperations.getServicePaths()).thenReturn(Optional.of(new ServicePathListBuilder()
- .setServicePaths(servicePathMap).build()));
+ when(serviceDataStoreOperations.getServicePaths())
+ .thenReturn(Optional.of(new ServicePathListBuilder().setServicePaths(servicePathMap).build()));
when(serviceDataStoreOperations.modifyServicePath(any(PathDescription.class), anyString()))
- .thenReturn(OperationResult.ok(""));
- when(serviceDataStoreOperations.getService(anyString())).thenReturn(Optional.of(
- new ServicesBuilder().setServiceName("serviceTest")
- .setOperationalState(State.InService)
- .setAdministrativeState(AdminStates.InService)
- .build()));
+ .thenReturn(OperationResult.ok(""));
+ when(serviceDataStoreOperations.getService(anyString()))
+ .thenReturn(Optional.of(new ServicesBuilder()
+ .setServiceName("serviceTest")
+ .setOperationalState(State.InService)
+ .setAdministrativeState(AdminStates.InService)
+ .build()));
when(serviceDataStoreOperations.modifyService(anyString(), any(State.class), any(AdminStates.class)))
- .thenReturn(OperationResult.ok(""));
+ .thenReturn(OperationResult.ok(""));
Map<TopologyChangesKey, TopologyChanges> topologyChanges = Map.of(
new TopologyChangesKey("tpNodeIdA", "TpIdA1"),
networkModelListener.updateServicePaths(new TopologyUpdateResultBuilder()
.setTopologyChanges(topologyChanges).build());
- verify(serviceDataStoreOperations, times(1)).modifyService(anyString(),
- eq(State.OutOfService), any(AdminStates.class));
+ verify(serviceDataStoreOperations, times(1))
+ .modifyService(anyString(), eq(State.OutOfService), any(AdminStates.class));
}
@Test
- public void testOnTopologyUpdateResultWhenNeverWired() {
+ void testOnTopologyUpdateResultWhenNeverWired() {
NetworkModelListenerImpl networkModelListenerMocked = Mockito.mock(NetworkModelListenerImpl.class);
doCallRealMethod().when(networkModelListenerMocked).onTopologyUpdateResult(any(TopologyUpdateResult.class));
.setTopologyChanges(topologyChanges1).build());
networkModelListenerMocked.onTopologyUpdateResult(new TopologyUpdateResultBuilder()
.setTopologyChanges(topologyChanges2).build());
- verify(networkModelListenerMocked, times(2)).updateServicePaths(
- any(TopologyUpdateResult.class));
+ verify(networkModelListenerMocked, times(2)).updateServicePaths(any(TopologyUpdateResult.class));
}
@Test
- public void testOnTopologyUpdateResultWhenAlreadyWired() {
+ void testOnTopologyUpdateResultWhenAlreadyWired() {
NetworkModelListenerImpl networkModelListenerMocked = Mockito.mock(NetworkModelListenerImpl.class);
doCallRealMethod().when(networkModelListenerMocked).onTopologyUpdateResult(any(TopologyUpdateResult.class));
networkModelListenerMocked.onTopologyUpdateResult(topologyUpdateResult);
networkModelListenerMocked.onTopologyUpdateResult(topologyUpdateResult);
- verify(networkModelListenerMocked, times(1)).updateServicePaths(
- any(TopologyUpdateResult.class));
+ verify(networkModelListenerMocked, times(1)).updateServicePaths(any(TopologyUpdateResult.class));
}
private Map<AToZKey, AToZ> createMapAtoZ() {
package org.opendaylight.transportpce.servicehandler.listeners;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
-import org.junit.Test;
-import org.junit.runner.RunWith;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
import org.opendaylight.mdsal.binding.api.DataTreeModification;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.Restorable;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommonBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.ServiceAEnd;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.ServiceAEndBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.ServiceZEnd;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.ServiceZEndBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.RxDirection;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.RxDirectionBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint8;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public class ServiceListenerTest {
@Mock
private PathComputationService pathComputationService;
@Test
- public void testOnDataTreeChangedWhenDeleteService() {
+ void testOnDataTreeChangedWhenDeleteService() {
@SuppressWarnings("unchecked") final DataObjectModification<Services> service =
mock(DataObjectModification.class);
final Collection<DataTreeModification<Services>> changes = new HashSet<>();
}
@Test
- public void testOnDataTreeChangedWhenServiceBecomesOutOfService() {
+ void testOnDataTreeChangedWhenServiceBecomesOutOfService() {
@SuppressWarnings("unchecked") final DataObjectModification<Services> service =
mock(DataObjectModification.class);
final Collection<DataTreeModification<Services>> changes = new HashSet<>();
}
@Test
- public void testOnDataTreeChangedWhenShouldNeverHappen() {
+ void testOnDataTreeChangedWhenShouldNeverHappen() {
@SuppressWarnings("unchecked") final DataObjectModification<Services> service =
mock(DataObjectModification.class);
final Collection<DataTreeModification<Services>> changes = new HashSet<>();
}
@Test
- public void testOnDataTreeChangedWhenServiceDegradedShouldBeRerouted() {
+ void testOnDataTreeChangedWhenServiceDegradedShouldBeRerouted() {
@SuppressWarnings("unchecked") final DataObjectModification<Services> service =
mock(DataObjectModification.class);
final Collection<DataTreeModification<Services>> changes = new HashSet<>();
.setServiceResiliency(serviceResiliency)
.build();
when(service.getModificationType()).thenReturn(DataObjectModification.ModificationType.WRITE);
- when(service.getDataBefore()).thenReturn(
- new ServicesBuilder(buildService(State.InService, AdminStates.InService))
+ when(service.getDataBefore())
+ .thenReturn(new ServicesBuilder(buildService(State.InService, AdminStates.InService))
.setServiceResiliency(serviceResiliency)
.build());
when(service.getDataAfter()).thenReturn(serviceAfter);
when(serviceDataStoreOperations.getService(anyString())).thenReturn(Optional.of(serviceAfter));
- when(servicehandler.serviceDelete(any())).thenReturn(
- RpcResultBuilder.success(
- new ServiceDeleteOutputBuilder()
- .setConfigurationResponseCommon(
- new ConfigurationResponseCommonBuilder()
+ when(servicehandler.serviceDelete(any()))
+ .thenReturn(RpcResultBuilder.success(new ServiceDeleteOutputBuilder()
+ .setConfigurationResponseCommon(new ConfigurationResponseCommonBuilder()
.setResponseCode(ResponseCodes.RESPONSE_OK)
.build())
.build())
.buildFuture());
- when(servicehandler.serviceReroute(any())).thenReturn(
- RpcResultBuilder.success(
- new ServiceRerouteOutputBuilder()
- .setConfigurationResponseCommon(
- new ConfigurationResponseCommonBuilder()
+ when(servicehandler.serviceReroute(any()))
+ .thenReturn(RpcResultBuilder.success(new ServiceRerouteOutputBuilder()
+ .setConfigurationResponseCommon(new ConfigurationResponseCommonBuilder()
.setResponseCode(ResponseCodes.RESPONSE_OK)
.build())
.build())
.buildFuture());
- when(servicehandler.serviceCreate(any())).thenReturn(
- RpcResultBuilder.success(
- new ServiceCreateOutputBuilder()
- .setConfigurationResponseCommon(
- new ConfigurationResponseCommonBuilder()
+ when(servicehandler.serviceCreate(any()))
+ .thenReturn(RpcResultBuilder.success(new ServiceCreateOutputBuilder()
+ .setConfigurationResponseCommon(new ConfigurationResponseCommonBuilder()
.setResponseCode(ResponseCodes.RESPONSE_OK)
.build())
.build())
}
@Test
- public void testOnDataTreeChangedWhenServiceDegradedShouldNotBeRerouted() {
+ void testOnDataTreeChangedWhenServiceDegradedShouldNotBeRerouted() {
@SuppressWarnings("unchecked") final DataObjectModification<Services> service =
mock(DataObjectModification.class);
final Collection<DataTreeModification<Services>> changes = new HashSet<>();
}
private Services buildService(State state, AdminStates adminStates) {
- ServiceAEnd serviceAEnd = getServiceAEndBuild().build();
- ServiceZEnd serviceZEnd = new ServiceZEndBuilder()
- .setClli("clli")
- .setServiceFormat(ServiceFormat.Ethernet)
- .setServiceRate(Uint32.valueOf(1))
- .setNodeId(new NodeIdType("XPONDER-3-2"))
- .setTxDirection(Map.of(new TxDirectionKey(getTxDirection().key()), getTxDirection()))
- .setRxDirection(Map.of(new RxDirectionKey(getRxDirection().key()), getRxDirection()))
- .build();
- ServicesBuilder builtInput = new ServicesBuilder()
+ return new ServicesBuilder()
.setSdncRequestHeader(new SdncRequestHeaderBuilder().build())
.setCommonId("commonId")
.setConnectionType(ConnectionType.Service)
.setCustomer("Customer")
.setServiceName("service 1")
- .setServiceAEnd(serviceAEnd)
- .setServiceZEnd(serviceZEnd)
+ .setServiceAEnd(getServiceAEndBuild().build())
+ .setServiceZEnd(new ServiceZEndBuilder()
+ .setClli("clli")
+ .setServiceFormat(ServiceFormat.Ethernet)
+ .setServiceRate(Uint32.valueOf(1))
+ .setNodeId(new NodeIdType("XPONDER-3-2"))
+ .setTxDirection(Map.of(new TxDirectionKey(getTxDirection().key()), getTxDirection()))
+ .setRxDirection(Map.of(new RxDirectionKey(getRxDirection().key()), getRxDirection()))
+ .build())
.setOperationalState(state)
- .setAdministrativeState(adminStates);
-
- return builtInput.build();
+ .setAdministrativeState(adminStates)
+ .build();
}
private ServiceAEndBuilder getServiceAEndBuild() {
.setPublisherName("ServiceListener")
.build();
}
-}
+}
\ No newline at end of file
*/
package org.opendaylight.transportpce.servicehandler.service;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoInteractions;
+import static org.mockito.Mockito.when;
import com.google.common.util.concurrent.ListenableFuture;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.transportpce.pce.service.PathComputationService;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateInput;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempServiceCreateInputBuilder;
+@ExtendWith(MockitoExtension.class)
public class PCEServiceWrapperTest extends AbstractTest {
@Mock
@InjectMocks
private PCEServiceWrapper pceServiceWrapperMock;
- private AutoCloseable closeable;
-
- @Before
- public void openMocks() throws NoSuchMethodException {
- closeable = MockitoAnnotations.openMocks(this);
- }
@Test
- public void performPCENullSdncRequestHeader() {
+ void performPCENullSdncRequestHeader() {
ServiceCreateInput input = ServiceDataUtils.buildServiceCreateInput();
input = new ServiceCreateInputBuilder(input).setSdncRequestHeader(null).build();
PathComputationRequestOutput pceResponse = this.pceServiceWrapperMock.performPCE(input, true);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_YES,
- pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- pceResponse.getConfigurationResponseCommon().getResponseCode());
- Mockito.verifyNoInteractions(this.pathComputationServiceMock);
+ assertEquals(ResponseCodes.FINAL_ACK_YES, pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_FAILED, pceResponse.getConfigurationResponseCommon().getResponseCode());
+ verifyNoInteractions(this.pathComputationServiceMock);
}
@Test
- public void performPCENullServiceName() {
+ void performPCENullServiceName() {
ServiceCreateInput input = ServiceDataUtils.buildServiceCreateInput();
input = new ServiceCreateInputBuilder(input).setServiceName(null).build();
PathComputationRequestOutput pceResponse = this.pceServiceWrapperMock.performPCE(input, true);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_YES,
- pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- pceResponse.getConfigurationResponseCommon().getResponseCode());
- Mockito.verifyNoInteractions(this.pathComputationServiceMock);
+ assertEquals(ResponseCodes.FINAL_ACK_YES, pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_FAILED, pceResponse.getConfigurationResponseCommon().getResponseCode());
+ verifyNoInteractions(this.pathComputationServiceMock);
}
@Test
- public void performPCENullCommonId() {
+ void performPCENullCommonId() {
TempServiceCreateInput input = ServiceDataUtils.buildTempServiceCreateInput();
input = new TempServiceCreateInputBuilder(input).setCommonId(null).build();
PathComputationRequestOutput pceResponse = this.pceServiceWrapperMock.performPCE(input, true);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_YES,
- pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- pceResponse.getConfigurationResponseCommon().getResponseCode());
- Mockito.verifyNoInteractions(this.pathComputationServiceMock);
+ assertEquals(ResponseCodes.FINAL_ACK_YES, pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_FAILED, pceResponse.getConfigurationResponseCommon().getResponseCode());
+ verifyNoInteractions(this.pathComputationServiceMock);
}
@Test
- public void cancelPCEResourceNullServiceName() {
+ void cancelPCEResourceNullServiceName() {
CancelResourceReserveOutput pceResponse =
this.pceServiceWrapperMock.cancelPCEResource(null, ServiceNotificationTypes.ServiceDeleteResult);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_YES,
- pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- pceResponse.getConfigurationResponseCommon().getResponseCode());
- Mockito.verifyNoInteractions(this.pathComputationServiceMock);
+ assertEquals(ResponseCodes.FINAL_ACK_YES, pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_FAILED, pceResponse.getConfigurationResponseCommon().getResponseCode());
+ verifyNoInteractions(this.pathComputationServiceMock);
}
@Test
- public void cancelPCEResourceValid() {
+ void cancelPCEResourceValid() {
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
.setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
CancelResourceReserveOutput output = new CancelResourceReserveOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).build();
ListenableFuture<CancelResourceReserveOutput> response = ServiceDataUtils.returnFuture(output);
- Mockito.when(this.pathComputationServiceMock.cancelResourceReserve(any(CancelResourceReserveInput.class)))
- .thenReturn(response);
- CancelResourceReserveOutput pceResponse =
- this.pceServiceWrapperMock.cancelPCEResource("service 1", ServiceNotificationTypes.ServiceDeleteResult);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_NO,
- pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_OK,
- pceResponse.getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals("PCE calculation in progress",
- pceResponse.getConfigurationResponseCommon().getResponseMessage());
+ when(this.pathComputationServiceMock.cancelResourceReserve(any(CancelResourceReserveInput.class)))
+ .thenReturn(response);
+ CancelResourceReserveOutput pceResponse = this.pceServiceWrapperMock
+ .cancelPCEResource("service 1", ServiceNotificationTypes.ServiceDeleteResult);
+ assertEquals(ResponseCodes.FINAL_ACK_NO, pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_OK, pceResponse.getConfigurationResponseCommon().getResponseCode());
+ assertEquals("PCE calculation in progress", pceResponse.getConfigurationResponseCommon().getResponseMessage());
verify(this.pathComputationServiceMock).cancelResourceReserve(any(CancelResourceReserveInput.class));
}
@Test
- public void performPCEValid() {
+ void performPCEValid() {
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
.setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
PathComputationRequestOutput output = new PathComputationRequestOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).build();
ListenableFuture<PathComputationRequestOutput> response = ServiceDataUtils.returnFuture(output);
- Mockito.when(this.pathComputationServiceMock.pathComputationRequest(any(PathComputationRequestInput.class)))
- .thenReturn(response);
+ when(this.pathComputationServiceMock.pathComputationRequest(any(PathComputationRequestInput.class)))
+ .thenReturn(response);
ServiceCreateInput input = ServiceDataUtils.buildServiceCreateInput();
PathComputationRequestOutput pceResponse = this.pceServiceWrapperMock.performPCE(input, true);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_NO,
- pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_OK,
- pceResponse.getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals("PCE calculation in progress",
- pceResponse.getConfigurationResponseCommon().getResponseMessage());
+ assertEquals(ResponseCodes.FINAL_ACK_NO, pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_OK, pceResponse.getConfigurationResponseCommon().getResponseCode());
+ assertEquals("PCE calculation in progress", pceResponse.getConfigurationResponseCommon().getResponseMessage());
verify(this.pathComputationServiceMock).pathComputationRequest((any(PathComputationRequestInput.class)));
}
@Test
- public void performPCETempValid() {
+ void performPCETempValid() {
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
.setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
PathComputationRequestOutput output = new PathComputationRequestOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).build();
ListenableFuture<PathComputationRequestOutput> response = ServiceDataUtils.returnFuture(output);
- Mockito.when(this.pathComputationServiceMock.pathComputationRequest(any(PathComputationRequestInput.class)))
- .thenReturn(response);
+ when(this.pathComputationServiceMock.pathComputationRequest(any(PathComputationRequestInput.class)))
+ .thenReturn(response);
TempServiceCreateInput input = ServiceDataUtils.buildTempServiceCreateInput();
PathComputationRequestOutput pceResponse = this.pceServiceWrapperMock.performPCE(input, true);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_NO,
- pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_OK, pceResponse.getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals("PCE calculation in progress",
- pceResponse.getConfigurationResponseCommon().getResponseMessage());
+ assertEquals(ResponseCodes.FINAL_ACK_NO, pceResponse.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_OK, pceResponse.getConfigurationResponseCommon().getResponseCode());
+ assertEquals("PCE calculation in progress", pceResponse.getConfigurationResponseCommon().getResponseMessage());
verify(this.pathComputationServiceMock).pathComputationRequest((any(PathComputationRequestInput.class)));
}
-
- @After public void releaseMocks() throws Exception {
- closeable.close();
- }
-}
+}
\ No newline at end of file
*/
package org.opendaylight.transportpce.servicehandler.service;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoInteractions;
+import static org.mockito.Mockito.when;
import com.google.common.util.concurrent.ListenableFuture;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.transportpce.common.ResponseCodes;
import org.opendaylight.transportpce.renderer.provisiondevice.RendererServiceOperations;
* @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
*
*/
+@ExtendWith(MockitoExtension.class)
public class RendererServiceWrapperTest extends AbstractTest {
@Mock
private RendererServiceOperations rendererServiceOperationsMock;
@InjectMocks
private RendererServiceWrapper rendererServiceWrapperMock;
- private AutoCloseable closeable;
-
- @Before
- public void openMocks() throws NoSuchMethodException {
- closeable = MockitoAnnotations.openMocks(this);
- }
@Test
- public void performRendererNullServiceHandlerHeader() {
- ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
- serviceDeleteInput =
- ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
+ void performRendererNullServiceHandlerHeader() {
+ var serviceDeleteInput = ModelMappingUtils
+ .createServiceDeleteInput(new ServiceInput(ServiceDataUtils.buildServiceDeleteInput()));
serviceDeleteInput = new ServiceDeleteInputBuilder(serviceDeleteInput).setServiceHandlerHeader(null).build();
ServiceDeleteOutput response = this.rendererServiceWrapperMock.performRenderer(serviceDeleteInput,
ServiceNotificationTypes.ServiceDeleteResult, null);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_YES,
+ assertEquals(ResponseCodes.FINAL_ACK_YES,
response.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
+ assertEquals(ResponseCodes.RESPONSE_FAILED,
response.getConfigurationResponseCommon().getResponseCode());
- Mockito.verifyNoInteractions(this.rendererServiceOperationsMock);
+ verifyNoInteractions(this.rendererServiceOperationsMock);
}
@Test
- public void performRendererNullServiceName() {
- ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
- serviceDeleteInput =
- ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
+ void performRendererNullServiceName() {
+ var serviceDeleteInput = ModelMappingUtils
+ .createServiceDeleteInput(new ServiceInput(ServiceDataUtils.buildServiceDeleteInput()));
serviceDeleteInput = new ServiceDeleteInputBuilder(serviceDeleteInput).setServiceName(null).build();
- ServiceDeleteOutput response = this.rendererServiceWrapperMock.performRenderer(serviceDeleteInput,
- ServiceNotificationTypes.ServiceDeleteResult, null);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_YES,
- response.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- response.getConfigurationResponseCommon().getResponseCode());
- Mockito.verifyNoInteractions(this.rendererServiceOperationsMock);
+ ServiceDeleteOutput response = this.rendererServiceWrapperMock
+ .performRenderer(serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, null);
+ assertEquals(ResponseCodes.FINAL_ACK_YES, response.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_FAILED, response.getConfigurationResponseCommon().getResponseCode());
+ verifyNoInteractions(this.rendererServiceOperationsMock);
}
@Test
- public void performRendererNullCommonId() {
- TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput();
- input = new TempServiceDeleteInputBuilder(input).setCommonId(null).build();
- ServiceDeleteOutput response =
- this.rendererServiceWrapperMock.performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_YES,
- response.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_FAILED,
- response.getConfigurationResponseCommon().getResponseCode());
- Mockito.verifyNoInteractions(this.rendererServiceOperationsMock);
+ void performRendererNullCommonId() {
+ TempServiceDeleteInput input = new TempServiceDeleteInputBuilder(ServiceDataUtils.buildTempServiceDeleteInput())
+ .setCommonId(null).build();
+ ServiceDeleteOutput response = this.rendererServiceWrapperMock
+ .performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
+ assertEquals(ResponseCodes.FINAL_ACK_YES, response.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_FAILED, response.getConfigurationResponseCommon().getResponseCode());
+ verifyNoInteractions(this.rendererServiceOperationsMock);
}
-
@Test
- public void performRendererValid() {
+ void performRendererValid() {
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
- .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
- .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("Renderer service delete in progress")
- .build();
+ .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
+ .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("Renderer service delete in progress")
+ .build();
ServiceDeleteOutput output = new ServiceDeleteOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon).build();
+ .setConfigurationResponseCommon(configurationResponseCommon).build();
ListenableFuture<ServiceDeleteOutput> response = ServiceDataUtils.returnFuture(output);
- Mockito.when(this.rendererServiceOperationsMock.serviceDelete(any(
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
- .ServiceDeleteInput.class), any())).thenReturn(response);
+ when(this.rendererServiceOperationsMock.serviceDelete(any(
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
+ .class), any()))
+ .thenReturn(response);
ServiceDeleteInput input = ServiceDataUtils.buildServiceDeleteInput();
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
- serviceDeleteInput =
- ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
- ServiceDeleteOutput rendereResponse = this.rendererServiceWrapperMock.performRenderer(serviceDeleteInput,
- ServiceNotificationTypes.ServiceDeleteResult, null);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_NO,
- rendereResponse.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_OK,
- rendereResponse.getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals("Renderer service delete in progress",
- rendereResponse.getConfigurationResponseCommon().getResponseMessage());
+ var serviceDeleteInput = ModelMappingUtils.createServiceDeleteInput(new ServiceInput(input));
+ ServiceDeleteOutput rendereResponse = this.rendererServiceWrapperMock
+ .performRenderer(serviceDeleteInput, ServiceNotificationTypes.ServiceDeleteResult, null);
+ assertEquals(
+ ResponseCodes.FINAL_ACK_NO,
+ rendereResponse.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_OK, rendereResponse.getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ "Renderer service delete in progress",
+ rendereResponse.getConfigurationResponseCommon().getResponseMessage());
verify(this.rendererServiceOperationsMock).serviceDelete(any(
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
- .ServiceDeleteInput.class), any());
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
+ .class), any());
}
@Test
- public void performRendererTempValid() {
+ void performRendererTempValid() {
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
- .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
- .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("Renderer service delete in progress")
- .build();
+ .setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
+ .setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("Renderer service delete in progress")
+ .build();
ServiceDeleteOutput output = new ServiceDeleteOutputBuilder()
- .setConfigurationResponseCommon(configurationResponseCommon).build();
+ .setConfigurationResponseCommon(configurationResponseCommon).build();
ListenableFuture<ServiceDeleteOutput> response = ServiceDataUtils.returnFuture(output);
- Mockito.when(this.rendererServiceOperationsMock.serviceDelete(any(
- org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915
- .ServiceDeleteInput.class), any())).thenReturn(response);
+ when(this.rendererServiceOperationsMock.serviceDelete(any(
+ org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
+ .class), any()))
+ .thenReturn(response);
TempServiceDeleteInput input = ServiceDataUtils.buildTempServiceDeleteInput();
- ServiceDeleteOutput rendereResponse = this.rendererServiceWrapperMock.performRenderer(input,
- ServiceNotificationTypes.ServiceDeleteResult);
- Assert.assertEquals(ResponseCodes.FINAL_ACK_NO,
- rendereResponse.getConfigurationResponseCommon().getAckFinalIndicator());
- Assert.assertEquals(ResponseCodes.RESPONSE_OK,
- rendereResponse.getConfigurationResponseCommon().getResponseCode());
- Assert.assertEquals("Renderer service delete in progress",
- rendereResponse.getConfigurationResponseCommon().getResponseMessage());
+ ServiceDeleteOutput rendereResponse = this.rendererServiceWrapperMock
+ .performRenderer(input, ServiceNotificationTypes.ServiceDeleteResult);
+ assertEquals(
+ ResponseCodes.FINAL_ACK_NO,
+ rendereResponse.getConfigurationResponseCommon().getAckFinalIndicator());
+ assertEquals(ResponseCodes.RESPONSE_OK, rendereResponse.getConfigurationResponseCommon().getResponseCode());
+ assertEquals(
+ "Renderer service delete in progress",
+ rendereResponse.getConfigurationResponseCommon().getResponseMessage());
verify(this.rendererServiceOperationsMock).serviceDelete(any(
org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.ServiceDeleteInput
.class), any());
}
-
- @After public void releaseMocks() throws Exception {
- closeable.close();
- }
-}
+}
\ No newline at end of file
*/
package org.opendaylight.transportpce.servicehandler.service;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperationsImpl.LogMessages;
import java.util.Optional;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.transportpce.common.OperationResult;
import org.opendaylight.transportpce.common.ResponseCodes;
private ServiceDataStoreOperationsImpl serviceDataStoreOperations;
- @Before
- public void init() {
+ @BeforeEach
+ void init() {
DataBroker dataBroker = this.getNewDataBroker();
this.serviceDataStoreOperations = new ServiceDataStoreOperationsImpl(dataBroker);
}
@Test
- public void modifyIfServiceNotPresent() {
- OperationResult result =
- this.serviceDataStoreOperations.modifyService("service 1", State.InService, AdminStates.InService);
- Assert.assertFalse(result.isSuccess());
- Assert.assertEquals(LogMessages.SERVICE_NOT_FOUND, result.getResultMessage());
+ void modifyIfServiceNotPresent() {
+ OperationResult result = this.serviceDataStoreOperations
+ .modifyService("service 1", State.InService, AdminStates.InService);
+ assertFalse(result.isSuccess());
+ assertEquals(LogMessages.SERVICE_NOT_FOUND, result.getResultMessage());
}
@Test
- public void writeOrModifyOrDeleteServiceListNotPresentWithNoWriteChoice() {
-
+ void writeOrModifyOrDeleteServiceListNotPresentWithNoWriteChoice() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
.setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).build();
- String result = serviceDataStoreOperations.writeOrModifyOrDeleteServiceList("serviceCreateInput",
- createInput, pathComputationRequestOutput, 3);
-
- Assert.assertEquals(LogMessages.SERVICE_NOT_FOUND, result);
+ String result = serviceDataStoreOperations
+ .writeOrModifyOrDeleteServiceList("serviceCreateInput", createInput, pathComputationRequestOutput, 3);
+ assertEquals(LogMessages.SERVICE_NOT_FOUND, result);
}
@Test
- public void writeOrModifyOrDeleteServiceListNotPresentWithWriteChoice() {
-
+ void writeOrModifyOrDeleteServiceListNotPresentWithWriteChoice() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
.setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).build();
- String result = serviceDataStoreOperations.writeOrModifyOrDeleteServiceList("service 1",
- createInput, pathComputationRequestOutput, 2);
-
- Assert.assertNull(result);
+ String result = serviceDataStoreOperations
+ .writeOrModifyOrDeleteServiceList("service 1", createInput, pathComputationRequestOutput, 2);
+ assertNull(result);
}
@Test
- public void writeOrModifyOrDeleteServiceListPresentWithModifyChoice() {
+ void writeOrModifyOrDeleteServiceListPresentWithModifyChoice() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).build();
this.serviceDataStoreOperations.createService(createInput);
- String result = serviceDataStoreOperations.writeOrModifyOrDeleteServiceList("service 1",
- createInput, pathComputationRequestOutput, 0);
- Assert.assertNull(result);
+ String result = serviceDataStoreOperations
+ .writeOrModifyOrDeleteServiceList("service 1", createInput, pathComputationRequestOutput, 0);
+ assertNull(result);
}
@Test
- public void writeOrModifyOrDeleteServiceListPresentWithDeleteChoice() {
+ void writeOrModifyOrDeleteServiceListPresentWithDeleteChoice() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
-
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
.setResponseCode(ResponseCodes.RESPONSE_OK).setResponseMessage("PCE calculation in progress").build();
PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).build();
this.serviceDataStoreOperations.createService(createInput);
- String result = serviceDataStoreOperations.writeOrModifyOrDeleteServiceList("service 1",
- createInput, pathComputationRequestOutput, 1);
- Assert.assertNull(result);
+ String result = serviceDataStoreOperations
+ .writeOrModifyOrDeleteServiceList("service 1", createInput, pathComputationRequestOutput, 1);
+ assertNull(result);
}
@Test
- public void writeOrModifyOrDeleteServiceListPresentWithNoValidChoice() {
+ void writeOrModifyOrDeleteServiceListPresentWithNoValidChoice() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
.setRequestId("request 1").setAckFinalIndicator(ResponseCodes.FINAL_ACK_NO)
PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).build();
this.serviceDataStoreOperations.createService(createInput);
- String result = serviceDataStoreOperations.writeOrModifyOrDeleteServiceList("service 1",
- createInput, pathComputationRequestOutput, 2);
- Assert.assertNull(result);
-
+ String result = serviceDataStoreOperations
+ .writeOrModifyOrDeleteServiceList("service 1",createInput, pathComputationRequestOutput, 2);
+ assertNull(result);
}
@Test
- public void getServiceFromEmptyDataStoreShouldBeEmpty() {
+ void getServiceFromEmptyDataStoreShouldBeEmpty() {
Optional<Services> optService = this.serviceDataStoreOperations.getService("service 1");
- Assert.assertFalse(optService.isPresent());
+ assertFalse(optService.isPresent());
}
@Test
- public void createServiceShouldBeSuccessForValidInput() {
+ void createServiceShouldBeSuccessForValidInput() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
OperationResult result = this.serviceDataStoreOperations.createService(createInput);
- Assert.assertTrue(result.isSuccess());
+ assertTrue(result.isSuccess());
}
@Test
- public void getServiceShouldReturnTheCorrectServiceForTheCreatedService() {
+ void getServiceShouldReturnTheCorrectServiceForTheCreatedService() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
this.serviceDataStoreOperations.createService(createInput);
Optional<Services> optService = this.serviceDataStoreOperations.getService(createInput.getServiceName());
- Assert.assertTrue(optService.isPresent());
- Assert.assertEquals(createInput.getServiceName(), optService.get().getServiceName());
+ assertTrue(optService.isPresent());
+ assertEquals(createInput.getServiceName(), optService.get().getServiceName());
}
@Test
- public void deleteServiceShouldBeSuccessfulForDeletingService() {
+ void deleteServiceShouldBeSuccessfulForDeletingService() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
this.serviceDataStoreOperations.createService(createInput);
OperationResult result = this.serviceDataStoreOperations.deleteService(createInput.getServiceName());
- Assert.assertTrue(result.isSuccess());
+ assertTrue(result.isSuccess());
}
-// @Test
-// public void deleteServiceShouldBeFailedIfServiceDoNotExists() {
-// OperationResult result = this.serviceDataStoreOperations.deleteService("Any service");
-// Assert.assertFalse(result.isSuccess());
-// }
+ @Test
+ void deleteServiceShouldBeSuccessEvenIfServiceDoNotExists() {
+ OperationResult result = this.serviceDataStoreOperations.deleteService("Any service");
+ assertTrue(result.isSuccess());
+ }
@Test
- public void modifyServiceIsSuccessfulForPresentService() {
+ void modifyServiceIsSuccessfulForPresentService() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
this.serviceDataStoreOperations.createService(createInput);
OperationResult result = this.serviceDataStoreOperations.modifyService(createInput.getServiceName(),
State.InService, AdminStates.InService);
- Assert.assertTrue(result.isSuccess());
+ assertTrue(result.isSuccess());
}
@Test
- public void getTempServiceFromEmptyDataStoreShouldBeEmpty() {
+ void getTempServiceFromEmptyDataStoreShouldBeEmpty() {
Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.temp.service.list
.Services> optService = this.serviceDataStoreOperations.getTempService("service 1");
- Assert.assertFalse(optService.isPresent());
+ assertFalse(optService.isPresent());
}
@Test
- public void createTempServiceShouldBeSuccessForValidInput() {
+ void createTempServiceShouldBeSuccessForValidInput() {
TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
OperationResult result = this.serviceDataStoreOperations.createTempService(createInput);
- Assert.assertTrue(result.isSuccess());
+ assertTrue(result.isSuccess());
}
@Test
- public void getTempServiceShouldReturnTheCorrectTempServiceForTheCreatedService() {
+ void getTempServiceShouldReturnTheCorrectTempServiceForTheCreatedService() {
TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
this.serviceDataStoreOperations.createTempService(createInput);
Optional<org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.temp.service.list
.Services> optService = this.serviceDataStoreOperations.getTempService(createInput.getCommonId());
- Assert.assertTrue(optService.isPresent());
- Assert.assertEquals(createInput.getCommonId(), optService.get().getCommonId());
+ assertTrue(optService.isPresent());
+ assertEquals(createInput.getCommonId(), optService.get().getCommonId());
}
@Test
- public void deleteTempServiceShouldBeSuccessfulForDeletingTempService() {
+ void deleteTempServiceShouldBeSuccessfulForDeletingTempService() {
TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
this.serviceDataStoreOperations.createTempService(createInput);
OperationResult result = this.serviceDataStoreOperations.deleteTempService(createInput.getCommonId());
- Assert.assertTrue(result.isSuccess());
+ assertTrue(result.isSuccess());
}
@Test
- public void modifyTempServiceIsSuccessfulForPresentTempService() {
+ void modifyTempServiceIsSuccessfulForPresentTempService() {
TempServiceCreateInput createInput = ServiceDataUtils.buildTempServiceCreateInput();
this.serviceDataStoreOperations.createTempService(createInput);
OperationResult result = this.serviceDataStoreOperations.modifyTempService(
createInput.getCommonId(), State.InService, AdminStates.InService);
- Assert.assertTrue(result.isSuccess());
+ assertTrue(result.isSuccess());
}
@Test
- public void createServicePathShouldBeSuccessfulForValidInput() {
+ void createServicePathShouldBeSuccessfulForValidInput() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
this.serviceDataStoreOperations.createService(createInput);
ServiceInput serviceInput = new ServiceInput(createInput);
PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).setResponseParameters(responseParameters)
.build();
- OperationResult result =
- this.serviceDataStoreOperations.createServicePath(serviceInput, pathComputationRequestOutput);
- Assert.assertTrue(result.isSuccess());
+ OperationResult result = this.serviceDataStoreOperations
+ .createServicePath(serviceInput, pathComputationRequestOutput);
+ assertTrue(result.isSuccess());
}
@Test
- public void createServicePathShouldFailForInvalidInput() {
+ void createServicePathShouldFailForInvalidInput() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
this.serviceDataStoreOperations.createService(createInput);
ServiceInput serviceInput = new ServiceInput(createInput);
PathComputationRequestOutput pathComputationRequestOutput = new PathComputationRequestOutputBuilder()
.setConfigurationResponseCommon(configurationResponseCommon).setResponseParameters(responseParameters)
.build();
- OperationResult result =
- this.serviceDataStoreOperations.createServicePath(serviceInput, pathComputationRequestOutput);
- Assert.assertFalse(result.isSuccess());
+ OperationResult result = this.serviceDataStoreOperations
+ .createServicePath(serviceInput, pathComputationRequestOutput);
+ assertFalse(result.isSuccess());
}
@Test
- public void deleteServicePathShouldBeSuccessForDeletingServicePath() {
+ void deleteServicePathShouldBeSuccessForDeletingServicePath() {
ServiceCreateInput createInput = ServiceDataUtils.buildServiceCreateInput();
this.serviceDataStoreOperations.createService(createInput);
ServiceInput serviceInput = new ServiceInput(createInput);
this.serviceDataStoreOperations.createServicePath(serviceInput, pathComputationRequestOutput);
OperationResult result = this.serviceDataStoreOperations.deleteServicePath(serviceInput.getServiceName());
- Assert.assertTrue(result.isSuccess());
+ assertTrue(result.isSuccess());
}
-}
+}
\ No newline at end of file
*/
package org.opendaylight.transportpce.servicehandler.utils;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
*/
package org.opendaylight.transportpce.servicehandler.validation;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import java.util.Map;
import java.util.Set;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.common.OperationResult;
import org.opendaylight.transportpce.servicehandler.ServiceInput;
import org.opendaylight.transportpce.servicehandler.utils.ServiceDataUtils;
public class ServiceCreateValidationTest {
@Test
- public void validateServiceCreateRequestIfCommonIdNull() {
+ void validateServiceCreateRequestIfCommonIdNull() {
ServiceCreateInput input = new ServiceCreateInputBuilder(ServiceDataUtils.buildServiceCreateInput())
.setCommonId(null).build();
- OperationResult result =
- ServiceCreateValidation.validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
- Assert.assertEquals(true, result.isSuccess());
+ OperationResult result = ServiceCreateValidation
+ .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
+ assertEquals(true, result.isSuccess());
}
@Test
- public void validateServiceCreateRequestIfConstraintsNotNull() {
+ void validateServiceCreateRequestIfConstraintsNotNull() {
ServiceCreateInput input = new ServiceCreateInputBuilder(ServiceDataUtils.buildServiceCreateInput())
.setHardConstraints(new HardConstraintsBuilder()
.setCoRouting(new CoRoutingBuilder()
.build())
.setCustomerCode(Set.of("Some customer-code"))
.build()).build();
- OperationResult result =
- ServiceCreateValidation.validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
- Assert.assertEquals(false, result.isSuccess());
+ OperationResult result = ServiceCreateValidation
+ .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
+ assertEquals(false, result.isSuccess());
}
@Test
- public void validateServiceCreateRequestIfConstraintsNull() {
+ void validateServiceCreateRequestIfConstraintsNull() {
ServiceCreateInput input = new ServiceCreateInputBuilder(ServiceDataUtils.buildServiceCreateInput())
.setSoftConstraints(null).setHardConstraints(null).build();
- OperationResult result =
- ServiceCreateValidation.validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
- Assert.assertEquals(true, result.isSuccess());
+ OperationResult result = ServiceCreateValidation
+ .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
+ assertEquals(true, result.isSuccess());
}
@Test
- public void validateServiceCreateRequestIfHardConstraintsNull() {
+ void validateServiceCreateRequestIfHardConstraintsNull() {
ServiceCreateInput input = new ServiceCreateInputBuilder(ServiceDataUtils.buildServiceCreateInput())
.setSoftConstraints(new SoftConstraintsBuilder()
.setCoRouting(new CoRoutingBuilder()
.build())
.setCustomerCode(Set.of("Some customer-code"))
.build()).setHardConstraints(null).build();
- OperationResult result =
- ServiceCreateValidation.validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
- Assert.assertEquals(true, result.isSuccess());
+ OperationResult result = ServiceCreateValidation
+ .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
+ assertEquals(true, result.isSuccess());
}
@Test
- public void validateServiceCreateRequestIfSoftConstraintsNull() {
+ void validateServiceCreateRequestIfSoftConstraintsNull() {
ServiceCreateInput input = new ServiceCreateInputBuilder(ServiceDataUtils.buildServiceCreateInput())
.setSoftConstraints(null).setHardConstraints(new HardConstraintsBuilder()
.setCoRouting(new CoRoutingBuilder()
.build())
.setCustomerCode(Set.of("Some customer-code"))
.build()).build();
- OperationResult result =
- ServiceCreateValidation.validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
- Assert.assertEquals(true, result.isSuccess());
+ OperationResult result = ServiceCreateValidation
+ .validateServiceCreateRequest(new ServiceInput(input), RpcActions.ServiceCreate);
+ assertEquals(true, result.isSuccess());
}
-}
+}
\ No newline at end of file
package org.opendaylight.transportpce.servicehandler.validation.checks;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.Protected;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.Restorable;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.Unprotected;
import org.opendaylight.yangtools.yang.common.Uint64;
import org.opendaylight.yangtools.yang.common.Uint8;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public class CheckCoherencyServiceResiliencyTest {
@Test
- public void testCheckWhenResiliencyNull() {
- ComplianceCheckResult result = ServicehandlerServiceResiliencyCheck.check(
- new ServiceResiliencyBuilder().setRevertive(true).build());
+ void testCheckWhenResiliencyNull() {
+ ComplianceCheckResult result = ServicehandlerServiceResiliencyCheck
+ .check(new ServiceResiliencyBuilder().setRevertive(true).build());
- Assert.assertFalse(result.hasPassed());
- Assert.assertEquals(ServicehandlerServiceResiliencyCheck.LOG_RESILIENCY_NULL, result.getMessage());
+ assertFalse(result.hasPassed());
+ assertEquals(ServicehandlerServiceResiliencyCheck.LOG_RESILIENCY_NULL, result.getMessage());
}
@Test
- public void testCheckWhenUnprotectedResiliencyWithWrongAttributes() {
+ void testCheckWhenUnprotectedResiliencyWithWrongAttributes() {
ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Unprotected.VALUE);
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(input.setRevertive(true).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setWaitToRestore(Uint64.valueOf(1)).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setHoldoffTime(Uint64.valueOf(1)).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setPreCalculatedBackupPathNumber(Uint8.valueOf(1)).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setCoupledService(new CoupledServiceBuilder().build()).build()).hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck.check(input.setRevertive(true).build()).hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setWaitToRestore(Uint64.valueOf(1)).build())
+ .hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setHoldoffTime(Uint64.valueOf(1)).build())
+ .hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setPreCalculatedBackupPathNumber(Uint8.valueOf(1)).build())
+ .hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setCoupledService(new CoupledServiceBuilder().build()).build())
+ .hasPassed());
}
@Test
- public void testCheckWhenUnprotectedResiliencyWithCorrectAttributes() {
- Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
- new ServiceResiliencyBuilder()
- .setResiliency(Unprotected.VALUE)
- .build())
- .hasPassed());
+ void testCheckWhenUnprotectedResiliencyWithCorrectAttributes() {
+ assertTrue(ServicehandlerServiceResiliencyCheck
+ .check(new ServiceResiliencyBuilder().setResiliency(Unprotected.VALUE).build())
+ .hasPassed());
}
@Test
- public void testCheckWhenUnprotectedDiverselyRoutedResiliencyWithWrongAttributes() {
+ void testCheckWhenUnprotectedDiverselyRoutedResiliencyWithWrongAttributes() {
ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.VALUE);
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(input.setRevertive(true).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setWaitToRestore(Uint64.valueOf(1)).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setHoldoffTime(Uint64.valueOf(1)).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setPreCalculatedBackupPathNumber(Uint8.valueOf(1)).build()).hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck.check(input.setRevertive(true).build()).hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setWaitToRestore(Uint64.valueOf(1)).build())
+ .hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setHoldoffTime(Uint64.valueOf(1)).build())
+ .hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setPreCalculatedBackupPathNumber(Uint8.valueOf(1)).build())
+ .hasPassed());
}
@Test
- public void testCheckWhenUnprotectedDiverselyRoutedResiliencyWithCorrectAttributes() {
- Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
- new ServiceResiliencyBuilder().setResiliency(UnprotectedDiverselyRouted.VALUE)
- .setCoupledService(new CoupledServiceBuilder().build()).build()).hasPassed());
+ void testCheckWhenUnprotectedDiverselyRoutedResiliencyWithCorrectAttributes() {
+ assertTrue(ServicehandlerServiceResiliencyCheck
+ .check(new ServiceResiliencyBuilder()
+ .setResiliency(UnprotectedDiverselyRouted.VALUE)
+ .setCoupledService(new CoupledServiceBuilder().build())
+ .build())
+ .hasPassed());
}
@Test
- public void testCheckWhenProtectedResiliencyWithWrongAttributes() {
+ void testCheckWhenProtectedResiliencyWithWrongAttributes() {
ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Protected.VALUE);
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setWaitToRestore(Uint64.valueOf(1)).setRevertive(false).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setPreCalculatedBackupPathNumber(Uint8.valueOf(1)).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setCoupledService(new CoupledServiceBuilder().build()).build()).hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setWaitToRestore(Uint64.valueOf(1)).setRevertive(false).build())
+ .hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setPreCalculatedBackupPathNumber(Uint8.valueOf(1)).build())
+ .hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setCoupledService(new CoupledServiceBuilder().build()).build())
+ .hasPassed());
}
@Test
- public void testCheckWhenProtectedResiliencyWithCorrectAttributes() {
- Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
- new ServiceResiliencyBuilder()
- .setResiliency(Protected.VALUE)
- .setRevertive(true)
- .setWaitToRestore(Uint64.valueOf(1))
- .setHoldoffTime(Uint64.valueOf(1))
- .build())
- .hasPassed());
+ void testCheckWhenProtectedResiliencyWithCorrectAttributes() {
+ assertTrue(ServicehandlerServiceResiliencyCheck
+ .check(new ServiceResiliencyBuilder()
+ .setResiliency(Protected.VALUE)
+ .setRevertive(true)
+ .setWaitToRestore(Uint64.valueOf(1))
+ .setHoldoffTime(Uint64.valueOf(1))
+ .build())
+ .hasPassed());
}
@Test
- public void testCheckWhenRestorableOrExternalTriggerRestorableResiliencyWithWrongAttributes() {
+ void testCheckWhenRestorableOrExternalTriggerRestorableResiliencyWithWrongAttributes() {
ServiceResiliencyBuilder input = new ServiceResiliencyBuilder().setResiliency(Restorable.VALUE);
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setWaitToRestore(Uint64.valueOf(1)).setRevertive(false).build()).hasPassed());
- Assert.assertFalse(ServicehandlerServiceResiliencyCheck.check(
- input.setCoupledService(new CoupledServiceBuilder().build()).build()).hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setWaitToRestore(Uint64.valueOf(1)).setRevertive(false).build())
+ .hasPassed());
+ assertFalse(ServicehandlerServiceResiliencyCheck
+ .check(input.setCoupledService(new CoupledServiceBuilder().build()).build())
+ .hasPassed());
}
@Test
- public void testCheckWhenRestorableOrExternalTriggerRestorableResiliencyWithCorrectAttributes() {
- Assert.assertTrue(ServicehandlerServiceResiliencyCheck.check(
- new ServiceResiliencyBuilder()
- .setResiliency(Restorable.VALUE)
- .setRevertive(true)
- .setWaitToRestore(Uint64.valueOf(1))
- .setHoldoffTime(Uint64.valueOf(1))
- .setPreCalculatedBackupPathNumber(Uint8.valueOf(1))
- .build())
- .hasPassed());
+ void testCheckWhenRestorableOrExternalTriggerRestorableResiliencyWithCorrectAttributes() {
+ assertTrue(ServicehandlerServiceResiliencyCheck
+ .check(new ServiceResiliencyBuilder()
+ .setResiliency(Restorable.VALUE)
+ .setRevertive(true)
+ .setWaitToRestore(Uint64.valueOf(1))
+ .setHoldoffTime(Uint64.valueOf(1))
+ .setPreCalculatedBackupPathNumber(Uint8.valueOf(1))
+ .build())
+ .hasPassed());
}
}
*/
package org.opendaylight.transportpce.servicehandler.validation.checks;
-import org.junit.Assert;
-import org.junit.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import org.junit.jupiter.api.Test;
public class ComplianceCheckResultTest {
@Test
- public void constructComplianceCheckResult() {
+ void constructComplianceCheckResult() {
ComplianceCheckResult checkResult = new ComplianceCheckResult(true);
- Assert.assertEquals(true, checkResult.hasPassed());
+ assertEquals(true, checkResult.hasPassed());
checkResult = new ComplianceCheckResult(false);
- Assert.assertEquals(false, checkResult.hasPassed());
+ assertEquals(false, checkResult.hasPassed());
}
-}
+}
\ No newline at end of file
*/
package org.opendaylight.transportpce.servicehandler.validation.checks;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerComplianceCheck.LogMessages;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.RpcActions;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder;
public class ServicehandlerComplianceCheckTest {
- public ServicehandlerComplianceCheckTest() {
- }
-
@Test
- public void checkFalseSdncRequest() {
+ void checkFalseSdncRequest() {
ComplianceCheckResult result = ServicehandlerComplianceCheck.check("service 1",
- new SdncRequestHeaderBuilder().setRequestId("1").setRequestSystemId("1").setNotificationUrl("1")
- .setRpcAction(RpcActions.ServiceCreate).build(),
- ConnectionType.Service,RpcActions.ServiceCreate, false, false);
+ new SdncRequestHeaderBuilder().setRequestId("1").setRequestSystemId("1").setNotificationUrl("1")
+ .setRpcAction(RpcActions.ServiceCreate).build(),
+ ConnectionType.Service,RpcActions.ServiceCreate, false, false);
- Assert.assertEquals("", result.getMessage());
- Assert.assertTrue(result.hasPassed());
+ assertEquals("", result.getMessage());
+ assertTrue(result.hasPassed());
}
@Test
- public void checkServiceNameNull() {
- ComplianceCheckResult result = ServicehandlerComplianceCheck.check(null, null,
- ConnectionType.Service, null, false, false);
+ void checkServiceNameNull() {
+ ComplianceCheckResult result = ServicehandlerComplianceCheck
+ .check(null, null, ConnectionType.Service, null, false, false);
- Assert.assertEquals(LogMessages.SERVICENAME_NOT_SET, result.getMessage());
- Assert.assertFalse(result.hasPassed());
+ assertEquals(LogMessages.SERVICENAME_NOT_SET, result.getMessage());
+ assertFalse(result.hasPassed());
}
@Test
- public void checkConTypeFalseAndNull() {
- ComplianceCheckResult result = ServicehandlerComplianceCheck.check("service 1", null,
- null, null, true, false);
- Assert.assertEquals(LogMessages.CONNECTIONTYPE_NOT_SET, result.getMessage());
- Assert.assertFalse(result.hasPassed());
+ void checkConTypeFalseAndNull() {
+ ComplianceCheckResult result = ServicehandlerComplianceCheck
+ .check("service 1", null, null, null, true, false);
+ assertEquals(LogMessages.CONNECTIONTYPE_NOT_SET, result.getMessage());
+ assertFalse(result.hasPassed());
}
@Test
- public void checkSdncRequestHeaderNull() {
- ComplianceCheckResult result = ServicehandlerComplianceCheck.check("service 1", null,
- ConnectionType.Service, null, true, true);
+ void checkSdncRequestHeaderNull() {
+ ComplianceCheckResult result = ServicehandlerComplianceCheck
+ .check("service 1", null, ConnectionType.Service, null, true, true);
- Assert.assertEquals(LogMessages.HEADER_NOT_SET, result.getMessage());
- Assert.assertFalse(result.hasPassed());
+ assertEquals(LogMessages.HEADER_NOT_SET, result.getMessage());
+ assertFalse(result.hasPassed());
}
@Test
- public void checkRequestIdEmptyString() {
+ void checkRequestIdEmptyString() {
ComplianceCheckResult result = ServicehandlerComplianceCheck.check("service 1",
- new SdncRequestHeaderBuilder().setRequestId("")
- .setRpcAction(RpcActions.ServiceCreate).build(),
+ new SdncRequestHeaderBuilder().setRequestId("").setRpcAction(RpcActions.ServiceCreate).build(),
ConnectionType.Service, RpcActions.ServiceCreate, true, true);
- Assert.assertEquals(LogMessages.REQUESTID_NOT_SET, result.getMessage());
- Assert.assertFalse(result.hasPassed());
+ assertEquals(LogMessages.REQUESTID_NOT_SET, result.getMessage());
+ assertFalse(result.hasPassed());
}
@Test
- public void checkDifferentAction() {
+ void checkDifferentAction() {
ComplianceCheckResult result = ServicehandlerComplianceCheck.check("service 1",
- new SdncRequestHeaderBuilder().setRequestId("1")
- .setRpcAction(RpcActions.ServiceCreate).build(),
+ new SdncRequestHeaderBuilder().setRequestId("1").setRpcAction(RpcActions.ServiceCreate).build(),
ConnectionType.Service, RpcActions.NetworkReOptimization, true, true);
- Assert.assertEquals(
- LogMessages.rpcactionsDiffers(RpcActions.ServiceCreate, RpcActions.NetworkReOptimization),
- result.getMessage());
- Assert.assertFalse(result.hasPassed());
+ assertEquals(
+ LogMessages.rpcactionsDiffers(RpcActions.ServiceCreate, RpcActions.NetworkReOptimization),
+ result.getMessage());
+ assertFalse(result.hasPassed());
}
@Test
- public void checkServiceActionNull() {
+ void checkServiceActionNull() {
ComplianceCheckResult result = ServicehandlerComplianceCheck.check("service 1",
new SdncRequestHeaderBuilder().setRequestId("1").build(),
ConnectionType.Service, RpcActions.NetworkReOptimization, true, true);
- Assert.assertEquals(LogMessages.RPCACTION_NOT_SET, result.getMessage());
- Assert.assertFalse(result.hasPassed());
+ assertEquals(LogMessages.RPCACTION_NOT_SET, result.getMessage());
+ assertFalse(result.hasPassed());
}
}
package org.opendaylight.transportpce.servicehandler.validation.checks;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.opendaylight.transportpce.servicehandler.validation.checks.ServicehandlerTxRxCheck.LogMessages;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.opendaylight.transportpce.servicehandler.ServiceEndpointType;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.ServiceAEndBuilder;
import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat;
public class ServicehandlerTxRxCheckTest {
@Test
- public void checkForServiceEndNull() {
+ void checkForServiceEndNull() {
ComplianceCheckResult result = ServicehandlerTxRxCheck.check(null, ServiceEndpointType.SERVICEAEND);
- Assert.assertFalse(result.hasPassed());
- Assert.assertEquals(LogMessages.endpointTypeNotSet(ServiceEndpointType.SERVICEAEND), result.getMessage());
+ assertFalse(result.hasPassed());
+ assertEquals(LogMessages.endpointTypeNotSet(ServiceEndpointType.SERVICEAEND), result.getMessage());
}
@Test
- public void checkForServiceRateNull() {
- ComplianceCheckResult result =
- ServicehandlerTxRxCheck.check(new ServiceAEndBuilder().build(), ServiceEndpointType.SERVICEAEND);
+ void checkForServiceRateNull() {
+ ComplianceCheckResult result = ServicehandlerTxRxCheck
+ .check(new ServiceAEndBuilder().build(), ServiceEndpointType.SERVICEAEND);
- Assert.assertFalse(result.hasPassed());
- Assert.assertEquals(LogMessages.rateNull(ServiceEndpointType.SERVICEAEND), result.getMessage());
+ assertFalse(result.hasPassed());
+ assertEquals(LogMessages.rateNull(ServiceEndpointType.SERVICEAEND), result.getMessage());
}
@Test
- public void checkForServiceRateEquals0() {
- ComplianceCheckResult result = ServicehandlerTxRxCheck.check(
- new ServiceAEndBuilder().setServiceRate(Uint32.valueOf(0)).build(), ServiceEndpointType.SERVICEAEND);
+ void checkForServiceRateEquals0() {
+ ComplianceCheckResult result = ServicehandlerTxRxCheck
+ .check(new ServiceAEndBuilder().setServiceRate(Uint32.valueOf(0)).build(), ServiceEndpointType.SERVICEAEND);
- Assert.assertFalse(result.hasPassed());
- Assert.assertEquals(LogMessages.rateNotSet(ServiceEndpointType.SERVICEAEND), result.getMessage());
+ assertFalse(result.hasPassed());
+ assertEquals(LogMessages.rateNotSet(ServiceEndpointType.SERVICEAEND), result.getMessage());
}
@Test
- public void checkForServiceFormatNull() {
- ComplianceCheckResult result = ServicehandlerTxRxCheck.check(
- new ServiceAEndBuilder().setServiceRate(Uint32.valueOf(3)).build(), ServiceEndpointType.SERVICEAEND);
+ void checkForServiceFormatNull() {
+ ComplianceCheckResult result = ServicehandlerTxRxCheck
+ .check(new ServiceAEndBuilder().setServiceRate(Uint32.valueOf(3)).build(), ServiceEndpointType.SERVICEAEND);
- Assert.assertFalse(result.hasPassed());
- Assert.assertEquals(LogMessages.formatNotSet(ServiceEndpointType.SERVICEAEND), result.getMessage());
+ assertFalse(result.hasPassed());
+ assertEquals(LogMessages.formatNotSet(ServiceEndpointType.SERVICEAEND), result.getMessage());
}
@Test
- public void checkForClliEmpty() {
+ void checkForClliEmpty() {
ComplianceCheckResult result = ServicehandlerTxRxCheck.check(new ServiceAEndBuilder()
- .setServiceRate(Uint32.valueOf(3)).setClli("").setServiceFormat(ServiceFormat.Ethernet).build(),
+ .setServiceRate(Uint32.valueOf(3)).setClli("").setServiceFormat(ServiceFormat.Ethernet).build(),
ServiceEndpointType.SERVICEAEND);
- Assert.assertFalse(result.hasPassed());
- Assert.assertEquals(LogMessages.clliNotSet(ServiceEndpointType.SERVICEAEND), result.getMessage());
+ assertFalse(result.hasPassed());
+ assertEquals(LogMessages.clliNotSet(ServiceEndpointType.SERVICEAEND), result.getMessage());
}
-}
+}
\ No newline at end of file