You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2016/12/06 12:48:57 UTC

[3/3] incubator-unomi git commit: UNOMI-70 Upgrade to ElasticSearch 5.x - Working on getting integration testing working (not yet working)

UNOMI-70 Upgrade to ElasticSearch 5.x
- Working on getting integration testing working (not yet working)


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

Branch: refs/heads/feature-UNOMI-70-ES5X
Commit: dafa9f6b3c68a37084b4148ce7c76c7faf5687e1
Parents: a217ba0
Author: Serge Huber <sh...@apache.org>
Authored: Tue Dec 6 13:48:48 2016 +0100
Committer: Serge Huber <sh...@apache.org>
Committed: Tue Dec 6 13:48:48 2016 +0100

----------------------------------------------------------------------
 itests/pom.xml                                  |  11 +-
 .../java/org/apache/unomi/itests/AllITs.java    |  38 ++++
 .../java/org/apache/unomi/itests/AllTests.java  |  38 ----
 .../java/org/apache/unomi/itests/BaseIT.java    | 108 +++++++++++
 .../java/org/apache/unomi/itests/BaseTest.java  | 100 -----------
 .../java/org/apache/unomi/itests/BasicIT.java   |  99 +++++++++++
 .../java/org/apache/unomi/itests/BasicTest.java |  99 -----------
 .../unomi/itests/ConditionESQueryBuilderIT.java |  59 ++++++
 .../itests/ConditionESQueryBuilderTest.java     |  59 ------
 .../unomi/itests/ConditionEvaluatorIT.java      | 178 +++++++++++++++++++
 .../unomi/itests/ConditionEvaluatorTest.java    | 178 -------------------
 .../apache/unomi/itests/ProfileServiceIT.java   |  53 ++++++
 .../apache/unomi/itests/ProfileServiceTest.java |  53 ------
 .../java/org/apache/unomi/itests/SegmentIT.java |  48 +++++
 .../org/apache/unomi/itests/SegmentTest.java    |  48 -----
 pom.xml                                         |   7 +-
 16 files changed, 598 insertions(+), 578 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/pom.xml
----------------------------------------------------------------------
diff --git a/itests/pom.xml b/itests/pom.xml
index 11e0a94..0bde83c 100644
--- a/itests/pom.xml
+++ b/itests/pom.xml
@@ -54,6 +54,12 @@
             <type>xml</type>
         </dependency>
         <dependency>
+            <groupId>org.apache.karaf.cellar</groupId>
+            <artifactId>apache-karaf-cellar</artifactId>
+            <classifier>features</classifier>
+            <type>xml</type>
+        </dependency>
+        <dependency>
             <groupId>org.ops4j.pax.web</groupId>
             <artifactId>pax-web-features</artifactId>
             <classifier>features</classifier>
@@ -140,8 +146,9 @@
                 <version>5.0</version>
                 <configuration>
                     <clusterName>contextElasticSearch</clusterName>
-                    <tcpPort>9300</tcpPort>
+                    <transportPort>9300</transportPort>
                     <httpPort>9200</httpPort>
+                    <version>5.0.2</version>
                 </configuration>
                 <executions>
                     <!--
@@ -169,7 +176,7 @@
                 <artifactId>maven-failsafe-plugin</artifactId>
                 <configuration>
                     <includes>
-                        <include>**/*AllTests.java</include>
+                        <include>**/*AllITs.java</include>
                     </includes>
                 </configuration>
                 <executions>

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/AllITs.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/AllITs.java b/itests/src/test/java/org/apache/unomi/itests/AllITs.java
new file mode 100644
index 0000000..96e5245
--- /dev/null
+++ b/itests/src/test/java/org/apache/unomi/itests/AllITs.java
@@ -0,0 +1,38 @@
+/*
+ * 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 org.apache.unomi.itests;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * Defines suite of test classes to run.
+ * 
+ * @author Sergiy Shyrkov
+ */
+@RunWith(Suite.class)
+@SuiteClasses({
+        //BasicIT.class,
+        ConditionEvaluatorIT.class,
+        ConditionESQueryBuilderIT.class,
+        SegmentIT.class,
+        ProfileServiceIT.class
+    })
+public class AllITs {
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/AllTests.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/AllTests.java b/itests/src/test/java/org/apache/unomi/itests/AllTests.java
deleted file mode 100644
index 0fbd383..0000000
--- a/itests/src/test/java/org/apache/unomi/itests/AllTests.java
+++ /dev/null
@@ -1,38 +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 org.apache.unomi.itests;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-import org.junit.runners.Suite.SuiteClasses;
-
-/**
- * Defines suite of test classes to run.
- * 
- * @author Sergiy Shyrkov
- */
-@RunWith(Suite.class)
-@SuiteClasses({
-        //BasicTest.class,
-        ConditionEvaluatorTest.class,
-        ConditionESQueryBuilderTest.class,
-        SegmentTest.class,
-        ProfileServiceTest.class
-    })
-public class AllTests {
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
new file mode 100644
index 0000000..334e7c6
--- /dev/null
+++ b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
@@ -0,0 +1,108 @@
+/*
+ * 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 org.apache.unomi.itests;
+
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
+import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
+import org.ops4j.pax.exam.options.MavenUrlReference;
+
+import java.io.File;
+
+import static org.ops4j.pax.exam.CoreOptions.*;
+import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.*;
+
+/**
+ * Base class for integration tests.
+ * 
+ * @author kevan
+ */
+public abstract class BaseIT {
+    
+    protected static final String HTTP_PORT = "8181";
+    
+    protected static final String URL = "http://localhost:" + HTTP_PORT;
+
+    @Configuration
+    public Option[] config() {
+        MavenArtifactUrlReference karafUrl = maven()
+                .groupId("org.apache.karaf")
+                .artifactId("apache-karaf")
+                .version("3.0.8")
+                .type("tar.gz");
+
+        MavenUrlReference karafStandardRepo = maven()
+                .groupId("org.apache.karaf.features")
+                .artifactId("standard")
+                .classifier("features")
+                .type("xml")
+                .versionAsInProject();
+        MavenUrlReference karafCellarRepo = maven()
+                .groupId("org.apache.karaf.cellar")
+                .artifactId("apache-karaf-cellar")
+                .classifier("features")
+                .type("xml")
+                .versionAsInProject();
+        MavenUrlReference karafPaxWebRepo = maven()
+                .groupId("org.ops4j.pax.web")
+                .artifactId("pax-web-features")
+                .classifier("features")
+                .type("xml")
+                .versionAsInProject();
+        MavenUrlReference karafCxfRepo = maven()
+                .groupId("org.apache.cxf.karaf")
+                .artifactId("apache-cxf")
+                .classifier("features")
+                .type("xml")
+                .versionAsInProject();
+        MavenUrlReference contextServerRepo = maven()
+                .groupId("org.apache.unomi")
+                .artifactId("unomi-kar")
+                .classifier("features")
+                .type("xml")
+                .versionAsInProject();
+        
+        return new Option[]{
+                debugConfiguration("5005", false),
+                karafDistributionConfiguration()
+                        .frameworkUrl(karafUrl)
+                        .unpackDirectory(new File("target/exam"))
+                        .useDeployFolder(false),
+                keepRuntimeFolder(),
+                configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
+                logLevel(LogLevel.INFO),
+//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", HTTP_PORT),
+//                systemProperty("org.osgi.service.http.port").value(HTTP_PORT),
+                systemProperty("org.ops4j.pax.exam.rbc.rmi.port").value("1199"),
+                features(karafPaxWebRepo, "war"),
+                features(karafCxfRepo, "cxf"),
+                features(karafStandardRepo, "openwebbeans"),
+                features(karafStandardRepo, "pax-cdi-web-openwebbeans"),
+                features(karafCellarRepo, "cellar"),
+                features(contextServerRepo, "unomi-kar"),
+                // we need to wrap the HttpComponents libraries ourselves since the OSGi bundles provided by the project are incorrect
+                wrappedBundle(mavenBundle("org.apache.httpcomponents",
+                        "httpcore").versionAsInProject()),
+                wrappedBundle(mavenBundle("org.apache.httpcomponents",
+                        "httpmime").versionAsInProject()),
+                wrappedBundle(mavenBundle("org.apache.httpcomponents",
+                        "httpclient").versionAsInProject())
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/BaseTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/BaseTest.java b/itests/src/test/java/org/apache/unomi/itests/BaseTest.java
deleted file mode 100644
index 9db3d9b..0000000
--- a/itests/src/test/java/org/apache/unomi/itests/BaseTest.java
+++ /dev/null
@@ -1,100 +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 org.apache.unomi.itests;
-
-import org.ops4j.pax.exam.Configuration;
-import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.karaf.options.LogLevelOption.LogLevel;
-import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
-import org.ops4j.pax.exam.options.MavenUrlReference;
-
-import java.io.File;
-
-import static org.ops4j.pax.exam.CoreOptions.*;
-import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.*;
-
-/**
- * Base class for integration tests.
- * 
- * @author kevan
- */
-public abstract class BaseTest {
-    
-    protected static final String HTTP_PORT = "8181";
-    
-    protected static final String URL = "http://localhost:" + HTTP_PORT;
-
-    @Configuration
-    public Option[] config() {
-        MavenArtifactUrlReference karafUrl = maven()
-                .groupId("org.apache.karaf")
-                .artifactId("apache-karaf")
-                .version("3.0.2")
-                .type("tar.gz");
-
-        MavenUrlReference karafStandardRepo = maven()
-                .groupId("org.apache.karaf.features")
-                .artifactId("standard")
-                .classifier("features")
-                .type("xml")
-                .versionAsInProject();
-        MavenUrlReference karafPaxWebRepo = maven()
-                .groupId("org.ops4j.pax.web")
-                .artifactId("pax-web-features")
-                .classifier("features")
-                .type("xml")
-                .versionAsInProject();
-        MavenUrlReference karafCxfRepo = maven()
-                .groupId("org.apache.cxf.karaf")
-                .artifactId("apache-cxf")
-                .classifier("features")
-                .type("xml")
-                .versionAsInProject();
-        MavenUrlReference contextServerRepo = maven()
-                .groupId("org.apache.unomi")
-                .artifactId("unomi-kar")
-                .classifier("features")
-                .type("xml")
-                .versionAsInProject();
-        
-        return new Option[]{
-                debugConfiguration("5005", false),
-                karafDistributionConfiguration()
-                        .frameworkUrl(karafUrl)
-                        .unpackDirectory(new File("target/exam"))
-                        .useDeployFolder(false),
-//                keepRuntimeFolder(),
-                configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
-                logLevel(LogLevel.INFO),
-//                editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", HTTP_PORT),
-//                systemProperty("org.osgi.service.http.port").value(HTTP_PORT),
-                features(karafPaxWebRepo, "war"),
-                features(karafCxfRepo, "cxf"),
-                features(karafStandardRepo, "openwebbeans"),
-                features(karafStandardRepo, "pax-cdi-web-openwebbeans"),
-                features(contextServerRepo, "unomi-kar"),
-                // we need to wrap the HttpComponents libraries ourselves since the OSGi bundles provided by the project are incorrect
-                wrappedBundle(mavenBundle("org.apache.httpcomponents",
-                        "httpcore").versionAsInProject()),
-                wrappedBundle(mavenBundle("org.apache.httpcomponents",
-                        "httpmime").versionAsInProject()),
-                wrappedBundle(mavenBundle("org.apache.httpcomponents",
-                        "httpclient").versionAsInProject())
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/BasicIT.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/BasicIT.java b/itests/src/test/java/org/apache/unomi/itests/BasicIT.java
new file mode 100644
index 0000000..cc91fed
--- /dev/null
+++ b/itests/src/test/java/org/apache/unomi/itests/BasicIT.java
@@ -0,0 +1,99 @@
+/*
+ * 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 org.apache.unomi.itests;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.apache.unomi.api.ContextRequest;
+import org.apache.unomi.api.ContextResponse;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerSuite;
+
+import java.io.IOException;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerSuite.class)
+public class BasicIT extends BaseIT {
+    private static final String JSON_MYME_TYPE = "application/json";
+
+    private ObjectMapper objectMapper = new ObjectMapper();
+
+    @Test
+    public void testContextJS() throws IOException {
+        HttpUriRequest request = new HttpGet(URL + "/context.js?sessionId=aa3b04bd-8f4d-4a07-8e96-d33ffa04d3d9");
+        CloseableHttpResponse response = HttpClientBuilder.create().build().execute(request);
+        // The underlying HTTP connection is still held by the response object
+        // to allow the response content to be streamed directly from the network socket.
+        // In order to ensure correct deallocation of system resources
+        // the profile MUST call CloseableHttpResponse#close() from a finally clause.
+        // Please note that if response content is not fully consumed the underlying
+        // connection cannot be safely re-used and will be shut down and discarded
+        // by the connection manager.
+        String responseContent = null;
+        try {
+            System.out.println(response.getStatusLine());
+            HttpEntity entity = response.getEntity();
+            // do something useful with the response body
+            // and ensure it is fully consumed
+            responseContent = EntityUtils.toString(entity);
+        } finally {
+            response.close();
+        }
+        Assert.assertTrue("Response should contain context object", responseContent.contains("window.digitalData = window.digitalData || {};"));
+        // @todo we should check the validity of the context object, but this is rather complex since it would
+        // potentially require parsing the Javascript !
+    }
+
+    @Test
+    public void testContextJSON() throws IOException {
+        String sessionId = "aa3b04bd-8f4d-4a07-8e96-d33ffa04d3d9";
+        ContextRequest contextRequest = new ContextRequest();
+//        contextRequest.setSource(new EventSource());
+//        contextRequest.getSource().setId("af6f393a-a537-4586-991b-8521b9c7b05b");
+        HttpPost request = new HttpPost(URL + "/context.json?sessionId=" + sessionId);
+        request.setEntity(new StringEntity(objectMapper.writeValueAsString(contextRequest), ContentType.create("application/json")));
+        CloseableHttpResponse response = HttpClientBuilder.create().build().execute(request);
+
+        try {
+            // validate mimeType
+            String mimeType = ContentType.getOrDefault(response.getEntity()).getMimeType();
+            Assert.assertEquals("Response content type should be " + JSON_MYME_TYPE, JSON_MYME_TYPE, mimeType);
+
+            // validate context
+            ContextResponse context = TestUtils.retrieveResourceFromResponse(response, ContextResponse.class);
+            Assert.assertNotNull("Context should not be null", context);
+            Assert.assertNotNull("Context profileId should not be null", context.getProfileId());
+            Assert.assertEquals("Context sessionId should be the same as the sessionId used to request the context", sessionId, context.getSessionId());
+        } finally {
+            response.close();
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/BasicTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/BasicTest.java b/itests/src/test/java/org/apache/unomi/itests/BasicTest.java
deleted file mode 100644
index 7bfba87..0000000
--- a/itests/src/test/java/org/apache/unomi/itests/BasicTest.java
+++ /dev/null
@@ -1,99 +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 org.apache.unomi.itests;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.client.methods.HttpUriRequest;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.util.EntityUtils;
-import org.apache.unomi.api.ContextRequest;
-import org.apache.unomi.api.ContextResponse;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerSuite;
-
-import java.io.IOException;
-
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerSuite.class)
-public class BasicTest extends BaseTest{
-    private static final String JSON_MYME_TYPE = "application/json";
-
-    private ObjectMapper objectMapper = new ObjectMapper();
-
-    @Test
-    public void testContextJS() throws IOException {
-        HttpUriRequest request = new HttpGet(URL + "/context.js?sessionId=aa3b04bd-8f4d-4a07-8e96-d33ffa04d3d9");
-        CloseableHttpResponse response = HttpClientBuilder.create().build().execute(request);
-        // The underlying HTTP connection is still held by the response object
-        // to allow the response content to be streamed directly from the network socket.
-        // In order to ensure correct deallocation of system resources
-        // the profile MUST call CloseableHttpResponse#close() from a finally clause.
-        // Please note that if response content is not fully consumed the underlying
-        // connection cannot be safely re-used and will be shut down and discarded
-        // by the connection manager.
-        String responseContent = null;
-        try {
-            System.out.println(response.getStatusLine());
-            HttpEntity entity = response.getEntity();
-            // do something useful with the response body
-            // and ensure it is fully consumed
-            responseContent = EntityUtils.toString(entity);
-        } finally {
-            response.close();
-        }
-        Assert.assertTrue("Response should contain context object", responseContent.contains("window.digitalData = window.digitalData || {};"));
-        // @todo we should check the validity of the context object, but this is rather complex since it would
-        // potentially require parsing the Javascript !
-    }
-
-    @Test
-    public void testContextJSON() throws IOException {
-        String sessionId = "aa3b04bd-8f4d-4a07-8e96-d33ffa04d3d9";
-        ContextRequest contextRequest = new ContextRequest();
-//        contextRequest.setSource(new EventSource());
-//        contextRequest.getSource().setId("af6f393a-a537-4586-991b-8521b9c7b05b");
-        HttpPost request = new HttpPost(URL + "/context.json?sessionId=" + sessionId);
-        request.setEntity(new StringEntity(objectMapper.writeValueAsString(contextRequest), ContentType.create("application/json")));
-        CloseableHttpResponse response = HttpClientBuilder.create().build().execute(request);
-
-        try {
-            // validate mimeType
-            String mimeType = ContentType.getOrDefault(response.getEntity()).getMimeType();
-            Assert.assertEquals("Response content type should be " + JSON_MYME_TYPE, JSON_MYME_TYPE, mimeType);
-
-            // validate context
-            ContextResponse context = TestUtils.retrieveResourceFromResponse(response, ContextResponse.class);
-            Assert.assertNotNull("Context should not be null", context);
-            Assert.assertNotNull("Context profileId should not be null", context.getProfileId());
-            Assert.assertEquals("Context sessionId should be the same as the sessionId used to request the context", sessionId, context.getSessionId());
-        } finally {
-            response.close();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/ConditionESQueryBuilderIT.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/ConditionESQueryBuilderIT.java b/itests/src/test/java/org/apache/unomi/itests/ConditionESQueryBuilderIT.java
new file mode 100644
index 0000000..3e4333c
--- /dev/null
+++ b/itests/src/test/java/org/apache/unomi/itests/ConditionESQueryBuilderIT.java
@@ -0,0 +1,59 @@
+/*
+ * 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 org.apache.unomi.itests;
+
+import org.apache.unomi.api.Item;
+import org.apache.unomi.api.conditions.Condition;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerSuite;
+
+import java.util.List;
+
+/**
+ * Integration tests for various condition query builder types (elasticsearch).
+ *
+ * @author Sergiy Shyrkov
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerSuite.class)
+public class ConditionESQueryBuilderIT extends ConditionEvaluatorIT {
+
+    @Override
+    protected boolean eval(Condition c) {
+        @SuppressWarnings("unchecked")
+        List<Item> list = persistenceService.query(c,null,(Class<Item>) item.getClass());
+        return list.contains(item);
+    }
+
+    @Before
+    public void setUp() {
+        super.setUp();
+        persistenceService.save(item);
+        persistenceService.refresh();
+    }
+
+    @After
+    public void tearDown() {
+        persistenceService.remove(item.getItemId(), item.getClass());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/ConditionESQueryBuilderTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/ConditionESQueryBuilderTest.java b/itests/src/test/java/org/apache/unomi/itests/ConditionESQueryBuilderTest.java
deleted file mode 100644
index 82e1780..0000000
--- a/itests/src/test/java/org/apache/unomi/itests/ConditionESQueryBuilderTest.java
+++ /dev/null
@@ -1,59 +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 org.apache.unomi.itests;
-
-import org.apache.unomi.api.Item;
-import org.apache.unomi.api.conditions.Condition;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerSuite;
-
-import java.util.List;
-
-/**
- * Integration tests for various condition query builder types (elasticsearch).
- *
- * @author Sergiy Shyrkov
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerSuite.class)
-public class ConditionESQueryBuilderTest extends ConditionEvaluatorTest {
-
-    @Override
-    protected boolean eval(Condition c) {
-        @SuppressWarnings("unchecked")
-        List<Item> list = persistenceService.query(c,null,(Class<Item>) item.getClass());
-        return list.contains(item);
-    }
-
-    @Before
-    public void setUp() {
-        super.setUp();
-        persistenceService.save(item);
-        persistenceService.refresh();
-    }
-
-    @After
-    public void tearDown() {
-        persistenceService.remove(item.getItemId(), item.getClass());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java b/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
new file mode 100644
index 0000000..b75a8f5
--- /dev/null
+++ b/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorIT.java
@@ -0,0 +1,178 @@
+/*
+ * 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 org.apache.unomi.itests;
+
+import org.apache.unomi.api.Item;
+import org.apache.unomi.api.Profile;
+import org.apache.unomi.api.conditions.Condition;
+import org.apache.unomi.api.services.DefinitionsService;
+import org.apache.unomi.persistence.spi.PersistenceService;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerSuite;
+
+import javax.inject.Inject;
+import java.util.*;
+
+import static org.junit.Assert.*;
+
+/**
+ * Integration tests for various condition types.
+ * 
+ * @author Sergiy Shyrkov
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerSuite.class)
+public class ConditionEvaluatorIT extends BaseIT {
+
+    protected ConditionBuilder builder;
+    @Inject
+    protected PersistenceService persistenceService;
+    protected Item item;
+    protected Date lastVisit;
+    @Inject
+    private DefinitionsService definitionsService;
+
+    protected boolean eval(Condition c) {
+        return persistenceService.testMatch(c, item);
+    }
+
+    @Before
+    public void setUp() {
+        assertNotNull("Definition service should be available", definitionsService);
+        assertNotNull("Persistence service should be available", persistenceService);
+
+        lastVisit = new GregorianCalendar(2015,1,1,20,30,0).getTime();
+
+        Profile profile = new Profile("profile-" + UUID.randomUUID().toString());
+        profile.setProperty("firstVisit", lastVisit);
+        profile.setProperty("age", Integer.valueOf(30));
+        profile.setProperty("gender", "female");
+        profile.setProperty("lastVisit", lastVisit);
+        profile.setSegments(new HashSet<String>(Arrays.asList("s1", "s2", "s3")));
+        this.item = profile;
+        builder = new ConditionBuilder(definitionsService);
+    }
+
+    @Test
+    public void testCompound() {
+        // test AND
+        assertTrue(eval(builder.and(builder.profileProperty("properties.gender").equalTo("female"),
+                builder.profileProperty("properties.age").equalTo(Integer.valueOf(30))).build()));
+        assertFalse(eval(builder.and(builder.profileProperty("properties.gender").equalTo("male"),
+                builder.profileProperty("properties.age").equalTo(Integer.valueOf(30))).build()));
+        assertFalse(eval(builder.and(builder.profileProperty("properties.gender").equalTo("female"),
+                builder.profileProperty("properties.age").equalTo(Integer.valueOf(40))).build()));
+
+        // test OR
+        assertTrue(eval(builder.or(builder.profileProperty("properties.gender").equalTo("female"),
+                builder.profileProperty("properties.age").equalTo(Integer.valueOf(40))).build()));
+        assertTrue(eval(builder.or(builder.profileProperty("properties.gender").equalTo("male"),
+                builder.profileProperty("properties.age").equalTo(Integer.valueOf(30))).build()));
+        assertFalse(eval(builder.or(builder.profileProperty("properties.gender").equalTo("male"),
+                builder.profileProperty("properties.age").equalTo(Integer.valueOf(40))).build()));
+
+        // test NOT
+        assertTrue(eval(builder.not(builder.profileProperty("properties.gender").equalTo("male")).build()));
+        assertFalse(eval(builder.not(builder.profileProperty("properties.age").equalTo(Integer.valueOf(30))).build()));
+
+    }
+
+    @Test
+    public void testDate() {
+        assertTrue(eval(builder.profileProperty("properties.lastVisit").equalTo(lastVisit).build()));
+        assertTrue(eval(builder.profileProperty("properties.lastVisit")
+                .greaterThan(new Date(lastVisit.getTime() - 10000)).build()));
+        assertTrue(eval(builder.profileProperty("properties.lastVisit").lessThan(new Date(lastVisit.getTime() + 10000))
+                .build()));
+        assertTrue(eval(builder.profileProperty("properties.lastVisit")
+                .in(new Date(lastVisit.getTime() + 10000), new Date(lastVisit.getTime() - 10000), lastVisit).build()));
+        assertTrue(eval(builder.profileProperty("properties.lastVisit")
+                .notIn(new Date(lastVisit.getTime() + 10000), new Date(lastVisit.getTime() - 10000)).build()));
+        assertFalse(eval(builder.profileProperty("properties.lastVisit")
+                .notIn(new Date(lastVisit.getTime() + 10000), new Date(lastVisit.getTime() - 10000), lastVisit).build()));
+        assertTrue(eval(builder.profileProperty("properties.lastVisit").all(lastVisit).build()));
+        assertFalse(eval(builder.profileProperty("properties.lastVisit")
+                .all(new Date(lastVisit.getTime() + 10000), lastVisit).build()));
+    }
+
+    @Test
+    public void testExistence() {
+        assertTrue("Gender property does not exist",
+                eval(builder.profileProperty("properties.gender").exists().build()));
+        assertFalse("Gender property missing", eval(builder.profileProperty("properties.gender").missing().build()));
+        assertTrue("Strange property exists", eval(builder.profileProperty("properties.unknown").missing().build()));
+        assertFalse("Strange property exists", eval(builder.profileProperty("properties.unknown").exists().build()));
+    }
+
+    @Test
+    public void testInteger() {
+        assertTrue(eval(builder.profileProperty("properties.age").equalTo(Integer.valueOf(30)).build()));
+        assertTrue(eval(builder.not(builder.profileProperty("properties.age").equalTo(Integer.valueOf(40))).build()));
+        assertTrue(eval(builder.profileProperty("properties.age").notEqualTo(Integer.valueOf(40)).build()));
+        assertTrue(eval(builder.profileProperty("properties.age").lessThan(Integer.valueOf(40)).build()));
+        assertTrue(eval(builder.profileProperty("properties.age").greaterThan(Integer.valueOf(20)).build()));
+        assertTrue(eval(builder.profileProperty("properties.age").greaterThanOrEqualTo(Integer.valueOf(30)).build()));
+        assertFalse(eval(builder.profileProperty("properties.age").greaterThanOrEqualTo(Integer.valueOf(31)).build()));
+
+        assertTrue(eval(builder.profileProperty("properties.age").in(Integer.valueOf(30)).build()));
+        assertTrue(eval(builder.profileProperty("properties.age").in(Integer.valueOf(31), Integer.valueOf(30)).build()));
+        assertTrue(eval(builder.profileProperty("properties.age").notIn(Integer.valueOf(25), Integer.valueOf(26))
+                .build()));
+        assertFalse(eval(builder.profileProperty("properties.age").notIn(Integer.valueOf(25), Integer.valueOf(30))
+                .build()));
+    }
+
+    @Test
+    public void testMultiValue() {
+        assertTrue(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "in")
+                .parameter("segments", "s10", "s20", "s2").build()));
+        assertFalse(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "in")
+                .parameter("segments", "s10", "s20", "s30").build()));
+        assertTrue(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "notIn")
+                .parameter("segments", "s10", "s20", "s30").build()));
+        assertFalse(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "notIn")
+                .parameter("segments", "s10", "s20", "s2").build()));
+        assertTrue(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "all")
+                .parameter("segments", "s1", "s2").build()));
+        assertFalse(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "all")
+                .parameter("segments", "s1", "s5").build()));
+    }
+
+    @Test
+    public void testString() {
+        assertTrue(eval(builder.profileProperty("properties.gender").equalTo("female").build()));
+        assertFalse(eval(builder.not(builder.profileProperty("properties.gender").equalTo("female")).build()));
+        assertTrue(eval(builder.profileProperty("properties.gender").notEqualTo("male").build()));
+//        assertFalse(eval(builder.not(builder.profileProperty("properties.gender").notEqualTo("male")).build()));
+        assertTrue(eval(builder.profileProperty("properties.gender").startsWith("fe").build()));
+        assertTrue(eval(builder.profileProperty("properties.gender").endsWith("le").build()));
+        assertTrue(eval(builder.profileProperty("properties.gender").contains("fem").build()));
+        assertFalse(eval(builder.profileProperty("properties.gender").contains("mu").build()));
+        assertTrue(eval(builder.profileProperty("properties.gender").matchesRegex(".*ale").build()));
+
+        assertTrue(eval(builder.profileProperty("properties.gender").in("male", "female").build()));
+        assertTrue(eval(builder.profileProperty("properties.gender").notIn("one", "two").build()));
+        assertFalse(eval(builder.profileProperty("properties.gender").notIn("one", "two", "female").build()));
+        assertTrue(eval(builder.profileProperty("properties.gender").all("female").build()));
+        //assertFalse(eval(builder.profileProperty("properties.gender").all("male", "female").build()));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorTest.java b/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorTest.java
deleted file mode 100644
index c635daf..0000000
--- a/itests/src/test/java/org/apache/unomi/itests/ConditionEvaluatorTest.java
+++ /dev/null
@@ -1,178 +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 org.apache.unomi.itests;
-
-import org.apache.unomi.api.Item;
-import org.apache.unomi.api.Profile;
-import org.apache.unomi.api.conditions.Condition;
-import org.apache.unomi.api.services.DefinitionsService;
-import org.apache.unomi.persistence.spi.PersistenceService;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerSuite;
-
-import javax.inject.Inject;
-import java.util.*;
-
-import static org.junit.Assert.*;
-
-/**
- * Integration tests for various condition types.
- * 
- * @author Sergiy Shyrkov
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerSuite.class)
-public class ConditionEvaluatorTest extends BaseTest {
-
-    protected ConditionBuilder builder;
-    @Inject
-    protected PersistenceService persistenceService;
-    protected Item item;
-    protected Date lastVisit;
-    @Inject
-    private DefinitionsService definitionsService;
-
-    protected boolean eval(Condition c) {
-        return persistenceService.testMatch(c, item);
-    }
-
-    @Before
-    public void setUp() {
-        assertNotNull("Definition service should be available", definitionsService);
-        assertNotNull("Persistence service should be available", persistenceService);
-
-        lastVisit = new GregorianCalendar(2015,1,1,20,30,0).getTime();
-
-        Profile profile = new Profile("profile-" + UUID.randomUUID().toString());
-        profile.setProperty("firstVisit", lastVisit);
-        profile.setProperty("age", Integer.valueOf(30));
-        profile.setProperty("gender", "female");
-        profile.setProperty("lastVisit", lastVisit);
-        profile.setSegments(new HashSet<String>(Arrays.asList("s1", "s2", "s3")));
-        this.item = profile;
-        builder = new ConditionBuilder(definitionsService);
-    }
-
-    @Test
-    public void testCompound() {
-        // test AND
-        assertTrue(eval(builder.and(builder.profileProperty("properties.gender").equalTo("female"),
-                builder.profileProperty("properties.age").equalTo(Integer.valueOf(30))).build()));
-        assertFalse(eval(builder.and(builder.profileProperty("properties.gender").equalTo("male"),
-                builder.profileProperty("properties.age").equalTo(Integer.valueOf(30))).build()));
-        assertFalse(eval(builder.and(builder.profileProperty("properties.gender").equalTo("female"),
-                builder.profileProperty("properties.age").equalTo(Integer.valueOf(40))).build()));
-
-        // test OR
-        assertTrue(eval(builder.or(builder.profileProperty("properties.gender").equalTo("female"),
-                builder.profileProperty("properties.age").equalTo(Integer.valueOf(40))).build()));
-        assertTrue(eval(builder.or(builder.profileProperty("properties.gender").equalTo("male"),
-                builder.profileProperty("properties.age").equalTo(Integer.valueOf(30))).build()));
-        assertFalse(eval(builder.or(builder.profileProperty("properties.gender").equalTo("male"),
-                builder.profileProperty("properties.age").equalTo(Integer.valueOf(40))).build()));
-
-        // test NOT
-        assertTrue(eval(builder.not(builder.profileProperty("properties.gender").equalTo("male")).build()));
-        assertFalse(eval(builder.not(builder.profileProperty("properties.age").equalTo(Integer.valueOf(30))).build()));
-
-    }
-
-    @Test
-    public void testDate() {
-        assertTrue(eval(builder.profileProperty("properties.lastVisit").equalTo(lastVisit).build()));
-        assertTrue(eval(builder.profileProperty("properties.lastVisit")
-                .greaterThan(new Date(lastVisit.getTime() - 10000)).build()));
-        assertTrue(eval(builder.profileProperty("properties.lastVisit").lessThan(new Date(lastVisit.getTime() + 10000))
-                .build()));
-        assertTrue(eval(builder.profileProperty("properties.lastVisit")
-                .in(new Date(lastVisit.getTime() + 10000), new Date(lastVisit.getTime() - 10000), lastVisit).build()));
-        assertTrue(eval(builder.profileProperty("properties.lastVisit")
-                .notIn(new Date(lastVisit.getTime() + 10000), new Date(lastVisit.getTime() - 10000)).build()));
-        assertFalse(eval(builder.profileProperty("properties.lastVisit")
-                .notIn(new Date(lastVisit.getTime() + 10000), new Date(lastVisit.getTime() - 10000), lastVisit).build()));
-        assertTrue(eval(builder.profileProperty("properties.lastVisit").all(lastVisit).build()));
-        assertFalse(eval(builder.profileProperty("properties.lastVisit")
-                .all(new Date(lastVisit.getTime() + 10000), lastVisit).build()));
-    }
-
-    @Test
-    public void testExistence() {
-        assertTrue("Gender property does not exist",
-                eval(builder.profileProperty("properties.gender").exists().build()));
-        assertFalse("Gender property missing", eval(builder.profileProperty("properties.gender").missing().build()));
-        assertTrue("Strange property exists", eval(builder.profileProperty("properties.unknown").missing().build()));
-        assertFalse("Strange property exists", eval(builder.profileProperty("properties.unknown").exists().build()));
-    }
-
-    @Test
-    public void testInteger() {
-        assertTrue(eval(builder.profileProperty("properties.age").equalTo(Integer.valueOf(30)).build()));
-        assertTrue(eval(builder.not(builder.profileProperty("properties.age").equalTo(Integer.valueOf(40))).build()));
-        assertTrue(eval(builder.profileProperty("properties.age").notEqualTo(Integer.valueOf(40)).build()));
-        assertTrue(eval(builder.profileProperty("properties.age").lessThan(Integer.valueOf(40)).build()));
-        assertTrue(eval(builder.profileProperty("properties.age").greaterThan(Integer.valueOf(20)).build()));
-        assertTrue(eval(builder.profileProperty("properties.age").greaterThanOrEqualTo(Integer.valueOf(30)).build()));
-        assertFalse(eval(builder.profileProperty("properties.age").greaterThanOrEqualTo(Integer.valueOf(31)).build()));
-
-        assertTrue(eval(builder.profileProperty("properties.age").in(Integer.valueOf(30)).build()));
-        assertTrue(eval(builder.profileProperty("properties.age").in(Integer.valueOf(31), Integer.valueOf(30)).build()));
-        assertTrue(eval(builder.profileProperty("properties.age").notIn(Integer.valueOf(25), Integer.valueOf(26))
-                .build()));
-        assertFalse(eval(builder.profileProperty("properties.age").notIn(Integer.valueOf(25), Integer.valueOf(30))
-                .build()));
-    }
-
-    @Test
-    public void testMultiValue() {
-        assertTrue(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "in")
-                .parameter("segments", "s10", "s20", "s2").build()));
-        assertFalse(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "in")
-                .parameter("segments", "s10", "s20", "s30").build()));
-        assertTrue(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "notIn")
-                .parameter("segments", "s10", "s20", "s30").build()));
-        assertFalse(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "notIn")
-                .parameter("segments", "s10", "s20", "s2").build()));
-        assertTrue(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "all")
-                .parameter("segments", "s1", "s2").build()));
-        assertFalse(eval(builder.property("profileSegmentCondition", "segments").parameter("matchType", "all")
-                .parameter("segments", "s1", "s5").build()));
-    }
-
-    @Test
-    public void testString() {
-        assertTrue(eval(builder.profileProperty("properties.gender").equalTo("female").build()));
-        assertFalse(eval(builder.not(builder.profileProperty("properties.gender").equalTo("female")).build()));
-        assertTrue(eval(builder.profileProperty("properties.gender").notEqualTo("male").build()));
-//        assertFalse(eval(builder.not(builder.profileProperty("properties.gender").notEqualTo("male")).build()));
-        assertTrue(eval(builder.profileProperty("properties.gender").startsWith("fe").build()));
-        assertTrue(eval(builder.profileProperty("properties.gender").endsWith("le").build()));
-        assertTrue(eval(builder.profileProperty("properties.gender").contains("fem").build()));
-        assertFalse(eval(builder.profileProperty("properties.gender").contains("mu").build()));
-        assertTrue(eval(builder.profileProperty("properties.gender").matchesRegex(".*ale").build()));
-
-        assertTrue(eval(builder.profileProperty("properties.gender").in("male", "female").build()));
-        assertTrue(eval(builder.profileProperty("properties.gender").notIn("one", "two").build()));
-        assertFalse(eval(builder.profileProperty("properties.gender").notIn("one", "two", "female").build()));
-        assertTrue(eval(builder.profileProperty("properties.gender").all("female").build()));
-        //assertFalse(eval(builder.profileProperty("properties.gender").all("male", "female").build()));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
new file mode 100644
index 0000000..c23e5ea
--- /dev/null
+++ b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceIT.java
@@ -0,0 +1,53 @@
+/*
+ * 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 org.apache.unomi.itests;
+
+import org.apache.unomi.api.Profile;
+import org.apache.unomi.api.services.ProfileService;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerSuite;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+
+/**
+ * An integration test for the profile service
+ */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerSuite.class)
+public class ProfileServiceIT extends BaseIT {
+
+    private final static Logger LOGGER = LoggerFactory.getLogger(SegmentIT.class);
+    private final static String TEST_PROFILE_ID = "test-profile-id";
+    @Inject
+    protected ProfileService profileService;
+
+    @Test
+    public void testProfileDelete() {
+        Profile profile = new Profile();
+        profile.setItemId(TEST_PROFILE_ID);
+        profileService.save(profile);
+        LOGGER.info("Profile saved, now testing profile delete...");
+        profileService.delete(TEST_PROFILE_ID, false);
+        LOGGER.info("Profile deleted successfully.");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/ProfileServiceTest.java b/itests/src/test/java/org/apache/unomi/itests/ProfileServiceTest.java
deleted file mode 100644
index 4f5dba8..0000000
--- a/itests/src/test/java/org/apache/unomi/itests/ProfileServiceTest.java
+++ /dev/null
@@ -1,53 +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 org.apache.unomi.itests;
-
-import org.apache.unomi.api.Profile;
-import org.apache.unomi.api.services.ProfileService;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerSuite;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-
-/**
- * An integration test for the profile service
- */
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerSuite.class)
-public class ProfileServiceTest extends BaseTest {
-
-    private final static Logger LOGGER = LoggerFactory.getLogger(SegmentTest.class);
-    private final static String TEST_PROFILE_ID = "test-profile-id";
-    @Inject
-    protected ProfileService profileService;
-
-    @Test
-    public void testProfileDelete() {
-        Profile profile = new Profile();
-        profile.setItemId(TEST_PROFILE_ID);
-        profileService.save(profile);
-        LOGGER.info("Profile saved, now testing profile delete...");
-        profileService.delete(TEST_PROFILE_ID, false);
-        LOGGER.info("Profile deleted successfully.");
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java b/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
new file mode 100644
index 0000000..721ab8f
--- /dev/null
+++ b/itests/src/test/java/org/apache/unomi/itests/SegmentIT.java
@@ -0,0 +1,48 @@
+/*
+ * 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 org.apache.unomi.itests;
+
+import org.apache.unomi.api.Metadata;
+import org.apache.unomi.api.services.SegmentService;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerSuite;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import java.util.List;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerSuite.class)
+public class SegmentIT extends BaseIT {
+    private final static Logger LOGGER = LoggerFactory.getLogger(SegmentIT.class);
+    @Inject
+    protected SegmentService segmentService;
+
+    @Test
+    public void testSegments() {
+        Assert.assertNotNull("Segment service should be available", segmentService);
+        List<Metadata> segmentMetadatas = segmentService.getSegmentMetadatas(0, 50, null).getList();
+        Assert.assertEquals("Segment metadata list should be empty", 0, segmentMetadatas.size());
+        LOGGER.info("Retrieved " + segmentMetadatas.size() + " segment metadata entries");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/itests/src/test/java/org/apache/unomi/itests/SegmentTest.java
----------------------------------------------------------------------
diff --git a/itests/src/test/java/org/apache/unomi/itests/SegmentTest.java b/itests/src/test/java/org/apache/unomi/itests/SegmentTest.java
deleted file mode 100644
index 8bf5169..0000000
--- a/itests/src/test/java/org/apache/unomi/itests/SegmentTest.java
+++ /dev/null
@@ -1,48 +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 org.apache.unomi.itests;
-
-import org.apache.unomi.api.Metadata;
-import org.apache.unomi.api.services.SegmentService;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.ops4j.pax.exam.junit.PaxExam;
-import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
-import org.ops4j.pax.exam.spi.reactors.PerSuite;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.inject.Inject;
-import java.util.List;
-
-@RunWith(PaxExam.class)
-@ExamReactorStrategy(PerSuite.class)
-public class SegmentTest extends BaseTest{
-    private final static Logger LOGGER = LoggerFactory.getLogger(SegmentTest.class);
-    @Inject
-    protected SegmentService segmentService;
-
-    @Test
-    public void testSegments() {
-        Assert.assertNotNull("Segment service should be available", segmentService);
-        List<Metadata> segmentMetadatas = segmentService.getSegmentMetadatas(0, 50, null).getList();
-        Assert.assertEquals("Segment metadata list should be empty", 0, segmentMetadatas.size());
-        LOGGER.info("Retrieved " + segmentMetadatas.size() + " segment metadata entries");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-unomi/blob/dafa9f6b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 1d8b334..040e382 100644
--- a/pom.xml
+++ b/pom.xml
@@ -904,7 +904,12 @@
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>
-                    <version>2.18.1</version>
+                    <version>2.19.1</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-failsafe-plugin</artifactId>
+                    <version>2.19.1</version>
                 </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>