From e0423116dd67d2d417a17d8acfa9b3289341521f Mon Sep 17 00:00:00 2001
From: Dan Markwat <daniel.markwat@gmail.com>
Date: Fri, 9 Jan 2015 11:56:08 -0500
Subject: [PATCH] Duplication of the repository module's tests.  Tests were fundamentally similar and could easily be performed inside of the repository module

---
 webapp/src/test/java/org/apache/hadoop/metadata/GraphRepositoryServiceIT.java | 69 ---------------------------------------------------------------------
 webapp/src/test/java/org/apache/hadoop/metadata/TitanGraphServiceIT.java      | 61 -------------------------------------------------------------
 2 files changed, 130 deletions(-)
 delete mode 100644 webapp/src/test/java/org/apache/hadoop/metadata/GraphRepositoryServiceIT.java
 delete mode 100644 webapp/src/test/java/org/apache/hadoop/metadata/TitanGraphServiceIT.java

diff --git a/webapp/src/test/java/org/apache/hadoop/metadata/GraphRepositoryServiceIT.java b/webapp/src/test/java/org/apache/hadoop/metadata/GraphRepositoryServiceIT.java
deleted file mode 100644
index d4be14a..0000000
--- a/webapp/src/test/java/org/apache/hadoop/metadata/GraphRepositoryServiceIT.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.apache.hadoop.metadata;
-
-import org.apache.hadoop.metadata.service.Services;
-import org.apache.hadoop.metadata.services.GraphBackedMetadataRepositoryService;
-import org.apache.hadoop.metadata.services.TitanGraphService;
-import org.json.simple.JSONValue;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class GraphRepositoryServiceIT {
-
-    private static final String ENTITY_NAME = "clicks-table";
-    private static final String ENTITY_TYPE = "hive-table";
-    private static final String DATABASE_NAME = "ads";
-    private static final String TABLE_NAME = "clicks-table";
-
-    @BeforeClass
-    public void setUp() throws Exception {
-        TitanGraphService titanGraphService = new TitanGraphService();
-        titanGraphService.start();
-        Services.get().register(titanGraphService);
-
-        GraphBackedMetadataRepositoryService repositoryService
-                = new GraphBackedMetadataRepositoryService();
-        repositoryService.start();
-        Services.get().register(repositoryService);
-    }
-
-    @AfterClass
-    public void tearDown() throws Exception {
-        Services.get().getService(GraphBackedMetadataRepositoryService.NAME).close();
-        Services.get().getService(TitanGraphService.NAME).close();
-        Services.get().reset();
-    }
-
-    @Test
-    public void testRepository() throws Exception {
-        GraphBackedMetadataRepositoryService repositoryService =
-                Services.get().getService(GraphBackedMetadataRepositoryService.NAME);
-
-        String entityStream = getTestEntityJSON();
-        String guid = repositoryService.submitEntity(entityStream, ENTITY_TYPE);
-        Assert.assertNotNull(guid);
-
-        String entity = repositoryService.getEntityDefinition(ENTITY_NAME, ENTITY_TYPE);
-        @SuppressWarnings("unchecked")
-        Map<String, String> entityProperties =
-                (Map<String, String>) JSONValue.parseWithException(entity);
-        Assert.assertEquals(entityProperties.get("guid"), guid);
-        Assert.assertEquals(entityProperties.get("entityName"), ENTITY_NAME);
-        Assert.assertEquals(entityProperties.get("entityType"), ENTITY_TYPE);
-        Assert.assertEquals(entityProperties.get("database"), DATABASE_NAME);
-        Assert.assertEquals(entityProperties.get("table"), TABLE_NAME);
-    }
-
-    private String getTestEntityJSON() {
-        Map<String, String> props = new HashMap<>();
-        props.put("entityName", ENTITY_NAME);
-        props.put("entityType", ENTITY_TYPE);
-        props.put("database", DATABASE_NAME);
-        props.put("table", TABLE_NAME);
-        return JSONValue.toJSONString(props);
-    }
-}
diff --git a/webapp/src/test/java/org/apache/hadoop/metadata/TitanGraphServiceIT.java b/webapp/src/test/java/org/apache/hadoop/metadata/TitanGraphServiceIT.java
deleted file mode 100644
index cb4bead..0000000
--- a/webapp/src/test/java/org/apache/hadoop/metadata/TitanGraphServiceIT.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.hadoop.metadata;
-
-import com.tinkerpop.blueprints.GraphQuery;
-import com.tinkerpop.blueprints.TransactionalGraph;
-import com.tinkerpop.blueprints.Vertex;
-import org.apache.hadoop.metadata.services.TitanGraphService;
-import org.apache.hadoop.metadata.util.GraphUtils;
-import org.testng.annotations.Test;
-
-import java.util.Iterator;
-import java.util.UUID;
-
-/**
- * End to end graph put/get test.
- */
-public class TitanGraphServiceIT {
-
-    @Test
-    public void testTitanGraph() throws Exception {
-        TitanGraphService titanGraphService = new TitanGraphService();
-        titanGraphService.start();
-
-        try {
-            String guid = UUID.randomUUID().toString();
-
-            final TransactionalGraph graph = titanGraphService.getTransactionalGraph();
-            System.out.println("graph = " + graph);
-            System.out.println("graph.getVertices() = " + graph.getVertices());
-
-
-            Vertex entityVertex = null;
-            try {
-                graph.rollback();
-                entityVertex = graph.addVertex(null);
-                entityVertex.setProperty("guid", guid);
-                entityVertex.setProperty("entityName", "entityName");
-                entityVertex.setProperty("entityType", "entityType");
-            } catch (Exception e) {
-                graph.rollback();
-                e.printStackTrace();
-            } finally {
-                graph.commit();
-            }
-
-            System.out.println("vertex = " + GraphUtils.vertexString(entityVertex));
-
-            GraphQuery query = graph.query()
-                    .has("entityName", "entityName")
-                    .has("entityType", "entityType");
-
-            Iterator<Vertex> results = query.vertices().iterator();
-            if (results.hasNext()) {
-                Vertex vertexFromQuery = results.next();
-                System.out.println("vertex = " + GraphUtils.vertexString(vertexFromQuery));
-            }
-        } finally {
-            Thread.sleep(1000);
-            titanGraphService.stop();
-        }
-    }
-}
--
libgit2 0.27.1