usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sfeld...@apache.org
Subject incubator-usergrid git commit: remove keyspace dependency
Date Thu, 04 Jun 2015 16:44:05 GMT
Repository: incubator-usergrid
Updated Branches:
  refs/heads/USERGRID-556 f4b67a961 -> a2fa7a0fc


remove keyspace dependency


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/a2fa7a0f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/a2fa7a0f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/a2fa7a0f

Branch: refs/heads/USERGRID-556
Commit: a2fa7a0fc5733baf626f4699d0bacec60ac80ae5
Parents: f4b67a9
Author: Shawn Feldman <sfeldman@apache.org>
Authored: Thu Jun 4 10:43:55 2015 -0600
Committer: Shawn Feldman <sfeldman@apache.org>
Committed: Thu Jun 4 10:43:55 2015 -0600

----------------------------------------------------------------------
 .../index/impl/IndexIdentifierv2Impl.java       | 22 +++++++++++---------
 .../persistence/index/impl/EntityIndexTest.java |  7 ++++---
 2 files changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a2fa7a0f/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv2Impl.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv2Impl.java
b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv2Impl.java
index cb84ffe..c438abe 100644
--- a/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv2Impl.java
+++ b/stack/corepersistence/queryindex/src/main/java/org/apache/usergrid/persistence/index/impl/IndexIdentifierv2Impl.java
@@ -22,7 +22,7 @@ package org.apache.usergrid.persistence.index.impl;
 
 import com.google.inject.Inject;
 
-import com.netflix.astyanax.Keyspace;
+import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
 import org.apache.usergrid.persistence.core.util.StringUtils;
 import org.apache.usergrid.persistence.index.IndexFig;
 import org.apache.usergrid.persistence.index.IndexIdentifier;
@@ -32,21 +32,23 @@ import org.apache.usergrid.persistence.index.IndexIdentifier;
  * Class is used to generate an index name and alias name
  */
 public class IndexIdentifierv2Impl implements IndexIdentifier {
-    private final IndexFig config;
+    private final CassandraFig cassandraFig;
+    private final IndexFig indexFig;
     private final String prefix;
 
     @Inject
-    public IndexIdentifierv2Impl(final Keyspace keyspace, final IndexFig config) {
-        this.config = config;
-        this.prefix = getPrefix(keyspace, config);
+    public IndexIdentifierv2Impl(final CassandraFig cassandraFig, final IndexFig config)
{
+        this.cassandraFig = cassandraFig;
+        this.indexFig = config;
+        this.prefix = getPrefix();
     }
 
-    private String getPrefix(Keyspace keyspace, IndexFig config) {
+    private String getPrefix() {
         //remove usergrid
-        final String indexPrefixConfig = StringUtils.isNotEmpty(config.getIndexPrefix())
-            ? config.getIndexPrefix().toLowerCase()  ////use lowercase value
+        final String indexPrefixConfig = StringUtils.isNotEmpty(indexFig.getIndexPrefix())
+            ? indexFig.getIndexPrefix().toLowerCase()  ////use lowercase value
             : "usergrid"; // default to something so its not null
-        final String keyspaceName = keyspace.getKeyspaceName().toLowerCase();
+        final String keyspaceName = cassandraFig.getApplicationKeyspace().toLowerCase();
         //check for repetition
         final boolean removePrefix = indexPrefixConfig.contains("usergrid") && keyspaceName.contains("usergrid");
         return !removePrefix
@@ -60,7 +62,7 @@ public class IndexIdentifierv2Impl implements IndexIdentifier {
      */
     @Override
     public IndexAlias getAlias() {
-        return new IndexAlias(config,prefix);
+        return new IndexAlias(indexFig,prefix);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a2fa7a0f/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
----------------------------------------------------------------------
diff --git a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
index dfa8f04..f678cc1 100644
--- a/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
+++ b/stack/corepersistence/queryindex/src/test/java/org/apache/usergrid/persistence/index/impl/EntityIndexTest.java
@@ -30,6 +30,7 @@ import java.util.concurrent.atomic.AtomicLong;
 
 import com.google.common.base.Optional;
 import com.netflix.astyanax.Keyspace;
+import org.apache.usergrid.persistence.core.astyanax.CassandraFig;
 import org.apache.usergrid.persistence.index.*;
 import org.junit.Rule;
 import org.junit.Test;
@@ -90,7 +91,7 @@ public class EntityIndexTest extends BaseIT {
     public IndexFig fig;
 
     @Inject
-    public Keyspace keyspace;
+    public CassandraFig cassandraFig;
 
     @Inject
     @Rule
@@ -1268,8 +1269,8 @@ public class EntityIndexTest extends BaseIT {
         String indexv1Name = identifierv1.getIndex("somesuffixv1");
         String indexv2Name = identifierv2.getIndex("somesuffixv2");
         assertFalse(indexv1Name.equals(indexv2Name));
-        assertFalse(indexv1Name.contains(keyspace.getKeyspaceName().toLowerCase()));
-        assertTrue(indexv2Name.contains(keyspace.getKeyspaceName().toLowerCase()));
+        assertFalse(indexv1Name.contains(cassandraFig.getApplicationKeyspace().toLowerCase()));
+        assertTrue(indexv2Name.contains(cassandraFig.getApplicationKeyspace().toLowerCase()));
         assertTrue(indexv1Name.contains(fig.getIndexPrefix()));
         assertTrue(indexv2Name.contains(fig.getIndexPrefix()));
 


Mime
View raw message