fixed test cases

This commit is contained in:
Adrian Cole 2010-11-07 20:20:35 +01:00
parent 15e30cfbaa
commit 5f5b01ad35
8 changed files with 35 additions and 87 deletions

View File

@ -116,6 +116,8 @@ public class ParseAWSErrorFromXmlContent implements HttpErrorHandler {
exception = new KeyNotFoundException(container, key, message);
}
break;
case 409:
exception = new IllegalStateException(message, exception);
}
} finally {
releasePayload(response);

View File

@ -1,62 +0,0 @@
/**
*
* Copyright (C) 2010 Cloud Conscious, LLC. <info@cloudconscious.com>
*
* ====================================================================
* Licensed 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.aws.ec2.compute;
import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
import static org.testng.Assert.assertEquals;
import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Template;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
*
* @author Adrian Cole
*/
@Test(groups = "live", sequential = true, testName = "ec2.EucalyptusComputeServiceLiveTest")
public class EucalyptusComputeServiceLiveTest extends EC2ComputeServiceLiveTest {
public EucalyptusComputeServiceLiveTest() {
provider = "eucalyptus";
}
@BeforeClass
@Override
public void setServiceDefaults() {
// security groups must be <30 characters
tag = "euc";
}
@Override
@Test(enabled = false)
public void testExtendedOptionsAndLogin() throws Exception {
// euc does not support monitoring
}
@Override
protected void assertDefaultWorks() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.CENTOS);
assertEquals(getCores(defaultTemplate.getHardware()), 2.0d);
}
}

View File

@ -69,9 +69,8 @@ public class SQSClientLiveTest {
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
credential = checkNotNull(System.getProperty("test." + provider + ".credential"), "test." + provider
+ ".credential");
endpoint = checkNotNull(System.getProperty("test." + provider + ".endpoint"), "test." + provider + ".endpoint");
apiversion = checkNotNull(System.getProperty("test." + provider + ".apiversion"), "test." + provider
+ ".apiversion");
endpoint = System.getProperty("test." + provider + ".endpoint");
apiversion = System.getProperty("test." + provider + ".apiversion");
}
protected Properties setupProperties() {
@ -79,8 +78,11 @@ public class SQSClientLiveTest {
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");
overrides.setProperty(Constants.PROPERTY_RELAX_HOSTNAME, "true");
overrides.setProperty(provider + ".identity", identity);
if (credential != null)
overrides.setProperty(provider + ".credential", credential);
if (endpoint != null)
overrides.setProperty(provider + ".endpoint", endpoint);
if (apiversion != null)
overrides.setProperty(provider + ".apiversion", apiversion);
return overrides;
}

View File

@ -49,10 +49,10 @@ public class BlueLockVCloudDirectorComputeServiceLiveTest extends VCloudComputeS
@Test
public void testTemplateBuilder() {
Template defaultTemplate = client.templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), false);
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assert OperatingSystemPredicates.supportsApt().apply(defaultTemplate.getImage().getOperatingSystem());
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getDescription(), "Ubuntu Linux (32-bit)");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getDescription(), "Ubuntu Linux (64-bit)");
assert defaultTemplate.getLocation().getId() != null : defaultTemplate.getLocation();
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
System.out.println(defaultTemplate.getHardware());

View File

@ -78,10 +78,11 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
Catalog response = connection.getCatalog(cat.getHref());
for (ReferenceType resource : response.values()) {
if (resource.getType().equals(VCloudMediaType.CATALOGITEM_XML)) {
try {
CatalogItem item = connection.getCatalogItem(resource.getHref());
if (item.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML)) {
try {
assertNotNull(connection.getOvfEnvelopeForVAppTemplate(item.getEntity().getHref()));
}
} catch (AuthorizationException e) {
}
@ -89,7 +90,6 @@ public class VCloudClientLiveTest extends CommonVCloudClientLiveTest<VCloudClien
}
}
}
}
@Test
public void testGetVApp() throws Exception {

View File

@ -57,8 +57,7 @@ public class ParseTerremarkVCloudErrorFromHttpResponse implements HttpErrorHandl
if (response.getMessage() != null
&& ((response.getMessage().indexOf("because there is a pending task running") != -1)
|| (response.getMessage().indexOf("because it is already powered off") != -1)
|| (response.getMessage().indexOf("already exists") != -1) || (response.getMessage()
.indexOf("same name exists") != -1)))
|| (response.getMessage().indexOf("exists") != -1)))
exception = new IllegalStateException(response.getMessage(), exception);
else
switch (response.getStatusCode()) {

View File

@ -84,7 +84,7 @@ public class TerremarkECloudComputeServiceLiveTest extends BaseComputeServiceLiv
@Override
protected void checkOsMatchesTemplate(NodeMetadata node) {
if (node.getOperatingSystem() != null)
assertEquals(node.getOperatingSystem().getFamily(), OsFamily.UNRECOGNIZED);
assertEquals(node.getOperatingSystem().getFamily(), null);
}
@Override

View File

@ -85,6 +85,13 @@ public class ParseTerremarkVCloudErrorFromHttpResponseTest extends BaseHttpError
IllegalStateException.class);
}
@Test
public void testKeyAlreadyExistsSetsIllegalStateException() {
assertCodeMakes("POST", URI.create("https://services.vcloudexpress.terremark.com/api/v0.8a-ext1.6/extensions/org/48/keys"), 400,
"Security key with name livetest exists.", "Security key with name livetest exists.",
IllegalStateException.class);
}
@Override
protected Class<? extends HttpErrorHandler> getHandlerClass() {
return ParseTerremarkVCloudErrorFromHttpResponse.class;