mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
fixing line ending in cp and core
This commit is contained in:
parent
fbf007ea0e
commit
aeee1e46f3
@ -10,22 +10,22 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.hypervisor.vmware.mo;
|
package com.cloud.hypervisor.vmware.mo;
|
||||||
|
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||||
import com.cloud.serializer.GsonHelper;
|
import com.cloud.serializer.GsonHelper;
|
||||||
import com.cloud.utils.testcase.Log4jEnabledTestCase;
|
import com.cloud.utils.testcase.Log4jEnabledTestCase;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.vmware.vim25.DynamicProperty;
|
import com.vmware.vim25.DynamicProperty;
|
||||||
import com.vmware.vim25.ManagedObjectReference;
|
import com.vmware.vim25.ManagedObjectReference;
|
||||||
import com.vmware.vim25.ObjectContent;
|
import com.vmware.vim25.ObjectContent;
|
||||||
import com.vmware.vim25.VirtualMachineConfigSpec;
|
import com.vmware.vim25.VirtualMachineConfigSpec;
|
||||||
|
|
||||||
public class TestVmwareMO extends Log4jEnabledTestCase {
|
public class TestVmwareMO extends Log4jEnabledTestCase {
|
||||||
private static final Logger s_logger = Logger.getLogger(TestVmwareMO.class);
|
private static final Logger s_logger = Logger.getLogger(TestVmwareMO.class);
|
||||||
|
|
||||||
public void test() {
|
public void test() {
|
||||||
@ -64,5 +64,5 @@ public class TestVmwareMO extends Log4jEnabledTestCase {
|
|||||||
s_logger.error("Unexpected exception : ", e);
|
s_logger.error("Unexpected exception : ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,94 +10,94 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
// Automatically generated by addcopyright.py at 04/03/2012
|
// Automatically generated by addcopyright.py at 04/03/2012
|
||||||
package com.cloud.hypervisor.vmware.util;
|
package com.cloud.hypervisor.vmware.util;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import junit.framework.Assert;
|
import junit.framework.Assert;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import com.cloud.hypervisor.vmware.resource.SshHelper;
|
import com.cloud.hypervisor.vmware.resource.SshHelper;
|
||||||
import com.cloud.hypervisor.vmware.resource.VmwareContextFactory;
|
import com.cloud.hypervisor.vmware.resource.VmwareContextFactory;
|
||||||
import com.cloud.utils.Pair;
|
import com.cloud.utils.Pair;
|
||||||
import com.cloud.utils.testcase.Log4jEnabledTestCase;
|
import com.cloud.utils.testcase.Log4jEnabledTestCase;
|
||||||
import com.vmware.vim25.ManagedObjectReference;
|
import com.vmware.vim25.ManagedObjectReference;
|
||||||
|
|
||||||
public class TestVmwareUtil extends Log4jEnabledTestCase {
|
public class TestVmwareUtil extends Log4jEnabledTestCase {
|
||||||
private static final Logger s_logger = Logger.getLogger(TestVmwareUtil.class);
|
private static final Logger s_logger = Logger.getLogger(TestVmwareUtil.class);
|
||||||
|
|
||||||
public void testContextCreation() {
|
public void testContextCreation() {
|
||||||
try {
|
try {
|
||||||
VmwareContext context = VmwareContextFactory.create("vsphere-1.lab.vmops.com", "Administrator", "Suite219");
|
VmwareContext context = VmwareContextFactory.create("vsphere-1.lab.vmops.com", "Administrator", "Suite219");
|
||||||
Assert.assertTrue(true);
|
Assert.assertTrue(true);
|
||||||
context.close();
|
context.close();
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
s_logger.error("Unexpected exception : ", e);
|
s_logger.error("Unexpected exception : ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSearchIndex() {
|
public void testSearchIndex() {
|
||||||
try {
|
try {
|
||||||
VmwareContext context = VmwareContextFactory.create("vsphere-1.lab.vmops.com", "Administrator", "Suite219");
|
VmwareContext context = VmwareContextFactory.create("vsphere-1.lab.vmops.com", "Administrator", "Suite219");
|
||||||
Assert.assertTrue(true);
|
Assert.assertTrue(true);
|
||||||
|
|
||||||
ManagedObjectReference morHost = context.getService().findByDnsName(context.getServiceContent().getSearchIndex(),
|
ManagedObjectReference morHost = context.getService().findByDnsName(context.getServiceContent().getSearchIndex(),
|
||||||
null, "esxhost-1.lab.vmops.com", false);
|
null, "esxhost-1.lab.vmops.com", false);
|
||||||
Assert.assertTrue(morHost.getType().equalsIgnoreCase("HostSystem"));
|
Assert.assertTrue(morHost.getType().equalsIgnoreCase("HostSystem"));
|
||||||
|
|
||||||
morHost = context.getService().findByIp(context.getServiceContent().getSearchIndex(),
|
morHost = context.getService().findByIp(context.getServiceContent().getSearchIndex(),
|
||||||
null, "192.168.1.168", false);
|
null, "192.168.1.168", false);
|
||||||
Assert.assertTrue(morHost == null);
|
Assert.assertTrue(morHost == null);
|
||||||
context.close();
|
context.close();
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
s_logger.error("Unexpected exception : ", e);
|
s_logger.error("Unexpected exception : ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVmxFileDownload() {
|
public void testVmxFileDownload() {
|
||||||
try {
|
try {
|
||||||
VmwareContext context = VmwareContextFactory.create("vsphere-1.lab.vmops.com", "Administrator", "Suite219");
|
VmwareContext context = VmwareContextFactory.create("vsphere-1.lab.vmops.com", "Administrator", "Suite219");
|
||||||
byte[] vmxContent = context.getResourceContent("https://vsphere-1.lab.vmops.com/folder/ServerRoom-Fedora32/ServerRoom-Fedora32.vmx?dcPath=cupertino&dsName=NFS%20datastore");
|
byte[] vmxContent = context.getResourceContent("https://vsphere-1.lab.vmops.com/folder/ServerRoom-Fedora32/ServerRoom-Fedora32.vmx?dcPath=cupertino&dsName=NFS%20datastore");
|
||||||
System.out.print(new String(vmxContent));
|
System.out.print(new String(vmxContent));
|
||||||
context.close();
|
context.close();
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
s_logger.error("Unexpected exception : ", e);
|
s_logger.error("Unexpected exception : ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testVmxFileParser() {
|
public void testVmxFileParser() {
|
||||||
String[] tokens = "[NFS datastore] Fedora-clone-test/Fedora-clone-test.vmx".split("\\[|\\]|/");
|
String[] tokens = "[NFS datastore] Fedora-clone-test/Fedora-clone-test.vmx".split("\\[|\\]|/");
|
||||||
|
|
||||||
for(String str : tokens) {
|
for(String str : tokens) {
|
||||||
System.out.println("Token " + str);
|
System.out.println("Token " + str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSsh() {
|
public void testSsh() {
|
||||||
try {
|
try {
|
||||||
File file = new File("c:\\temp\\id_rsa.kelven");
|
File file = new File("c:\\temp\\id_rsa.kelven");
|
||||||
if(!file.exists()) {
|
if(!file.exists()) {
|
||||||
System.out.println("key file does not exist!");
|
System.out.println("key file does not exist!");
|
||||||
}
|
}
|
||||||
|
|
||||||
Pair<Boolean, String> result = SshHelper.sshExecute("192.168.1.107", 22, "kelven", file, null, "ls -al");
|
Pair<Boolean, String> result = SshHelper.sshExecute("192.168.1.107", 22, "kelven", file, null, "ls -al");
|
||||||
System.out.println("Result: " + result.second());
|
System.out.println("Result: " + result.second());
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
s_logger.error("Unexpected exception : ", e);
|
s_logger.error("Unexpected exception : ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testScp() {
|
public void testScp() {
|
||||||
try {
|
try {
|
||||||
File file = new File("c:\\temp\\id_rsa.kelven");
|
File file = new File("c:\\temp\\id_rsa.kelven");
|
||||||
if(!file.exists()) {
|
if(!file.exists()) {
|
||||||
System.out.println("key file does not exist!");
|
System.out.println("key file does not exist!");
|
||||||
}
|
}
|
||||||
|
|
||||||
SshHelper.scpTo("192.168.1.107", 22, "kelven", file, null, "~", "Hello, world".getBytes(),
|
SshHelper.scpTo("192.168.1.107", 22, "kelven", file, null, "~", "Hello, world".getBytes(),
|
||||||
"hello.txt", null);
|
"hello.txt", null);
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
s_logger.error("Unexpected exception : ", e);
|
s_logger.error("Unexpected exception : ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user