From 922003ff5d61ea256217ac0db8df5d17dee21867 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Sat, 4 Jun 2011 02:40:04 +0200 Subject: [PATCH] Now ignoring the tests that cause issue 402 only on Windows, in line with the 1.0.0 release --- .../jclouds/vcloud/VCloudAsyncClientTest.java | 11 ++++-- .../org/jclouds/vcloud/utils/TestUtils.java | 34 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 apis/vcloud/src/test/java/org/jclouds/vcloud/utils/TestUtils.java diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java index 60de566c64..2f45d64822 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/VCloudAsyncClientTest.java @@ -69,6 +69,7 @@ import org.jclouds.vcloud.filters.SetVCloudTokenCookie; import org.jclouds.vcloud.options.CaptureVAppOptions; import org.jclouds.vcloud.options.CloneVAppOptions; import org.jclouds.vcloud.options.InstantiateVAppTemplateOptions; +import org.jclouds.vcloud.utils.TestUtils; import org.jclouds.vcloud.xml.CatalogHandler; import org.jclouds.vcloud.xml.CatalogItemHandler; import org.jclouds.vcloud.xml.OrgHandler; @@ -81,6 +82,7 @@ import org.jclouds.vcloud.xml.VAppTemplateHandler; import org.jclouds.vcloud.xml.VDCHandler; import org.jclouds.vcloud.xml.VmHandler; import org.jclouds.vcloud.xml.ovf.OvfEnvelopeHandler; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; import com.google.common.base.Supplier; @@ -118,8 +120,7 @@ public class VCloudAsyncClientTest extends RestClientTest { checkFilters(request); } - // see http://code.google.com/p/jclouds/issues/detail?id=402 - @Test(enabled = false) + @Test(dataProvider = "ignoreOnWindows", description = "see http://code.google.com/p/jclouds/issues/detail?id=402") public void testUpdateGuestConfiguration() throws SecurityException, NoSuchMethodException, IOException { Method method = VCloudAsyncClient.class.getMethod("updateGuestCustomizationOfVm", URI.class, GuestCustomizationSection.class); @@ -1041,4 +1042,10 @@ public class VCloudAsyncClientTest extends RestClientTest { } + @DataProvider + public Object[][] ignoreOnWindows() { + return (TestUtils.isWindowsOs() ? TestUtils.NO_INVOCATIONS + : TestUtils.SINGLE_NO_ARG_INVOCATION); + } + } diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/utils/TestUtils.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/utils/TestUtils.java new file mode 100644 index 0000000000..1831852f10 --- /dev/null +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/utils/TestUtils.java @@ -0,0 +1,34 @@ +/** + * + * Copyright (C) 2011 Cloud Conscious, LLC. + * + * ==================================================================== + * 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.vcloud.utils; + + +/** + * Utility class for test + * + * @author Andrew Phillips + */ +public class TestUtils { + public static final Object[][] NO_INVOCATIONS = new Object[0][0]; + public static final Object[][] SINGLE_NO_ARG_INVOCATION = new Object[][] { new Object[0] }; + + public static boolean isWindowsOs() { + return System.getProperty("os.name", "").toLowerCase().contains("windows"); + } +}