forked from JanusGraph/janusgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Truncate tables instead of drop kepspace in CQLStoreManager. Use wrap…
…per to manage cluster and session statically in CQL tests. Signed-off-by: sjudeng <sjudeng@users.noreply.github.com>
- Loading branch information
Showing
14 changed files
with
115 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
janusgraph-cql/src/test/java/org/janusgraph/diskstorage/cql/CachingCQLStoreManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package org.janusgraph.diskstorage.cql; | ||
|
||
import com.datastax.driver.core.Cluster; | ||
import com.datastax.driver.core.Session; | ||
import org.janusgraph.diskstorage.BackendException; | ||
import org.janusgraph.diskstorage.PermanentBackendException; | ||
import org.janusgraph.diskstorage.configuration.Configuration; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class CachingCQLStoreManager extends CQLStoreManager { | ||
|
||
private static Cluster cluster; | ||
private static Map<String,Session> sessions = new HashMap<>(); | ||
|
||
public CachingCQLStoreManager(final Configuration configuration) throws BackendException { | ||
super(configuration); | ||
} | ||
|
||
@Override | ||
Cluster initializeCluster() throws PermanentBackendException { | ||
if (cluster == null || cluster.isClosed()) { | ||
cluster = super.initializeCluster(); | ||
} | ||
return cluster; | ||
} | ||
|
||
@Override | ||
Session initializeSession(final String keyspaceName) { | ||
if (!sessions.containsKey(keyspaceName)) { | ||
sessions.put(keyspaceName, super.initializeSession(keyspaceName)); | ||
} | ||
return sessions.get(keyspaceName); | ||
} | ||
|
||
@Override | ||
public void close() { | ||
this.executorService.shutdownNow(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
log4j.appender.FILE=org.apache.log4j.FileAppender | ||
log4j.appender.FILE.File=${project.build.directory}/test.log | ||
log4j.appender.FILE.Threshold=TRACE | ||
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.FILE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%20.20t] %-5p %30.30c: %m%n | ||
log4j.appender.A1=org.apache.log4j.FileAppender | ||
log4j.appender.A1.File=${project.build.directory}/test.log | ||
log4j.appender.A1.Threshold=ALL | ||
log4j.appender.A1.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.A1.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%20.20t] %-5p %30.30c: %m%n | ||
|
||
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender | ||
log4j.appender.CONSOLE.Threshold=INFO | ||
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.CONSOLE.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%20.20t] %-5p %30.30c: %m%n | ||
log4j.appender.A2=org.apache.log4j.ConsoleAppender | ||
log4j.appender.A2.Threshold=ALL | ||
log4j.appender.A2.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.A2.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss.SSS} [%20.20t] %-5p %30.30c: %m%n | ||
|
||
log4j.rootLogger=INFO,FILE,CONSOLE | ||
#log4j.rootLogger=INFO, A1, A2 | ||
log4j.rootLogger=ERROR, A1 | ||
|
||
log4j.logger.org.apache.cassandra=WARN | ||
log4j.logger.com.datastax.driver=WARN | ||
log4j.logger.com.datastax.driver=WARN |