added summary log output to route53 live test

This commit is contained in:
adriancole 2013-02-21 10:09:50 -08:00
parent b756af1543
commit aa91c6a5aa
1 changed files with 32 additions and 6 deletions

View File

@ -7,13 +7,13 @@
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICE"NS"E-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, * Unles required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an * software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIO"NS" OF ANY * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the * KIND, either expres or implied. See the License for the
* specific language governing permissions and limitations * specific language governing permisions and limitations
* under the License. * under the License.
*/ */
package org.jclouds.route53.features; package org.jclouds.route53.features;
@ -32,7 +32,9 @@ import static org.testng.Assert.assertTrue;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import org.jclouds.JcloudsVersion; import org.jclouds.JcloudsVersion;
import org.jclouds.collect.PagedIterable; import org.jclouds.collect.PagedIterable;
@ -45,9 +47,13 @@ import org.jclouds.route53.domain.ResourceRecordSet.RecordSubset.Latency;
import org.jclouds.route53.domain.ResourceRecordSet.RecordSubset.Weighted; import org.jclouds.route53.domain.ResourceRecordSet.RecordSubset.Weighted;
import org.jclouds.route53.internal.BaseRoute53ApiLiveTest; import org.jclouds.route53.internal.BaseRoute53ApiLiveTest;
import org.testng.SkipException; import org.testng.SkipException;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.base.Predicate; import com.google.common.base.Predicate;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
/** /**
@ -77,9 +83,12 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest {
} }
} }
AtomicLong zones = new AtomicLong();
@Test @Test
private void testListRRSs() { private void testListRRSs() {
for (HostedZone zone : zones().concat()) { for (HostedZone zone : zones().concat()) {
zones.incrementAndGet();
checkAllRRs(zone.getId()); checkAllRRs(zone.getId());
} }
} }
@ -90,10 +99,26 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest {
assertEquals(zone.getResourceRecordSetCount(), records.size()); assertEquals(zone.getResourceRecordSetCount(), records.size());
for (ResourceRecordSet rrs : records) { for (ResourceRecordSet rrs : records) {
recordTypeCounts.getUnchecked(rrs.getType()).addAndGet(
rrs.getAliasTarget().isPresent() ? 1 : rrs.getValues().size());
checkRRS(rrs); checkRRS(rrs);
} }
} }
LoadingCache<String, AtomicLong> recordTypeCounts = CacheBuilder.newBuilder().build(
new CacheLoader<String, AtomicLong>() {
public AtomicLong load(String key) throws Exception {
return new AtomicLong();
}
});
@AfterClass
void logSummary() {
getAnonymousLogger().info("zoneCount: " + zones);
for (Entry<String, AtomicLong> entry : recordTypeCounts.asMap().entrySet())
getAnonymousLogger().info(String.format("type: %s, count: %s", entry.getKey(), entry.getValue()));
}
@Test @Test
public void testDeleteRRSNotFound() { public void testDeleteRRSNotFound() {
for (HostedZone zone : zones().concat()) { for (HostedZone zone : zones().concat()) {
@ -118,7 +143,8 @@ public class ResourceRecordSetApiLiveTest extends BaseRoute53ApiLiveTest {
String nonce = name + " @ " + new Date(); String nonce = name + " @ " + new Date();
String comment = name + " for " + JcloudsVersion.get(); String comment = name + " for " + JcloudsVersion.get();
NewHostedZone newHostedZone = context.getApi().getHostedZoneApi().createWithReferenceAndComment(name, nonce, comment); NewHostedZone newHostedZone = context.getApi().getHostedZoneApi()
.createWithReferenceAndComment(name, nonce, comment);
String zoneId = newHostedZone.getZone().getId(); String zoneId = newHostedZone.getZone().getId();
getAnonymousLogger().info("created zone: " + newHostedZone); getAnonymousLogger().info("created zone: " + newHostedZone);
try { try {