From dadf142cac85c8e4bd687907af2eb636ca0854a2 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 24 Dec 2012 00:16:57 -0800 Subject: [PATCH] removed chance of race condition due to duplicate tearDown methods --- .../cloudsigma/CloudSigmaClientLiveTest.java | 6 +- .../cloudstack/CloudStackClientLiveTest.java | 147 ------------------ ...oudStackComputeServiceAdapterLiveTest.java | 5 +- .../features/AddressClientLiveTest.java | 5 +- .../features/FirewallClientLiveTest.java | 5 +- .../features/GlobalHostClientLiveTest.java | 1 - .../features/GlobalPodClientLiveTest.java | 7 +- .../features/GlobalVlanClientLiveTest.java | 8 +- .../features/LoadBalancerClientLiveTest.java | 5 +- .../features/SecurityGroupClientLiveTest.java | 26 ++-- .../features/TemplateClientLiveTest.java | 5 +- .../features/VMGroupClientLiveTest.java | 5 +- .../VirtualMachineClientLiveTest.java | 5 +- ...ticNATVirtualMachineInNetworkLiveTest.java | 5 +- .../BaseCloudStackClientLiveTest.java | 7 - .../ElasticStackClientLiveTest.java | 6 +- .../internal/BaseKeystoneApiLiveTest.java | 11 +- .../cdmi/v1/internal/BaseCDMIApiLiveTest.java | 9 +- .../v6_5/features/MachineApiLiveTest.java | 7 +- .../internal/BaseJoyentCloudApiLiveTest.java | 9 +- .../v1_0/internal/BaseGlanceApiLiveTest.java | 6 - .../v1_0/internal/BaseQuantumApiLiveTest.java | 9 +- .../v1/internal/BaseSwiftApiLiveTest.java | 7 - .../v1_5/features/CatalogApiLiveTest.java | 4 +- .../BaseVirtualBoxClientLiveTest.java | 7 - ...rtualBoxComputeServiceAdapterLiveTest.java | 8 +- ...romIMachineIfNotAlreadyExistsLiveTest.java | 8 +- .../functions/CreateAndInstallVmLiveTest.java | 10 +- ...hineFromIsoIfNotAlreadyExistsLiveTest.java | 8 +- .../IMachinePredicatesLiveTest.java | 8 +- .../util/MachineControllerLiveTest.java | 9 +- 31 files changed, 92 insertions(+), 276 deletions(-) delete mode 100644 apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackClientLiveTest.java diff --git a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java index 36f788d817..91ed90ba63 100644 --- a/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java +++ b/apis/cloudsigma/src/test/java/org/jclouds/cloudsigma/CloudSigmaClientLiveTest.java @@ -404,13 +404,13 @@ public class CloudSigmaClientLiveTest extends BaseComputeServiceContextLiveTest } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (server != null) client.destroyServer(server.getUuid()); if (server != null) client.destroyDrive(drive.getUuid()); - if (cloudSigmaContext != null) - cloudSigmaContext.close(); + super.tearDownContext(); } @Test diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackClientLiveTest.java deleted file mode 100644 index 299f5a3da6..0000000000 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackClientLiveTest.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * Licensed to jclouds, Inc. (jclouds) under one or more - * contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. jclouds 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. - */ -// -//package org.jclouds.cloudstack; -// -//import static org.testng.Assert.assertEquals; -// -//import java.io.IOException; -//import java.util.logging.Logger; -// -//import org.jclouds.compute.domain.ExecResponse; -//import org.jclouds.cloudstack.domain.Instance; -//import org.jclouds.cloudstack.domain.InstanceAction; -//import org.jclouds.cloudstack.domain.InstanceState; -//import org.jclouds.cloudstack.features.ReadOnlyCloudStackClientLiveTest; -//import org.jclouds.cloudstack.options.CreateInstanceOptions; -//import org.jclouds.domain.Credentials; -//import org.jclouds.http.HttpRequest; -//import com.google.common.net.HostAndPort; -//import org.jclouds.ssh.SshClient; -//import org.jclouds.ssh.jsch.config.JschSshClientModule; -//import org.testng.annotations.AfterGroups; -//import org.testng.annotations.Test; -// -//import com.google.common.collect.Iterables; -//import com.google.gson.Gson; -//import com.google.inject.Guice; -// -///** -// * Tests behavior of {@code CloudStackClient} -// * -// * @author Adrian Cole -// */ -//@Test(groups = "live", singleThreaded = true, testName = "CloudStackClientLiveTest") -//public class CloudStackClientLiveTest extends ReadOnlyCloudStackClientLiveTest { -// -// protected String prefix = System.getProperty("user.name") + ".test"; -// protected Instance instance; -// -// public void testCreateInstance() throws Exception { -// Logger.getAnonymousLogger().info("starting instance"); -// instance = client.createInstance(Iterables.get(client.listImages(), 0).getId(), -// CreateInstanceOptions.Builder.named(prefix)); -// instance = client.getInstance(instance.getHref()); -// checkStartedInstance(); -// -// Instance newInfo = client.getInstance(instance.getHref()); -// checkInstanceMatchesGet(newInfo); -// -// } -// -// protected void checkInstanceMatchesGet(Instance newInfo) { -// assertEquals(newInfo.getHref(), instance.getHref()); -// } -// -// protected void checkStartedInstance() { -// System.out.println(new Gson().toJson(instance)); -// assertEquals(instance.getName(), prefix); -// assertEquals(instance.getState(), InstanceState.RUNNING); -// } -// -// @Test(dependsOnMethods = "testCreateInstance") -// public void testConnectivity() throws Exception { -// Logger.getAnonymousLogger().info("awaiting ssh"); -// // TODO -// // assert socketTester.apply(HostAndPort.fromParts(Iterables.get(instance.getPublicAddresses(), 0), -// // 22)) : instance; -// // doConnectViaSsh(instance, getSshCredentials(instance)); -// } -// -// private Credentials getSshCredentials(Instance instance2) { -// // TODO -// return null; -// } -// -// public HttpRequest refreshInstanceAndGetAction(InstanceAction action) { -// return client.getInstance(instance.getHref()).getActions().get(action); -// } -// -// @Test(dependsOnMethods = "testConnectivity") -// public void testLifeCycle() throws Exception { -// client.performAction(refreshInstanceAndGetAction(InstanceAction.STOP)); -// assertEquals(client.getInstance(instance.getHref()).getState(), InstanceState.STOPPED); -// -// client.performAction(refreshInstanceAndGetAction(InstanceAction.START)); -// assertEquals(client.getInstance(instance.getHref()).getState(), InstanceState.RUNNING); -// -// client.performAction(refreshInstanceAndGetAction(InstanceAction.REBOOT)); -// assertEquals(client.getInstance(instance.getHref()).getState(), InstanceState.RUNNING); -// -// } -// -// @Test(dependsOnMethods = "testLifeCycle") -// public void testDestroyInstance() throws Exception { -// try { -// client.performAction(refreshInstanceAndGetAction(InstanceAction.STOP)); -// assertEquals(client.getInstance(instance.getHref()).getState(), InstanceState.STOPPED); -// } catch (IllegalArgumentException e) { -// } -// client.performAction(refreshInstanceAndGetAction(InstanceAction.DESTROY)); -// assertEquals(client.getInstance(instance.getHref()), null); -// } -// -// protected void doConnectViaSsh(Instance instance, Credentials creds) throws IOException { -// SshClient ssh = Guice.createInjector(new JschSshClientModule()).getInstance(SshClient.Factory.class) -// .create(HostAndPort.fromParts(Iterables.get(instance.getPublicAddresses(), 0), 22), creds); -// try { -// ssh.connect(); -// ExecResponse hello = ssh.exec("echo hello"); -// assertEquals(hello.getOutput().trim(), "hello"); -// System.err.println(ssh.exec("df -k").getOutput()); -// System.err.println(ssh.exec("mount").getOutput()); -// System.err.println(ssh.exec("uname -a").getOutput()); -// } finally { -// if (ssh != null) -// ssh.disconnect(); -// } -// } -// -// @AfterGroups(groups = "live") -// @Override -// protected void tearDown() { -// try { -// testDestroyInstance(); -// } catch (Exception e) { -// // no need to check null or anything as we swallow all -// } -// super.tearDown(); -// } -// -// } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java index 38f3f48bb9..bddd452e42 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/compute/CloudStackComputeServiceAdapterLiveTest.java @@ -217,9 +217,10 @@ public class CloudStackComputeServiceAdapterLiveTest extends BaseCloudStackClien } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (vm != null) adapter.destroyNode(vm.getNodeId()); - super.tearDown(); + super.tearDownContext(); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AddressClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AddressClientLiveTest.java index 1b43da731e..e1c1392357 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AddressClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/AddressClientLiveTest.java @@ -62,11 +62,12 @@ public class AddressClientLiveTest extends BaseCloudStackClientLiveTest { } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (ip != null) { client.getAddressClient().disassociateIPAddress(ip.getId()); } - super.tearDown(); + super.tearDownContext(); } public void testListPublicIPAddresss() throws Exception { diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallClientLiveTest.java index bdd32acfbf..8a9713a5be 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/FirewallClientLiveTest.java @@ -154,7 +154,8 @@ public class FirewallClientLiveTest extends BaseCloudStackClientLiveTest { } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (firewallRule != null) { client.getFirewallClient().deleteFirewallRule(firewallRule.getId()); } @@ -167,7 +168,7 @@ public class FirewallClientLiveTest extends BaseCloudStackClientLiveTest { if (ip != null) { client.getAddressClient().disassociateIPAddress(ip.getId()); } - super.tearDown(); + super.tearDownContext(); } protected void checkFirewallRule(FirewallRule rule) { diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java index 0dd741f6b7..077ff8fef1 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalHostClientLiveTest.java @@ -21,7 +21,6 @@ package org.jclouds.cloudstack.features; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertTrue; import java.util.Set; diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java index daa1eba379..413282206f 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalPodClientLiveTest.java @@ -35,6 +35,7 @@ import org.jclouds.cloudstack.options.CreatePodOptions; import org.jclouds.cloudstack.options.ListPodsOptions; import org.jclouds.cloudstack.options.UpdatePodOptions; import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterGroups; import org.testng.annotations.Test; import com.google.common.base.Strings; @@ -117,8 +118,9 @@ public class GlobalPodClientLiveTest extends BaseCloudStackClientLiveTest { assertEquals(updated.getAllocationState(), AllocationState.DISABLED); } - @AfterClass - public void testFixtureTearDown() { + @AfterGroups(groups = "live") + @Override + protected void tearDownContext() { if (pod != null) { globalAdminClient.getPodClient().deletePod(pod.getId()); pod = null; @@ -127,5 +129,6 @@ public class GlobalPodClientLiveTest extends BaseCloudStackClientLiveTest { globalAdminClient.getZoneClient().deleteZone(zone.getId()); zone = null; } + super.tearDownContext(); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java index 3e62987dc9..168eb7bd6d 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/GlobalVlanClientLiveTest.java @@ -37,7 +37,7 @@ import org.jclouds.cloudstack.options.CreateVlanIPRangeOptions; import org.jclouds.cloudstack.options.ListVlanIPRangesOptions; import org.jclouds.cloudstack.predicates.NetworkOfferingPredicates; import org.jclouds.cloudstack.predicates.ZonePredicates; -import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterGroups; import org.testng.annotations.Test; import com.google.common.base.Predicate; @@ -121,8 +121,9 @@ public class GlobalVlanClientLiveTest extends BaseCloudStackClientLiveTest { ); } - @AfterClass - public void testFixtureTearDown() { + @AfterGroups(groups = "live") + @Override + protected void tearDownContext() { if (range != null) { globalAdminClient.getVlanClient().deleteVlanIPRange(range.getId()); range = null; @@ -131,6 +132,7 @@ public class GlobalVlanClientLiveTest extends BaseCloudStackClientLiveTest { client.getNetworkClient().deleteNetwork(network.getId()); network = null; } + super.tearDownContext(); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LoadBalancerClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LoadBalancerClientLiveTest.java index 8d8d385cfb..9872434ff2 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LoadBalancerClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/LoadBalancerClientLiveTest.java @@ -179,7 +179,8 @@ public class LoadBalancerClientLiveTest extends BaseCloudStackClientLiveTest { } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (rule != null) { assertTrue(jobComplete.apply(client.getLoadBalancerClient().deleteLoadBalancerRule(rule.getId()))); } @@ -189,7 +190,7 @@ public class LoadBalancerClientLiveTest extends BaseCloudStackClientLiveTest { if (ip != null) { client.getAddressClient().disassociateIPAddress(ip.getId()); } - super.tearDown(); + super.tearDownContext(); } public void testListLoadBalancerRules() throws Exception { diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupClientLiveTest.java index 31f58d2dab..db8e16a074 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/SecurityGroupClientLiveTest.java @@ -36,6 +36,7 @@ import org.jclouds.cloudstack.options.AccountInDomainOptions; import org.jclouds.cloudstack.options.DeployVirtualMachineOptions; import org.jclouds.cloudstack.options.ListSecurityGroupsOptions; import org.jclouds.util.Strings2; +import org.testng.SkipException; import org.testng.annotations.AfterGroups; import org.testng.annotations.Test; @@ -98,11 +99,16 @@ public class SecurityGroupClientLiveTest extends BaseCloudStackClientLiveTest { connection.connect(); return Strings2.toStringAndClose(connection.getInputStream()).trim() + "/32"; } - + + protected void skipIfSecurityGroupsNotSupported() { + if (!securityGroupsSupported) { + throw new SkipException("Test cannot run without security groups supported in a zone"); + } + } + @Test(dependsOnMethods = "testCreateDestroySecurityGroup") public void testCreateIngress() throws Exception { - if (!securityGroupsSupported) - return; + skipIfSecurityGroupsNotSupported(); String cidr = getCurrentCIDR(); ImmutableSet cidrs = ImmutableSet.of(cidr); assertTrue(jobComplete.apply(client.getSecurityGroupClient().authorizeIngressICMPToCIDRs(group.getId(), 0, 8, cidrs)), group.toString()); @@ -163,16 +169,14 @@ public class SecurityGroupClientLiveTest extends BaseCloudStackClientLiveTest { } public void testListSecurityGroup() throws Exception { - if (!securityGroupsSupported) - return; + skipIfSecurityGroupsNotSupported(); for (SecurityGroup securityGroup : client.getSecurityGroupClient().listSecurityGroups()) checkGroup(securityGroup); } @Test(dependsOnMethods = "testCreateIngress") public void testCreateVMInSecurityGroup() throws Exception { - if (!securityGroupsSupported) - return; + skipIfSecurityGroupsNotSupported(); String defaultTemplate = template != null ? template.getImageId() : null; vm = VirtualMachineClientLiveTest.createVirtualMachineWithSecurityGroupInZone(zone.getId(), defaultTemplateOrPreferredInZone(defaultTemplate, client, zone.getId()), group.getId(), client, @@ -200,8 +204,7 @@ public class SecurityGroupClientLiveTest extends BaseCloudStackClientLiveTest { @Test public void testCreateVMWithoutSecurityGroupAssignsDefault() throws Exception { - if (!securityGroupsSupported) - return; + skipIfSecurityGroupsNotSupported(); String defaultTemplate = template != null ? template.getImageId() : null; VirtualMachine newVm = VirtualMachineClientLiveTest.createVirtualMachineWithOptionsInZone(DeployVirtualMachineOptions.NONE, zone.getId(), defaultTemplateOrPreferredInZone(defaultTemplate, client, zone.getId()), client, @@ -216,7 +219,8 @@ public class SecurityGroupClientLiveTest extends BaseCloudStackClientLiveTest { } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (vm != null) { assertTrue(jobComplete.apply(client.getVirtualMachineClient().destroyVirtualMachine(vm.getId()))); } @@ -226,7 +230,7 @@ public class SecurityGroupClientLiveTest extends BaseCloudStackClientLiveTest { client.getSecurityGroupClient().deleteSecurityGroup(group.getId()); assertEquals(client.getSecurityGroupClient().getSecurityGroup(group.getId()), null); } - super.tearDown(); + super.tearDownContext(); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateClientLiveTest.java index f4a3173637..f07dce1111 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/TemplateClientLiveTest.java @@ -195,7 +195,8 @@ public class TemplateClientLiveTest extends BaseCloudStackClientLiveTest { @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (vmForCreation != null) { assertTrue(jobComplete.apply(client.getVirtualMachineClient().stopVirtualMachine(vmForCreation.getId())), vmForCreation.toString()); assertTrue(jobComplete.apply(client.getVirtualMachineClient().destroyVirtualMachine(vmForCreation.getId())), vmForCreation.toString()); @@ -214,7 +215,7 @@ public class TemplateClientLiveTest extends BaseCloudStackClientLiveTest { AsyncCreateResponse deleteJob = client.getTemplateClient().deleteTemplate(registeredTemplate.getId()); assertTrue(jobComplete.apply(deleteJob.getJobId())); } - super.tearDown(); + super.tearDownContext(); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VMGroupClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VMGroupClientLiveTest.java index 63f7ed6ef4..7394dbc83b 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VMGroupClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VMGroupClientLiveTest.java @@ -62,11 +62,12 @@ public class VMGroupClientLiveTest extends BaseCloudStackClientLiveTest { } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (groupCreated != null) { client.getVMGroupClient().deleteInstanceGroup(groupCreated.getId()); } - super.tearDown(); + super.tearDownContext(); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineClientLiveTest.java index 63dbc30f20..cc46aa5f41 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VirtualMachineClientLiveTest.java @@ -326,12 +326,13 @@ public class VirtualMachineClientLiveTest extends BaseCloudStackClientLiveTest { } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (vm != null) { destroyMachine(vm); vm = null; } - super.tearDown(); + super.tearDownContext(); } @Test diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/functions/StaticNATVirtualMachineInNetworkLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/functions/StaticNATVirtualMachineInNetworkLiveTest.java index f610ca2e04..56af93c715 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/functions/StaticNATVirtualMachineInNetworkLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/functions/StaticNATVirtualMachineInNetworkLiveTest.java @@ -108,7 +108,8 @@ public class StaticNATVirtualMachineInNetworkLiveTest extends NATClientLiveTest } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (rule != null) { client.getNATClient().deleteIPForwardingRule(rule.getId()); } @@ -118,7 +119,7 @@ public class StaticNATVirtualMachineInNetworkLiveTest extends NATClientLiveTest if (ip != null) { client.getAddressClient().disassociateIPAddress(ip.getId()); } - super.tearDown(); + super.tearDownContext(); } } diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackClientLiveTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackClientLiveTest.java index 6f1cf48b87..1b1bcd0f10 100644 --- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackClientLiveTest.java +++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/internal/BaseCloudStackClientLiveTest.java @@ -58,7 +58,6 @@ import org.jclouds.rest.RestContext; import org.jclouds.ssh.SshClient; import org.jclouds.sshj.config.SshjSshClientModule; import org.testng.SkipException; -import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; import com.google.common.base.Predicate; @@ -283,10 +282,4 @@ public class BaseCloudStackClientLiveTest extends BaseGenericComputeServiceConte } } - @AfterGroups(groups = "live") - protected void tearDown() { - if (cloudStackContext != null) - cloudStackContext.close(); - } - } diff --git a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackClientLiveTest.java b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackClientLiveTest.java index 5dcca7e56f..50b5f50a97 100644 --- a/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackClientLiveTest.java +++ b/apis/elasticstack/src/test/java/org/jclouds/elasticstack/ElasticStackClientLiveTest.java @@ -299,7 +299,8 @@ public class ElasticStackClientLiveTest extends BaseComputeServiceContextLiveTes } @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { try { client.destroyServer(server.getUuid()); } catch (Exception e) { @@ -310,8 +311,7 @@ public class ElasticStackClientLiveTest extends BaseComputeServiceContextLiveTes } catch (Exception e) { } - if (cloudStackContext != null) - cloudStackContext.close(); + super.tearDownContext(); } private DriveInfo drive2; diff --git a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeystoneApiLiveTest.java b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeystoneApiLiveTest.java index 9a5c364d61..2702722947 100644 --- a/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeystoneApiLiveTest.java +++ b/apis/openstack-keystone/src/test/java/org/jclouds/openstack/keystone/v2_0/internal/BaseKeystoneApiLiveTest.java @@ -21,12 +21,11 @@ package org.jclouds.openstack.keystone.v2_0.internal; import java.util.Properties; import org.jclouds.apis.BaseContextLiveTest; +import org.jclouds.openstack.keystone.v2_0.KeystoneApi; import org.jclouds.openstack.keystone.v2_0.KeystoneApiMetadata; import org.jclouds.openstack.keystone.v2_0.KeystoneAsyncApi; -import org.jclouds.openstack.keystone.v2_0.KeystoneApi; import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; import org.jclouds.rest.RestContext; -import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -59,13 +58,7 @@ public class BaseKeystoneApiLiveTest extends BaseContextLiveTest> contextType() { return KeystoneApiMetadata.CONTEXT_TOKEN; diff --git a/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/internal/BaseCDMIApiLiveTest.java b/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/internal/BaseCDMIApiLiveTest.java index 1c3e412632..aeca8530f0 100644 --- a/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/internal/BaseCDMIApiLiveTest.java +++ b/labs/cdmi/src/test/java/org/jclouds/snia/cdmi/v1/internal/BaseCDMIApiLiveTest.java @@ -23,7 +23,6 @@ import org.jclouds.rest.RestContext; import org.jclouds.snia.cdmi.v1.CDMIApi; import org.jclouds.snia.cdmi.v1.CDMIApiMetadata; import org.jclouds.snia.cdmi.v1.CDMIAsyncApi; -import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -49,13 +48,7 @@ public class BaseCDMIApiLiveTest extends BaseContextLiveTest> contextType() { return CDMIApiMetadata.CONTEXT_TOKEN; diff --git a/labs/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineApiLiveTest.java b/labs/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineApiLiveTest.java index 1e35d381ab..18240be4a4 100644 --- a/labs/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineApiLiveTest.java +++ b/labs/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/features/MachineApiLiveTest.java @@ -151,13 +151,14 @@ public class MachineApiLiveTest extends BaseJoyentCloudApiLiveTest { api.delete(machine.getId()); } - @Override + @AfterGroups(groups = "live") - protected void tearDown() { + @Override + protected void tearDownContext() { if (machine != null) api.delete(machine.getId()); cloudApiContext.getApi().getKeyApi().delete(fingerprint); - super.tearDown(); + super.tearDownContext(); } @Override diff --git a/labs/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudApiLiveTest.java b/labs/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudApiLiveTest.java index c9a1101f3d..f9aeb9c8dd 100644 --- a/labs/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudApiLiveTest.java +++ b/labs/joyent-cloudapi/src/test/java/org/jclouds/joyent/cloudapi/v6_5/internal/BaseJoyentCloudApiLiveTest.java @@ -19,11 +19,10 @@ package org.jclouds.joyent.cloudapi.v6_5.internal; import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest; -import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudAsyncApi; import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudApi; +import org.jclouds.joyent.cloudapi.v6_5.JoyentCloudAsyncApi; import org.jclouds.rest.RestContext; import org.jclouds.sshj.config.SshjSshClientModule; -import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -50,12 +49,6 @@ public class BaseJoyentCloudApiLiveTest extends BaseComputeServiceContextLiveTes cloudApiContext = view.unwrap(); } - @AfterGroups(groups = "live") - protected void tearDown() { - if (cloudApiContext != null) - cloudApiContext.close(); - } - @Override protected Module getSshModule() { return new SshjSshClientModule(); diff --git a/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/internal/BaseGlanceApiLiveTest.java b/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/internal/BaseGlanceApiLiveTest.java index a91c5c6b0e..f26b5fc57b 100644 --- a/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/internal/BaseGlanceApiLiveTest.java +++ b/labs/openstack-glance/src/test/java/org/jclouds/openstack/glance/v1_0/internal/BaseGlanceApiLiveTest.java @@ -59,12 +59,6 @@ public class BaseGlanceApiLiveTest extends BaseContextLiveTest> contextType() { diff --git a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/internal/BaseQuantumApiLiveTest.java b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/internal/BaseQuantumApiLiveTest.java index f8a1a79823..8bf6b70246 100644 --- a/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/internal/BaseQuantumApiLiveTest.java +++ b/labs/openstack-quantum/src/test/java/org/jclouds/openstack/quantum/v1_0/internal/BaseQuantumApiLiveTest.java @@ -22,11 +22,10 @@ import java.util.Properties; import org.jclouds.apis.BaseContextLiveTest; import org.jclouds.openstack.keystone.v2_0.config.KeystoneProperties; +import org.jclouds.openstack.quantum.v1_0.QuantumApi; import org.jclouds.openstack.quantum.v1_0.QuantumApiMetadata; import org.jclouds.openstack.quantum.v1_0.QuantumAsyncApi; -import org.jclouds.openstack.quantum.v1_0.QuantumApi; import org.jclouds.rest.RestContext; -import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; import org.testng.annotations.Test; @@ -59,12 +58,6 @@ public class BaseQuantumApiLiveTest extends BaseContextLiveTest> contextType() { diff --git a/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java b/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java index ae083d6b94..863016c7b6 100644 --- a/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java +++ b/labs/openstack-swift/src/test/java/org/jclouds/openstack/swift/v1/internal/BaseSwiftApiLiveTest.java @@ -26,7 +26,6 @@ import org.jclouds.openstack.swift.v1.SwiftApi; import org.jclouds.openstack.swift.v1.SwiftApiMetadata; import org.jclouds.openstack.swift.v1.SwiftAsyncApi; import org.jclouds.rest.RestContext; -import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeGroups; import com.google.common.reflect.TypeToken; @@ -57,12 +56,6 @@ public class BaseSwiftApiLiveTest extends BaseContextLiveTest> contextType() { diff --git a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiLiveTest.java b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiLiveTest.java index 5c409a0dcd..30e24d7803 100644 --- a/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiLiveTest.java +++ b/labs/vcloud-director/src/test/java/org/jclouds/vcloud/director/v1_5/features/CatalogApiLiveTest.java @@ -91,7 +91,8 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest { } @AfterClass(alwaysRun = true) - public void tearDown() { + @Override + protected void tearDownContext() { if (media != null) { try { Task remove = context.getApi().getMediaApi().remove(media.getId()); @@ -116,6 +117,7 @@ public class CatalogApiLiveTest extends BaseVCloudDirectorApiLiveTest { } } } + super.tearDownContext(); } @Test(description = "GET /catalog/{id}") diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java index 9ab564dfc2..c9e9e52d92 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java @@ -55,7 +55,6 @@ import org.jclouds.virtualbox.functions.admin.UnregisterMachineIfExistsAndDelete import org.jclouds.virtualbox.util.MachineController; import org.jclouds.virtualbox.util.MachineUtils; import org.jclouds.virtualbox.util.NetworkUtils; -import org.testng.annotations.AfterClass; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -211,12 +210,6 @@ public class BaseVirtualBoxClientLiveTest extends BaseComputeServiceContextLiveT return new SshjSshClientModule(); } - @AfterClass(groups = "live") - protected void tearDown() throws Exception { - if (view != null) - view.close(); - } - @AfterSuite protected void destroyMaster() { if (System.getProperty(DONT_DESTROY_MASTER) == null diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java index 37af77d2a2..f27045af9a 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/compute/VirtualBoxComputeServiceAdapterLiveTest.java @@ -35,7 +35,7 @@ import org.jclouds.domain.LoginCredentials; import org.jclouds.ssh.SshClient; import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest; import org.jclouds.virtualbox.functions.IMachineToSshClient; -import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterGroups; import org.testng.annotations.Test; import org.virtualbox_4_1.IMachine; @@ -88,11 +88,11 @@ public class VirtualBoxComputeServiceAdapterLiveTest extends BaseVirtualBoxClien assertFalse(Iterables.isEmpty(iMageIterable)); } - @AfterClass + @AfterGroups(groups = "live") @Override - protected void tearDown() throws Exception { + protected void tearDownContext() { if (machine != null) adapter.destroyNode(machine.getNodeId() + ""); - super.tearDown(); + super.tearDownContext(); } } diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java index 56c00445e7..4d5034cf42 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest.java @@ -34,7 +34,7 @@ import org.jclouds.virtualbox.domain.NetworkInterfaceCard; import org.jclouds.virtualbox.domain.NetworkSpec; import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; -import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; @@ -116,13 +116,13 @@ public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExistsLiveTest exten } } + @AfterGroups(groups = "live") @Override - @AfterClass(groups = "live") - protected void tearDown() throws Exception { + protected void tearDownContext() { for (String vmName : ImmutableSet.of(instanceName)) { undoVm(vmName); } - super.tearDown(); + super.tearDownContext(); } } diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java index 35e201e278..31b8d0cc88 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java @@ -22,8 +22,8 @@ package org.jclouds.virtualbox.functions; import static com.google.common.base.Preconditions.checkState; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE; -import static org.testng.Assert.assertNotNull; import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; import java.net.URI; import java.util.Map; @@ -49,7 +49,7 @@ import org.jclouds.virtualbox.domain.NetworkSpec; import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; import org.jclouds.virtualbox.predicates.SshResponds; -import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; @@ -164,12 +164,12 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest { } } + @AfterGroups(groups = "live") @Override - @AfterClass(groups = "live") - protected void tearDown() throws Exception { + protected void tearDownContext() { for (String vmName : ImmutableSet.of(instanceName)) { undoVm(vmName); } - super.tearDown(); + super.tearDownContext(); } } diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java index 72c9aff546..df9ee62a76 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest.java @@ -33,7 +33,7 @@ import org.jclouds.virtualbox.domain.NetworkInterfaceCard; import org.jclouds.virtualbox.domain.NetworkSpec; import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; -import org.testng.annotations.AfterMethod; +import org.testng.annotations.AfterGroups; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; import org.virtualbox_4_1.IMachine; @@ -118,11 +118,11 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExistsLiveTest extends B } } + @AfterGroups(groups = "live") @Override - @AfterMethod(groups = "live") - protected void tearDown() throws Exception { + protected void tearDownContext() { undoVm(vmName); - super.tearDown(); + super.tearDownContext(); } } diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java index 1b2295a124..6c7c557778 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/predicates/IMachinePredicatesLiveTest.java @@ -37,7 +37,7 @@ import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; import org.jclouds.virtualbox.functions.CloneAndRegisterMachineFromIMachineIfNotAlreadyExists; import org.jclouds.virtualbox.functions.CreateAndInstallVm; -import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; @@ -119,12 +119,12 @@ public class IMachinePredicatesLiveTest extends BaseVirtualBoxClientLiveTest { } } + @AfterGroups(groups = "live") @Override - @AfterClass(groups = "live") - protected void tearDown() throws Exception { + protected void tearDownContext() { for (String vmName : ImmutableSet.of(instanceName)) { undoVm(vmName); } - super.tearDown(); + super.tearDownContext(); } } diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java index ba20069bae..31460523dd 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/util/MachineControllerLiveTest.java @@ -23,7 +23,6 @@ import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE; import static org.testng.AssertJUnit.assertEquals; import static org.testng.AssertJUnit.assertSame; -import static org.testng.AssertJUnit.assertTrue; import org.jclouds.config.ValueOfConfigurationKeyOrNull; import org.jclouds.virtualbox.BaseVirtualBoxClientLiveTest; @@ -38,7 +37,7 @@ import org.jclouds.virtualbox.domain.StorageController; import org.jclouds.virtualbox.domain.VmSpec; import org.jclouds.virtualbox.functions.CloneAndRegisterMachineFromIMachineIfNotAlreadyExists; import org.jclouds.virtualbox.functions.CreateAndInstallVm; -import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterGroups; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.virtualbox_4_1.CleanupMode; @@ -135,12 +134,12 @@ public class MachineControllerLiveTest extends BaseVirtualBoxClientLiveTest { } } + @AfterGroups(groups = "live") @Override - @AfterClass(groups = "live") - protected void tearDown() throws Exception { + protected void tearDownContext() { for (String vmName : ImmutableSet.of(instanceName)) { undoVm(vmName); } - super.tearDown(); + super.tearDownContext(); } }