@Test public void testUpdatePortChain() { testCreatePortChain(); final TenantId tenantId2 = TenantId.tenantId("2"); final String name2 = "PortChain2"; final String description2 = "PortChain2"; final List<PortPairGroupId> portPairGroupList = new LinkedList<PortPairGroupId>(); PortPairGroupId portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3ae"); portPairGroupList.add(portPairGroupId); portPairGroupId = PortPairGroupId.of("75555555-fc23-aeb6-f44b-56dc5e2fb3af"); portPairGroupList.add(portPairGroupId); final List<FlowClassifierId> flowClassifierList = new LinkedList<FlowClassifierId>(); FlowClassifierId flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3ae"); flowClassifierList.add(flowClassifierId); flowClassifierId = FlowClassifierId.of("76666666-fc23-aeb6-f44b-56dc5e2fb3af"); flowClassifierList.add(flowClassifierId); portChain = portChainBuilder.setId(portChainId).setTenantId(tenantId2).setName(name2) .setDescription(description2).setPortPairGroups(portPairGroupList) .setFlowClassifiers(flowClassifierList).build(); assertThat(portChainMgr.updatePortChain(portChain), is(true)); }
@Override public boolean updatePortChain(PortChain portChain) { checkNotNull(portChain, PORT_CHAIN_NULL); PortChain oldPortChain = null; if (!portChainStore.containsKey(portChain.portChainId())) { log.warn("The portChain is not exist whose identifier was {} ", portChain.portChainId().toString()); return false; } else { oldPortChain = portChainStore.get(portChain.portChainId()); } PortChain newPortChain = DefaultPortChain.create(portChain, oldPortChain); portChainStore.put(newPortChain.portChainId(), newPortChain); if (!newPortChain.equals(portChainStore.get(newPortChain.portChainId()))) { log.debug("The portChain is updated failed whose identifier was {} ", newPortChain.portChainId().toString()); return false; } return true; }
PortChainManager extends AbstractListenerManager<PortChainEvent, PortChainListener> implements
        PortChainService { @Override public boolean updatePortChain(PortChain portChain) { checkNotNull(portChain, PORT_CHAIN_NULL); PortChain oldPortChain = null; if (!portChainStore.containsKey(portChain.portChainId())) { log.warn("The portChain is not exist whose identifier was {} ", portChain.portChainId().toString()); return false; } else { oldPortChain = portChainStore.get(portChain.portChainId()); } PortChain newPortChain = DefaultPortChain.create(portChain, oldPortChain); portChainStore.put(newPortChain.portChainId(), newPortChain); if (!newPortChain.equals(portChainStore.get(newPortChain.portChainId()))) { log.debug("The portChain is updated failed whose identifier was {} ", newPortChain.portChainId().toString()); return false; } return true; } }
PortChainManager extends AbstractListenerManager<PortChainEvent, PortChainListener> implements
        PortChainService { @Override public boolean updatePortChain(PortChain portChain) { checkNotNull(portChain, PORT_CHAIN_NULL); PortChain oldPortChain = null; if (!portChainStore.containsKey(portChain.portChainId())) { log.warn("The portChain is not exist whose identifier was {} ", portChain.portChainId().toString()); return false; } else { oldPortChain = portChainStore.get(portChain.portChainId()); } PortChain newPortChain = DefaultPortChain.create(portChain, oldPortChain); portChainStore.put(newPortChain.portChainId(), newPortChain); if (!newPortChain.equals(portChainStore.get(newPortChain.portChainId()))) { log.debug("The portChain is updated failed whose identifier was {} ", newPortChain.portChainId().toString()); return false; } return true; }  }
PortChainManager extends AbstractListenerManager<PortChainEvent, PortChainListener> implements
        PortChainService { @Override public boolean updatePortChain(PortChain portChain) { checkNotNull(portChain, PORT_CHAIN_NULL); PortChain oldPortChain = null; if (!portChainStore.containsKey(portChain.portChainId())) { log.warn("The portChain is not exist whose identifier was {} ", portChain.portChainId().toString()); return false; } else { oldPortChain = portChainStore.get(portChain.portChainId()); } PortChain newPortChain = DefaultPortChain.create(portChain, oldPortChain); portChainStore.put(newPortChain.portChainId(), newPortChain); if (!newPortChain.equals(portChainStore.get(newPortChain.portChainId()))) { log.debug("The portChain is updated failed whose identifier was {} ", newPortChain.portChainId().toString()); return false; } return true; }  @Activate void activate(); @Deactivate void deactivate(); @Override boolean exists(PortChainId portChainId); @Override int getPortChainCount(); @Override Iterable<PortChain> getPortChains(); @Override PortChain getPortChain(PortChainId portChainId); @Override boolean createPortChain(PortChain portChain); @Override boolean updatePortChain(PortChain portChain); @Override boolean removePortChain(PortChainId portChainId); }
PortChainManager extends AbstractListenerManager<PortChainEvent, PortChainListener> implements
        PortChainService { @Override public boolean updatePortChain(PortChain portChain) { checkNotNull(portChain, PORT_CHAIN_NULL); PortChain oldPortChain = null; if (!portChainStore.containsKey(portChain.portChainId())) { log.warn("The portChain is not exist whose identifier was {} ", portChain.portChainId().toString()); return false; } else { oldPortChain = portChainStore.get(portChain.portChainId()); } PortChain newPortChain = DefaultPortChain.create(portChain, oldPortChain); portChainStore.put(newPortChain.portChainId(), newPortChain); if (!newPortChain.equals(portChainStore.get(newPortChain.portChainId()))) { log.debug("The portChain is updated failed whose identifier was {} ", newPortChain.portChainId().toString()); return false; } return true; }  @Activate void activate(); @Deactivate void deactivate(); @Override boolean exists(PortChainId portChainId); @Override int getPortChainCount(); @Override Iterable<PortChain> getPortChains(); @Override PortChain getPortChain(PortChainId portChainId); @Override boolean createPortChain(PortChain portChain); @Override boolean updatePortChain(PortChain portChain); @Override boolean removePortChain(PortChainId portChainId);  }