reduce payload for GET VirtualGuests

This commit is contained in:
Andrea Turli 2016-10-13 22:03:44 +02:00
parent c79b235594
commit a843196bf6
4 changed files with 45 additions and 37 deletions

View File

@ -45,7 +45,7 @@ public interface AccountApi {
String GUEST_MASK = "children.blockDevices.diskImage.softwareReferences.softwareDescription"; String GUEST_MASK = "children.blockDevices.diskImage.softwareReferences.softwareDescription";
String LIST_GUEST_MASK = "powerState;operatingSystem.passwords;datacenter;billingItem;blockDevices" + String LIST_GUEST_MASK = "powerState;operatingSystem.passwords;datacenter;billingItem;blockDevices" +
".diskImage;tagReferences"; ".diskImage;tagReferences.tag.name";
/** /**
* @return an account's associated virtual guest objects. * @return an account's associated virtual guest objects.

View File

@ -41,7 +41,7 @@ public class AccountApiMockTest extends BaseSoftLayerMockTest {
AccountApi api = getAccountApi(server); AccountApi api = getAccountApi(server);
try { try {
assertEquals(api.listVirtualGuests(), new VirtualGuestsParseTest().expected()); assertEquals(api.listVirtualGuests(), new VirtualGuestsParseTest().expected());
assertSent(server, "GET", "/SoftLayer_Account/VirtualGuests?objectMask=powerState%3BoperatingSystem.passwords%3Bdatacenter%3BbillingItem%3BblockDevices.diskImage%3BtagReferences"); assertSent(server, "GET", "/SoftLayer_Account/VirtualGuests?objectMask=powerState%3BoperatingSystem.passwords%3Bdatacenter%3BbillingItem%3BblockDevices.diskImage%3BtagReferences.tag.name");
} finally { } finally {
server.shutdown(); server.shutdown();
} }
@ -52,7 +52,7 @@ public class AccountApiMockTest extends BaseSoftLayerMockTest {
AccountApi api = getAccountApi(server); AccountApi api = getAccountApi(server);
try { try {
assertTrue(api.listVirtualGuests().isEmpty()); assertTrue(api.listVirtualGuests().isEmpty());
assertSent(server, "GET", "/SoftLayer_Account/VirtualGuests?objectMask=powerState%3BoperatingSystem.passwords%3Bdatacenter%3BbillingItem%3BblockDevices.diskImage%3BtagReferences"); assertSent(server, "GET", "/SoftLayer_Account/VirtualGuests?objectMask=powerState%3BoperatingSystem.passwords%3Bdatacenter%3BbillingItem%3BblockDevices.diskImage%3BtagReferences.tag.name");
} finally { } finally {
server.shutdown(); server.shutdown();
} }

View File

@ -0,0 +1,42 @@
<?xml version="1.0"?>
<configuration scan="false">
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>target/test-data/jclouds.log</file>
<encoder>
<Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
</encoder>
</appender>
<appender name="WIREFILE" class="ch.qos.logback.core.FileAppender">
<file>target/test-data/jclouds-wire.log</file>
<encoder>
<Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
</encoder>
</appender>
<appender name="COMPUTEFILE" class="ch.qos.logback.core.FileAppender">
<file>target/jclouds-compute.log</file>
<encoder>
<Pattern>%d %-5p [%c] [%thread] %m%n</Pattern>
</encoder>
</appender>
<logger name="org.jclouds">
<level value="DEBUG" />
<appender-ref ref="FILE" />
</logger>
<logger name="jclouds.compute">
<level value="DEBUG" />
<appender-ref ref="COMPUTEFILE" />
</logger>
<logger name="jclouds.wire">
<level value="DEBUG" />
<appender-ref ref="WIREFILE" />
</logger>
<logger name="jclouds.headers">
<level value="DEBUG" />
<appender-ref ref="WIREFILE" />
</logger>
<root>
<level value="INFO" />
</root>
</configuration>

View File

@ -1,34 +0,0 @@
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>- %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="STDOUT"/>
</root>
<logger name="jclouds.compute" level="debug"/>
<logger name="net.schmizz" level="warn"/>
<logger name="jclouds.wire" level="debug"/>
<logger name="jclouds.headers" level="debug"/>
<logger name="jclouds.ssh" level="debug"/>
</configuration>