@Test public void testInterfaceBuilder() { NetworkFactory nf = new NetworkFactory(); Interface.Builder ib = nf.interfaceBuilder(); Interface i1 = ib.build(); Interface i2 = ib.build(); Configuration c = nf.configurationBuilder().setConfigurationFormat(CONFIG_FORMAT).build(); Vrf vrf = nf.vrfBuilder().setOwner(c).build(); ib.setOwner(c); Interface i3 = ib.build(); ib.setVrf(vrf); Interface i4 = ib.build(); assertThat(i1.getName(), is(notNullValue())); assertThat(i1.getName(), not(equalTo(i2.getName()))); assertThat(c.getAllInterfaces(), not(hasKey(i1.getName()))); assertThat(i2.getName(), is(notNullValue())); assertThat(c.getAllInterfaces(), not(hasKey(i2.getName()))); assertThat(c.getAllInterfaces(), hasKey(i3.getName())); assertThat(i3.getOwner(), sameInstance(c)); assertThat(c.getAllInterfaces(), hasKey(i4.getName())); assertThat(i4.getVrf(), sameInstance(vrf)); }
public Interface.Builder interfaceBuilder() { return Interface.builder(() -> generateName(Interface.class)); }
NetworkFactory { public Interface.Builder interfaceBuilder() { return Interface.builder(() -> generateName(Interface.class)); } }
NetworkFactory { public Interface.Builder interfaceBuilder() { return Interface.builder(() -> generateName(Interface.class)); } NetworkFactory(); }
NetworkFactory { public Interface.Builder interfaceBuilder() { return Interface.builder(() -> generateName(Interface.class)); } NetworkFactory(); IpAccessList.Builder aclBuilder(); BgpActivePeerConfig.Builder bgpNeighborBuilder(); BgpPassivePeerConfig.Builder bgpDynamicNeighborBuilder(); BgpProcess.Builder bgpProcessBuilder(); Configuration.Builder configurationBuilder(); Interface.Builder interfaceBuilder(); OspfArea.Builder ospfAreaBuilder(); OspfProcess.Builder ospfProcessBuilder(); RipProcess.Builder ripProcessBuilder(); @VisibleForTesting RoutingPolicy.Builder routingPolicyBuilder(); Vrf.Builder vrfBuilder(); }
NetworkFactory { public Interface.Builder interfaceBuilder() { return Interface.builder(() -> generateName(Interface.class)); } NetworkFactory(); IpAccessList.Builder aclBuilder(); BgpActivePeerConfig.Builder bgpNeighborBuilder(); BgpPassivePeerConfig.Builder bgpDynamicNeighborBuilder(); BgpProcess.Builder bgpProcessBuilder(); Configuration.Builder configurationBuilder(); Interface.Builder interfaceBuilder(); OspfArea.Builder ospfAreaBuilder(); OspfProcess.Builder ospfProcessBuilder(); RipProcess.Builder ripProcessBuilder(); @VisibleForTesting RoutingPolicy.Builder routingPolicyBuilder(); Vrf.Builder vrfBuilder();  }