From 8ca4f5e8b57b6edb911df0e20fbeb46ab3342ed1 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Sat, 23 May 2015 00:02:37 +0200 Subject: [PATCH] moved settings serialization from com.sap.sse.common to com.sap.sse; created new test fragment com.sap.sse.test which now hosts the settings serializer test case --- java/com.sap.sse.test/.classpath | 7 +++++ java/com.sap.sse.test/.project | 28 +++++++++++++++++++ .../.settings/org.eclipse.jdt.core.prefs | 7 +++++ .../.settings/org.eclipse.pde.core.prefs | 3 ++ java/com.sap.sse.test/META-INF/MANIFEST.MF | 9 ++++++ java/com.sap.sse.test/build.properties | 4 +++ java/com.sap.sse.test/pom.xml | 12 ++++++++ .../SettingsJsonSerializationTest.java | 4 +-- java/com.sap.sse/META-INF/MANIFEST.MF | 3 +- .../settings/SettingsToJsonSerializer.java | 13 +++++++-- java/pom.xml | 1 + 11 files changed, 84 insertions(+), 7 deletions(-) create mode 100755 java/com.sap.sse.test/.classpath create mode 100755 java/com.sap.sse.test/.project create mode 100755 java/com.sap.sse.test/.settings/org.eclipse.jdt.core.prefs create mode 100755 java/com.sap.sse.test/.settings/org.eclipse.pde.core.prefs create mode 100755 java/com.sap.sse.test/META-INF/MANIFEST.MF create mode 100755 java/com.sap.sse.test/build.properties create mode 100755 java/com.sap.sse.test/pom.xml rename java/{com.sap.sse.common.test => com.sap.sse.test}/src/com/sap/sse/common/settings/SettingsJsonSerializationTest.java (95%) rename java/{com.sap.sse.common/src/com/sap/sse/common => com.sap.sse/src/com/sap/sse}/settings/SettingsToJsonSerializer.java (93%) diff --git a/java/com.sap.sse.test/.classpath b/java/com.sap.sse.test/.classpath new file mode 100755 index 00000000000..b862a296d38 --- /dev/null +++ b/java/com.sap.sse.test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/java/com.sap.sse.test/.project b/java/com.sap.sse.test/.project new file mode 100755 index 00000000000..3366ea5434b --- /dev/null +++ b/java/com.sap.sse.test/.project @@ -0,0 +1,28 @@ + + + com.sap.sse.test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/java/com.sap.sse.test/.settings/org.eclipse.jdt.core.prefs b/java/com.sap.sse.test/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..295926d9641 --- /dev/null +++ b/java/com.sap.sse.test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/java/com.sap.sse.test/.settings/org.eclipse.pde.core.prefs b/java/com.sap.sse.test/.settings/org.eclipse.pde.core.prefs new file mode 100755 index 00000000000..b7e72d019c2 --- /dev/null +++ b/java/com.sap.sse.test/.settings/org.eclipse.pde.core.prefs @@ -0,0 +1,3 @@ +eclipse.preferences.version=1 +pluginProject.extensions=false +resolve.requirebundle=false diff --git a/java/com.sap.sse.test/META-INF/MANIFEST.MF b/java/com.sap.sse.test/META-INF/MANIFEST.MF new file mode 100755 index 00000000000..d52e3fc73d3 --- /dev/null +++ b/java/com.sap.sse.test/META-INF/MANIFEST.MF @@ -0,0 +1,9 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: SSE Test +Bundle-SymbolicName: com.sap.sse.test +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: SAP +Fragment-Host: com.sap.sse +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 +Require-Bundle: org.junit4;bundle-version="4.8.2" diff --git a/java/com.sap.sse.test/build.properties b/java/com.sap.sse.test/build.properties new file mode 100755 index 00000000000..41eb6ade2b4 --- /dev/null +++ b/java/com.sap.sse.test/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/java/com.sap.sse.test/pom.xml b/java/com.sap.sse.test/pom.xml new file mode 100755 index 00000000000..26c8a069929 --- /dev/null +++ b/java/com.sap.sse.test/pom.xml @@ -0,0 +1,12 @@ + + + 4.0.0 + + root + com.sap.sailing + 1.0.0-SNAPSHOT + + com.sap.sse.test + eclipse-test-plugin + diff --git a/java/com.sap.sse.common.test/src/com/sap/sse/common/settings/SettingsJsonSerializationTest.java b/java/com.sap.sse.test/src/com/sap/sse/common/settings/SettingsJsonSerializationTest.java similarity index 95% rename from java/com.sap.sse.common.test/src/com/sap/sse/common/settings/SettingsJsonSerializationTest.java rename to java/com.sap.sse.test/src/com/sap/sse/common/settings/SettingsJsonSerializationTest.java index dbaf4c92f0c..5f3d6e67fdf 100755 --- a/java/com.sap.sse.common.test/src/com/sap/sse/common/settings/SettingsJsonSerializationTest.java +++ b/java/com.sap.sse.test/src/com/sap/sse/common/settings/SettingsJsonSerializationTest.java @@ -14,6 +14,7 @@ import org.junit.Test; import com.sap.sse.common.filter.TextOperator; import com.sap.sse.common.filter.TextOperator.Operators; +import com.sap.sse.settings.SettingsToJsonSerializer; public class SettingsJsonSerializationTest { @Test @@ -48,7 +49,6 @@ public class SettingsJsonSerializationTest { * A white-box test that tests property name escaping in case the property name conflicts with how type * names (used particularly for enum settings) are represented in JSON. */ - @Ignore("doesn't compile for gwt yet") @Test public void testJsonSerializationWithFunnyPropertyName() throws ClassNotFoundException { final Map settingsMap = new HashMap<>(); @@ -65,7 +65,6 @@ public class SettingsJsonSerializationTest { * A white-box test that tests property name escaping in case the property name conflicts with how type * names (used particularly for enum settings) are represented in JSON. */ - @Ignore("doesn't compile for gwt yet") @Test public void testJsonSerializationWithEnumTypedList() throws ClassNotFoundException { final Map settingsMap = new HashMap<>(); @@ -84,7 +83,6 @@ public class SettingsJsonSerializationTest { * A white-box test that tests property name escaping in case the property name conflicts with how type * names (used particularly for enum settings) are represented in JSON. */ - @Ignore("Class.forName doesn't compile for gwt yet") @Test public void testJsonSerializationWithStringifiedEnum() throws ClassNotFoundException { final Map settingsMap = new HashMap<>(); diff --git a/java/com.sap.sse/META-INF/MANIFEST.MF b/java/com.sap.sse/META-INF/MANIFEST.MF index f241ed100a1..3adeecda510 100644 --- a/java/com.sap.sse/META-INF/MANIFEST.MF +++ b/java/com.sap.sse/META-INF/MANIFEST.MF @@ -17,7 +17,8 @@ Export-Package: com.sap.sse, Bundle-ActivationPolicy: lazy Require-Bundle: com.sap.sse.common, com.sap.sse.shared.android, - org.apache.servicemix.bundles.zxing;bundle-version="3.1.0" + org.apache.servicemix.bundles.zxing;bundle-version="3.1.0", + org.json.simple;bundle-version="1.1.0" Import-Package: javax.servlet;version="3.1.0", javax.servlet.http;version="3.1.0", org.osgi.framework;version="1.8.0", diff --git a/java/com.sap.sse.common/src/com/sap/sse/common/settings/SettingsToJsonSerializer.java b/java/com.sap.sse/src/com/sap/sse/settings/SettingsToJsonSerializer.java similarity index 93% rename from java/com.sap.sse.common/src/com/sap/sse/common/settings/SettingsToJsonSerializer.java rename to java/com.sap.sse/src/com/sap/sse/settings/SettingsToJsonSerializer.java index 2a0bae7051e..2d5371b0d7c 100755 --- a/java/com.sap.sse.common/src/com/sap/sse/common/settings/SettingsToJsonSerializer.java +++ b/java/com.sap.sse/src/com/sap/sse/settings/SettingsToJsonSerializer.java @@ -1,4 +1,4 @@ -package com.sap.sse.common.settings; +package com.sap.sse.settings; import java.util.ArrayList; import java.util.HashMap; @@ -10,7 +10,15 @@ import java.util.Map.Entry; import org.json.simple.JSONArray; import org.json.simple.JSONObject; -import com.google.gwt.core.shared.GwtIncompatible; +import com.sap.sse.common.settings.AbstractSettings; +import com.sap.sse.common.settings.EnumSetting; +import com.sap.sse.common.settings.ListSetting; +import com.sap.sse.common.settings.MapSettings; +import com.sap.sse.common.settings.NumberSetting; +import com.sap.sse.common.settings.Setting; +import com.sap.sse.common.settings.SettingType; +import com.sap.sse.common.settings.Settings; +import com.sap.sse.common.settings.StringSetting; /** * Serializes a {@link Settings} object to a {@link JSONObject}. All setting types are supported as top-level entities. @@ -27,7 +35,6 @@ import com.google.gwt.core.shared.GwtIncompatible; * @author Axel Uhl (D043530) * */ -@GwtIncompatible public class SettingsToJsonSerializer { private final static String TYPE_PROPERTY_SUFFIX = "___TYPE"; private final static char TYPE_PROPERTY_SUFFIX_ESCAPE = ':'; diff --git a/java/pom.xml b/java/pom.xml index 220fed91e88..ad600f22e03 100755 --- a/java/pom.xml +++ b/java/pom.xml @@ -14,6 +14,7 @@ com.sap.sse + com.sap.sse.test com.sap.sse.common com.sap.sse.shared.android com.sap.sse.mail