Commit 461a2a4e by Shwetha GS

ATLAS-209 Use testng and delete junit and scalatest (ltfxyz via shwethags)

parent 538fa496
...@@ -991,13 +991,6 @@ ...@@ -991,13 +991,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.binary.version}</artifactId>
<version>2.2.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalamacros</groupId> <groupId>org.scalamacros</groupId>
<artifactId>quasiquotes_${scala.binary.version}</artifactId> <artifactId>quasiquotes_${scala.binary.version}</artifactId>
<version>${scala.macros.version}</version> <version>${scala.macros.version}</version>
...@@ -1108,14 +1101,6 @@ ...@@ -1108,14 +1101,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- todo - use testng and delete junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>org.easymock</groupId> <groupId>org.easymock</groupId>
<artifactId>easymock</artifactId> <artifactId>easymock</artifactId>
...@@ -1409,11 +1394,6 @@ ...@@ -1409,11 +1394,6 @@
<artifactId>surefire-testng</artifactId> <artifactId>surefire-testng</artifactId>
<version>2.18.1</version> <version>2.18.1</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies> </dependencies>
</plugin> </plugin>
......
...@@ -9,6 +9,7 @@ ATLAS-54 Rename configs in hive hook (shwethags) ...@@ -9,6 +9,7 @@ ATLAS-54 Rename configs in hive hook (shwethags)
ATLAS-3 Mixed Index creation fails with Date types (sumasai via shwethags) ATLAS-3 Mixed Index creation fails with Date types (sumasai via shwethags)
ALL CHANGES: ALL CHANGES:
ATLAS-209 Use testng and delete junit and scalatest (ltfxyz via shwethags)
ATLAS-163 New Trait UI (Tag) ( darshankumar89 via sumasai) ATLAS-163 New Trait UI (Tag) ( darshankumar89 via sumasai)
ATLAS-199 webapp build fails (grunt + tests) ( darshankumar89 via sumasai) ATLAS-199 webapp build fails (grunt + tests) ( darshankumar89 via sumasai)
ATLAS-204 Lineage I/O Lineage Enhancement ( Anilsg via sumasai ) ATLAS-204 Lineage I/O Lineage Enhancement ( Anilsg via sumasai )
......
...@@ -155,12 +155,6 @@ ...@@ -155,12 +155,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.binary.version}</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalamacros</groupId> <groupId>org.scalamacros</groupId>
<artifactId>quasiquotes_${scala.binary.version}</artifactId> <artifactId>quasiquotes_${scala.binary.version}</artifactId>
</dependency> </dependency>
...@@ -176,11 +170,6 @@ ...@@ -176,11 +170,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId> <groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId> <artifactId>mockito-all</artifactId>
</dependency> </dependency>
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
package org.apache.atlas.repository; package org.apache.atlas.repository;
import org.apache.atlas.typesystem.types.TypeSystem; import org.apache.atlas.typesystem.types.TypeSystem;
import org.junit.Before; import org.testng.annotations.BeforeMethod;
public abstract class BaseTest { public abstract class BaseTest {
@Before @BeforeMethod
public void setup() throws Exception { public void setup() throws Exception {
TypeSystem ts = TypeSystem.getInstance(); TypeSystem ts = TypeSystem.getInstance();
ts.reset(); ts.reset();
......
...@@ -23,7 +23,6 @@ import com.thinkaurelius.titan.core.util.TitanCleanup; ...@@ -23,7 +23,6 @@ import com.thinkaurelius.titan.core.util.TitanCleanup;
import com.tinkerpop.blueprints.Direction; import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.blueprints.Edge; import com.tinkerpop.blueprints.Edge;
import com.tinkerpop.blueprints.Vertex; import com.tinkerpop.blueprints.Vertex;
import junit.framework.Assert;
import org.apache.atlas.AtlasException; import org.apache.atlas.AtlasException;
import org.apache.atlas.GraphTransaction; import org.apache.atlas.GraphTransaction;
import org.apache.atlas.RepositoryMetadataModule; import org.apache.atlas.RepositoryMetadataModule;
...@@ -44,6 +43,7 @@ import org.testng.annotations.AfterClass; ...@@ -44,6 +43,7 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Guice; import org.testng.annotations.Guice;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import org.testng.Assert;
import javax.inject.Inject; import javax.inject.Inject;
import java.util.List; import java.util.List;
...@@ -121,7 +121,7 @@ public class GraphBackedTypeStoreTest { ...@@ -121,7 +121,7 @@ public class GraphBackedTypeStoreTest {
clsTypeFound = true; clsTypeFound = true;
} }
} }
Assert.assertTrue("Manager type not restored", clsTypeFound); Assert.assertTrue(clsTypeFound, "Manager type not restored");
//validate trait //validate trait
List<HierarchicalTypeDefinition<TraitType>> traitTypes = types.traitTypesAsJavaList(); List<HierarchicalTypeDefinition<TraitType>> traitTypes = types.traitTypesAsJavaList();
......
...@@ -20,11 +20,11 @@ package org.apache.atlas.query ...@@ -20,11 +20,11 @@ package org.apache.atlas.query
import org.apache.atlas.query.Expressions._ import org.apache.atlas.query.Expressions._
import org.apache.atlas.repository.BaseTest import org.apache.atlas.repository.BaseTest
import org.junit.{Before, Test} import org.testng.annotations.{BeforeMethod,Test}
class ExpressionTest extends BaseTest { class ExpressionTest extends BaseTest {
@Before @BeforeMethod
override def setup { override def setup {
super.setup super.setup
......
...@@ -24,18 +24,16 @@ import org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy ...@@ -24,18 +24,16 @@ import org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy
import org.apache.atlas.query.Expressions._ import org.apache.atlas.query.Expressions._
import org.apache.atlas.repository.graph.{TitanGraphProvider, GraphBackedMetadataRepository} import org.apache.atlas.repository.graph.{TitanGraphProvider, GraphBackedMetadataRepository}
import org.apache.atlas.typesystem.types.TypeSystem import org.apache.atlas.typesystem.types.TypeSystem
import org.junit.runner.RunWith import org.testng.annotations.{Test,BeforeClass,AfterClass}
import org.scalatest._
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner]) class GremlinTest2 extends BaseGremlinTest {
class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest {
var g: TitanGraph = null var g: TitanGraph = null
var gProvider:TitanGraphProvider = null; var gProvider:TitanGraphProvider = null;
var gp:GraphPersistenceStrategies = null; var gp:GraphPersistenceStrategies = null;
override def beforeAll() { @BeforeClass
def beforeAll() {
TypeSystem.getInstance().reset() TypeSystem.getInstance().reset()
QueryTestsUtils.setupTypes QueryTestsUtils.setupTypes
gProvider = new TitanGraphProvider(); gProvider = new TitanGraphProvider();
...@@ -43,7 +41,8 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest ...@@ -43,7 +41,8 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest
g = QueryTestsUtils.setupTestGraph(gProvider) g = QueryTestsUtils.setupTestGraph(gProvider)
} }
override def afterAll() { @AfterClass
def afterAll() {
g.shutdown() g.shutdown()
try { try {
TitanCleanup.clear(g); TitanCleanup.clear(g);
...@@ -53,43 +52,43 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest ...@@ -53,43 +52,43 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest
} }
} }
test("testTraitSelect") { @Test def testTraitSelect {
val r = QueryProcessor.evaluate(_class("Table").as("t").join("Dimension").as("dim").select(id("t"), id("dim")), g) val r = QueryProcessor.evaluate(_class("Table").as("t").join("Dimension").as("dim").select(id("t"), id("dim")), g)
validateJson(r, "{\n \"query\":\"Table as t.Dimension as dim select t as _col_0, dim as _col_1\",\n \"dataType\":{\n \"typeName\":\"\",\n \"attributeDefinitions\":[\n {\n \"name\":\"_col_0\",\n \"dataTypeName\":\"Table\",\n \"multiplicity\":{\n \"lower\":0,\n \"upper\":1,\n \"isUnique\":false\n },\n \"isComposite\":false,\n \"isUnique\":false,\n \"isIndexable\":true,\n \"reverseAttributeName\":null\n },\n {\n \"name\":\"_col_1\",\n \"dataTypeName\":\"Dimension\",\n \"multiplicity\":{\n \"lower\":0,\n \"upper\":1,\n \"isUnique\":false\n },\n \"isComposite\":false,\n \"isUnique\":false,\n \"isIndexable\":true,\n \"reverseAttributeName\":null\n }\n ]\n },\n \"rows\":[\n {\n \"$typeName$\":\"\",\n \"_col_1\":{\n \"$typeName$\":\"Dimension\"\n },\n \"_col_0\":{\n \"id\":\"3328\",\n \"$typeName$\":\"Table\",\n \"version\":0\n }\n },\n {\n \"$typeName$\":\"\",\n \"_col_1\":{\n \"$typeName$\":\"Dimension\"\n },\n \"_col_0\":{\n \"id\":\"4864\",\n \"$typeName$\":\"Table\",\n \"version\":0\n }\n },\n {\n \"$typeName$\":\"\",\n \"_col_1\":{\n \"$typeName$\":\"Dimension\"\n },\n \"_col_0\":{\n \"id\":\"6656\",\n \"$typeName$\":\"Table\",\n \"version\":0\n }\n }\n ]\n}") validateJson(r, "{\n \"query\":\"Table as t.Dimension as dim select t as _col_0, dim as _col_1\",\n \"dataType\":{\n \"typeName\":\"\",\n \"attributeDefinitions\":[\n {\n \"name\":\"_col_0\",\n \"dataTypeName\":\"Table\",\n \"multiplicity\":{\n \"lower\":0,\n \"upper\":1,\n \"isUnique\":false\n },\n \"isComposite\":false,\n \"isUnique\":false,\n \"isIndexable\":true,\n \"reverseAttributeName\":null\n },\n {\n \"name\":\"_col_1\",\n \"dataTypeName\":\"Dimension\",\n \"multiplicity\":{\n \"lower\":0,\n \"upper\":1,\n \"isUnique\":false\n },\n \"isComposite\":false,\n \"isUnique\":false,\n \"isIndexable\":true,\n \"reverseAttributeName\":null\n }\n ]\n },\n \"rows\":[\n {\n \"$typeName$\":\"\",\n \"_col_1\":{\n \"$typeName$\":\"Dimension\"\n },\n \"_col_0\":{\n \"id\":\"3328\",\n \"$typeName$\":\"Table\",\n \"version\":0\n }\n },\n {\n \"$typeName$\":\"\",\n \"_col_1\":{\n \"$typeName$\":\"Dimension\"\n },\n \"_col_0\":{\n \"id\":\"4864\",\n \"$typeName$\":\"Table\",\n \"version\":0\n }\n },\n {\n \"$typeName$\":\"\",\n \"_col_1\":{\n \"$typeName$\":\"Dimension\"\n },\n \"_col_0\":{\n \"id\":\"6656\",\n \"$typeName$\":\"Table\",\n \"version\":0\n }\n }\n ]\n}")
} }
test("testTrait") { @Test def testTrait {
val r = QueryProcessor.evaluate(_trait("Dimension"), g) val r = QueryProcessor.evaluate(_trait("Dimension"), g)
validateJson(r) validateJson(r)
} }
test("testTraitInstance") { @Test def testTraitInstance {
val r = QueryProcessor.evaluate(_trait("Dimension").traitInstance(), g) val r = QueryProcessor.evaluate(_trait("Dimension").traitInstance(), g)
validateJson(r) validateJson(r)
} }
test("testInstanceAddedToFilter") { @Test def testInstanceAddedToFilter {
val r = QueryProcessor.evaluate(_trait("Dimension").hasField("typeName"), g) val r = QueryProcessor.evaluate(_trait("Dimension").hasField("typeName"), g)
validateJson(r) validateJson(r)
} }
test("testInstanceFilter") { @Test def testInstanceFilter {
val r = QueryProcessor.evaluate(_trait("Dimension").traitInstance().hasField("name"), g) val r = QueryProcessor.evaluate(_trait("Dimension").traitInstance().hasField("name"), g)
validateJson(r) validateJson(r)
} }
test("testLineageWithPath") { @Test def testLineageWithPath {
val r = QueryProcessor.evaluate(_class("Table").loop(id("LoadProcess").field("outputTable")).path(), g) val r = QueryProcessor.evaluate(_class("Table").loop(id("LoadProcess").field("outputTable")).path(), g)
validateJson(r) validateJson(r)
} }
test("testLineageAllSelectWithPath") { @Test def testLineageAllSelectWithPath {
val r = QueryProcessor.evaluate(_class("Table").as("src").loop(id("LoadProcess").field("outputTable")).as("dest"). val r = QueryProcessor.evaluate(_class("Table").as("src").loop(id("LoadProcess").field("outputTable")).as("dest").
select(id("src").field("name").as("srcTable"), id("dest").field("name").as("destTable")).path(), g) select(id("src").field("name").as("srcTable"), id("dest").field("name").as("destTable")).path(), g)
validateJson(r) validateJson(r)
} }
test("testLineageAllSelectWithPathFromParser") { @Test def testLineageAllSelectWithPathFromParser {
val p = new QueryParser val p = new QueryParser
val e = p("Table as src loop (LoadProcess outputTable) as dest " + val e = p("Table as src loop (LoadProcess outputTable) as dest " +
"select src.name as srcTable, dest.name as destTable withPath").right.get "select src.name as srcTable, dest.name as destTable withPath").right.get
...@@ -98,7 +97,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest ...@@ -98,7 +97,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest
validateJson(r) validateJson(r)
} }
test("testLineageAllSelectWithPathFromParser2") { @Test def testLineageAllSelectWithPathFromParser2 {
val p = new QueryParser val p = new QueryParser
val e = p("Table as src loop (`LoadProcess->outputTable` inputTables) as dest " + val e = p("Table as src loop (`LoadProcess->outputTable` inputTables) as dest " +
...@@ -107,7 +106,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest ...@@ -107,7 +106,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest
validateJson(r) validateJson(r)
} }
test("testHighLevelLineage") { @Test def testHighLevelLineage {
val r = HiveLineageQuery("Table", "sales_fact_monthly_mv", val r = HiveLineageQuery("Table", "sales_fact_monthly_mv",
"LoadProcess", "LoadProcess",
"inputTables", "inputTables",
...@@ -116,7 +115,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest ...@@ -116,7 +115,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest
validateJson(r) validateJson(r)
} }
test("testHighLevelLineageReturnGraph") { @Test def testHighLevelLineageReturnGraph {
val r = HiveLineageQuery("Table", "sales_fact_monthly_mv", val r = HiveLineageQuery("Table", "sales_fact_monthly_mv",
"LoadProcess", "LoadProcess",
"inputTables", "inputTables",
...@@ -127,7 +126,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest ...@@ -127,7 +126,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest
//validateJson(r) //validateJson(r)
} }
test("testHighLevelWhereUsed") { @Test def testHighLevelWhereUsed {
val r = HiveWhereUsedQuery("Table", "sales_fact", val r = HiveWhereUsedQuery("Table", "sales_fact",
"LoadProcess", "LoadProcess",
"inputTables", "inputTables",
...@@ -136,7 +135,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest ...@@ -136,7 +135,7 @@ class GremlinTest2 extends FunSuite with BeforeAndAfterAll with BaseGremlinTest
validateJson(r) validateJson(r)
} }
test("testHighLevelWhereUsedReturnGraph") { @Test def testHighLevelWhereUsedReturnGraph {
val r = HiveWhereUsedQuery("Table", "sales_fact", val r = HiveWhereUsedQuery("Table", "sales_fact",
"LoadProcess", "LoadProcess",
"inputTables", "inputTables",
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
package org.apache.atlas.query package org.apache.atlas.query
import org.junit.{Assert, Test} import org.testng.Assert
import org.testng.annotations.Test
import scala.util.parsing.input.CharArrayReader import scala.util.parsing.input.CharArrayReader
......
...@@ -24,18 +24,16 @@ import org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy ...@@ -24,18 +24,16 @@ import org.apache.atlas.discovery.graph.DefaultGraphPersistenceStrategy
import org.apache.atlas.query.Expressions._ import org.apache.atlas.query.Expressions._
import org.apache.atlas.repository.graph.{GraphBackedMetadataRepository, TitanGraphProvider} import org.apache.atlas.repository.graph.{GraphBackedMetadataRepository, TitanGraphProvider}
import org.apache.atlas.typesystem.types.TypeSystem import org.apache.atlas.typesystem.types.TypeSystem
import org.junit.runner.RunWith import org.testng.annotations.{Test,BeforeClass,AfterClass}
import org.scalatest.junit.JUnitRunner
import org.scalatest.{Assertions, BeforeAndAfterAll, FunSuite}
@RunWith(classOf[JUnitRunner]) class LineageQueryTest extends BaseGremlinTest {
class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinTest {
var g: TitanGraph = null var g: TitanGraph = null
var gProvider:TitanGraphProvider = null; var gProvider:TitanGraphProvider = null;
var gp:GraphPersistenceStrategies = null; var gp:GraphPersistenceStrategies = null;
override def beforeAll() { @BeforeClass
def beforeAll() {
TypeSystem.getInstance().reset() TypeSystem.getInstance().reset()
QueryTestsUtils.setupTypes QueryTestsUtils.setupTypes
gProvider = new TitanGraphProvider(); gProvider = new TitanGraphProvider();
...@@ -43,7 +41,8 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT ...@@ -43,7 +41,8 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT
g = QueryTestsUtils.setupTestGraph(gProvider) g = QueryTestsUtils.setupTestGraph(gProvider)
} }
override def afterAll() { @AfterClass
def afterAll() {
g.shutdown() g.shutdown()
try { try {
TitanCleanup.clear(g); TitanCleanup.clear(g);
...@@ -55,7 +54,7 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT ...@@ -55,7 +54,7 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT
val PREFIX_SPACES_REGEX = ("\\n\\s*").r val PREFIX_SPACES_REGEX = ("\\n\\s*").r
test("testInputTables") { @Test def testInputTables {
val r = QueryProcessor.evaluate(_class("LoadProcess").field("inputTables"), g, gp) val r = QueryProcessor.evaluate(_class("LoadProcess").field("inputTables"), g, gp)
val x = r.toJson val x = r.toJson
validateJson(r,"""{ validateJson(r,"""{
...@@ -183,12 +182,12 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT ...@@ -183,12 +182,12 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT
""".stripMargin) """.stripMargin)
} }
test("testLoadProcessOut") { @Test def testLoadProcessOut {
val r = QueryProcessor.evaluate(_class("Table").field("LoadProcess").field("outputTable"), g, gp) val r = QueryProcessor.evaluate(_class("Table").field("LoadProcess").field("outputTable"), g, gp)
validateJson(r, null) validateJson(r, null)
} }
test("testLineageAll") { @Test def testLineageAll {
val r = QueryProcessor.evaluate(_class("Table").loop(id("LoadProcess").field("outputTable")), g, gp) val r = QueryProcessor.evaluate(_class("Table").loop(id("LoadProcess").field("outputTable")), g, gp)
validateJson(r, """{ validateJson(r, """{
| "query":"Table as _loop0 loop (LoadProcess outputTable)", | "query":"Table as _loop0 loop (LoadProcess outputTable)",
...@@ -343,7 +342,7 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT ...@@ -343,7 +342,7 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT
|}""".stripMargin) |}""".stripMargin)
} }
test("testLineageAllSelect") { @Test def testLineageAllSelect {
val r = QueryProcessor.evaluate(_class("Table").as("src").loop(id("LoadProcess").field("outputTable")).as("dest"). val r = QueryProcessor.evaluate(_class("Table").as("src").loop(id("LoadProcess").field("outputTable")).as("dest").
select(id("src").field("name").as("srcTable"), id("dest").field("name").as("destTable")), g, gp) select(id("src").field("name").as("srcTable"), id("dest").field("name").as("destTable")), g, gp)
validateJson(r, """{ validateJson(r, """{
...@@ -409,7 +408,7 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT ...@@ -409,7 +408,7 @@ class LineageQueryTest extends FunSuite with BeforeAndAfterAll with BaseGremlinT
}""".stripMargin) }""".stripMargin)
} }
test("testLineageFixedDepth") { @Test def testLineageFixedDepth {
val r = QueryProcessor.evaluate(_class("Table").loop(id("LoadProcess").field("outputTable"), int(1)), g, gp) val r = QueryProcessor.evaluate(_class("Table").loop(id("LoadProcess").field("outputTable"), int(1)), g, gp)
validateJson(r, """{ validateJson(r, """{
| "query":"Table as _loop0 loop (LoadProcess outputTable) times 1", | "query":"Table as _loop0 loop (LoadProcess outputTable) times 1",
......
...@@ -19,12 +19,12 @@ ...@@ -19,12 +19,12 @@
package org.apache.atlas.query package org.apache.atlas.query
import org.apache.atlas.repository.BaseTest import org.apache.atlas.repository.BaseTest
import org.junit.{Before, Test} import org.testng.annotations.{BeforeMethod,Test}
class ParserTest extends BaseTest { class ParserTest extends BaseTest {
@Before @BeforeMethod
override def setup { override def setup {
super.setup super.setup
QueryTestsUtils.setupTypes QueryTestsUtils.setupTypes
......
...@@ -30,7 +30,6 @@ import org.apache.atlas.typesystem.types._ ...@@ -30,7 +30,6 @@ import org.apache.atlas.typesystem.types._
import org.apache.commons.configuration.{Configuration, ConfigurationException, MapConfiguration} import org.apache.commons.configuration.{Configuration, ConfigurationException, MapConfiguration}
import org.apache.commons.io.FileUtils import org.apache.commons.io.FileUtils
import org.json.JSONObject import org.json.JSONObject
import org.scalatest.{Assertions, BeforeAndAfterAll, FunSuite}
import org.skyscreamer.jsonassert.JSONAssert import org.skyscreamer.jsonassert.JSONAssert
...@@ -170,8 +169,6 @@ object QueryTestsUtils extends GraphUtils { ...@@ -170,8 +169,6 @@ object QueryTestsUtils extends GraphUtils {
} }
trait BaseGremlinTest { trait BaseGremlinTest {
self : FunSuite with BeforeAndAfterAll =>
val STRUCT_NAME_REGEX = (TypeUtils.TEMP_STRUCT_NAME_PREFIX + "\\d+").r val STRUCT_NAME_REGEX = (TypeUtils.TEMP_STRUCT_NAME_PREFIX + "\\d+").r
def validateJson(r: GremlinQueryResult, expected: String = null): Unit = { def validateJson(r: GremlinQueryResult, expected: String = null): Unit = {
val rJ = r.toJson val rJ = r.toJson
......
...@@ -70,12 +70,6 @@ ...@@ -70,12 +70,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_${scala.binary.version}</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scalamacros</groupId> <groupId>org.scalamacros</groupId>
<artifactId>quasiquotes_${scala.binary.version}</artifactId> <artifactId>quasiquotes_${scala.binary.version}</artifactId>
</dependency> </dependency>
...@@ -106,11 +100,6 @@ ...@@ -106,11 +100,6 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
</dependency> </dependency>
......
...@@ -34,9 +34,9 @@ import org.apache.atlas.typesystem.types.Multiplicity; ...@@ -34,9 +34,9 @@ import org.apache.atlas.typesystem.types.Multiplicity;
import org.apache.atlas.typesystem.types.StructTypeDefinition; import org.apache.atlas.typesystem.types.StructTypeDefinition;
import org.apache.atlas.typesystem.types.TraitType; import org.apache.atlas.typesystem.types.TraitType;
import org.apache.atlas.typesystem.types.TypeSystem; import org.apache.atlas.typesystem.types.TypeSystem;
import org.junit.Assert; import org.testng.annotations.BeforeMethod;
import org.junit.Before; import org.testng.annotations.Test;
import org.junit.Test; import org.testng.Assert;
import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef; import static org.apache.atlas.typesystem.types.utils.TypesUtil.createClassTypeDef;
import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef; import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAttrDef;
...@@ -45,7 +45,7 @@ import static org.apache.atlas.typesystem.types.utils.TypesUtil.createTraitTypeD ...@@ -45,7 +45,7 @@ import static org.apache.atlas.typesystem.types.utils.TypesUtil.createTraitTypeD
public class SerializationJavaTest extends BaseTest { public class SerializationJavaTest extends BaseTest {
@Before @BeforeMethod
public void setup() throws Exception { public void setup() throws Exception {
super.setup(); super.setup();
} }
......
...@@ -25,7 +25,7 @@ import org.apache.atlas.AtlasException; ...@@ -25,7 +25,7 @@ import org.apache.atlas.AtlasException;
import org.apache.atlas.typesystem.Referenceable; import org.apache.atlas.typesystem.Referenceable;
import org.apache.atlas.typesystem.Struct; import org.apache.atlas.typesystem.Struct;
import org.apache.atlas.typesystem.types.utils.TypesUtil; import org.apache.atlas.typesystem.types.utils.TypesUtil;
import org.junit.Before; import org.testng.annotations.BeforeMethod;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
...@@ -67,7 +67,7 @@ public abstract class BaseTest { ...@@ -67,7 +67,7 @@ public abstract class BaseTest {
return TypeSystem.getInstance(); return TypeSystem.getInstance();
} }
@Before @BeforeMethod
public void setup() throws Exception { public void setup() throws Exception {
TypeSystem ts = TypeSystem.getInstance(); TypeSystem ts = TypeSystem.getInstance();
ts.reset(); ts.reset();
...@@ -86,9 +86,8 @@ public abstract class BaseTest { ...@@ -86,9 +86,8 @@ public abstract class BaseTest {
TypesUtil.createOptionalAttrDef("k", DataTypes.BIGDECIMAL_TYPE), TypesUtil.createOptionalAttrDef("k", DataTypes.BIGDECIMAL_TYPE),
TypesUtil.createOptionalAttrDef("l", DataTypes.DATE_TYPE), TypesUtil.createOptionalAttrDef("l", DataTypes.DATE_TYPE),
TypesUtil.createOptionalAttrDef("m", ts.defineArrayType(DataTypes.INT_TYPE)), TypesUtil.createOptionalAttrDef("m", ts.defineArrayType(DataTypes.INT_TYPE)),
TypesUtil.createOptionalAttrDef("n", ts.defineArrayType(DataTypes.BIGDECIMAL_TYPE)), TypesUtil TypesUtil.createOptionalAttrDef("n", ts.defineArrayType(DataTypes.BIGDECIMAL_TYPE)),
.createOptionalAttrDef("o", TypesUtil.createOptionalAttrDef("o", ts.defineMapType(DataTypes.STRING_TYPE, DataTypes.DOUBLE_TYPE)));
ts.defineMapType(DataTypes.STRING_TYPE, DataTypes.DOUBLE_TYPE)));
System.out.println("defined structType = " + structType); System.out.println("defined structType = " + structType);
StructType recursiveStructType = StructType recursiveStructType =
......
...@@ -21,13 +21,13 @@ package org.apache.atlas.typesystem.types; ...@@ -21,13 +21,13 @@ package org.apache.atlas.typesystem.types;
import org.apache.atlas.AtlasException; import org.apache.atlas.AtlasException;
import org.apache.atlas.typesystem.ITypedReferenceableInstance; import org.apache.atlas.typesystem.ITypedReferenceableInstance;
import org.apache.atlas.typesystem.Referenceable; import org.apache.atlas.typesystem.Referenceable;
import org.junit.Assert; import org.testng.Assert;
import org.junit.Before; import org.testng.annotations.Test;
import org.junit.Test; import org.testng.annotations.BeforeMethod;
public class ClassTest extends BaseTest { public class ClassTest extends BaseTest {
@Before @BeforeMethod
public void setup() throws Exception { public void setup() throws Exception {
super.setup(); super.setup();
} }
......
...@@ -27,9 +27,9 @@ import org.apache.atlas.typesystem.ITypedReferenceableInstance; ...@@ -27,9 +27,9 @@ import org.apache.atlas.typesystem.ITypedReferenceableInstance;
import org.apache.atlas.typesystem.ITypedStruct; import org.apache.atlas.typesystem.ITypedStruct;
import org.apache.atlas.typesystem.Referenceable; import org.apache.atlas.typesystem.Referenceable;
import org.apache.atlas.typesystem.Struct; import org.apache.atlas.typesystem.Struct;
import org.junit.Assert; import org.testng.Assert;
import org.junit.Before; import org.testng.annotations.Test;
import org.junit.Test; import org.testng.annotations.BeforeMethod;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
...@@ -42,7 +42,7 @@ import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAt ...@@ -42,7 +42,7 @@ import static org.apache.atlas.typesystem.types.utils.TypesUtil.createRequiredAt
public class EnumTest extends BaseTest { public class EnumTest extends BaseTest {
@Before @BeforeMethod
public void setup() throws Exception { public void setup() throws Exception {
super.setup(); super.setup();
} }
......
...@@ -21,16 +21,16 @@ package org.apache.atlas.typesystem.types; ...@@ -21,16 +21,16 @@ package org.apache.atlas.typesystem.types;
import org.apache.atlas.AtlasException; import org.apache.atlas.AtlasException;
import org.apache.atlas.typesystem.ITypedStruct; import org.apache.atlas.typesystem.ITypedStruct;
import org.apache.atlas.typesystem.Struct; import org.apache.atlas.typesystem.Struct;
import org.junit.Assert; import org.testng.Assert;
import org.junit.Before; import org.testng.annotations.Test;
import org.junit.Test; import org.testng.annotations.BeforeMethod;
public class StructTest extends BaseTest { public class StructTest extends BaseTest {
StructType structType; StructType structType;
StructType recursiveStructType; StructType recursiveStructType;
@Before @BeforeMethod
public void setup() throws Exception { public void setup() throws Exception {
super.setup(); super.setup();
structType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_1); structType = getTypeSystem().getDataType(StructType.class, STRUCT_TYPE_1);
......
...@@ -23,10 +23,9 @@ import org.apache.atlas.AtlasException; ...@@ -23,10 +23,9 @@ import org.apache.atlas.AtlasException;
import org.apache.atlas.typesystem.IStruct; import org.apache.atlas.typesystem.IStruct;
import org.apache.atlas.typesystem.ITypedStruct; import org.apache.atlas.typesystem.ITypedStruct;
import org.apache.atlas.typesystem.Struct; import org.apache.atlas.typesystem.Struct;
import org.junit.Assert; import org.testng.Assert;
import org.junit.Before; import org.testng.annotations.BeforeMethod;
import org.junit.Test; import org.testng.annotations.Test;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -37,7 +36,7 @@ import static org.apache.atlas.typesystem.types.utils.TypesUtil.createTraitTypeD ...@@ -37,7 +36,7 @@ import static org.apache.atlas.typesystem.types.utils.TypesUtil.createTraitTypeD
public class TraitTest extends BaseTest { public class TraitTest extends BaseTest {
@Before @BeforeMethod
public void setup() throws Exception { public void setup() throws Exception {
super.setup(); super.setup();
} }
...@@ -54,7 +53,7 @@ public class TraitTest extends BaseTest { ...@@ -54,7 +53,7 @@ public class TraitTest extends BaseTest {
* complete Path. * complete Path.
* For e.g. the 'b' attribute in A (that is a superType for B) is hidden the 'b' attribute * For e.g. the 'b' attribute in A (that is a superType for B) is hidden the 'b' attribute
* in B. * in B.
* So it is availabel by the name 'A.B.D.b' * So it is available by the name 'A.B.D.b'
* *
* - Another way to set attributes is to cast. Casting a 'D' instance of 'B' makes the 'A.B.D * - Another way to set attributes is to cast. Casting a 'D' instance of 'B' makes the 'A.B.D
* .b' attribute * .b' attribute
...@@ -176,8 +175,8 @@ public class TraitTest extends BaseTest { ...@@ -176,8 +175,8 @@ public class TraitTest extends BaseTest {
createOptionalAttrDef("d", DataTypes.SHORT_TYPE)); createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
HierarchicalTypeDefinition B = createTraitTypeDef("B", ImmutableList.<String>of("A"), HierarchicalTypeDefinition B = createTraitTypeDef("B", ImmutableList.<String>of("A"),
createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE)); createOptionalAttrDef("b", DataTypes.BOOLEAN_TYPE));
HierarchicalTypeDefinition C = HierarchicalTypeDefinition C = createTraitTypeDef("C", ImmutableList.<String>of("A"),
createTraitTypeDef("C", ImmutableList.<String>of("A"), createOptionalAttrDef("c", DataTypes.BYTE_TYPE)); createOptionalAttrDef("c", DataTypes.BYTE_TYPE));
HierarchicalTypeDefinition D = createTraitTypeDef("D", ImmutableList.<String>of("B", "C"), HierarchicalTypeDefinition D = createTraitTypeDef("D", ImmutableList.<String>of("B", "C"),
createOptionalAttrDef("d", DataTypes.SHORT_TYPE)); createOptionalAttrDef("d", DataTypes.SHORT_TYPE));
......
...@@ -20,13 +20,14 @@ package org.apache.atlas.typesystem.builders ...@@ -20,13 +20,14 @@ package org.apache.atlas.typesystem.builders
import org.apache.atlas.typesystem.TypesDef import org.apache.atlas.typesystem.TypesDef
import org.apache.atlas.typesystem.types.TypeSystem import org.apache.atlas.typesystem.types.TypeSystem
import org.scalatest.{BeforeAndAfter, FunSuite} import org.testng.annotations.BeforeMethod
abstract class BuilderTest extends FunSuite with BeforeAndAfter { abstract class BuilderTest {
var tDef : TypesDef = null var tDef : TypesDef = null
before { @BeforeMethod
def before {
TypeSystem.getInstance().reset() TypeSystem.getInstance().reset()
val b = new TypesBuilder val b = new TypesBuilder
......
...@@ -19,11 +19,11 @@ ...@@ -19,11 +19,11 @@
package org.apache.atlas.typesystem.builders package org.apache.atlas.typesystem.builders
import org.apache.atlas.typesystem.types.{ClassType, Multiplicity, TypeSystem} import org.apache.atlas.typesystem.types.{ClassType, Multiplicity, TypeSystem}
import org.testng.annotations.Test
class InstanceBuilderTest extends BuilderTest { class InstanceBuilderTest extends BuilderTest {
test("test1") { @Test def test1 {
TypeSystem.getInstance().defineTypes(tDef) TypeSystem.getInstance().defineTypes(tDef)
val b = new InstanceBuilder val b = new InstanceBuilder
......
...@@ -20,12 +20,12 @@ package org.apache.atlas.typesystem.builders ...@@ -20,12 +20,12 @@ package org.apache.atlas.typesystem.builders
import org.apache.atlas.AtlasException import org.apache.atlas.AtlasException
import org.apache.atlas.typesystem.types.{ClassType, Multiplicity, TypeSystem} import org.apache.atlas.typesystem.types.{ClassType, Multiplicity, TypeSystem}
import org.scalatest.{BeforeAndAfterAll, FunSuite} import org.testng.annotations.{BeforeMethod,Test}
class MultiplicityTest {
class MultiplicityTest extends FunSuite with BeforeAndAfterAll { @BeforeMethod
def beforeAll {
override def beforeAll() = {
TypeSystem.getInstance().reset() TypeSystem.getInstance().reset()
val b = new TypesBuilder val b = new TypesBuilder
...@@ -83,7 +83,8 @@ class MultiplicityTest extends FunSuite with BeforeAndAfterAll { ...@@ -83,7 +83,8 @@ class MultiplicityTest extends FunSuite with BeforeAndAfterAll {
TypeSystem.getInstance().defineTypes(tDef) TypeSystem.getInstance().defineTypes(tDef)
} }
test("test1") { @Test
def test1 {
val b = new InstanceBuilder val b = new InstanceBuilder
import b._ import b._
...@@ -108,7 +109,8 @@ class MultiplicityTest extends FunSuite with BeforeAndAfterAll { ...@@ -108,7 +109,8 @@ class MultiplicityTest extends FunSuite with BeforeAndAfterAll {
} }
} }
test("WrongMultiplicity") { @Test(expectedExceptions = Array(classOf[AtlasException]) , expectedExceptionsMessageRegExp = "A multiplicty of more than one requires a collection type for attribute 'stringSet'")
def WrongMultiplicity {
val b = new TypesBuilder val b = new TypesBuilder
import b._ import b._
val tDef = types { val tDef = types {
...@@ -117,9 +119,6 @@ class MultiplicityTest extends FunSuite with BeforeAndAfterAll { ...@@ -117,9 +119,6 @@ class MultiplicityTest extends FunSuite with BeforeAndAfterAll {
"stringSet" ~ (string, multiplicty(0, Int.MaxValue, true)) "stringSet" ~ (string, multiplicty(0, Int.MaxValue, true))
} }
} }
val me = intercept[AtlasException] {
TypeSystem.getInstance().defineTypes(tDef) TypeSystem.getInstance().defineTypes(tDef)
} }
assert("A multiplicty of more than one requires a collection type for attribute 'stringSet'" == me.getMessage)
}
} }
...@@ -20,14 +20,12 @@ package org.apache.atlas.typesystem.builders ...@@ -20,14 +20,12 @@ package org.apache.atlas.typesystem.builders
import org.apache.atlas.typesystem.json.TypesSerialization import org.apache.atlas.typesystem.json.TypesSerialization
import org.apache.atlas.typesystem.types.TypeSystem import org.apache.atlas.typesystem.types.TypeSystem
import org.junit.runner.RunWith import org.testng.annotations.Test
import org.scalatest.junit.JUnitRunner
@RunWith(classOf[JUnitRunner])
class TypesBuilderTest extends BuilderTest { class TypesBuilderTest extends BuilderTest {
test("test1") { @Test def test1 {
TypeSystem.getInstance().defineTypes(tDef) TypeSystem.getInstance().defineTypes(tDef)
println(TypesSerialization.toJson(TypeSystem.getInstance(), x => true)) println(TypesSerialization.toJson(TypeSystem.getInstance(), x => true))
......
...@@ -26,14 +26,15 @@ import org.apache.atlas.typesystem.{ITypedReferenceableInstance, ITypedStruct, R ...@@ -26,14 +26,15 @@ import org.apache.atlas.typesystem.{ITypedReferenceableInstance, ITypedStruct, R
import org.json4s.native.JsonMethods._ import org.json4s.native.JsonMethods._
import org.json4s.native.Serialization.{write => swrite, _} import org.json4s.native.Serialization.{write => swrite, _}
import org.json4s.{NoTypeHints, _} import org.json4s.{NoTypeHints, _}
import org.junit.{Assert, Before, Test} import org.testng.Assert
import org.testng.annotations.{BeforeMethod,Test}
class SerializationTest extends BaseTest { class SerializationTest extends BaseTest {
private[atlas] var structType: StructType = null private[atlas] var structType: StructType = null
private[atlas] var recursiveStructType: StructType = null private[atlas] var recursiveStructType: StructType = null
@Before @BeforeMethod
override def setup { override def setup {
super.setup super.setup
structType = getTypeSystem.getDataType(classOf[StructType], BaseTest.STRUCT_TYPE_1).asInstanceOf[StructType] structType = getTypeSystem.getDataType(classOf[StructType], BaseTest.STRUCT_TYPE_1).asInstanceOf[StructType]
......
...@@ -20,7 +20,8 @@ package org.apache.atlas.typesystem.json ...@@ -20,7 +20,8 @@ package org.apache.atlas.typesystem.json
import com.google.common.collect.ImmutableList import com.google.common.collect.ImmutableList
import org.apache.atlas.typesystem.types._ import org.apache.atlas.typesystem.types._
import org.junit.{Assert, Test} import org.testng.Assert
import org.testng.annotations.Test
class TypesSerializationTest extends BaseTest with TypeHelpers { class TypesSerializationTest extends BaseTest with TypeHelpers {
......
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