public void testAddNodeOptions() throws SecurityException, NoSuchMethodException, IOException { Method method = TerremarkVCloudExpressAsyncClient.class.getMethod( "addNode", URI.class, String.class, String.class, int.class, AddNodeOptions[].class); HttpRequest request = processor.createRequest( method, URI.create("https://vcloud/extensions/internetService/12"), "10.2.2.2", "name", 22, AddNodeOptions.Builder.disabled().withDescription("yahoo")); assertRequestLineEquals( request, "POST https://vcloud/extensions/internetService/12/nodeServices HTTP/1.1"); assertNonPayloadHeadersEqual(request, "Accept: application/vnd.tmrk.vCloud.nodeService+xml\n"); assertPayloadEquals( request, Strings2.toStringAndClose( getClass().getResourceAsStream("/terremark/CreateNodeService-options-test.xml")), "application/vnd.tmrk.vCloud.nodeService+xml", false); assertResponseParserClassEquals(method, request, ParseSax.class); assertSaxResponseParserClassEquals(method, NodeHandler.class); assertExceptionParserClassEquals(method, null); checkFilters(request); }
public void testAddNodeOptions() throws SecurityException, NoSuchMethodException, IOException { Method method = TerremarkVCloudAsyncClient.class.getMethod( "addNode", int.class, String.class, String.class, int.class, Array.newInstance(AddNodeOptions.class, 0).getClass()); GeneratedHttpRequest<TerremarkVCloudAsyncClient> httpMethod = processor.createRequest( method, 12, "10.2.2.2", "name", 22, AddNodeOptions.Builder.disabled().withDescription("yahoo")); assertRequestLineEquals( httpMethod, "POST http://vcloud/extensions/internetService/12/nodeServices HTTP/1.1"); assertHeadersEqual( httpMethod, "Accept: application/vnd.tmrk.vCloud.nodeService+xml\nContent-Length: 333\nContent-Type: application/vnd.tmrk.vCloud.nodeService+xml\n"); assertPayloadEquals( httpMethod, Utils.toStringAndClose( getClass().getResourceAsStream("/terremark/CreateNodeService-options-test.xml"))); assertResponseParserClassEquals(method, httpMethod, ParseSax.class); assertSaxResponseParserClassEquals(method, NodeHandler.class); assertExceptionParserClassEquals(method, null); checkFilters(httpMethod); }