package jetbrains.buildServer.clouds.vmware.vmrun.remote; import com.thoughtworks.xstream.XStream; import java.io.ByteArrayInputStream; import java.io.UnsupportedEncodingException; import jetbrains.buildServer.clouds.vmware.settings.VMImageInfo; import jetbrains.buildServer.messages.XStreamHolder; import junit.framework.Assert; import org.testng.annotations.Test; /** * @author Eugene Petrenko (eugene.petrenko@gmail.com) * Date: 02.07.12 20:57 */ public class XStreamSerializationTest { @Test public void test_VMImageInfo() throws UnsupportedEncodingException { final XStream xs = new XStreamHolder().getXStream(getClass().getClassLoader()); String xml = "\n" + " \n" + " Win7-64.Professional.SP1\n" + "\n" + " \n" + " C:\\VMWare\\Windows 7 x64 Professional SP1\\Clone of Windows 7 x64 Professional No SP.vmx\n" + " \n" + " \n" + " C:\\BuildAgent\\conf\\buildAgent.properties\n" + " \n" + " \n" + " DOMAIN\\USERNAME\n" + " PWD\n" + ""; byte[] data = xml.getBytes("utf-8"); VMImageInfo info = (VMImageInfo)xs.fromXML(new ByteArrayInputStream(data)); System.out.println(info.getClass().getName()); Assert.assertNotNull(info); } }