@Test public void testExecute_WhenElementIdMatches_UpdateNotNeeded() throws Exception { SecurityGroup sg = registerSecurityGroup(1L, "projectId", "projectName", 1L, "sgName"); sg.addSecurityGroupMember(newSGMWithPort(1L, OPENSTACK_ID)); NetworkElementImpl portGroup = createPortGroup(OPENSTACK_ID); ostRegisterPorts(sg); String domainId = UUID.randomUUID().toString(); registerDomain(domainId, sg); NetworkElement ne = createNetworkElement(OPENSTACK_ID); SdnRedirectionApi redirectionApi = registerNetworkElement(portGroup, ne); registerNetworkRedirectionApi(redirectionApi, sg.getVirtualizationConnector()); UpdatePortGroupTask task = this.factoryTask.create(sg, portGroup); task.execute(); verify(this.em, Mockito.never()).merge(any()); }
public UpdatePortGroupTask create(SecurityGroup sg, NetworkElementImpl portGroup) { UpdatePortGroupTask task = new UpdatePortGroupTask(); task.securityGroup = sg; task.portGroup = portGroup; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }
UpdatePortGroupTask extends TransactionalTask { public UpdatePortGroupTask create(SecurityGroup sg, NetworkElementImpl portGroup) { UpdatePortGroupTask task = new UpdatePortGroupTask(); task.securityGroup = sg; task.portGroup = portGroup; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; } }
UpdatePortGroupTask extends TransactionalTask { public UpdatePortGroupTask create(SecurityGroup sg, NetworkElementImpl portGroup) { UpdatePortGroupTask task = new UpdatePortGroupTask(); task.securityGroup = sg; task.portGroup = portGroup; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  }
UpdatePortGroupTask extends TransactionalTask { public UpdatePortGroupTask create(SecurityGroup sg, NetworkElementImpl portGroup) { UpdatePortGroupTask task = new UpdatePortGroupTask(); task.securityGroup = sg; task.portGroup = portGroup; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  UpdatePortGroupTask create(SecurityGroup sg, NetworkElementImpl portGroup); @Override void executeTransaction(EntityManager em); @Override String getName(); }
UpdatePortGroupTask extends TransactionalTask { public UpdatePortGroupTask create(SecurityGroup sg, NetworkElementImpl portGroup) { UpdatePortGroupTask task = new UpdatePortGroupTask(); task.securityGroup = sg; task.portGroup = portGroup; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  UpdatePortGroupTask create(SecurityGroup sg, NetworkElementImpl portGroup); @Override void executeTransaction(EntityManager em); @Override String getName();  }