atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkan...@apache.org
Subject [1/9] incubator-atlas git commit: ATLAS-693 Titan 0.5.4 implementation of graph db abstraction. (jnhagelb via dkantor)
Date Fri, 05 Aug 2016 23:27:31 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 2ef0fc46d -> 4fa10b6ae


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/4fa10b6a/titan/src/test/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseKeyColumnValueStoreTest.java
----------------------------------------------------------------------
diff --git a/titan/src/test/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseKeyColumnValueStoreTest.java
b/titan/src/test/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseKeyColumnValueStoreTest.java
deleted file mode 100644
index 7ed636a..0000000
--- a/titan/src/test/java/com/thinkaurelius/titan/diskstorage/hbase/HBaseKeyColumnValueStoreTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.thinkaurelius.titan.diskstorage.hbase;
-
-import com.thinkaurelius.titan.diskstorage.BackendException;
-import com.thinkaurelius.titan.diskstorage.EntryMetaData;
-import com.thinkaurelius.titan.diskstorage.StaticBuffer;
-import com.thinkaurelius.titan.diskstorage.configuration.Configuration;
-import com.thinkaurelius.titan.diskstorage.locking.LocalLockMediator;
-import com.thinkaurelius.titan.diskstorage.locking.PermanentLockingException;
-import com.thinkaurelius.titan.diskstorage.util.KeyColumn;
-import com.thinkaurelius.titan.diskstorage.util.time.StandardDuration;
-import com.thinkaurelius.titan.diskstorage.util.time.Timepoint;
-import com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-import java.util.concurrent.TimeUnit;
-
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.fail;
-
-public class HBaseKeyColumnValueStoreTest {
-
-    @Mock
-    HBaseStoreManager storeManager;
-
-    @Mock
-    ConnectionMask connectionMask;
-
-    @Mock
-    LocalLockMediator localLockMediator;
-
-    @Mock
-    StaticBuffer key;
-
-    @Mock
-    StaticBuffer column;
-
-    @Mock
-    StaticBuffer expectedValue;
-
-    @Mock
-    HBaseTransaction transaction;
-
-    @Mock
-    Configuration storageConfig;
-
-    @BeforeMethod
-    public void setup() {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void shouldSucceedInLockingIfLockMediatorSucceeds() throws BackendException {
-
-        when(storeManager.getMetaDataSchema("hbase")).thenReturn(new EntryMetaData[] {EntryMetaData.TIMESTAMP});
-        when(storeManager.getStorageConfig()).thenReturn(storageConfig);
-        when(storageConfig.get(GraphDatabaseConfiguration.LOCK_EXPIRE)).thenReturn(
-                new StandardDuration(300L, TimeUnit.MILLISECONDS));
-        when(storageConfig.get(GraphDatabaseConfiguration.LOCK_WAIT)).thenReturn(
-                new StandardDuration(10L, TimeUnit.MILLISECONDS));
-        when(storageConfig.get(GraphDatabaseConfiguration.LOCK_RETRY)).thenReturn(3);
-        KeyColumn lockID = new KeyColumn(key, column);
-        when(localLockMediator.lock(eq(lockID), eq(transaction), any(Timepoint.class))).
-                thenReturn(true);
-
-        HBaseKeyColumnValueStore hBaseKeyColumnValueStore =
-                new HBaseKeyColumnValueStore(storeManager, connectionMask, "titan", "e",
"hbase", localLockMediator);
-        hBaseKeyColumnValueStore.acquireLock(key, column, expectedValue, transaction);
-
-        verify(transaction).updateLocks(lockID, expectedValue);
-        verify(localLockMediator, times(1)).lock(eq(lockID), eq(transaction), any(Timepoint.class));
-    }
-
-    @Test
-    public void shouldRetryRightNumberOfTimesIfLockMediationFails() throws BackendException
{
-        when(storeManager.getMetaDataSchema("hbase")).thenReturn(new EntryMetaData[] {EntryMetaData.TIMESTAMP});
-        when(storeManager.getStorageConfig()).thenReturn(storageConfig);
-        when(storageConfig.get(GraphDatabaseConfiguration.LOCK_EXPIRE)).thenReturn(
-                new StandardDuration(300L, TimeUnit.MILLISECONDS));
-        when(storageConfig.get(GraphDatabaseConfiguration.LOCK_WAIT)).thenReturn(
-                new StandardDuration(10L, TimeUnit.MILLISECONDS));
-        when(storageConfig.get(GraphDatabaseConfiguration.LOCK_RETRY)).thenReturn(3);
-        KeyColumn lockID = new KeyColumn(key, column);
-        when(localLockMediator.lock(eq(lockID), eq(transaction), any(Timepoint.class))).
-                thenReturn(false).thenReturn(false).thenReturn(true);
-
-        HBaseKeyColumnValueStore hBaseKeyColumnValueStore =
-                new HBaseKeyColumnValueStore(storeManager, connectionMask, "titan", "e",
"hbase", localLockMediator);
-        hBaseKeyColumnValueStore.acquireLock(key, column, expectedValue, transaction);
-
-        verify(transaction).updateLocks(lockID, expectedValue);
-        verify(localLockMediator, times(3)).lock(eq(lockID), eq(transaction), any(Timepoint.class));
-    }
-
-    @Test(expectedExceptions = PermanentLockingException.class)
-    public void shouldThrowExceptionAfterConfiguredRetriesIfLockMediationFails() throws BackendException
{
-        when(storeManager.getMetaDataSchema("hbase")).thenReturn(new EntryMetaData[] {EntryMetaData.TIMESTAMP});
-        when(storeManager.getStorageConfig()).thenReturn(storageConfig);
-        when(storageConfig.get(GraphDatabaseConfiguration.LOCK_EXPIRE)).thenReturn(
-                new StandardDuration(300L, TimeUnit.MILLISECONDS));
-        when(storageConfig.get(GraphDatabaseConfiguration.LOCK_WAIT)).thenReturn(
-                new StandardDuration(10L, TimeUnit.MILLISECONDS));
-        when(storageConfig.get(GraphDatabaseConfiguration.LOCK_RETRY)).thenReturn(3);
-        KeyColumn lockID = new KeyColumn(key, column);
-        when(localLockMediator.lock(eq(lockID), eq(transaction), any(Timepoint.class))).
-                thenReturn(false).thenReturn(false).thenReturn(false);
-
-        HBaseKeyColumnValueStore hBaseKeyColumnValueStore =
-                new HBaseKeyColumnValueStore(storeManager, connectionMask, "titan", "e",
"hbase", localLockMediator);
-        hBaseKeyColumnValueStore.acquireLock(key, column, expectedValue, transaction);
-
-        fail("Should fail as lock could not be acquired after 3 retries.");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/4fa10b6a/titan/src/test/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediatorTest.java
----------------------------------------------------------------------
diff --git a/titan/src/test/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediatorTest.java
b/titan/src/test/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediatorTest.java
deleted file mode 100644
index d0fd401..0000000
--- a/titan/src/test/java/com/thinkaurelius/titan/diskstorage/locking/LocalLockMediatorTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2012-2013 Aurelius LLC
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.thinkaurelius.titan.diskstorage.locking;
-
-import com.thinkaurelius.titan.diskstorage.hbase.HBaseTransaction;
-import com.thinkaurelius.titan.diskstorage.util.time.TimestampProvider;
-import com.thinkaurelius.titan.diskstorage.util.time.Timestamps;
-import com.thinkaurelius.titan.diskstorage.StaticBuffer;
-import com.thinkaurelius.titan.diskstorage.util.KeyColumn;
-import com.thinkaurelius.titan.diskstorage.util.StaticArrayBuffer;
-import org.mockito.Mockito;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import java.util.concurrent.TimeUnit;
-
-public class LocalLockMediatorTest {
-
-    private static final String LOCK_NAMESPACE = "test";
-    private static final StaticBuffer LOCK_ROW = StaticArrayBuffer.of(new byte[]{1});
-    private static final StaticBuffer LOCK_COL = StaticArrayBuffer.of(new byte[]{1});
-    private static final KeyColumn kc = new KeyColumn(LOCK_ROW, LOCK_COL);
-    private static final HBaseTransaction mockTx1 = Mockito.mock(HBaseTransaction.class);
-    private static final HBaseTransaction mockTx2 = Mockito.mock(HBaseTransaction.class);
-
-    @Test
-    public void testLock() throws InterruptedException {
-        TimestampProvider times = Timestamps.MICRO;
-        LocalLockMediator<HBaseTransaction> llm =
-            new LocalLockMediator<HBaseTransaction>(LOCK_NAMESPACE, times);
-
-        //Expire immediately
-        Assert.assertTrue(llm.lock(kc, mockTx1, times.getTime(0, TimeUnit.NANOSECONDS)));
-        Assert.assertTrue(llm.lock(kc, mockTx2, times.getTime(Long.MAX_VALUE, TimeUnit.NANOSECONDS)));
-
-        llm = new LocalLockMediator<HBaseTransaction>(LOCK_NAMESPACE, times);
-
-        //Expire later
-        Assert.assertTrue(llm.lock(kc, mockTx1, times.getTime(Long.MAX_VALUE, TimeUnit.NANOSECONDS)));
-        //So second lock should fail on same keyCol
-        Assert.assertFalse(llm.lock(kc, mockTx2, times.getTime(Long.MAX_VALUE, TimeUnit.NANOSECONDS)));
-
-        //Unlock
-        Assert.assertTrue(llm.unlock(kc, mockTx1));
-        //Now locking should succeed
-        Assert.assertTrue(llm.lock(kc, mockTx2, times.getTime(Long.MAX_VALUE, TimeUnit.NANOSECONDS)));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/4fa10b6a/webapp/pom.xml
----------------------------------------------------------------------
diff --git a/webapp/pom.xml b/webapp/pom.xml
index b2cd18c..708a216 100755
--- a/webapp/pom.xml
+++ b/webapp/pom.xml
@@ -105,6 +105,11 @@
 
         <dependency>
             <groupId>org.apache.atlas</groupId>
+            <artifactId>atlas-graphdb-titan0</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-client</artifactId>
         </dependency>
 
@@ -123,7 +128,6 @@
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-common</artifactId>
         </dependency>
-
         <dependency>
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-minikdc</artifactId>
@@ -133,7 +137,7 @@
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-hdfs</artifactId>
         </dependency>
-   
+
         <dependency>
             <groupId>org.apache.atlas</groupId>
             <artifactId>atlas-catalog</artifactId>
@@ -166,16 +170,6 @@
         </dependency>
 
         <dependency>
-            <groupId>com.tinkerpop.blueprints</groupId>
-            <artifactId>blueprints-core</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>com.thinkaurelius.titan</groupId>
-            <artifactId>titan-core</artifactId>
-        </dependency>
-
-        <dependency>
             <groupId>com.googlecode.json-simple</groupId>
             <artifactId>json-simple</artifactId>
         </dependency>


Mime
View raw message