NiciraNvpApi { public void updateSecurityProfile(final SecurityProfile securityProfile, final String securityProfileUuid) throws NiciraNvpApiException { update(securityProfile, securityProfileUuid); } private  NiciraNvpApi(final Builder builder); static Builder create(); SecurityProfile createSecurityProfile(final SecurityProfile securityProfile); List<SecurityProfile> findSecurityProfile(); List<SecurityProfile> findSecurityProfile(final String uuid); void updateSecurityProfile(final SecurityProfile securityProfile, final String securityProfileUuid); void deleteSecurityProfile(final String securityProfileUuid); Acl createAcl(final Acl acl); List<Acl> findAcl(); List<Acl> findAcl(final String uuid); void updateAcl(final Acl acl, final String aclUuid); void deleteAcl(final String aclUuid); LogicalSwitch createLogicalSwitch(final LogicalSwitch logicalSwitch); List<LogicalSwitch> findLogicalSwitch(); List<LogicalSwitch> findLogicalSwitch(final String uuid); void updateLogicalSwitch(final LogicalSwitch logicalSwitch, final String logicalSwitchUuid); void deleteLogicalSwitch(final String uuid); LogicalSwitchPort createLogicalSwitchPort(final String logicalSwitchUuid, final LogicalSwitchPort logicalSwitchPort); void updateLogicalSwitchPort(final String logicalSwitchUuid, final LogicalSwitchPort logicalSwitchPort); void updateLogicalSwitchPortAttachment(final String logicalSwitchUuid, final String logicalSwitchPortUuid, final Attachment attachment); void deleteLogicalSwitchPort(final String logicalSwitchUuid, final String logicalSwitchPortUuid); String findLogicalSwitchPortUuidByVifAttachmentUuid(final String logicalSwitchUuid, final String vifAttachmentUuid); ControlClusterStatus getControlClusterStatus(); List<LogicalSwitchPort> findLogicalSwitchPortsByUuid(final String logicalSwitchUuid, final String logicalSwitchPortUuid); List<LogicalRouterPort> findLogicalRouterPortsByUuid(final String logicalRouterUuid, final String logicalRouterPortUuid); LogicalRouter createLogicalRouter(final LogicalRouter logicalRouter); List<LogicalRouter> findLogicalRouter(); List<LogicalRouter> findLogicalRouter(final String uuid); LogicalRouter findOneLogicalRouterByUuid(final String logicalRouterUuid); void updateLogicalRouter(final LogicalRouter logicalRouter, final String logicalRouterUuid); void deleteLogicalRouter(final String logicalRouterUuid); LogicalRouterPort createLogicalRouterPort(final String logicalRouterUuid, final LogicalRouterPort logicalRouterPort); void deleteLogicalRouterPort(final String logicalRouterUuid, final String logicalRouterPortUuid); void updateLogicalRouterPort(final String logicalRouterUuid, final LogicalRouterPort logicalRouterPort); void updateLogicalRouterPortAttachment(final String logicalRouterUuid, final String logicalRouterPortUuid, final Attachment attachment); NatRule createLogicalRouterNatRule(final String logicalRouterUuid, final NatRule natRule); void updateLogicalRouterNatRule(final String logicalRouterUuid, final NatRule natRule); void deleteLogicalRouterNatRule(final String logicalRouterUuid, final UUID natRuleUuid); List<LogicalRouterPort> findLogicalRouterPortByGatewayServiceAndVlanId(final String logicalRouterUuid, final String gatewayServiceUuid, final long vlanId); List<NatRule> findNatRulesByLogicalRouterUuid(final String logicalRouterUuid); List<LogicalRouterPort> findLogicalRouterPortByGatewayServiceUuid(final String logicalRouterUuid, final String l3GatewayServiceUuid);  }
@Test public void testUpdateSecurityProfile() throws Exception { final CloseableHttpResponse response = mock(CloseableHttpResponse.class); when(response.getStatusLine()).thenReturn(HTTP_201_REPSONSE); when(response.getEntity()).thenReturn(new StringEntity(SEC_PROFILE_JSON_RESPONSE)); final CloseableHttpClient httpClient = spy(HttpClientHelper.createHttpClient(2)); doReturn(response).when(httpClient).execute(any(HttpHost.class), any(HttpRequest.class), any(HttpClientContext.class)); final NiciraNvpApi api = buildApi(httpClient); api.updateSecurityProfile(new SecurityProfile(), UUID); verify(response, times(1)).close(); verify(httpClient).execute(any(HttpHost.class), HttpUriRequestMethodMatcher.aMethod("PUT"), any(HttpClientContext.class)); verify(httpClient).execute(any(HttpHost.class), HttpUriRequestPathMatcher.aPath(NiciraConstants.SEC_PROFILE_URI_PREFIX + "/" + UUID), any(HttpClientContext.class)); }