Skip to content
This repository was archived by the owner on Sep 21, 2020. It is now read-only.

Commit 9ffb86d

Browse files
committed
UNITSOFMEASUREMENT-121: Introduce "Pluggable" Unit Systems and data
sources Task-Url: https://java.net/jira/browse/UNITSOFMEASUREMENT-121
1 parent 072203d commit 9ffb86d

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<maven.compile.sourceLevel>${jdkVersion}</maven.compile.sourceLevel>
2828
<impl.version>0.8-SNAPSHOT</impl.version>
2929
<lib.version>0.7</lib.version> <!-- currently unused -->
30+
<ucum.version>0.1-SNAPSHOT</ucum.version>
3031
<jackson.version>2.2.2</jackson.version>
3132
</properties>
3233

@@ -44,6 +45,11 @@
4445
<artifactId>uom-se</artifactId>
4546
<version>${impl.version}</version>
4647
</dependency>
48+
<dependency>
49+
<groupId>systems.uom</groupId>
50+
<artifactId>uom-systems-ucum</artifactId>
51+
<version>${ucum.version}</version>
52+
</dependency>
4753

4854
<!-- =========================================================================================================== -->
4955
<!-- Jackson library for JSON-parsing -->

src/main/java/com/opower/unitsofmeasure/UnitJacksonModule.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
import com.fasterxml.jackson.databind.module.SimpleModule;
1414
import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer;
1515

16-
import tec.uom.se.format.UCUMFormat;
17-
import tec.uom.se.format.UCUMFormat.Variant;
16+
import systems.uom.ucum.format.UCUMFormat;
17+
import systems.uom.ucum.format.UCUMFormat.Variant;
1818

1919
import javax.measure.Unit;
2020

src/test/java/com/opower/unitsofmeasure/TestUnitJacksonModule.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
import org.junit.Ignore;
1515
import org.junit.Test;
1616

17-
import tec.uom.se.unit.SI;
1817
import tec.uom.se.unit.Units;
19-
import tec.uom.se.unit.ucum.UCUM;
18+
import systems.uom.ucum.UCUM;
2019

2120
import javax.measure.Unit;
2221

@@ -43,7 +42,7 @@ public void setUp() throws Exception {
4342
public void testSerializeArea() throws Exception {
4443
assertEquals(
4544
"Expected JSON with a UCUM representation of the area unit",
46-
"\"m2\"", serialize(SI.SQUARE_METRE));
45+
"\"m2\"", serialize(Units.SQUARE_METRE));
4746
}
4847

4948
@Test
@@ -53,7 +52,7 @@ public void testSerializeTemperature() throws Exception {
5352
"\"[degF]\"", serialize(UCUM.FAHRENHEIT));
5453
assertEquals(
5554
"Expected JSON with a UCUM representation of the temperature unit",
56-
"\"Cel\"", serialize(SI.CELSIUS));
55+
"\"Cel\"", serialize(Units.CELSIUS));
5756
}
5857

5958
@Test
@@ -64,7 +63,7 @@ public void testSerializeLength() throws Exception {
6463

6564
assertEquals(
6665
"Expected JSON with a UCUM representation of the length unit",
67-
"\"km\"", serialize(KILO(SI.METRE)));
66+
"\"km\"", serialize(KILO(Units.METRE)));
6867
}
6968

7069
@Test
@@ -87,15 +86,15 @@ public void testParseArea() throws Exception {
8786
public void testParseTemperature() throws Exception {
8887
Unit<?> parsedUnit = parse("\"Cel\"", Unit.class);
8988
assertEquals("The Unit<Temperature> in the parsed JSON doesn't match",
90-
SI.CELSIUS, parsedUnit);
89+
Units.CELSIUS, parsedUnit);
9190
}
9291

9392
@Test
9493
public void testParseLength() throws Exception {
9594
Unit<?> parsedUnit = parse("\"km\"", Unit.class);
9695

9796
assertEquals("The Unit<Length> in the parsed JSON doesn't match",
98-
KILO(SI.METRE), parsedUnit);
97+
KILO(Units.METRE), parsedUnit);
9998
}
10099

101100
@Test(expected = JsonParseException.class)

0 commit comments

Comments
 (0)