mirror of https://github.com/apache/cloudstack.git
[CLOUDSTACK-10197] Update DisplayText of XenServer tools ISO entry in the database when it already exists (#2470)
* Update the displayText of XenServer ISO when it already exist in the DB Besides updating the ISO display text, I also created unit test cases for 'createXenServerToolsIsoEntryInDatabase' and 'getActualIsoTemplate' methods. * Formatting and cleanups for checkstyle of changed classes
This commit is contained in:
parent
f2efbcecec
commit
c3e5c09ac6
|
|
@ -16,6 +16,24 @@
|
|||
// under the License.
|
||||
package com.cloud.hypervisor.xenserver.discoverer;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.URI;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.persistence.EntityExistsException;
|
||||
|
||||
import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.Listener;
|
||||
import com.cloud.agent.api.AgentControlAnswer;
|
||||
|
|
@ -81,46 +99,28 @@ import com.xensource.xenapi.Session;
|
|||
import com.xensource.xenapi.Types.SessionAuthenticationFailed;
|
||||
import com.xensource.xenapi.Types.UuidInvalid;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
import javax.persistence.EntityExistsException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.URI;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter {
|
||||
private static final Logger s_logger = Logger.getLogger(XcpServerDiscoverer.class);
|
||||
protected String _publicNic;
|
||||
protected String _privateNic;
|
||||
protected String _storageNic1;
|
||||
protected String _storageNic2;
|
||||
protected int _wait;
|
||||
protected XenServerConnectionPool _connPool;
|
||||
protected boolean _checkHvm;
|
||||
protected String _guestNic;
|
||||
protected boolean _setupMultipath;
|
||||
protected String _instance;
|
||||
private int _wait;
|
||||
private XenServerConnectionPool _connPool;
|
||||
private boolean _checkHvm;
|
||||
private boolean _setupMultipath;
|
||||
private String _instance;
|
||||
|
||||
@Inject
|
||||
protected AlertManager _alertMgr;
|
||||
private AlertManager _alertMgr;
|
||||
@Inject
|
||||
protected AgentManager _agentMgr;
|
||||
private AgentManager _agentMgr;
|
||||
@Inject
|
||||
private VMTemplateDao _tmpltDao;
|
||||
@Inject
|
||||
private HostPodDao _podDao;
|
||||
|
||||
private String xenServerIsoName = "xs-tools.iso";
|
||||
private String xenServerIsoDisplayText = "XenServer Tools Installer ISO (xen-pv-drv-iso)";
|
||||
|
||||
protected XcpServerDiscoverer() {
|
||||
}
|
||||
|
||||
|
|
@ -198,8 +198,9 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
|
||||
ClusterVO cluster = _clusterDao.findById(clusterId);
|
||||
if (cluster == null || cluster.getHypervisorType() != HypervisorType.XenServer) {
|
||||
if (s_logger.isInfoEnabled())
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("invalid cluster id or cluster is not for XenServer hypervisors");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
@ -237,7 +238,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
if (clusterHosts != null && clusterHosts.size() > 0) {
|
||||
if (!clu.getGuid().equals(poolUuid)) {
|
||||
String msg = "Please join the host " + hostIp + " to XS pool "
|
||||
+ clu.getGuid() + " through XC/XS before adding it through CS UI";
|
||||
+ clu.getGuid() + " through XC/XS before adding it through CS UI";
|
||||
s_logger.warn(msg);
|
||||
throw new DiscoveryException(msg);
|
||||
}
|
||||
|
|
@ -395,18 +396,18 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
protected CitrixResourceBase createServerResource(String prodBrand, String prodVersion, String prodVersionTextShort, String hotfix) {
|
||||
// Xen Cloud Platform group of hypervisors
|
||||
if (prodBrand.equals("XCP") && (prodVersion.equals("1.0.0") || prodVersion.equals("1.1.0")
|
||||
|| prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4") || prodVersion.startsWith("1.6"))) {
|
||||
|| prodVersion.equals("5.6.100") || prodVersion.startsWith("1.4") || prodVersion.startsWith("1.6"))) {
|
||||
return new XcpServerResource();
|
||||
} // Citrix Xenserver group of hypervisors
|
||||
else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
|
||||
else if (prodBrand.equals("XenServer") && prodVersion.equals("5.6.0")) {
|
||||
return new XenServer56Resource();
|
||||
else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0"))
|
||||
} else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.0")) {
|
||||
return new XenServer600Resource();
|
||||
else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2"))
|
||||
} else if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2")) {
|
||||
return new XenServer600Resource();
|
||||
else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0"))
|
||||
} else if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0")) {
|
||||
return new XenServer610Resource();
|
||||
else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0")) {
|
||||
} else if (prodBrand.equals("XenServer") && prodVersion.equals("6.2.0")) {
|
||||
if (hotfix != null && hotfix.equals(XenserverConfigs.XSHotFix62ESP1004)) {
|
||||
return new Xenserver625Resource();
|
||||
} else if (hotfix != null && hotfix.equals(XenserverConfigs.XSHotFix62ESP1)) {
|
||||
|
|
@ -464,37 +465,27 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
super.configure(name, params);
|
||||
serverConfig();
|
||||
|
||||
_publicNic = _params.get(Config.XenServerPublicNetwork.key());
|
||||
_privateNic = _params.get(Config.XenServerPrivateNetwork.key());
|
||||
|
||||
_storageNic1 = _params.get(Config.XenServerStorageNetwork1.key());
|
||||
_storageNic2 = _params.get(Config.XenServerStorageNetwork2.key());
|
||||
|
||||
_guestNic = _params.get(Config.XenServerGuestNetwork.key());
|
||||
|
||||
String value = _params.get(Config.XapiWait.toString());
|
||||
_wait = NumbersUtil.parseInt(value, Integer.parseInt(Config.XapiWait.getDefaultValue()));
|
||||
|
||||
_instance = _params.get(Config.InstanceName.key());
|
||||
|
||||
value = _params.get(Config.XenServerSetupMultipath.key());
|
||||
Boolean.parseBoolean(value);
|
||||
|
||||
value = _params.get("xenserver.check.hvm");
|
||||
_checkHvm = Boolean.parseBoolean(value);
|
||||
_connPool = XenServerConnectionPool.getInstance();
|
||||
|
||||
_agentMgr.registerForHostEvents(this, true, false, true);
|
||||
|
||||
createXsToolsISO();
|
||||
createXenServerToolsIsoEntryInDatabase();
|
||||
_resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matchHypervisor(String hypervisor) {
|
||||
if (hypervisor == null)
|
||||
if (hypervisor == null) {
|
||||
return true;
|
||||
}
|
||||
return Hypervisor.HypervisorType.XenServer.toString().equalsIgnoreCase(hypervisor);
|
||||
}
|
||||
|
||||
|
|
@ -528,20 +519,23 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
|||
return false;
|
||||
}
|
||||
|
||||
private void createXsToolsISO() {
|
||||
String isoName = "xs-tools.iso";
|
||||
VMTemplateVO tmplt = _tmpltDao.findByTemplateName(isoName);
|
||||
Long id;
|
||||
/**
|
||||
* Create the XenServer tools ISO entry in the database.
|
||||
* If there is already an entry with 'isoName' equals to {@value #xenServerIsoName} , we update its 'displayText' to {@value #xenServerIsoDisplayText}.
|
||||
* Otherwise, we create a new entry.
|
||||
*/
|
||||
protected void createXenServerToolsIsoEntryInDatabase() {
|
||||
VMTemplateVO tmplt = _tmpltDao.findByTemplateName(xenServerIsoName);
|
||||
if (tmplt == null) {
|
||||
id = _tmpltDao.getNextInSequence(Long.class, "id");
|
||||
VMTemplateVO template =
|
||||
VMTemplateVO.createPreHostIso(id, isoName, isoName, ImageFormat.ISO, true, true, TemplateType.PERHOST, null, null, true, 64, Account.ACCOUNT_ID_SYSTEM,
|
||||
null, "XenServer Tools Installer ISO (xen-pv-drv-iso)", false, 1, false, HypervisorType.XenServer);
|
||||
long id = _tmpltDao.getNextInSequence(Long.class, "id");
|
||||
VMTemplateVO template = VMTemplateVO.createPreHostIso(id, xenServerIsoName, xenServerIsoName, ImageFormat.ISO, true, true, TemplateType.PERHOST, null, null, true, 64,
|
||||
Account.ACCOUNT_ID_SYSTEM, null, xenServerIsoDisplayText, false, 1, false, HypervisorType.XenServer);
|
||||
_tmpltDao.persist(template);
|
||||
} else {
|
||||
id = tmplt.getId();
|
||||
long id = tmplt.getId();
|
||||
tmplt.setTemplateType(TemplateType.PERHOST);
|
||||
tmplt.setUrl(null);
|
||||
tmplt.setDisplayText(xenServerIsoDisplayText);
|
||||
_tmpltDao.update(id, tmplt);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,72 @@
|
|||
// Licensed to the Apache Software Foundation (ASF) under one
|
||||
// or more contributor license agreements. See the NOTICE file
|
||||
// distributed with this work for additional information
|
||||
// regarding copyright ownership. The ASF 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 com.cloud.hypervisor.xenserver.discoverer;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.InOrder;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
import com.cloud.storage.Storage.TemplateType;
|
||||
import com.cloud.storage.VMTemplateVO;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class XcpServerDiscovererTest {
|
||||
|
||||
@Spy
|
||||
@InjectMocks
|
||||
private XcpServerDiscoverer xcpServerDiscoverer;
|
||||
|
||||
@Mock
|
||||
private VMTemplateDao vmTemplateDao;
|
||||
|
||||
@Test
|
||||
public void createXenServerToolsIsoEntryInDatabaseTestNoEntryFound() {
|
||||
Mockito.when(vmTemplateDao.findByTemplateName("xs-tools.iso")).thenReturn(null);
|
||||
Mockito.when(vmTemplateDao.getNextInSequence(Long.class, "id")).thenReturn(1L);
|
||||
|
||||
xcpServerDiscoverer.createXenServerToolsIsoEntryInDatabase();
|
||||
|
||||
InOrder inOrder = Mockito.inOrder(vmTemplateDao);
|
||||
inOrder.verify(vmTemplateDao).findByTemplateName("xs-tools.iso");
|
||||
inOrder.verify(vmTemplateDao).getNextInSequence(Long.class, "id");
|
||||
inOrder.verify(vmTemplateDao).persist(Mockito.any(VMTemplateVO.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createXenServerToolsIsoEntryInDatabaseTestEntryAlreadyExist() {
|
||||
VMTemplateVO vmTemplateVOMock = Mockito.mock(VMTemplateVO.class);
|
||||
Mockito.when(vmTemplateDao.findByTemplateName("xs-tools.iso")).thenReturn(vmTemplateVOMock);
|
||||
Mockito.when(vmTemplateVOMock.getId()).thenReturn(1L);
|
||||
|
||||
xcpServerDiscoverer.createXenServerToolsIsoEntryInDatabase();
|
||||
|
||||
InOrder inOrder = Mockito.inOrder(vmTemplateDao, vmTemplateVOMock);
|
||||
inOrder.verify(vmTemplateDao).findByTemplateName("xs-tools.iso");
|
||||
inOrder.verify(vmTemplateDao, Mockito.times(0)).getNextInSequence(Long.class, "id");
|
||||
inOrder.verify(vmTemplateVOMock).setTemplateType(TemplateType.PERHOST);
|
||||
inOrder.verify(vmTemplateVOMock).setUrl(null);
|
||||
inOrder.verify(vmTemplateVOMock).setDisplayText("XenServer Tools Installer ISO (xen-pv-drv-iso)");
|
||||
inOrder.verify(vmTemplateDao).update(1L, vmTemplateVOMock);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,17 +16,32 @@
|
|||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.Spy;
|
||||
import org.powermock.api.mockito.PowerMockito;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import com.cloud.utils.script.Script;
|
||||
import com.xensource.xenapi.Connection;
|
||||
import com.xensource.xenapi.Host;
|
||||
import com.xensource.xenapi.Host.Record;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest({Host.class, Script.class})
|
||||
public class CitrixResourceBaseTest {
|
||||
|
||||
@Spy
|
||||
protected CitrixResourceBase citrixResourceBase = new CitrixResourceBase() {
|
||||
@Override
|
||||
protected String getPatchFilePath() {
|
||||
|
|
@ -34,6 +49,27 @@ public class CitrixResourceBaseTest {
|
|||
}
|
||||
};
|
||||
|
||||
@Mock
|
||||
private Connection connectionMock;
|
||||
@Mock
|
||||
private Host hostMock;
|
||||
@Mock
|
||||
private Record hostRecordMock;
|
||||
|
||||
private String hostUuidMock = "hostUuidMock";
|
||||
|
||||
@Before
|
||||
public void beforeTest() throws XenAPIException, XmlRpcException {
|
||||
citrixResourceBase._host.setUuid(hostUuidMock);
|
||||
|
||||
PowerMockito.mockStatic(Host.class);
|
||||
PowerMockito.when(Host.getByUuid(connectionMock, hostUuidMock)).thenReturn(hostMock);
|
||||
|
||||
hostRecordMock.softwareVersion = new HashMap<>();
|
||||
Mockito.when(hostMock.getRecord(connectionMock)).thenReturn(hostRecordMock);
|
||||
|
||||
}
|
||||
|
||||
public void testGetPathFilesExeption() {
|
||||
String patch = citrixResourceBase.getPatchFilePath();
|
||||
|
||||
|
|
@ -92,4 +128,44 @@ public class CitrixResourceBaseTest {
|
|||
String guestOsType = citrixResourceBase.getGuestOsType(platformEmulator);
|
||||
Assert.assertEquals(platformEmulator, guestOsType);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void actualIsoTemplateTestXcpHots() throws XenAPIException, XmlRpcException {
|
||||
hostRecordMock.softwareVersion.put("product_brand", "XCP");
|
||||
hostRecordMock.softwareVersion.put("product_version", "1.0");
|
||||
|
||||
String returnedIsoTemplateName = citrixResourceBase.getActualIsoTemplate(connectionMock);
|
||||
|
||||
Assert.assertEquals("xs-tools.iso", returnedIsoTemplateName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void actualIsoTemplateTestXenServerBefore70() throws XenAPIException, XmlRpcException {
|
||||
hostRecordMock.softwareVersion.put("product_brand", "XenServer");
|
||||
hostRecordMock.softwareVersion.put("product_version", "6.0");
|
||||
|
||||
String returnedIsoTemplateName = citrixResourceBase.getActualIsoTemplate(connectionMock);
|
||||
|
||||
Assert.assertEquals("xs-tools.iso", returnedIsoTemplateName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void actualIsoTemplateTestXenServer70() throws XenAPIException, XmlRpcException {
|
||||
hostRecordMock.softwareVersion.put("product_brand", "XenServer");
|
||||
hostRecordMock.softwareVersion.put("product_version", "7.0");
|
||||
|
||||
String returnedIsoTemplateName = citrixResourceBase.getActualIsoTemplate(connectionMock);
|
||||
|
||||
Assert.assertEquals("guest-tools.iso", returnedIsoTemplateName);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void actualIsoTemplateTestXenServer71() throws XenAPIException, XmlRpcException {
|
||||
hostRecordMock.softwareVersion.put("product_brand", "XenServer");
|
||||
hostRecordMock.softwareVersion.put("product_version", "7.1");
|
||||
|
||||
String returnedIsoTemplateName = citrixResourceBase.getActualIsoTemplate(connectionMock);
|
||||
|
||||
Assert.assertEquals("guest-tools.iso", returnedIsoTemplateName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,21 +15,21 @@
|
|||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
@RunWith(PowerMockRunner.class)
|
||||
public class XcpOssResourceTest extends CitrixResourceBaseTest{
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
public class XcpOssResourceTest extends CitrixResourceBaseTest {
|
||||
|
||||
@Before
|
||||
public void beforeTest() {
|
||||
@Override
|
||||
public void beforeTest() throws XenAPIException, XmlRpcException {
|
||||
super.citrixResourceBase = new XcpOssResource();
|
||||
super.beforeTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -41,13 +41,11 @@ public class XcpOssResourceTest extends CitrixResourceBaseTest{
|
|||
}
|
||||
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFiles(){
|
||||
testGetPathFilesExeption();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFilesListReturned(){
|
||||
testGetPathFilesListReturned();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,22 +15,21 @@
|
|||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
public class XcpServerResourceTest extends CitrixResourceBaseTest{
|
||||
public class XcpServerResourceTest extends CitrixResourceBaseTest {
|
||||
|
||||
@Before
|
||||
public void beforeTest() {
|
||||
@Override
|
||||
public void beforeTest() throws XenAPIException, XmlRpcException {
|
||||
super.citrixResourceBase = new XcpServerResource();
|
||||
super.beforeTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -42,13 +41,11 @@ public class XcpServerResourceTest extends CitrixResourceBaseTest{
|
|||
}
|
||||
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFilesExeption(){
|
||||
testGetPathFilesExeption();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFilesListReturned(){
|
||||
testGetPathFilesListReturned();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,22 +15,21 @@
|
|||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
public class XenServer56FP1ResourceTest extends CitrixResourceBaseTest{
|
||||
public class XenServer56FP1ResourceTest extends CitrixResourceBaseTest {
|
||||
|
||||
@Before
|
||||
public void beforeTest() {
|
||||
@Override
|
||||
public void beforeTest() throws XenAPIException, XmlRpcException {
|
||||
super.citrixResourceBase = new XenServer56FP1Resource();
|
||||
super.beforeTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -42,13 +41,11 @@ public class XenServer56FP1ResourceTest extends CitrixResourceBaseTest{
|
|||
}
|
||||
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFiles(){
|
||||
testGetPathFilesExeption();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFilesListReturned(){
|
||||
testGetPathFilesListReturned();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,21 +15,21 @@
|
|||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
@RunWith(PowerMockRunner.class)
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
public class XenServer56ResourceTest extends CitrixResourceBaseTest {
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void beforeTest() {
|
||||
public void beforeTest() throws XenAPIException, XmlRpcException {
|
||||
super.citrixResourceBase = new XenServer56Resource();
|
||||
super.beforeTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -41,13 +41,11 @@ public class XenServer56ResourceTest extends CitrixResourceBaseTest {
|
|||
}
|
||||
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFiles(){
|
||||
testGetPathFilesExeption();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFilesListReturned(){
|
||||
testGetPathFilesListReturned();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,21 +15,21 @@
|
|||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
@RunWith(PowerMockRunner.class)
|
||||
public class XenServer56SP2ResourceTest extends CitrixResourceBaseTest{
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
public class XenServer56SP2ResourceTest extends CitrixResourceBaseTest {
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void beforeTest() {
|
||||
public void beforeTest() throws XenAPIException, XmlRpcException {
|
||||
super.citrixResourceBase = new XenServer56SP2Resource();
|
||||
super.beforeTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -41,14 +41,12 @@ public class XenServer56SP2ResourceTest extends CitrixResourceBaseTest{
|
|||
}
|
||||
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFiles(){
|
||||
public void testGetFiles() {
|
||||
testGetPathFilesExeption();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFilesListReturned(){
|
||||
public void testGetFilesListReturned() {
|
||||
testGetPathFilesListReturned();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,24 +15,23 @@
|
|||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
@RunWith(PowerMockRunner.class)
|
||||
public class XenServer600ResourceTest extends CitrixResourceBaseTest{
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
public class XenServer600ResourceTest extends CitrixResourceBaseTest {
|
||||
|
||||
@Before
|
||||
public void beforeTest() {
|
||||
@Override
|
||||
public void beforeTest() throws XenAPIException, XmlRpcException {
|
||||
super.citrixResourceBase = new XenServer600Resource();
|
||||
super.beforeTest();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testPatchFilePath() {
|
||||
String patchFilePath = citrixResourceBase.getPatchFilePath();
|
||||
|
|
@ -42,14 +41,12 @@ public class XenServer600ResourceTest extends CitrixResourceBaseTest{
|
|||
}
|
||||
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFiles(){
|
||||
public void testGetFiles() {
|
||||
testGetPathFilesExeption();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFilesListReturned(){
|
||||
public void testGetFilesListReturned() {
|
||||
testGetPathFilesListReturned();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,22 +15,21 @@
|
|||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
public class XenServer625ResourceTest extends CitrixResourceBaseTest {
|
||||
|
||||
@Before
|
||||
public void beforeTest() {
|
||||
@Override
|
||||
public void beforeTest() throws XenAPIException, XmlRpcException {
|
||||
super.citrixResourceBase = new Xenserver625Resource();
|
||||
super.beforeTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -42,13 +41,11 @@ public class XenServer625ResourceTest extends CitrixResourceBaseTest {
|
|||
}
|
||||
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
@PrepareForTest(Script.class)
|
||||
public void testGetFiles() {
|
||||
testGetPathFilesExeption();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PrepareForTest(Script.class)
|
||||
public void testGetFilesListReturned() {
|
||||
testGetPathFilesListReturned();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,21 +15,21 @@
|
|||
*/
|
||||
package com.cloud.hypervisor.xenserver.resource;
|
||||
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.powermock.core.classloader.annotations.PrepareForTest;
|
||||
import org.powermock.modules.junit4.PowerMockRunner;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.script.Script;
|
||||
@RunWith(PowerMockRunner.class)
|
||||
public class XenServer650ResourceTest extends CitrixResourceBaseTest{
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
public class XenServer650ResourceTest extends CitrixResourceBaseTest {
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void beforeTest() {
|
||||
public void beforeTest() throws XenAPIException, XmlRpcException {
|
||||
super.citrixResourceBase = new XenServer650Resource();
|
||||
super.beforeTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -41,14 +41,12 @@ public class XenServer650ResourceTest extends CitrixResourceBaseTest{
|
|||
}
|
||||
|
||||
@Test(expected = CloudRuntimeException.class)
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFiles(){
|
||||
public void testGetFiles() {
|
||||
testGetPathFilesExeption();
|
||||
}
|
||||
|
||||
@Test
|
||||
@PrepareForTest(Script.class )
|
||||
public void testGetFilesListReturned(){
|
||||
public void testGetFilesListReturned() {
|
||||
testGetPathFilesListReturned();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue