Commit 96059e0a by Shwetha GS

ATLAS-25 Fix Atlas on Java 8 (sandeep.samudrala via shwethags)

parent b93fe4a4
......@@ -327,7 +327,7 @@
<jackson.version>1.8.3</jackson.version>
<tinkerpop.version>2.6.0</tinkerpop.version>
<titan.version>0.5.4</titan.version>
<hadoop.version>2.6.0</hadoop.version>
<hadoop.version>2.7.0</hadoop.version>
<hbase.version>0.98.9-hadoop2</hbase.version>
<!-- scala versions -->
......@@ -402,6 +402,21 @@
</properties>
</profile>
<profile>
<id>jdk7</id>
<activation>
<jdk>[1.7,1.8)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.29</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<modules>
<module>typesystem</module>
......@@ -1192,8 +1207,9 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.2</version>
<version>3.0.1</version>
</plugin>
<!-- Source code metrics: mvn javancss:report or mvn site -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
......@@ -1276,11 +1292,6 @@
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<version>1.29</version>
</plugin>
</plugins>
</pluginManagement>
......
......@@ -8,6 +8,7 @@ ATLAS-54 Rename configs in hive hook (shwethags)
ATLAS-3 Mixed Index creation fails with Date types (suma.shivaprasad via shwethags)
ALL CHANGES:
ATLAS-25 Fix Atlas on Java 8 (sandeep.samudrala via shwethags)
ATLAS-86 Jenkins build failing as of build #41 (shwethags)
ATLAS-80 Support for variables in application properties (shwethags)
ATLAS-37 atlas repository, webapp, hive-bridge tests fails with Hbase and Solr as Titan storage backend (suma.shivaprasad via shwethags)
......
......@@ -96,7 +96,7 @@ public final class GraphHelper {
public static String vertexString(final Vertex vertex) {
StringBuilder properties = new StringBuilder();
for (String propertyKey : vertex.getPropertyKeys()) {
properties.append(propertyKey).append("=").append(vertex.getProperty(propertyKey)).append(", ");
properties.append(propertyKey).append("=").append(vertex.getProperty(propertyKey).toString()).append(", ");
}
return "v[" + vertex.getId() + "], Properties[" + properties + "]";
......
......@@ -176,7 +176,7 @@ public class EnumTest extends BaseTest {
"\tl : \t" + TEST_DATE + "\n" +
"\tm : \t[1, 1]\n" +
"\tn : \t[1.1, 1.1]\n" +
"\to : \t{b=2.0, a=1.0}\n" +
"\to : \t{a=1.0, b=2.0}\n" +
"\tenum4 : \tPARTITION\n" +
"}");
}
......@@ -208,7 +208,7 @@ public class EnumTest extends BaseTest {
"\tl : \t" + TEST_DATE + "\n" +
"\tm : \t[1, 1]\n" +
"\tn : \t[1.1, 1.1]\n" +
"\to : \t{b=2.0, a=1.0}\n" +
"\to : \t{a=1.0, b=2.0}\n" +
"\tenum4 : \tPARTITION\n" +
"}");
}
......@@ -245,7 +245,7 @@ public class EnumTest extends BaseTest {
"\tl : \t" + TEST_DATE + "\n" +
"\tm : \t[1, 1]\n" +
"\tn : \t[1.1, 1.1]\n" +
"\to : \t{b=2.0, a=1.0}\n" +
"\to : \t{a=1.0, b=2.0}\n" +
"\tenum4 : \tPARTITION\n" +
"}");
}
......@@ -286,7 +286,7 @@ public class EnumTest extends BaseTest {
"\tm : \t[1, 1]\n" +
"\tn : \t[1.100000000000000088817841970012523233890533447265625, 1" +
".100000000000000088817841970012523233890533447265625]\n" +
"\to : \t{b=2.0, a=1.0}\n" +
"\to : \t{a=1.0, b=2.0}\n" +
"\tenum4 : \tPARTITION\n" +
"}");
}
......
......@@ -60,7 +60,7 @@ public class StructTest extends BaseTest {
"\tl : \t" + TEST_DATE + "\n" +
"\tm : \t[1, 1]\n" +
"\tn : \t[1.1, 1.1]\n" +
"\to : \t{b=2.0, a=1.0}\n" +
"\to : \t{a=1.0, b=2.0}\n" +
"}");
}
......@@ -104,7 +104,7 @@ public class StructTest extends BaseTest {
"\tm : \t[1, 1]\n" +
"\tn : \t[1.100000000000000088817841970012523233890533447265625, 1" +
".100000000000000088817841970012523233890533447265625]\n" +
"\to : \t{b=2.0, a=1.0}\n" +
"\to : \t{a=1.0, b=2.0}\n" +
"}");
}
......
......@@ -18,8 +18,11 @@
package org.apache.atlas.typesystem.types;
import com.google.common.collect.ImmutableSortedMap;
import org.apache.atlas.AtlasException;
import java.util.Map;
abstract class AbstractDataType<T> implements IDataType<T> {
protected T convertNull(Multiplicity m) throws AtlasException {
......@@ -31,7 +34,13 @@ abstract class AbstractDataType<T> implements IDataType<T> {
@Override
public void output(T val, Appendable buf, String prefix) throws AtlasException {
TypeUtils.outputVal(val == null ? "<null>" : val.toString(), buf, prefix);
if (val instanceof Map) {
ImmutableSortedMap immutableSortedMap = ImmutableSortedMap.copyOf((Map) val);
TypeUtils.outputVal(val == null ? "<null>" : immutableSortedMap.toString(), buf, prefix);
} else {
TypeUtils.outputVal(val == null ? "<null>" : val.toString(), buf, prefix);
}
}
}
......@@ -162,7 +162,7 @@ public class EnumTest extends BaseTest {
"\tl : \t" + TEST_DATE + "\n" +
"\tm : \t[1, 1]\n" +
"\tn : \t[1.1, 1.1]\n" +
"\to : \t{b=2.0, a=1.0}\n" +
"\to : \t{a=1.0, b=2.0}\n" +
"\tenum4 : \tPARTITION\n" +
"}");
}
......@@ -194,7 +194,7 @@ public class EnumTest extends BaseTest {
"\tl : \t" + TEST_DATE + "\n" +
"\tm : \t[1, 1]\n" +
"\tn : \t[1.1, 1.1]\n" +
"\to : \t{b=2.0, a=1.0}\n" +
"\to : \t{a=1.0, b=2.0}\n" +
"\tenum4 : \tPARTITION\n" +
"}");
}
......
......@@ -56,7 +56,7 @@ public class StructTest extends BaseTest {
"\tl : \t" + TEST_DATE + "\n" +
"\tm : \t[1, 1]\n" +
"\tn : \t[1.1, 1.1]\n" +
"\to : \t{b=2.0, a=1.0}\n" +
"\to : \t{a=1.0, b=2.0}\n" +
"}");
}
......
......@@ -44,18 +44,18 @@ class SerializationTest extends BaseTest {
val s: Struct = BaseTest.createStruct()
val ts: ITypedStruct = structType.convert(s, Multiplicity.REQUIRED)
Assert.assertEquals(ts.toString, "{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t" + BaseTest.TEST_DATE + "\n\tm : \t[1, 1]\n\tn : \t[1.1, 1.1]\n\to : \t{b=2.0, a=1.0}\n}")
Assert.assertEquals(ts.toString, "{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t" + BaseTest.TEST_DATE + "\n\tm : \t[1, 1]\n\tn : \t[1.1, 1.1]\n\to : \t{a=1.0, b=2.0}\n}")
implicit val formats = org.json4s.native.Serialization.formats(NoTypeHints) + new TypedStructSerializer +
new BigDecimalSerializer + new BigIntegerSerializer
//Json representation
val ser = swrite(ts)
Assert.assertEquals(ser, "{\"$typeName$\":\"t1\",\"e\":1,\"n\":[1.1,1.1],\"h\":1.0,\"b\":true,\"k\":1,\"j\":1,\"d\":2,\"m\":[1,1],\"g\":1,\"a\":1,\"i\":1.0,\"c\":1,\"l\":\"" + BaseTest.TEST_DATE + "\",\"f\":1,\"o\":{\"b\":2.0,\"a\":1.0}}")
val ser1 = swrite(ts.toString)
Assert.assertEquals(ser1, "\"{\\n\\ta : \\t1\\n\\tb : \\ttrue\\n\\tc : \\t1\\n\\td : \\t2\\n\\te : \\t1\\n\\tf : \\t1\\n\\tg : \\t1\\n\\th : \\t1.0\\n\\ti : \\t1.0\\n\\tj : \\t1\\n\\tk : \\t1\\n\\tl : \\t" + BaseTest.TEST_DATE + "\\n\\tm : \\t[1, 1]\\n\\tn : \\t[1.1, 1.1]\\n\\to : \\t{a=1.0, b=2.0}\\n}\"");
// Typed Struct read back
val ts1 = read[StructInstance](ser)
Assert.assertEquals(ts1.toString, "{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t" + BaseTest.TEST_DATE + "\n\tm : \t[1, 1]\n\tn : \t[1.100000000000000088817841970012523233890533447265625, 1.100000000000000088817841970012523233890533447265625]\n\to : \t{b=2.0, a=1.0}\n}")
Assert.assertEquals(ts1.toString, "{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t" + BaseTest.TEST_DATE + "\n\tm : \t[1, 1]\n\tn : \t[1.100000000000000088817841970012523233890533447265625, 1.100000000000000088817841970012523233890533447265625]\n\to : \t{a=1.0, b=2.0}\n}")
}
@Test def test2 {
......@@ -68,9 +68,9 @@ class SerializationTest extends BaseTest {
val ts1 = read[StructInstance](
"""
{"$typeName$":"t1","e":1,"n":[1.1,1.1],"h":1.0,"b":true,"k":1,"j":1,"d":2,"m":[1,1],"g":1,"a":1,"i":1.0,
"c":1,"l":"2014-12-03T19:38:55.053Z","f":1,"o":{"b":2.0,"a":1.0}}""")
"c":1,"l":"2014-12-03T19:38:55.053Z","f":1,"o":{"a":1.0,"b":2.0}}""")
// Typed Struct read from string
Assert.assertEquals(ts1.toString, "{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t2014-12-03T19:38:55.053Z\n\tm : \t[1, 1]\n\tn : \t[1.100000000000000088817841970012523233890533447265625, 1.100000000000000088817841970012523233890533447265625]\n\to : \t{b=2.0, a=1.0}\n}")
Assert.assertEquals(ts1.toString, "{\n\ta : \t1\n\tb : \ttrue\n\tc : \t1\n\td : \t2\n\te : \t1\n\tf : \t1\n\tg : \t1\n\th : \t1.0\n\ti : \t1.0\n\tj : \t1\n\tk : \t1\n\tl : \t2014-12-03T19:38:55.053Z\n\tm : \t[1, 1]\n\tn : \t[1.100000000000000088817841970012523233890533447265625, 1.100000000000000088817841970012523233890533447265625]\n\to : \t{a=1.0, b=2.0}\n}")
}
@Test def testTrait {
......
......@@ -38,6 +38,35 @@
<debug.jetty.daemon>true</debug.jetty.daemon>
</properties>
<profiles>
<profile>
<id>jdk7</id>
<activation>
<jdk>[1.7,1.8)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>docs</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- the directory where to put the docs -->
<docsDir>${project.build.directory}/apidocs</docsDir>
<configFile>${basedir}/../src/build/enunciate.xml</configFile>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.apache.atlas</groupId>
......@@ -278,23 +307,6 @@
</plugin>
<plugin>
<groupId>org.codehaus.enunciate</groupId>
<artifactId>maven-enunciate-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>docs</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- the directory where to put the docs -->
<docsDir>${project.build.directory}/apidocs</docsDir>
<configFile>${basedir}/../src/build/enunciate.xml</configFile>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>keytool-maven-plugin</artifactId>
<executions>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment