cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sw...@apache.org
Subject [2/3] git commit: updated refs/heads/master to a3371d2
Date Mon, 18 Apr 2016 18:42:37 GMT
Remove test cases duplicated code.

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8355b586
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8355b586
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8355b586

Branch: refs/heads/master
Commit: 8355b586a0f420ca183e6f4657305284e68487e3
Parents: 935113f
Author: weingartner <rafaelweingartner@gmail.com>
Authored: Sun Apr 10 18:06:12 2016 -0300
Committer: weingartner <rafaelweingartner@gmail.com>
Committed: Tue Apr 12 16:05:18 2016 -0300

----------------------------------------------------------------------
 .../resource/CitrixResourceBaseTest.java        | 26 +++++++++----
 .../xenserver/resource/XcpOssResourceTest.java  | 29 ++++----------
 .../resource/XcpServerResourceTest.java         | 29 ++++----------
 .../resource/XenServer56FP1ResourceTest.java    | 32 ++++++----------
 .../resource/XenServer56ResourceTest.java       | 30 +++++----------
 .../resource/XenServer56SP2ResourceTest.java    | 31 +++++----------
 .../resource/XenServer600ResourceTest.java      | 32 ++++++----------
 .../resource/XenServer625ResourceTest.java      | 40 ++++++++------------
 .../resource/XenServer650ResourceTest.java      | 30 +++++----------
 9 files changed, 100 insertions(+), 179 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8355b586/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/CitrixResourceBaseTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/CitrixResourceBaseTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/CitrixResourceBaseTest.java
index 81853d4..67fce92 100644
--- a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/CitrixResourceBaseTest.java
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/CitrixResourceBaseTest.java
@@ -19,14 +19,22 @@ import java.io.File;
 import java.util.List;
 
 import org.junit.Assert;
+import org.junit.Test;
 import org.mockito.Mockito;
 import org.powermock.api.mockito.PowerMockito;
 
 import com.cloud.utils.script.Script;
 
-public abstract class CitrixResourceBaseTest {
+public class CitrixResourceBaseTest {
 
-    public void testGetPathFilesExeption(CitrixResourceBase citrixResourceBase) {
+    protected CitrixResourceBase citrixResourceBase = new CitrixResourceBase() {
+        @Override
+        protected String getPatchFilePath() {
+            return null;
+        }
+    };
+
+    public void testGetPathFilesExeption() {
         String patch = citrixResourceBase.getPatchFilePath();
 
         PowerMockito.mockStatic(Script.class);
@@ -36,7 +44,7 @@ public abstract class CitrixResourceBaseTest {
 
     }
 
-    public void testGetPathFilesListReturned(CitrixResourceBase citrixResourceBase) {
+    public void testGetPathFilesListReturned() {
         String patch = citrixResourceBase.getPatchFilePath();
 
         PowerMockito.mockStatic(Script.class);
@@ -50,7 +58,8 @@ public abstract class CitrixResourceBaseTest {
         Assert.assertEquals(receivedPath, pathExpected);
     }
 
-    public void testGetGuestOsTypeNull(CitrixResourceBase citrixResourceBase) {
+    @Test
+    public void testGetGuestOsTypeNull() {
         String platformEmulator = null;
 
         String expected = "Other install media";
@@ -58,7 +67,8 @@ public abstract class CitrixResourceBaseTest {
         Assert.assertEquals(expected, guestOsType);
     }
 
-    public void testGetGuestOsTypeEmpty(CitrixResourceBase citrixResourceBase) {
+    @Test
+    public void testGetGuestOsTypeEmpty() {
         String platformEmulator = "";
 
         String expected = "Other install media";
@@ -66,7 +76,8 @@ public abstract class CitrixResourceBaseTest {
         Assert.assertEquals(expected, guestOsType);
     }
 
-    public void testGetGuestOsTypeBlank(CitrixResourceBase citrixResourceBase) {
+    @Test
+    public void testGetGuestOsTypeBlank() {
         String platformEmulator = "    ";
 
         String expected = "Other install media";
@@ -74,7 +85,8 @@ public abstract class CitrixResourceBaseTest {
         Assert.assertEquals(expected, guestOsType);
     }
 
-    public void testGetGuestOsTypeOther(CitrixResourceBase citrixResourceBase) {
+    @Test
+    public void testGetGuestOsTypeOther() {
         String platformEmulator = "My Own Linux Distribution Y.M (64-bit)";
 
         String guestOsType = citrixResourceBase.getGuestOsType(platformEmulator);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8355b586/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpOssResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpOssResourceTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpOssResourceTest.java
index cd4db0f..9266bf9 100644
--- a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpOssResourceTest.java
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpOssResourceTest.java
@@ -16,6 +16,7 @@
 package com.cloud.hypervisor.xenserver.resource;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -26,11 +27,14 @@ import com.cloud.utils.script.Script;
 @RunWith(PowerMockRunner.class)
 public class XcpOssResourceTest extends CitrixResourceBaseTest{
 
-    private XcpOssResource xcpOssResource = new XcpOssResource();
+    @Before
+    public void beforeTest() {
+        super.citrixResourceBase = new XcpOssResource();
+    }
 
     @Test
     public void testPatchFilePath() {
-        String patchFilePath = xcpOssResource.getPatchFilePath();
+        String patchFilePath = citrixResourceBase.getPatchFilePath();
         String patch = "scripts/vm/hypervisor/xenserver/xcposs/patch";
 
         Assert.assertEquals(patch, patchFilePath);
@@ -39,29 +43,12 @@ public class XcpOssResourceTest extends CitrixResourceBaseTest{
     @Test(expected = CloudRuntimeException.class)
     @PrepareForTest(Script.class )
     public void testGetFiles(){
-        testGetPathFilesExeption(xcpOssResource);
+        testGetPathFilesExeption();
     }
 
     @Test
     @PrepareForTest(Script.class )
     public void testGetFilesListReturned(){
-        testGetPathFilesListReturned(xcpOssResource);
-    }
-
-    @Test
-    public void testGetOsTypeNull() {
-        testGetGuestOsTypeNull(xcpOssResource);
-    }
-    @Test
-    public void testGetOsTypeEmpty() {
-        testGetGuestOsTypeEmpty(xcpOssResource);
-    }
-    @Test
-    public void testGetOsTypeBlank() {
-        testGetGuestOsTypeBlank(xcpOssResource);
-    }
-    @Test
-    public void testGetOsTypeOther() {
-        testGetGuestOsTypeOther(xcpOssResource);
+        testGetPathFilesListReturned();
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8355b586/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpServerResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpServerResourceTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpServerResourceTest.java
index 95ba8f6..5b80a1d 100644
--- a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpServerResourceTest.java
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XcpServerResourceTest.java
@@ -16,6 +16,7 @@
 package com.cloud.hypervisor.xenserver.resource;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -27,11 +28,14 @@ import com.cloud.utils.script.Script;
 @RunWith(PowerMockRunner.class)
 public class XcpServerResourceTest extends CitrixResourceBaseTest{
 
-    private XcpServerResource xcpServerResource = new XcpServerResource();
+    @Before
+    public void beforeTest() {
+        super.citrixResourceBase = new XcpServerResource();
+    }
 
     @Test
     public void testPatchFilePath() {
-        String patchFilePath = xcpServerResource.getPatchFilePath();
+        String patchFilePath = citrixResourceBase.getPatchFilePath();
         String patch = "scripts/vm/hypervisor/xenserver/xcpserver/patch";
 
         Assert.assertEquals(patch, patchFilePath);
@@ -40,29 +44,12 @@ public class XcpServerResourceTest extends CitrixResourceBaseTest{
     @Test(expected = CloudRuntimeException.class)
     @PrepareForTest(Script.class )
     public void testGetFilesExeption(){
-        testGetPathFilesExeption(xcpServerResource);
+        testGetPathFilesExeption();
     }
 
     @Test
     @PrepareForTest(Script.class )
     public void testGetFilesListReturned(){
-        testGetPathFilesListReturned(xcpServerResource);
-    }
-
-    @Test
-    public void testGetOsTypeNull() {
-        testGetGuestOsTypeNull(xcpServerResource);
-    }
-    @Test
-    public void testGetOsTypeEmpty() {
-        testGetGuestOsTypeEmpty(xcpServerResource);
-    }
-    @Test
-    public void testGetOsTypeBlank() {
-        testGetGuestOsTypeBlank(xcpServerResource);
-    }
-    @Test
-    public void testGetOsTypeOther() {
-        testGetGuestOsTypeOther(xcpServerResource);
+        testGetPathFilesListReturned();
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8355b586/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56FP1ResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56FP1ResourceTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56FP1ResourceTest.java
index bba3b6a..d2edbd4 100644
--- a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56FP1ResourceTest.java
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56FP1ResourceTest.java
@@ -16,6 +16,7 @@
 package com.cloud.hypervisor.xenserver.resource;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -23,43 +24,32 @@ import org.powermock.modules.junit4.PowerMockRunner;
 
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
+
 @RunWith(PowerMockRunner.class)
 public class XenServer56FP1ResourceTest extends CitrixResourceBaseTest{
 
-    private XenServer56FP1Resource xenServer56FP1Resource = new XenServer56FP1Resource();
+    @Before
+    public void beforeTest() {
+        super.citrixResourceBase = new XenServer56FP1Resource();
+    }
 
     @Test
     public void testPatchFilePath() {
-        String patchFilePath = xenServer56FP1Resource.getPatchFilePath();
+        String patchFilePath = citrixResourceBase.getPatchFilePath();
         String patch = "scripts/vm/hypervisor/xenserver/xenserver56fp1/patch";
 
         Assert.assertEquals(patch, patchFilePath);
     }
+
     @Test(expected = CloudRuntimeException.class)
     @PrepareForTest(Script.class )
     public void testGetFiles(){
-        testGetPathFilesExeption(xenServer56FP1Resource);
+        testGetPathFilesExeption();
     }
+
     @Test
     @PrepareForTest(Script.class )
     public void testGetFilesListReturned(){
-        testGetPathFilesListReturned(xenServer56FP1Resource);
-    }
-
-    @Test
-    public void testGetOsTypeNull() {
-        testGetGuestOsTypeNull(xenServer56FP1Resource);
-    }
-    @Test
-    public void testGetOsTypeEmpty() {
-        testGetGuestOsTypeEmpty(xenServer56FP1Resource);
-    }
-    @Test
-    public void testGetOsTypeBlank() {
-        testGetGuestOsTypeBlank(xenServer56FP1Resource);
-    }
-    @Test
-    public void testGetOsTypeOther() {
-        testGetGuestOsTypeOther(xenServer56FP1Resource);
+        testGetPathFilesListReturned();
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8355b586/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56ResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56ResourceTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56ResourceTest.java
index 4a6ff0b..dccdb28 100644
--- a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56ResourceTest.java
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56ResourceTest.java
@@ -16,6 +16,7 @@
 package com.cloud.hypervisor.xenserver.resource;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -26,11 +27,14 @@ import com.cloud.utils.script.Script;
 @RunWith(PowerMockRunner.class)
 public class XenServer56ResourceTest extends CitrixResourceBaseTest {
 
-    private XenServer56Resource xenServer56Resource = new XenServer56Resource();
+    @Before
+    public void beforeTest() {
+        super.citrixResourceBase = new XenServer56Resource();
+    }
 
     @Test
     public void testPatchFilePath() {
-        String patchFilePath = xenServer56Resource.getPatchFilePath();
+        String patchFilePath = citrixResourceBase.getPatchFilePath();
         String patch = "scripts/vm/hypervisor/xenserver/xenserver56/patch";
 
         Assert.assertEquals(patch, patchFilePath);
@@ -39,28 +43,12 @@ public class XenServer56ResourceTest extends CitrixResourceBaseTest {
     @Test(expected = CloudRuntimeException.class)
     @PrepareForTest(Script.class )
     public void testGetFiles(){
-        testGetPathFilesExeption(xenServer56Resource);
+        testGetPathFilesExeption();
     }
+
     @Test
     @PrepareForTest(Script.class )
     public void testGetFilesListReturned(){
-        testGetPathFilesListReturned(xenServer56Resource);
-    }
-
-    @Test
-    public void testGetOsTypeNull() {
-        testGetGuestOsTypeNull(xenServer56Resource);
-    }
-    @Test
-    public void testGetOsTypeEmpty() {
-        testGetGuestOsTypeEmpty(xenServer56Resource);
-    }
-    @Test
-    public void testGetOsTypeBlank() {
-        testGetGuestOsTypeBlank(xenServer56Resource);
-    }
-    @Test
-    public void testGetOsTypeOther() {
-        testGetGuestOsTypeOther(xenServer56Resource);
+        testGetPathFilesListReturned();
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8355b586/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56SP2ResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56SP2ResourceTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56SP2ResourceTest.java
index defbe9b..4cc9470 100644
--- a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56SP2ResourceTest.java
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer56SP2ResourceTest.java
@@ -16,6 +16,7 @@
 package com.cloud.hypervisor.xenserver.resource;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -26,40 +27,28 @@ import com.cloud.utils.script.Script;
 @RunWith(PowerMockRunner.class)
 public class XenServer56SP2ResourceTest extends CitrixResourceBaseTest{
 
-    private XenServer56SP2Resource xenServer56SP2Resource = new XenServer56SP2Resource();
+    @Before
+    public void beforeTest() {
+        super.citrixResourceBase = new XenServer56SP2Resource();
+    }
 
     @Test
     public void testPatchFilePath() {
-        String patchFilePath = xenServer56SP2Resource.getPatchFilePath();
+        String patchFilePath = citrixResourceBase.getPatchFilePath();
         String patch = "scripts/vm/hypervisor/xenserver/xenserver56fp1/patch";
 
         Assert.assertEquals(patch, patchFilePath);
     }
+
     @Test(expected = CloudRuntimeException.class)
     @PrepareForTest(Script.class )
     public void testGetFiles(){
-        testGetPathFilesExeption(xenServer56SP2Resource);
+        testGetPathFilesExeption();
     }
+
     @Test
     @PrepareForTest(Script.class )
     public void testGetFilesListReturned(){
-        testGetPathFilesListReturned(xenServer56SP2Resource);
-    }
-
-    @Test
-    public void testGetOsTypeNull() {
-        testGetGuestOsTypeNull(xenServer56SP2Resource);
-    }
-    @Test
-    public void testGetOsTypeEmpty() {
-        testGetGuestOsTypeEmpty(xenServer56SP2Resource);
-    }
-    @Test
-    public void testGetOsTypeBlank() {
-        testGetGuestOsTypeBlank(xenServer56SP2Resource);
-    }
-    @Test
-    public void testGetOsTypeOther() {
-        testGetGuestOsTypeOther(xenServer56SP2Resource);
+        testGetPathFilesListReturned();
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8355b586/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer600ResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer600ResourceTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer600ResourceTest.java
index 899f0a7..d5eba2af 100644
--- a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer600ResourceTest.java
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer600ResourceTest.java
@@ -16,6 +16,7 @@
 package com.cloud.hypervisor.xenserver.resource;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -26,40 +27,29 @@ import com.cloud.utils.script.Script;
 @RunWith(PowerMockRunner.class)
 public class XenServer600ResourceTest extends CitrixResourceBaseTest{
 
-    private XenServer600Resource xenServer600Resource = new XenServer600Resource();
+    @Before
+    public void beforeTest() {
+        super.citrixResourceBase = new XenServer600Resource();
+    }
+
 
     @Test
     public void testPatchFilePath() {
-        String patchFilePath = xenServer600Resource.getPatchFilePath();
+        String patchFilePath = citrixResourceBase.getPatchFilePath();
         String patch = "scripts/vm/hypervisor/xenserver/xenserver60/patch";
 
         Assert.assertEquals(patch, patchFilePath);
     }
+
     @Test(expected = CloudRuntimeException.class)
     @PrepareForTest(Script.class )
     public void testGetFiles(){
-        testGetPathFilesExeption(xenServer600Resource);
+        testGetPathFilesExeption();
     }
+
     @Test
     @PrepareForTest(Script.class )
     public void testGetFilesListReturned(){
-        testGetPathFilesListReturned(xenServer600Resource);
-    }
-
-    @Test
-    public void testGetOsTypeNull() {
-        testGetGuestOsTypeNull(xenServer600Resource);
-    }
-    @Test
-    public void testGetOsTypeEmpty() {
-        testGetGuestOsTypeEmpty(xenServer600Resource);
-    }
-    @Test
-    public void testGetOsTypeBlank() {
-        testGetGuestOsTypeBlank(xenServer600Resource);
-    }
-    @Test
-    public void testGetOsTypeOther() {
-        testGetGuestOsTypeOther(xenServer600Resource);
+        testGetPathFilesListReturned();
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8355b586/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer625ResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer625ResourceTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer625ResourceTest.java
index 4c6a6ec..9998c2f 100644
--- a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer625ResourceTest.java
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer625ResourceTest.java
@@ -16,6 +16,7 @@
 package com.cloud.hypervisor.xenserver.resource;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -23,43 +24,32 @@ import org.powermock.modules.junit4.PowerMockRunner;
 
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
+
 @RunWith(PowerMockRunner.class)
-public class XenServer625ResourceTest extends CitrixResourceBaseTest{
+public class XenServer625ResourceTest extends CitrixResourceBaseTest {
 
-    private Xenserver625Resource xenServer625Resource = new Xenserver625Resource();
+    @Before
+    public void beforeTest() {
+        super.citrixResourceBase = new Xenserver625Resource();
+    }
 
     @Test
     public void testPatchFilePath() {
-        String patchFilePath = xenServer625Resource.getPatchFilePath();
+        String patchFilePath = citrixResourceBase.getPatchFilePath();
         String patch = "scripts/vm/hypervisor/xenserver/xenserver62/patch";
 
         Assert.assertEquals(patch, patchFilePath);
     }
+
     @Test(expected = CloudRuntimeException.class)
-    @PrepareForTest(Script.class )
-    public void testGetFiles(){
-        testGetPathFilesExeption(xenServer625Resource);
-    }
-    @Test
-    @PrepareForTest(Script.class )
-    public void testGetFilesListReturned(){
-        testGetPathFilesListReturned(xenServer625Resource);
+    @PrepareForTest(Script.class)
+    public void testGetFiles() {
+        testGetPathFilesExeption();
     }
 
     @Test
-    public void testGetOsTypeNull() {
-        testGetGuestOsTypeNull(xenServer625Resource);
-    }
-    @Test
-    public void testGetOsTypeEmpty() {
-        testGetGuestOsTypeEmpty(xenServer625Resource);
-    }
-    @Test
-    public void testGetOsTypeBlank() {
-        testGetGuestOsTypeBlank(xenServer625Resource);
-    }
-    @Test
-    public void testGetOsTypeOther() {
-        testGetGuestOsTypeOther(xenServer625Resource);
+    @PrepareForTest(Script.class)
+    public void testGetFilesListReturned() {
+        testGetPathFilesListReturned();
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8355b586/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer650ResourceTest.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer650ResourceTest.java
b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer650ResourceTest.java
index a062c0c..5195025 100644
--- a/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer650ResourceTest.java
+++ b/plugins/hypervisors/xenserver/test/com/cloud/hypervisor/xenserver/resource/XenServer650ResourceTest.java
@@ -16,6 +16,7 @@
 package com.cloud.hypervisor.xenserver.resource;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.powermock.core.classloader.annotations.PrepareForTest;
@@ -26,11 +27,14 @@ import com.cloud.utils.script.Script;
 @RunWith(PowerMockRunner.class)
 public class XenServer650ResourceTest extends CitrixResourceBaseTest{
 
-    private XenServer650Resource xenServer650Resource = new XenServer650Resource();
+    @Before
+    public void beforeTest() {
+        super.citrixResourceBase = new XenServer650Resource();
+    }
 
     @Test
     public void testPatchFilePath() {
-        String patchFilePath = xenServer650Resource.getPatchFilePath();
+        String patchFilePath = citrixResourceBase.getPatchFilePath();
         String patch = "scripts/vm/hypervisor/xenserver/xenserver65/patch";
 
         Assert.assertEquals(patch, patchFilePath);
@@ -39,28 +43,12 @@ public class XenServer650ResourceTest extends CitrixResourceBaseTest{
     @Test(expected = CloudRuntimeException.class)
     @PrepareForTest(Script.class )
     public void testGetFiles(){
-        testGetPathFilesExeption(xenServer650Resource);
+        testGetPathFilesExeption();
     }
+
     @Test
     @PrepareForTest(Script.class )
     public void testGetFilesListReturned(){
-        testGetPathFilesListReturned(xenServer650Resource);
-    }
-
-    @Test
-    public void testGetOsTypeNull() {
-        testGetGuestOsTypeNull(xenServer650Resource);
-    }
-    @Test
-    public void testGetOsTypeEmpty() {
-        testGetGuestOsTypeEmpty(xenServer650Resource);
-    }
-    @Test
-    public void testGetOsTypeBlank() {
-        testGetGuestOsTypeBlank(xenServer650Resource);
-    }
-    @Test
-    public void testGetOsTypeOther() {
-        testGetGuestOsTypeOther(xenServer650Resource);
+        testGetPathFilesListReturned();
     }
 }


Mime
View raw message