diff --git a/pom.xml b/pom.xml
index ea032b8..60a0e08 100644
--- a/pom.xml
+++ b/pom.xml
@@ -121,12 +121,20 @@
test
- slf4j-log4j12
org.slf4j
+ slf4j-log4j12
- guava
+ ch.qos.logback
+ logback-core
+
+
+ ch.qos.logback
+ logback-classic
+
+
com.google.guava
+ guava
@@ -187,13 +195,6 @@
runtime
-
- ch.qos.logback
- logback-classic
- ${logback}
- test
-
-
diff --git a/src/main/java/casser/core/Casser.java b/src/main/java/casser/core/Casser.java
index e1030a1..7ae45c3 100644
--- a/src/main/java/casser/core/Casser.java
+++ b/src/main/java/casser/core/Casser.java
@@ -40,6 +40,10 @@ public final class Casser {
return new SessionInitializer(session);
}
+ public static SessionInitializer init(Session session) {
+ return new SessionInitializer(session);
+ }
+
public static E dsl(Class iface) {
return dsl(iface, iface.getClassLoader());
}
diff --git a/src/main/java/casser/core/SessionInitializer.java b/src/main/java/casser/core/SessionInitializer.java
index 1b0c6b8..fa63791 100644
--- a/src/main/java/casser/core/SessionInitializer.java
+++ b/src/main/java/casser/core/SessionInitializer.java
@@ -36,6 +36,4 @@ public class SessionInitializer {
return new CasserSession(session);
}
-
-
}
diff --git a/src/test/java/casser/test/integration/core/ContextInitTest.java b/src/test/java/casser/test/integration/core/ContextInitTest.java
new file mode 100644
index 0000000..23d7097
--- /dev/null
+++ b/src/test/java/casser/test/integration/core/ContextInitTest.java
@@ -0,0 +1,20 @@
+package casser.test.integration.core;
+
+import org.junit.Test;
+
+import casser.core.Casser;
+import casser.core.CasserSession;
+import casser.test.integration.build.AbstractEmbeddedCassandraTest;
+
+public class ContextInitTest extends AbstractEmbeddedCassandraTest {
+
+ CasserSession session = Casser.init(getSession()).get();
+
+ @Test
+ public void test() {
+
+ System.out.println("Works! " + session);
+
+ }
+
+}
diff --git a/src/test/java/casser/test/integration/core/SimpleTest.java b/src/test/java/casser/test/integration/core/SimpleTest.java
deleted file mode 100644
index bc9dc42..0000000
--- a/src/test/java/casser/test/integration/core/SimpleTest.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package casser.test.integration.core;
-
-import org.junit.Test;
-
-import casser.test.integration.build.AbstractEmbeddedCassandraTest;
-
-public class SimpleTest extends AbstractEmbeddedCassandraTest {
-
- @Test
- public void test() {
-
- System.out.println("Works!");
-
- }
-
-}
diff --git a/src/test/java/casser/test/integration/core/flat/FlatObjectTest.java b/src/test/java/casser/test/integration/core/flat/FlatObjectTest.java
new file mode 100644
index 0000000..2d20eef
--- /dev/null
+++ b/src/test/java/casser/test/integration/core/flat/FlatObjectTest.java
@@ -0,0 +1,42 @@
+package casser.test.integration.core.flat;
+
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import casser.core.Casser;
+import casser.core.CasserSession;
+import casser.test.integration.build.AbstractEmbeddedCassandraTest;
+
+public class FlatObjectTest extends AbstractEmbeddedCassandraTest {
+
+ User user = Casser.dsl(User.class);
+
+ CasserSession session = Casser.init(getSession()).create(user).get();
+
+ @Test
+ public void testFake() {
+
+ }
+
+ //@Test
+ public void testCruid() {
+
+ User alex = Casser.pojo(User.class);
+ alex.setId(123L);
+ alex.setName("alex");
+ alex.setAge(34);
+
+ session.upsert(alex).sync();
+
+ Long id = session.select(user::getId).where(user::getId, "==", 123L).sync().findFirst().get().v1;
+
+ Assert.assertEquals(Long.valueOf(123L), id);
+
+ session.delete().where(user::getId, "==", 123L).sync();
+
+ }
+
+
+
+}
diff --git a/src/test/java/casser/test/integration/core/flat/User.java b/src/test/java/casser/test/integration/core/flat/User.java
new file mode 100644
index 0000000..b52fc6a
--- /dev/null
+++ b/src/test/java/casser/test/integration/core/flat/User.java
@@ -0,0 +1,20 @@
+package casser.test.integration.core.flat;
+
+import casser.mapping.Table;
+
+@Table("user")
+public interface User {
+
+ Long getId();
+
+ void setId(Long id);
+
+ String getName();
+
+ void setName(String name);
+
+ Integer getAge();
+
+ void setAge(Integer age);
+
+}
diff --git a/src/test/resources/log4j-embedded-cassandra.properties b/src/test/resources/log4j-embedded-cassandra.properties
new file mode 100644
index 0000000..1571670
--- /dev/null
+++ b/src/test/resources/log4j-embedded-cassandra.properties
@@ -0,0 +1,30 @@
+# 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.
+
+# for production, you should probably set the root to INFO
+# and the pattern to %c instead of %l. (%l is slower.)
+
+# output messages into a rolling log file as well as stdout
+log4j.rootLogger=ERROR,stdout
+
+# stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c{3} - %m%n
+log4j.appender.stdout.follow=true
+
+log4j.logger.org.apache=WARN
+log4j.logger.org.cassandraunit=ERROR
\ No newline at end of file
diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties
index 74cdbf4..1a74d06 100644
--- a/src/test/resources/log4j.properties
+++ b/src/test/resources/log4j.properties
@@ -2,4 +2,5 @@ log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
-log4j.logger.casser=INFO
+log4j.logger.casser=WARN
+log4j.logger.org.cassandraunit=ERROR
\ No newline at end of file