@Test public void testExecute_WhenPortGroupIsNotFound_ThrowsException() throws Exception { SecurityGroup sg = registerSecurityGroup(1L, "projectId", "projectName", 1L, "sgName"); sg.addSecurityGroupMember(newSGMWithPort(1L)); ostRegisterPorts(sg); registerDomain(UUID.randomUUID().toString(), sg); NetworkElement ne = null; SdnRedirectionApi redirectionApi = registerNetworkElement(ne); registerNetworkRedirectionApi(redirectionApi, sg.getVirtualizationConnector()); this.exception.expect(Exception.class); this.exception.expectMessage(String.format("RegisterNetworkElement failed to return PortGroup")); CreatePortGroupTask task = this.factoryTask.create(sg); task.execute(); verify(this.em, Mockito.never()).merge(any()); }
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();  }