@Test public void testExecute_SGWithMultipleSGM_ExecutionFinishes() throws Exception { SecurityGroup sg = registerSecurityGroup(1L, "projectId", "projectName", 1L, "sgName"); sg.addSecurityGroupMember(newSGMWithPort(1L)); sg.addSecurityGroupMember(newSGMWithPort(2L)); List<NetworkElement> neList = ostRegisterPorts(sg); String domainId = UUID.randomUUID().toString(); registerDomain(domainId, sg); NetworkElement ne = createNetworkElement(); SdnRedirectionApi redirectionApi = registerNetworkElement(ne); registerNetworkRedirectionApi(redirectionApi, sg.getVirtualizationConnector()); CreatePortGroupTask task = this.factoryTask.create(sg); task.execute(); verify(this.em, Mockito.times(1)).merge(sg); Assert.assertEquals("Network element security group element id mismatch", ne.getElementId(), sg.getNetworkElementId()); assertNetworkElementsParentIdWithDomainId(neList, domainId); }
public CreatePortGroupTask create(SecurityGroup sg) { CreatePortGroupTask task = new CreatePortGroupTask(); task.securityGroup = sg; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }
CreatePortGroupTask extends TransactionalTask { public CreatePortGroupTask create(SecurityGroup sg) { CreatePortGroupTask task = new CreatePortGroupTask(); task.securityGroup = sg; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; } }
CreatePortGroupTask extends TransactionalTask { public CreatePortGroupTask create(SecurityGroup sg) { CreatePortGroupTask task = new CreatePortGroupTask(); task.securityGroup = sg; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  }
CreatePortGroupTask extends TransactionalTask { public CreatePortGroupTask create(SecurityGroup sg) { CreatePortGroupTask task = new CreatePortGroupTask(); task.securityGroup = sg; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  CreatePortGroupTask create(SecurityGroup sg); @Override void executeTransaction(EntityManager em); @Override String getName(); }
CreatePortGroupTask extends TransactionalTask { public CreatePortGroupTask create(SecurityGroup sg) { CreatePortGroupTask task = new CreatePortGroupTask(); task.securityGroup = sg; task.apiFactoryService = this.apiFactoryService; task.dbConnectionManager = this.dbConnectionManager; task.txBroadcastUtil = this.txBroadcastUtil; return task; }  CreatePortGroupTask create(SecurityGroup sg); @Override void executeTransaction(EntityManager em); @Override String getName();  }