/* * Copyright 2000-2014 JetBrains s.r.o. * * 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 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); } }