@@ -0,0 +1,2797 @@
+/*%0A * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.%0A *%0A * Copyright 2008-2013 Geosparc nv, http://www.geosparc.com/, Belgium.%0A *%0A * The program is available in open source according to the GNU Affero%0A * General Public License. All contributions in this program are covered%0A * by the Geomajas Contributors License Agreement. For full licensing%0A * details, see LICENSE.txt in the project root.%0A */%0Apackage org.geomajas.plugin.deskmanager.test.general;%0A%0Aimport junit.framework.Assert;%0Aimport org.geomajas.configuration.client.ClientLayerInfo;%0Aimport org.geomajas.configuration.client.ClientVectorLayerInfo;%0Aimport org.geomajas.configuration.client.ScaleInfo;%0Aimport org.geomajas.plugin.deskmanager.domain.types.XmlSerialisationType;%0Aimport org.junit.Test;%0A%0Aimport java.beans.XMLDecoder;%0Aimport java.beans.XMLEncoder;%0Aimport java.io.ByteArrayInputStream;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.Serializable;%0A%0A/**%0A * @author Oliver May%0A */%0Apublic class XmlSerialisationTest %7B%0A%0A%09@Test%0A%09public void testXmlSerialisation() %7B%0A%09%09ClientLayerInfo cli = new ClientVectorLayerInfo();%0A%0A%09%09cli.setMinimumScale(new ScaleInfo(1, 100));%0A%09%09cli.setMaximumScale(new ScaleInfo(1, 342));%0A%0A%09%09XmlSerialisationType xmlSerialisationType = new XmlSerialisationType();%0A%09%09ClientLayerInfo cli2 = (ClientLayerInfo) xmlSerialisationType.deepCopy(cli);%0A%0A%09%09Assert.assertEquals(cli.getMinimumScale().getDenominator(), cli2.getMinimumScale().getDenominator());%0A%09%09Assert.assertEquals(cli.getMinimumScale().getNumerator(), cli2.getMinimumScale().getNumerator());%0A%09%09Assert.assertEquals(cli.getMinimumScale().getPixelPerUnit(), cli2.getMinimumScale().getPixelPerUnit());%0A%0A%09%09Assert.assertEquals(cli.getMaximumScale().getDenominator(), cli2.getMaximumScale().getDenominator());%0A%09%09Assert.assertEquals(cli.getMaximumScale().getNumerator(), cli2.getMaximumScale().getNumerator());%0A%09%09Assert.assertEquals(cli.getMaximumScale().getPixelPerUnit(), cli2.getMaximumScale().getPixelPerUnit());%0A%09%0A%7D%0A%0A%09@Test%0A%09public void testXmlEncoder2() throws IOException %7B%0A%0A%09%09MySerializable mySer = new MySerializable();%0A%09%09mySer.setTest(342);%0A%0A%09%09ByteArrayOutputStream baos = new ByteArrayOutputStream();%0A%09%09XMLEncoder encoder = new XMLEncoder(baos);%0A%09%09encoder.writeObject(mySer);%0A%09%09encoder.close();%0A%09%09String result = baos.toString();%0A%09%09baos.close();%0A//%09%09System.out.println(result);%0A%0A%09%09XMLDecoder decoder = new XMLDecoder(new ByteArrayInputStream(baos.toByteArray()));%0A%09%09MySerializable mySer1 = (MySerializable) decoder.readObject();%0A%0A%09%09Assert.assertEquals(mySer1.getTest(), mySer.getTest());%0A%09%7D%0A%0A%0A%09public static class MySerializable implements Serializable %7B%0A%09%09private double test;%0A%0A%09%09public double getTest() %7B%0A%09%09%09return test;%0A%09%09%7D%0A%0A%09%09public void setTest(double test) %7B%0A%09%09%09this.test = test;%0A%09%09%7D%0A%0A%09%7D;%0A%0A%0A%7D%0A

Scale info is not calculated correctly