Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2019-11-07 09:52:45 -0500
committerThomas Watson2019-11-07 09:53:10 -0500
commit59494aa4fc7bdcbff981040d7c30fda561e9c3af (patch)
tree1c9ad60dddca19f100fb92005d96233640193d06
parentd99345f6e6ef356b335ef44e6533d8cf95a17536 (diff)
downloadrt.equinox.bundles-59494aa4fc7bdcbff981040d7c30fda561e9c3af.tar.gz
rt.equinox.bundles-59494aa4fc7bdcbff981040d7c30fda561e9c3af.tar.xz
rt.equinox.bundles-59494aa4fc7bdcbff981040d7c30fda561e9c3af.zip
Double Added tests and also fixed support for BigInteger/BigDecimal Change-Id: I4e81901c91e3d507029a3574718bed5bc9b33eeb Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/.settings/org.eclipse.jdt.core.prefs3
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/.settings/org.eclipse.jdt.launching.prefs3
-rwxr-xr-xbundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/getMinMax.tb1/OSGI-INF/metatype/metadata.xml9
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/AllTests.java2
-rwxr-xr-xbundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/GetMinMaxTest.java53
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java7
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/Persistence.java2
7 files changed, 77 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.compendium.tests/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.compendium.tests/.settings/org.eclipse.jdt.core.prefs
index 0a67bc6f..1e26766b 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.compendium.tests/.settings/org.eclipse.jdt.core.prefs
@@ -2,10 +2,13 @@ eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=ignore
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
diff --git a/bundles/org.eclipse.equinox.compendium.tests/.settings/org.eclipse.jdt.launching.prefs b/bundles/org.eclipse.equinox.compendium.tests/.settings/org.eclipse.jdt.launching.prefs
new file mode 100644
index 00000000..f8a131b5
--- /dev/null
+++ b/bundles/org.eclipse.equinox.compendium.tests/.settings/org.eclipse.jdt.launching.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.launching.PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE=warning
+org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
diff --git a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/getMinMax.tb1/OSGI-INF/metatype/metadata.xml b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/getMinMax.tb1/OSGI-INF/metatype/metadata.xml
index f525328e..79a668cb 100755
--- a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/getMinMax.tb1/OSGI-INF/metatype/metadata.xml
+++ b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/getMinMax.tb1/OSGI-INF/metatype/metadata.xml
@@ -12,6 +12,15 @@
<AD id="getMinAsNotANumber" type="String" min="foo"/>
<AD id="minMaxValidUsingInt" type="Password" min="8" max="16"/>
<AD id="minMaxValidUsingString" type="String" min="1" max="1.2"/>
+ <AD id="getDouble" type="Double" min="1" max="100"/>
+ <AD id="getFloat" type="Float" min="1" max="100"/>
+ <AD id="getByte" type="Byte" min="1" max="2"/>
+ <AD id="getShort" type="Short" min="1" max="2"/>
+ <AD id="getCharacter" type="Character" min="a" max="z"/>
+ <AD id="getBoolean" type="Boolean" min="false" max="true"/>
+ <AD id="getLong" type="Long" min="1" max="1000"/>
+ <AD id="getBigInteger" type="BigInteger" min="1" max="1000"/>
+ <AD id="getBigDecimal" type="BigDecimal" min="1.1" max="1000.1"/>
</OCD>
<Designate pid="org.eclipse.equinox.metatype.tests.getMinMax.tb1">
<Object ocdref="getMinMax"/>
diff --git a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/AllTests.java b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/AllTests.java
index e38f02b8..34b2852a 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/AllTests.java
+++ b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/AllTests.java
@@ -18,7 +18,7 @@ import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
-@SuiteClasses({AttributeTypePasswordTest.class, Bug332161Test.class, Bug340899Test.class, BugTests.class, SameOcdPidFactoryPidTest.class, ExtendableTest.class, Bug358969Test.class, UnresolvedBundleTest.class, GetDefaultValueTest.class, IconTest.class, Bug395196Test.class, NoADTest.class})
+@SuiteClasses({AttributeTypePasswordTest.class, Bug332161Test.class, Bug340899Test.class, BugTests.class, SameOcdPidFactoryPidTest.class, ExtendableTest.class, Bug358969Test.class, UnresolvedBundleTest.class, GetDefaultValueTest.class, IconTest.class, Bug395196Test.class, NoADTest.class, GetMinMaxTest.class})
public class AllTests {
//see @SuiteClasses
}
diff --git a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/GetMinMaxTest.java b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/GetMinMaxTest.java
index 7d4d9a4c..926995f1 100755
--- a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/GetMinMaxTest.java
+++ b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/GetMinMaxTest.java
@@ -37,31 +37,84 @@ public class GetMinMaxTest extends AbstractTest {
@Test
public void testGetMax() throws Exception {
assertMaxValue("getMax", "0"); //$NON-NLS-1$ //$NON-NLS-2$
+ restartMetatype();
+ assertMaxValue("getMax", "0"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test
public void testGetMaxAsNotANumber() {
assertMaxValue("getMaxAsNotANumber", "1.0.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ restartMetatype();
+ assertMaxValue("getMaxAsNotANumber", "1.0.0"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test
public void testGetMaxNull() {
assertMaxValue("getMaxNull", null); //$NON-NLS-1$
+ restartMetatype();
+ assertMaxValue("getMaxNull", null); //$NON-NLS-1$
}
@Test
public void testGetMin() {
assertMinValue("getMin", "5"); //$NON-NLS-1$ //$NON-NLS-2$
+ restartMetatype();
+ assertMinValue("getMin", "5"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test
public void testGetMinAsNotANumber() {
assertMinValue("getMinAsNotANumber", "foo"); //$NON-NLS-1$ //$NON-NLS-2$
+ restartMetatype();
+ assertMinValue("getMinAsNotANumber", "foo"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test
public void testGetMinNull() {
assertMinValue("getMinNull", null); //$NON-NLS-1$
+ restartMetatype();
+ assertMinValue("getMinNull", null); //$NON-NLS-1$
+ }
+
+ @Test
+ public void testGetTheRest() {
+ assertMinValue("getDouble", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getDouble", "100.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getFloat", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getFloat", "100.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getByte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getByte", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getShort", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getShort", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getLong", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getLong", "1000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getCharacter", "a"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getCharacter", "z"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getBoolean", "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getBoolean", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getBigInteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getBigInteger", "1000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getBigDecimal", "1.1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getBigDecimal", "1000.1"); //$NON-NLS-1$ //$NON-NLS-2$
+ restartMetatype();
+ assertMinValue("getDouble", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getDouble", "100.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getFloat", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getFloat", "100.0"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getByte", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getByte", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getShort", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getShort", "2"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getLong", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getLong", "1000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getCharacter", "a"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getCharacter", "z"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getBoolean", "false"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getBoolean", "true"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getBigInteger", "1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getBigInteger", "1000"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMinValue("getBigDecimal", "1.1"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertMaxValue("getBigDecimal", "1000.1"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java
index 000e8f23..d70d0e26 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/DataParser.java
@@ -71,6 +71,8 @@ public class DataParser {
private static final String BOOLEAN = "Boolean"; //$NON-NLS-1$
private static final String SHORT = "Short"; //$NON-NLS-1$
private static final String PASSWORD = "Password"; //$NON-NLS-1$
+ private static final String BIGINTEGER = "BigInteger"; //$NON-NLS-1$
+ private static final String BIGDECIMAL = "BigDecimal"; //$NON-NLS-1$
protected Bundle _dp_bundle;
protected URL _dp_url;
@@ -443,6 +445,7 @@ public class DataParser {
super(handler);
}
+ @SuppressWarnings("deprecation")
public void init(String name, Attributes atts, List<AttributeDefinitionImpl> ads) {
logger.log(LogTracker.LOG_DEBUG, "Here is AttributeDefinitionHandler():init()"); //$NON-NLS-1$
@@ -492,6 +495,10 @@ public class DataParser {
_dataType = AttributeDefinition.SHORT;
} else if (ad_type_val.equalsIgnoreCase(PASSWORD)) {
_dataType = AttributeDefinition.PASSWORD;
+ } else if (ad_type_val.equalsIgnoreCase(BIGDECIMAL)) {
+ _dataType = AttributeDefinition.BIGDECIMAL;
+ } else if (ad_type_val.equalsIgnoreCase(BIGINTEGER)) {
+ _dataType = AttributeDefinition.BIGINTEGER;
} else {
_isParsedDataValid = false;
logger.log(LogTracker.LOG_ERROR, NLS.bind(MetaTypeMsg.INVALID_TYPE, new Object[] {ad_type_val, ad_id_val, _dp_url, _dp_bundle.getBundleId(), _dp_bundle.getSymbolicName()}));
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/Persistence.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/Persistence.java
index 356c07a5..f91f63d0 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/Persistence.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/Persistence.java
@@ -105,7 +105,7 @@ public class Persistence {
}
public double readDouble() throws IOException {
- return readDouble();
+ return in.readDouble();
}
public float readFloat() throws IOException {

Back to the top