Source:
public void testCreateSecurityGroup() { HttpRequest create = HttpRequest.builder().method("POST").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()) .payload( payloadFromStringWithContentType( "{\"security_group\":{\"name\":\"jclouds-test\",\"description\":\"jclouds-test\"}}", "application/json")).build(); HttpResponse createResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_created.json")).build(); HttpRequest list = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String>builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_list_extension.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(create, createResponse); requestResponseMap.put(list, listResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); SecurityGroup group = extension.createSecurityGroup("test", new LocationBuilder() .scope(LocationScope.ZONE) .id(zone) .description("zone") .build()); assertEquals("160", group.getId()); }

Target:
public void testCreateSecurityGroup() { HttpRequest create = HttpRequest.builder().method("POST").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String> builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()) .payload( payloadFromStringWithContentType( "{\"security_group\":{\"name\":\"jclouds-test\",\"description\":\"jclouds-test\"}}", "application/json")).build(); HttpResponse createResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_created.json")).build(); HttpRequest list = HttpRequest.builder().method("GET").endpoint( URI.create("<LINK_0>")).headers( ImmutableMultimap.<String, String>builder().put("Accept", "application/json").put("X-Auth-Token", authToken).build()).build(); HttpResponse listResponse = HttpResponse.builder().statusCode(200).payload( payloadFromResource("/securitygroup_list_extension.json")).build(); Builder<HttpRequest, HttpResponse> requestResponseMap = ImmutableMap.<HttpRequest, HttpResponse> builder(); requestResponseMap.put(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess); requestResponseMap.put(extensionsOfNovaRequest, extensionsOfNovaResponse); requestResponseMap.put(create, createResponse); requestResponseMap.put(list, listResponse).build(); SecurityGroupExtension extension = requestsSendResponses(requestResponseMap.build()).getSecurityGroupExtension().get(); SecurityGroup group = extension.createSecurityGroup("test", new LocationBuilder() .scope(LocationScope.ZONE) .id(zone) .description("zone") .build()); assertEquals(group.getId(), "160"); }