You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2014/07/23 20:20:14 UTC
git commit: [OLINGO-377] Replaced cargo with embedded tomcat
Repository: olingo-odata4
Updated Branches:
refs/heads/OLINGO-377-FIT [created] 5ab4bdc92
[OLINGO-377] Replaced cargo with embedded tomcat
Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/5ab4bdc9
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/5ab4bdc9
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/5ab4bdc9
Branch: refs/heads/OLINGO-377-FIT
Commit: 5ab4bdc922720e45e26b126bc3979183ba7007eb
Parents: b891821
Author: Michael Bolz <mi...@sap.com>
Authored: Wed Jul 23 20:16:13 2014 +0200
Committer: Michael Bolz <mi...@sap.com>
Committed: Wed Jul 23 20:16:13 2014 +0200
----------------------------------------------------------------------
fit/pom.xml | 134 ++++++------
.../apache/olingo/fit/server/StringHelper.java | 208 ++++++++++++++++++
.../olingo/fit/server/TomcatTestServer.java | 212 +++++++++++++++++++
.../olingo/fit/AbstractBaseTestITCase.java | 32 +++
.../olingo/fit/proxy/v3/AbstractTestITCase.java | 20 +-
.../olingo/fit/proxy/v4/AbstractTestITCase.java | 19 +-
.../olingo/fit/tecsvc/client/BasicITCase.java | 9 +-
.../olingo/fit/v4/MetadataTestITCase.java | 2 +-
fit/src/test/resources/org-odata-core-v1.xml | 134 ++++++++++++
.../olingo/server/tecsvc/data/StringHelper.java | 208 ------------------
lib/server-test/pom.xml | 14 ++
11 files changed, 695 insertions(+), 297 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/fit/pom.xml
----------------------------------------------------------------------
diff --git a/fit/pom.xml b/fit/pom.xml
index 8f4cbe2..7bbd4db 100644
--- a/fit/pom.xml
+++ b/fit/pom.xml
@@ -79,6 +79,19 @@
<!-- /REST services CXF -->
<dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>7.0.54</version>
+ <!--<version>8.0.9</version>-->
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>7.0.54</version>
+ <!--<version>8.0.9</version>-->
+ </dependency>
+
+ <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
@@ -115,7 +128,6 @@
<groupId>org.apache.olingo</groupId>
<artifactId>olingo-server-tecsvc</artifactId>
<version>${project.version}</version>
- <type>war</type>
<scope>test</scope>
</dependency>
<dependency>
@@ -139,6 +151,44 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.17</version>
+ <!--<configuration>-->
+ <!--<includes>-->
+ <!--<include>**/*TestITCase.java</include>-->
+ <!--</includes>-->
+ <!--</configuration>-->
+ </plugin>
+
+ <!--
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>unpack-dependencies</id>
+ <phase>compile</phase>
+ <!--<phase>package</phase>-->
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <includes>**/olingo/**/*.class</includes>
+ <excludes>**/*.properties</excludes>
+ <outputDirectory>${project.build.directory}/classes</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!--
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<inherited>true</inherited>
<configuration>
@@ -157,8 +207,8 @@
<execution>
<id>integration-test</id>
<goals>
- <goal>integration-test</goal>
- <goal>verify</goal>
+ <!--<goal>integration-test</goal>-->
+ <!--<goal>verify</goal>-->
</goals>
</execution>
</executions>
@@ -168,6 +218,15 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<inherited>true</inherited>
+ <executions>
+ <execution>
+ <id>compile</id>
+ <phase>process-classes</phase>
+ <goals>
+ <goal>exploded</goal>
+ </goals>
+ </execution>
+ </executions>
<configuration>
<webResources>
<resource>
@@ -177,6 +236,7 @@
</includes>-->
</resource>
</webResources>
+
<packagingExcludes>WEB-INF/classes/esigate.properties,WEB-INF/classes/META-INF/LICENSE*,WEB-INF/classes/META-INF/DEPENDENCIES*</packagingExcludes>
</configuration>
</plugin>
@@ -192,74 +252,6 @@
</systemPropertyVariables>
</configuration>
</plugin>
-
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <inherited>true</inherited>
- <configuration>
- <configuration>
- <type>standalone</type>
- <properties>
- <cargo.servlet.port>${cargo.servlet.port}</cargo.servlet.port>
- <cargo.tomcat.ajp.port>${cargo.tomcat.ajp.port}</cargo.tomcat.ajp.port>
- <cargo.rmi.port>${cargo.rmi.port}</cargo.rmi.port>
-
- <!--<cargo.jvmargs>-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -->
- <cargo.jvmargs>-noverify -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=256m</cargo.jvmargs>
- </properties>
- <files>
- <file>
- <file>${project.build.outputDirectory}/esigate.properties</file>
- <todir>lib</todir>
- </file>
- </files>
- <configfiles>
- <configfile>
- <file>${project.build.outputDirectory}/context.xml</file>
- <todir>conf/</todir>
- <tofile>context.xml</tofile>
- </configfile>
- <configfile>
- <file>${project.build.outputDirectory}/tomcat-users.xml</file>
- <todir>conf/</todir>
- <tofile>tomcat-users.xml</tofile>
- </configfile>
- </configfiles>
- </configuration>
- <deployables>
- <deployable>
- <groupId>org.apache.olingo</groupId>
- <artifactId>olingo-server-tecsvc</artifactId>
- <type>war</type>
- <properties>
- <context>olingo-server-tecsvc</context>
- </properties>
- </deployable>
- <deployable>
- <properties>
- <context>stub</context>
- </properties>
- </deployable>
- </deployables>
- </configuration>
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop-container</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/fit/src/main/java/org/apache/olingo/fit/server/StringHelper.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/server/StringHelper.java b/fit/src/main/java/org/apache/olingo/fit/server/StringHelper.java
new file mode 100644
index 0000000..104d5c9
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/server/StringHelper.java
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * 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.olingo.fit.server;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
+import java.util.Random;
+
+/**
+ *
+ */
+public class StringHelper {
+
+ public static class Stream {
+ private final byte[] data;
+
+ private Stream(final byte[] data) {
+ this.data = data;
+ }
+
+ public Stream(final String content, final String charset) throws UnsupportedEncodingException {
+ this(content.getBytes(charset));
+ }
+
+ public InputStream asStream() {
+ return new ByteArrayInputStream(data);
+ }
+
+ public byte[] asArray() {
+ return data;
+ }
+
+ public String asString() {
+ return asString("UTF-8");
+ }
+
+ public String asString(final String charsetName) {
+ return new String(data, Charset.forName(charsetName));
+ }
+
+ public Stream print(final OutputStream out) throws IOException {
+ out.write(data);
+ return this;
+ }
+
+ public Stream print() throws IOException {
+ return print(System.out);
+ }
+
+ /**
+ * Number of lines separated by line breaks (<code>CRLF</code>).
+ * A content string like <code>text\r\nmoreText</code> will result in
+ * a line count of <code>2</code>.
+ *
+ * @return lines count
+ */
+ public int linesCount() {
+ return StringHelper.countLines(asString(), "\r\n");
+ }
+ }
+
+ public static Stream toStream(final InputStream stream) throws IOException {
+ byte[] result = new byte[0];
+ byte[] tmp = new byte[8192];
+ int readCount = stream.read(tmp);
+ while (readCount >= 0) {
+ byte[] innerTmp = new byte[result.length + readCount];
+ System.arraycopy(result, 0, innerTmp, 0, result.length);
+ System.arraycopy(tmp, 0, innerTmp, result.length, readCount);
+ result = innerTmp;
+ readCount = stream.read(tmp);
+ }
+ stream.close();
+ return new Stream(result);
+ }
+
+ public static Stream toStream(final String content) {
+ try {
+ return new Stream(content, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ throw new RuntimeException("UTF-8 should be supported on each system.");
+ }
+ }
+
+ public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) throws IOException {
+ final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8")));
+ final StringBuilder stringBuilder = new StringBuilder();
+ String line = null;
+
+ while ((line = bufferedReader.readLine()) != null) {
+ stringBuilder.append(line);
+ if (preserveLineBreaks) {
+ stringBuilder.append("\n");
+ }
+ }
+
+ bufferedReader.close();
+
+ final String result = stringBuilder.toString();
+
+ return result;
+ }
+
+ public static int countLines(final String content) {
+ return countLines(content, "\r\n");
+ }
+
+ public static int countLines(final String content, final String lineBreak) {
+ if (content == null) {
+ return -1;
+ }
+
+ int lastPos = content.indexOf(lineBreak);
+ int count = 1;
+
+ while (lastPos >= 0) {
+ lastPos = content.indexOf(lineBreak, lastPos + 1);
+ count++;
+ }
+ return count;
+ }
+
+ public static String inputStreamToString(final InputStream in) throws IOException {
+ return inputStreamToString(in, false);
+ }
+
+ /**
+ * Encapsulate given content in an {@link java.io.InputStream} with charset <code>UTF-8</code>.
+ *
+ * @param content to encapsulate content
+ * @return content as stream
+ */
+ public static InputStream encapsulate(final String content) {
+ try {
+ return encapsulate(content, "UTF-8");
+ } catch (UnsupportedEncodingException e) {
+ // we know that UTF-8 is supported
+ throw new TestUtilRuntimeException("UTF-8 MUST be supported.", e);
+ }
+ }
+
+ /**
+ * Encapsulate given content in an {@link java.io.InputStream} with given charset.
+ *
+ * @param content to encapsulate content
+ * @param charset to be used charset
+ * @return content as stream
+ * @throws java.io.UnsupportedEncodingException if charset is not supported
+ */
+ public static InputStream encapsulate(final String content, final String charset)
+ throws UnsupportedEncodingException {
+ return new ByteArrayInputStream(content.getBytes(charset));
+ }
+
+ /**
+ * Generate a string with given length containing random upper case characters ([A-Z]).
+ *
+ * @param len length of to generated string
+ * @return random upper case characters ([A-Z]).
+ */
+ public static InputStream generateDataStream(final int len) {
+ return encapsulate(generateData(len));
+ }
+
+ /**
+ * Generates a string with given length containing random upper case characters ([A-Z]).
+ * @param len length of the generated string
+ * @return random upper case characters ([A-Z])
+ */
+ public static String generateData(final int len) {
+ Random random = new Random();
+ StringBuilder b = new StringBuilder(len);
+ for (int j = 0; j < len; j++) {
+ final char c = (char) ('A' + random.nextInt('Z' - 'A' + 1));
+ b.append(c);
+ }
+ return b.toString();
+ }
+
+ private static class TestUtilRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = 8759664297317490186L;
+ @SuppressWarnings("unused")
+ public TestUtilRuntimeException(String message, Throwable cause) {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java
----------------------------------------------------------------------
diff --git a/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java
new file mode 100644
index 0000000..8bd8e23
--- /dev/null
+++ b/fit/src/main/java/org/apache/olingo/fit/server/TomcatTestServer.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * 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.olingo.fit.server;
+
+import org.apache.catalina.Context;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.LifecycleState;
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.directory.DirContext;
+import javax.servlet.http.HttpServlet;
+import java.io.File;
+import java.io.IOException;
+import java.util.jar.JarFile;
+
+/**
+ *
+ */
+public class TomcatTestServer {
+ private static final Logger LOG = LoggerFactory.getLogger(TomcatTestServer.class);
+
+// private static final int PORT_MIN = 19000;
+// private static final int PORT_MAX = 19200;
+// private static final int PORT_INC = 1;
+
+ private final Tomcat tomcat;
+
+ private TomcatTestServer(Tomcat tomcat) {
+ this.tomcat = tomcat;
+ }
+
+ private static TestServerBuilder builder;
+ public static TestServerBuilder init(int port) {
+ if(builder == null) {
+ builder = new TestServerBuilder(port);
+ }
+ return builder;
+ }
+
+ public static class TestServerBuilder {
+ private final Tomcat tomcat;
+ private final File baseDir;
+ private TomcatTestServer server;
+
+ private TestServerBuilder(int fixedPort) {
+ tomcat = new Tomcat();
+ tomcat.setPort(fixedPort);
+ //baseDir = new File(System.getProperty("java.io.tmpdir"), "tomcat-test");
+ File projectTarget = new File(Thread.currentThread().getContextClassLoader().getResource(".").getFile());
+ // projectTarget == ...fit/target/test-classes
+ baseDir = new File(projectTarget, "../emb-tom-fit");
+ if(!baseDir.exists() && !baseDir.mkdirs()) {
+ throw new RuntimeException("Unable to create temporary test directory at {" + baseDir.getAbsolutePath() + "}");
+ }
+ tomcat.getHost().setAutoDeploy(true);
+ tomcat.getHost().setAppBase(baseDir.getAbsolutePath());
+ tomcat.setBaseDir(baseDir.getParentFile().getAbsolutePath());
+ tomcat.getHost().setDeployOnStartup(true);
+ // <user name="odatajclient" password="odatajclient" roles="odatajclient"/>
+ tomcat.addUser("odatajclient", "odatajclient");
+ tomcat.addRole("odatajclient", "odatajclient");
+ }
+
+ public TestServerBuilder addWebApp() throws IOException {
+ if(server != null) {
+ return this;
+ }
+
+ File projectTarget = new File(Thread.currentThread().getContextClassLoader().getResource(".").getFile());
+ File webAppProjectDir = new File(projectTarget, "../olingo-fit-0.1.0-SNAPSHOT");
+ File webAppDir = new File(baseDir, webAppProjectDir.getName());
+ FileUtils.deleteDirectory(webAppDir);
+ if(!webAppDir.mkdirs()) {
+ throw new RuntimeException("Unable to create temporary directory at {" + webAppDir.getAbsolutePath() + "}");
+ }
+ FileUtils.copyDirectory(webAppProjectDir, webAppDir);
+ File libDir = new File(webAppDir, "WEB-INF/lib");
+ File classesDir = new File(webAppDir, "WEB-INF/classes");
+ String[] libs = new String[]{"olingo-client-proxy-0.1.0-SNAPSHOT.jar",
+ "olingo-commons-api-0.1.0-SNAPSHOT.jar",
+ "olingo-commons-core-0.1.0-SNAPSHOT.jar"};
+ for (String lib : libs) {
+ File libFile = new File(libDir, lib);
+ extract(libFile, classesDir);
+ FileUtils.forceDelete(libFile);
+ }
+
+ String contextPath = "/stub"; // contextFile.getName()
+ tomcat.addWebapp(tomcat.getHost(), contextPath, webAppDir.getAbsolutePath());
+ LOG.info("Webapp {} at context {}.", webAppDir.getName(), contextPath);
+
+ return this;
+ }
+
+ public TestServerBuilder addServlet(final Class<? extends HttpServlet> factoryClass, String path) throws Exception {
+ if(server != null) {
+ return this;
+ }
+ String odataServlet = factoryClass.getName();
+ HttpServlet httpServlet = (HttpServlet) Class.forName(odataServlet).newInstance();
+ Context cxt = getContext();
+ Tomcat.addServlet(cxt, odataServlet, httpServlet);
+ cxt.addServletMapping(path, odataServlet);
+ //
+ LOG.info("Added servlet {} at context {}.", odataServlet, path);
+ return this;
+ }
+
+ private Context baseContext = null;
+
+ private Context getContext() {
+ if(baseContext == null) {
+ baseContext = tomcat.addContext("/", baseDir.getAbsolutePath());
+ }
+ return baseContext;
+ }
+
+ public TomcatTestServer start() throws LifecycleException {
+ if(server != null) {
+ return server;
+ }
+ tomcat.start();
+
+ LOG.info("Started server at endpoint " + tomcat.getServer().getAddress());
+
+// tomcat.getServer().await();
+ tomcat.getServer().getState();
+ server = new TomcatTestServer(tomcat);
+ return server;
+ }
+ }
+
+// public boolean start(final Class<? extends HttpServlet> factoryClass, final String context) {
+// try {
+// init(9080).addServlet(factoryClass, context).start();
+// return true;
+// } catch (Exception e) {
+// e.printStackTrace();
+// return false;
+// }
+// }
+
+// public void start(final Class<? extends HttpServlet> factoryClass) {
+// try {
+// for (int port = PORT_MIN; port <= PORT_MAX; port += PORT_INC) {
+// LifecycleState state = startInternal(factoryClass, port);
+// if(state == LifecycleState.STARTED) {
+// LOG.info("Tomcat in state :[" + state + "]");
+// break;
+// } else {
+// LOG.info("port is busy... " + port + " [" + state + "]");
+// }
+// }
+//
+// if (!tomcat.getServer().getState().isAvailable()) {
+// throw new BindException("no free port in range of [" + PORT_MIN + ".." + PORT_MAX + "]");
+// }
+// } catch (final Exception e) {
+// LOG.error("server start failed", e);
+// throw new RuntimeException(e);
+// }
+// }
+
+ public void stop() throws LifecycleException {
+ if (tomcat.getServer() != null
+ && tomcat.getServer().getState() != LifecycleState.DESTROYED) {
+ if (tomcat.getServer().getState() != LifecycleState.STOPPED) {
+ tomcat.stop();
+ }
+ tomcat.destroy();
+ }
+ }
+
+ private static void extract(File jarFile, File destDir) throws IOException {
+ JarFile jar = new java.util.jar.JarFile(jarFile);
+ java.util.Enumeration enumEntries = jar.entries();
+ while (enumEntries.hasMoreElements()) {
+ java.util.jar.JarEntry file = (java.util.jar.JarEntry) enumEntries.nextElement();
+ java.io.File f = new java.io.File(destDir + java.io.File.separator + file.getName());
+ if (file.isDirectory()) { // if its a directory, create it
+ f.mkdir();
+ continue;
+ }
+ java.io.InputStream is = jar.getInputStream(file); // get the input stream
+ java.io.FileOutputStream fos = new java.io.FileOutputStream(f);
+ while (is.available() > 0) { // write contents of 'is' to 'fos'
+ fos.write(is.read());
+ }
+ fos.close();
+ is.close();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java
index 0e2d1d5..922c9fb 100644
--- a/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/AbstractBaseTestITCase.java
@@ -27,9 +27,17 @@ import org.apache.olingo.commons.api.domain.CommonODataProperty;
import org.apache.olingo.commons.api.domain.ODataValue;
import org.apache.olingo.commons.api.format.ODataFormat;
import org.apache.olingo.commons.api.serialization.ODataSerializerException;
+import org.apache.olingo.fit.server.StringHelper;
+import org.apache.olingo.fit.server.TomcatTestServer;
+import org.apache.olingo.server.tecsvc.TechnicalServlet;
+import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
@@ -44,6 +52,21 @@ public abstract class AbstractBaseTestITCase {
@SuppressWarnings("rawtypes")
protected abstract CommonODataClient getClient();
+
+ @BeforeClass
+ public static void init() throws Exception {
+ TomcatTestServer server = TomcatTestServer.init(9080)
+ .addServlet(TechnicalServlet.class, "/olingo-server-tecsvc/odata.svc/*")
+ .addServlet(StaticContent.class, "/olingo-server-tecsvc/v4.0/cs02/vocabularies/Org.OData.Core.V1.xml")
+ .addWebApp()
+ .start();
+ }
+
+// @AfterClass
+// public static void cleanUp() throws LifecycleException {
+// server.stop();
+// }
+
protected void debugEntity(final Entity entity, final String message) {
if (LOG.isDebugEnabled()) {
final StringWriter writer = new StringWriter();
@@ -104,4 +127,13 @@ public abstract class AbstractBaseTestITCase {
}
}
+ public static class StaticContent extends HttpServlet {
+ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+
+ StringHelper.Stream st = StringHelper.toStream(
+ Thread.currentThread().getContextClassLoader().getResourceAsStream("org-odata-core-v1.xml"));
+ resp.getOutputStream().write(st.asArray());
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
index df2a003..0e71806 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v3/AbstractTestITCase.java
@@ -25,12 +25,15 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
+
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.v3.EdmEnabledODataClient;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
//CHECKSTYLE:OFF (Maven checkstyle)
+import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.proxy.v3.staticservice.Service;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.DefaultContainer;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Aliases;
@@ -38,19 +41,15 @@ import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.service
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.ContactDetailsCollection;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.Customer;
import org.apache.olingo.fit.proxy.v3.staticservice.microsoft.test.odata.services.astoriadefaultservice.types.PhoneCollection;
+
+import org.apache.olingo.fit.server.TomcatTestServer;
+import org.apache.olingo.server.tecsvc.TechnicalServlet;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
//CHECKSTYLE:ON (Maven checkstyle)
-public abstract class AbstractTestITCase {
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractTestITCase.class);
-
- protected static final String TEST_PRODUCT_TYPE = "Microsoft.Test.OData.Services.AstoriaDefaultService.Product";
+public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
protected static String testStaticServiceRootURL;
@@ -165,4 +164,9 @@ public abstract class AbstractTestITCase {
return customer;
}
+
+ @Override
+ protected CommonODataClient getClient() {
+ throw new RuntimeException("This method should not be used from proxy tests.");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
index 6a74d50..c90135e 100644
--- a/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/proxy/v4/AbstractTestITCase.java
@@ -29,26 +29,24 @@ import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Calendar;
import java.util.TimeZone;
+
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.v4.EdmEnabledODataClient;
import org.apache.olingo.commons.api.format.ContentType;
import org.apache.olingo.ext.proxy.AbstractService;
import org.apache.olingo.ext.proxy.api.PrimitiveCollection;
+import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.proxy.v4.staticservice.Service;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.InMemoryEntities;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Customer;
import org.apache.olingo.fit.proxy.v4.staticservice.microsoft.test.odata.services.odatawcfservice.types.Order;
+import org.apache.olingo.fit.server.TomcatTestServer;
+import org.apache.olingo.server.tecsvc.TechnicalServlet;
import org.junit.BeforeClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class AbstractTestITCase {
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractTestITCase.class);
-
- protected static final String TEST_PRODUCT_TYPE = "Microsoft.Test.OData.Services.AstoriaDefaultService.Product";
+public abstract class AbstractTestITCase extends AbstractBaseTestITCase {
protected static String testStaticServiceRootURL;
@@ -147,4 +145,9 @@ public abstract class AbstractTestITCase {
} catch (IllegalArgumentException e) {
}
}
+
+ @Override
+ protected CommonODataClient getClient() {
+ throw new RuntimeException("This method should not be used from proxy tests.");
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
index a419ca0..8514ca4 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/BasicITCase.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import org.apache.olingo.client.api.CommonODataClient;
import org.apache.olingo.client.api.communication.request.retrieve.EdmMetadataRequest;
import org.apache.olingo.client.api.communication.request.retrieve.ODataServiceDocumentRequest;
import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
@@ -31,11 +32,12 @@ import org.apache.olingo.commons.api.domain.ODataServiceDocument;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.FullQualifiedName;
import org.apache.olingo.commons.api.format.ODataFormat;
+import org.apache.olingo.fit.AbstractBaseTestITCase;
import org.apache.olingo.fit.tecsvc.TecSvcConst;
import org.junit.Before;
import org.junit.Test;
-public class BasicITCase {
+public class BasicITCase extends AbstractBaseTestITCase {
private static final String SERVICE_URI = TecSvcConst.BASE_URI;
@@ -47,6 +49,7 @@ public class BasicITCase {
odata.getConfiguration().setDefaultPubFormat(ODataFormat.JSON);
}
+
@Test
public void readServiceDocument() {
ODataServiceDocumentRequest request =
@@ -81,4 +84,8 @@ public class BasicITCase {
assertNotNull(edm.getTerm(new FullQualifiedName("Core.Description")));
assertEquals(2, edm.getSchemas().size());
}
+
+ @Override protected CommonODataClient getClient() {
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java b/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
index bd55d0b..2119c0c 100644
--- a/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/v4/MetadataTestITCase.java
@@ -18,10 +18,10 @@
*/
package org.apache.olingo.fit.v4;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertEquals;
import org.apache.olingo.commons.api.edm.Edm;
import org.apache.olingo.commons.api.edm.EdmAnnotation;
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/fit/src/test/resources/org-odata-core-v1.xml
----------------------------------------------------------------------
diff --git a/fit/src/test/resources/org-odata-core-v1.xml b/fit/src/test/resources/org-odata-core-v1.xml
new file mode 100644
index 0000000..48cbb62
--- /dev/null
+++ b/fit/src/test/resources/org-odata-core-v1.xml
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+
+<!--
+ OData Version 4.0
+ Committee Specification 02
+ 17 November 2013
+ Copyright (c) OASIS Open 2013. All Rights Reserved.
+ Source: http://docs.oasis-open.org/odata/odata/v4.0/cs02/vocabularies/
+-->
+
+<edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0">
+ <edmx:DataServices>
+ <Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Org.OData.Core.V1" Alias="Core">
+ <Annotation Term="Core.Description">
+ <String>Core terms needed to write vocabularies</String>
+ </Annotation>
+
+ <!--Documentation -->
+
+ <Term Name="Description" Type="Edm.String">
+ <Annotation Term="Core.Description" String="A brief description of a model element" />
+ <Annotation Term="Core.IsLanguageDependent" />
+ </Term>
+
+ <Term Name="LongDescription" Type="Edm.String">
+ <Annotation Term="Core.Description" String="A lengthy description of a model element" />
+ <Annotation Term="Core.IsLanguageDependent" />
+ </Term>
+
+ <!-- Localization -->
+
+ <Term Name="IsLanguageDependent" Type="Core.Tag" DefaultValue="true" AppliesTo="Property Term">
+ <Annotation Term="Core.Description" String="Properties and terms annotated with this term are language-dependent" />
+ <Annotation Term="Core.RequiresType" String="Edm.String" />
+ </Term>
+
+ <!-- Term Restrictions -->
+
+ <TypeDefinition Name="Tag" UnderlyingType="Edm.Boolean">
+ <Annotation Term="Core.Description" String="This is the type to use for all tagging terms" />
+ </TypeDefinition>
+
+ <Term Name="RequiresType" Type="Edm.String" AppliesTo="Term">
+ <Annotation Term="Core.Description"
+ String="Properties and terms annotated with this annotation MUST have a type that is identical to or derived from the given type name" />
+ </Term>
+
+ <!--Resource Paths -->
+
+ <Term Name="ResourcePath" Type="Edm.String" AppliesTo="EntitySet Singleton ActionImport FunctionImport">
+ <Annotation Term="Core.Description"
+ String="Resource path for entity container child, can be relative to xml:base and the request URL" />
+ <Annotation Term="Core.IsUrl" />
+ </Term>
+
+ <Term Name="DereferenceableIDs" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
+ <Annotation Term="Core.Description" String="Entity-ids are URLs that locate the identified entity" />
+ </Term>
+
+ <Term Name="ConventionalIDs" Type="Core.Tag" DefaultValue="true" AppliesTo="EntityContainer">
+ <Annotation Term="Core.Description" String="Entity-ids follow OData URL conventions" />
+ </Term>
+
+ <!-- Permissions -->
+
+ <Term Name="Permissions" Type="Core.Permission" AppliesTo="Property">
+ <Annotation Term="Core.Description" String="Permissions available for a property.The value of 2 is reserved for future use." />
+ </Term>
+ <EnumType Name="Permission" IsFlags="true">
+ <Member Name="None" Value="0" />
+ <Member Name="Read" Value="1" />
+ <Member Name="ReadWrite" Value="3" />
+ </EnumType>
+
+ <!-- Metadata Extensions -->
+
+ <Term Name="Immutable" Type="Core.Tag" DefaultValue="true" AppliesTo="Property">
+ <Annotation Term="Core.Description"
+ String="A value for this non-key property can be provided on insert and remains unchanged on update" />
+ </Term>
+
+ <Term Name="Computed" Type="Core.Tag" DefaultValue="true" AppliesTo="Property">
+ <Annotation Term="Core.Description" String="A value for this property is generated on both insert and update" />
+ </Term>
+
+ <Term Name="IsURL" Type="Core.Tag" DefaultValue="true" AppliesTo="Property Term">
+ <Annotation Term="Core.Description" String="Properties and terms annotated with this term MUST contain a valid URL" />
+ <Annotation Term="Core.RequiresType" String="Edm.String" />
+ </Term>
+
+ <Term Name="AcceptableMediaTypes" Type="Collection(Edm.String)" AppliesTo="EntityType Property">
+ <Annotation Term="Core.Description"
+ String="Lists the MIME types acceptable for the annotated entity type marked with HasStream="true" or the annotated stream property" />
+ <Annotation Term="Core.IsMediaType" />
+ </Term>
+
+ <Term Name="MediaType" Type="Edm.String" AppliesTo="Property">
+ <Annotation Term="Core.IsMediaType" />
+ <Annotation Term="Core.RequiresType" String="Edm.Binary" />
+ </Term>
+
+ <Term Name="IsMediaType" Type="Core.Tag" DefaultValue="true" AppliesTo="Property Term">
+ <Annotation Term="Core.Description" String="Properties and terms annotated with this term MUST contain a valid MIME type" />
+ <Annotation Term="Core.RequiresType" String="Edm.String" />
+ </Term>
+
+ <Term Name="OptimisticConcurrency" Type="Collection(Edm.PropertyPath)" AppliesTo="EntitySet">
+ <Annotation Term="Core.Description"
+ String="Data modification requires the use of Etags. A non-empty collection contains the set of properties that are used to compute the ETag" />
+ </Term>
+
+ </Schema>
+ </edmx:DataServices>
+</edmx:Edmx>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/StringHelper.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/StringHelper.java b/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/StringHelper.java
deleted file mode 100644
index 6ae4b5a..0000000
--- a/lib/server-tecsvc/src/test/java/org/apache/olingo/server/tecsvc/data/StringHelper.java
+++ /dev/null
@@ -1,208 +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.olingo.server.tecsvc.data;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.Charset;
-import java.util.Random;
-
-/**
- *
- */
-public class StringHelper {
-
- public static class Stream {
- private final byte[] data;
-
- private Stream(final byte[] data) {
- this.data = data;
- }
-
- public Stream(final String content, final String charset) throws UnsupportedEncodingException {
- this(content.getBytes(charset));
- }
-
- public InputStream asStream() {
- return new ByteArrayInputStream(data);
- }
-
- public byte[] asArray() {
- return data;
- }
-
- public String asString() {
- return asString("UTF-8");
- }
-
- public String asString(final String charsetName) {
- return new String(data, Charset.forName(charsetName));
- }
-
- public Stream print(final OutputStream out) throws IOException {
- out.write(data);
- return this;
- }
-
- public Stream print() throws IOException {
- return print(System.out);
- }
-
- /**
- * Number of lines separated by line breaks (<code>CRLF</code>).
- * A content string like <code>text\r\nmoreText</code> will result in
- * a line count of <code>2</code>.
- *
- * @return lines count
- */
- public int linesCount() {
- return StringHelper.countLines(asString(), "\r\n");
- }
- }
-
- public static Stream toStream(final InputStream stream) throws IOException {
- byte[] result = new byte[0];
- byte[] tmp = new byte[8192];
- int readCount = stream.read(tmp);
- while (readCount >= 0) {
- byte[] innerTmp = new byte[result.length + readCount];
- System.arraycopy(result, 0, innerTmp, 0, result.length);
- System.arraycopy(tmp, 0, innerTmp, result.length, readCount);
- result = innerTmp;
- readCount = stream.read(tmp);
- }
- stream.close();
- return new Stream(result);
- }
-
- public static Stream toStream(final String content) {
- try {
- return new Stream(content, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- throw new RuntimeException("UTF-8 should be supported on each system.");
- }
- }
-
- public static String inputStreamToString(final InputStream in, final boolean preserveLineBreaks) throws IOException {
- final BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(in, Charset.forName("UTF-8")));
- final StringBuilder stringBuilder = new StringBuilder();
- String line = null;
-
- while ((line = bufferedReader.readLine()) != null) {
- stringBuilder.append(line);
- if (preserveLineBreaks) {
- stringBuilder.append("\n");
- }
- }
-
- bufferedReader.close();
-
- final String result = stringBuilder.toString();
-
- return result;
- }
-
- public static int countLines(final String content) {
- return countLines(content, "\r\n");
- }
-
- public static int countLines(final String content, final String lineBreak) {
- if (content == null) {
- return -1;
- }
-
- int lastPos = content.indexOf(lineBreak);
- int count = 1;
-
- while (lastPos >= 0) {
- lastPos = content.indexOf(lineBreak, lastPos + 1);
- count++;
- }
- return count;
- }
-
- public static String inputStreamToString(final InputStream in) throws IOException {
- return inputStreamToString(in, false);
- }
-
- /**
- * Encapsulate given content in an {@link InputStream} with charset <code>UTF-8</code>.
- *
- * @param content to encapsulate content
- * @return content as stream
- */
- public static InputStream encapsulate(final String content) {
- try {
- return encapsulate(content, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- // we know that UTF-8 is supported
- throw new TestUtilRuntimeException("UTF-8 MUST be supported.", e);
- }
- }
-
- /**
- * Encapsulate given content in an {@link InputStream} with given charset.
- *
- * @param content to encapsulate content
- * @param charset to be used charset
- * @return content as stream
- * @throws UnsupportedEncodingException if charset is not supported
- */
- public static InputStream encapsulate(final String content, final String charset)
- throws UnsupportedEncodingException {
- return new ByteArrayInputStream(content.getBytes(charset));
- }
-
- /**
- * Generate a string with given length containing random upper case characters ([A-Z]).
- *
- * @param len length of to generated string
- * @return random upper case characters ([A-Z]).
- */
- public static InputStream generateDataStream(final int len) {
- return encapsulate(generateData(len));
- }
-
- /**
- * Generates a string with given length containing random upper case characters ([A-Z]).
- * @param len length of the generated string
- * @return random upper case characters ([A-Z])
- */
- public static String generateData(final int len) {
- Random random = new Random();
- StringBuilder b = new StringBuilder(len);
- for (int j = 0; j < len; j++) {
- final char c = (char) ('A' + random.nextInt('Z' - 'A' + 1));
- b.append(c);
- }
- return b.toString();
- }
-
- private static class TestUtilRuntimeException extends RuntimeException {
- private static final long serialVersionUID = 8759664297317490186L;
- @SuppressWarnings("unused")
- public TestUtilRuntimeException(String message, Throwable cause) {
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/5ab4bdc9/lib/server-test/pom.xml
----------------------------------------------------------------------
diff --git a/lib/server-test/pom.xml b/lib/server-test/pom.xml
index 334bea5..ee74124 100644
--- a/lib/server-test/pom.xml
+++ b/lib/server-test/pom.xml
@@ -49,6 +49,20 @@
</dependency>
<dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-core</artifactId>
+ <version>7.0.54</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat.embed</groupId>
+ <artifactId>tomcat-embed-logging-juli</artifactId>
+ <version>7.0.54</version>
+ <scope>test</scope>
+ </dependency>
+
+
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>