use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.ConfigBuilder in project controller by opendaylight.
the class TracingBrokerTest method testPrintOpenTransactions.
@Test
// Finding resource leaks is the point of this test
@SuppressWarnings({ "resource", "unused" })
public void testPrintOpenTransactions() {
DOMDataBroker domDataBroker = mock(DOMDataBroker.class, RETURNS_DEEP_STUBS);
Config config = new ConfigBuilder().setTransactionDebugContextEnabled(true).build();
BindingNormalizedNodeSerializer codec = mock(BindingNormalizedNodeSerializer.class);
TracingBroker tracingBroker = new TracingBroker(domDataBroker, config, codec);
DOMDataReadWriteTransaction tx = tracingBroker.newReadWriteTransaction();
DOMTransactionChain txChain = tracingBroker.createTransactionChain(null);
DOMDataReadWriteTransaction txFromChain = txChain.newReadWriteTransaction();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
boolean printReturnValue = tracingBroker.printOpenTransactions(ps);
String output = new String(baos.toByteArray(), UTF_8);
assertThat(printReturnValue).isTrue();
// Assert expections about stack trace
assertThat(output).contains("testPrintOpenTransactions(TracingBrokerTest.java");
assertThat(output).doesNotContain(TracingBroker.class.getName());
String previousLine = "";
for (String line : output.split("\n")) {
if (line.contains("(...")) {
assertThat(previousLine.contains("(...)")).isFalse();
}
previousLine = line;
}
// We don't do any verify/times on the mocks,
// because the main point of the test is just to verify that
// printOpenTransactions runs through without any exceptions
// (e.g. it used to have a ClassCastException).
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.ConfigBuilder in project bgpcep by opendaylight.
the class OpenConfigMappingUtilTest method testGetPeerAs.
@Test
public void testGetPeerAs() {
assertEquals(AS, OpenConfigMappingUtil.getPeerAs(NEIGHBOR, null, null));
assertEquals(AS, OpenConfigMappingUtil.getPeerAs(new NeighborBuilder().build(), null, this.rib.getLocalAs()));
assertEquals(AS, OpenConfigMappingUtil.getPeerAs(NEIGHBOR, new PeerGroupBuilder().build(), null));
assertEquals(AS, OpenConfigMappingUtil.getPeerAs(new NeighborBuilder().build(), new PeerGroupBuilder().build(), this.rib.getLocalAs()));
assertEquals(AS, OpenConfigMappingUtil.getPeerAs(null, new PeerGroupBuilder().setConfig(new ConfigBuilder().setPeerAs(AS).build()).build(), null));
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.ConfigBuilder in project bgpcep by opendaylight.
the class GracefulRestartUtilTest method getLlGracefulTimersTest.
@Test
public void getLlGracefulTimersTest() {
final List<AfiSafi> afiSafi = new ArrayList<>();
afiSafi.add(new AfiSafiBuilder().setAfiSafiName(IPV4UNICAST.class).setGracefulRestart(new GracefulRestartBuilder().setConfig(new ConfigBuilder().addAugmentation(new Config1Builder().setLlGracefulRestart(new LlGracefulRestartBuilder().setConfig(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.ll.graceful.restart.rev181112.afi.safi.ll.graceful.restart.ll.graceful.restart.ConfigBuilder().setLongLivedStaleTime(new Uint24(Uint32.valueOf(STALE_TIME))).build()).build()).build()).build()).build()).build());
final Map<TablesKey, Integer> llGracefulTimers = GracefulRestartUtil.getLlGracefulTimers(afiSafi, this.tableRegistry);
assertNotNull(llGracefulTimers);
assertEquals(1, llGracefulTimers.size());
assertEquals(STALE_TIME, llGracefulTimers.get(IPV4_KEY).intValue());
}
Aggregations