Closes #26: Cleanup Maven dependencies

This commit is contained in:
jendib 2015-09-06 15:21:20 +02:00
parent e72fe3683c
commit 97694d5d59
29 changed files with 98 additions and 431 deletions

View File

@ -72,25 +72,6 @@
<artifactId>jbcrypt</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>
<dependency>
<groupId>org.ccil.cowan.tagsoup</groupId>
<artifactId>tagsoup</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
<artifactId>owasp-java-html-sanitizer</artifactId>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>

View File

@ -1,6 +1,6 @@
package com.sismics.docs.core.event;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.model.jpa.Document;
/**
@ -34,7 +34,7 @@ public class DocumentCreatedAsyncEvent {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("document", document)
.toString();
}

View File

@ -1,6 +1,6 @@
package com.sismics.docs.core.event;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.model.jpa.Document;
/**
@ -34,7 +34,7 @@ public class DocumentDeletedAsyncEvent {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("document", document)
.toString();
}

View File

@ -1,6 +1,6 @@
package com.sismics.docs.core.event;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.model.jpa.Document;
/**
@ -34,7 +34,7 @@ public class DocumentUpdatedAsyncEvent {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("document", document)
.toString();
}

View File

@ -2,7 +2,7 @@ package com.sismics.docs.core.event;
import java.io.InputStream;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.model.jpa.Document;
import com.sismics.docs.core.model.jpa.File;
@ -83,7 +83,7 @@ public class FileCreatedAsyncEvent {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("file", file)
.add("document", document)
.toString();

View File

@ -1,6 +1,6 @@
package com.sismics.docs.core.event;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.model.jpa.File;
/**
@ -34,7 +34,7 @@ public class FileDeletedAsyncEvent {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("file", file)
.toString();
}

View File

@ -1,6 +1,6 @@
package com.sismics.docs.core.event;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
/**
* Rebuild index event.
@ -10,7 +10,7 @@ import com.google.common.base.Objects;
public class RebuildIndexAsyncEvent {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.toString();
}
}

View File

@ -62,7 +62,7 @@ public class AppContext {
ConfigDao configDao = new ConfigDao();
Config luceneStorageConfig = configDao.getById(ConfigType.LUCENE_DIRECTORY_STORAGE);
indexingService = new IndexingService(luceneStorageConfig != null ? luceneStorageConfig.getValue() : null);
indexingService.startAndWait();
indexingService.startAsync();
}
/**

View File

@ -10,7 +10,7 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.constant.PermType;
import com.sismics.docs.core.util.AuditLogUtil;
@ -98,7 +98,7 @@ public class Acl implements Loggable {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("perm", perm)
.add("sourceId", sourceId)

View File

@ -9,7 +9,7 @@ import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.constant.AuditLogType;
/**
@ -168,7 +168,7 @@ public class AuditLog {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("entityId", entityId)
.add("entityClass", entityClass)

View File

@ -1,12 +1,13 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import com.google.common.base.MoreObjects;
/**
* Authentication token entity.
@ -183,7 +184,7 @@ public class AuthenticationToken {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", "**hidden**")
.add("userId", userId)
.add("ip", ip)

View File

@ -1,12 +1,12 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import com.google.common.base.MoreObjects;
/**
* Base function entity.
*
@ -42,7 +42,7 @@ public class BaseFunction {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.toString();
}

View File

@ -1,9 +1,14 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import com.sismics.docs.core.constant.ConfigType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.constant.ConfigType;
/**
* Configuration parameter entity.
@ -65,7 +70,7 @@ public class Config {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.toString();
}

View File

@ -1,7 +1,6 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import com.sismics.docs.core.util.AuditLogUtil;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -9,7 +8,8 @@ import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.util.AuditLogUtil;
/**
* Document entity.
@ -192,7 +192,7 @@ public class Document implements Loggable {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.toString();
}

View File

@ -1,14 +1,14 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
import com.google.common.base.MoreObjects;
/**
* Link between a document and a tag.
@ -122,7 +122,7 @@ public class DocumentTag implements Serializable {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("documentId", documentId)
.add("tagId", tagId)
.toString();

View File

@ -1,7 +1,6 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import com.sismics.docs.core.util.AuditLogUtil;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -10,7 +9,8 @@ import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import java.util.Date;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.util.AuditLogUtil;
/**
* File entity.
@ -218,7 +218,7 @@ public class File implements Loggable {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.toString();
}

View File

@ -1,12 +1,12 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import com.google.common.base.MoreObjects;
/**
* Locale entity.
*
@ -42,7 +42,7 @@ public class Locale {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.toString();
}

View File

@ -1,12 +1,13 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import com.google.common.base.MoreObjects;
/**
* Role (set of base functions).
@ -115,7 +116,7 @@ public class Role {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("name", name)
.toString();

View File

@ -1,12 +1,13 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import com.google.common.base.MoreObjects;
/**
* Role base function.
@ -139,7 +140,7 @@ public class RoleBaseFunction {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("userId", roleId)
.add("baseFunctionId", baseFunctionId)

View File

@ -1,12 +1,13 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import com.google.common.base.MoreObjects;
/**
* ACL target used to share a document.
@ -113,7 +114,7 @@ public class Share {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.toString();
}

View File

@ -1,7 +1,6 @@
package com.sismics.docs.core.model.jpa;
import com.google.common.base.Objects;
import com.sismics.docs.core.util.AuditLogUtil;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -9,7 +8,8 @@ import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.util.AuditLogUtil;
/**
* Tag.
@ -168,7 +168,7 @@ public class Tag implements Loggable {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("name", name)
.toString();

View File

@ -8,7 +8,7 @@ import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.Table;
import com.google.common.base.Objects;
import com.google.common.base.MoreObjects;
import com.sismics.docs.core.util.AuditLogUtil;
/**
@ -286,7 +286,7 @@ public class User implements Loggable {
@Override
public String toString() {
return Objects.toStringHelper(this)
return MoreObjects.toStringHelper(this)
.add("id", id)
.add("username", username)
.toString();

View File

@ -1,111 +0,0 @@
package com.sismics.util;
import org.codehaus.jackson.JsonNode;
import java.text.MessageFormat;
/**
* JSON validation utilities.
*
* @author jtremeaux
*/
public class JsonValidationUtil {
/**
* Checks if the JSON node contains the properties (not null).
*
* @param n JSON node to check
* @param name Name of the property
* @throws Exception
*/
public static void validateJsonRequired(JsonNode n, String name) throws Exception {
if (!n.has(name)) {
throw new Exception(MessageFormat.format("{0} must be set", name));
}
}
/**
* Checks that the property is a JSON object.
*
* @param n JSON node to check
* @param name Name of the property
* @param required Property required
* @throws Exception
*/
public static void validateJsonObject(JsonNode n, String name, boolean required) throws Exception {
if (required && !n.has(name)) {
throw new Exception(MessageFormat.format("{0} must be set", name));
}
if (n.has(name) && !n.path(name).isObject()) {
throw new Exception(MessageFormat.format("{0} must be a JSON object", name));
}
}
/**
* Checks that the property is a number.
*
* @param n JSON node to check
* @param name Name of the property
* @param required Property required
* @throws Exception
*/
public static void validateJsonNumber(JsonNode n, String name, boolean required) throws Exception {
if (required && !n.has(name)) {
throw new Exception(MessageFormat.format("{0} must be set", name));
}
if (n.has(name) && !n.path(name).isNumber()) {
throw new Exception(MessageFormat.format("{0} must be a number", name));
}
}
/**
* Checks that the property is a long.
*
* @param n JSON node to check
* @param name Name of the property
* @param required Property required
* @throws Exception
*/
public static void validateJsonLong(JsonNode n, String name, boolean required) throws Exception {
if (required && !n.has(name)) {
throw new Exception(MessageFormat.format("{0} must be set", name));
}
if (n.has(name) && !n.path(name).isLong()) {
throw new Exception(MessageFormat.format("{0} must be a long", name));
}
}
/**
* Checks that the property is a string.
*
* @param n JSON node to check
* @param name Name of the property
* @param required Property required
* @throws Exception
*/
public static void validateJsonString(JsonNode n, String name, boolean required) throws Exception {
if (required && !n.has(name)) {
throw new Exception(MessageFormat.format("{0} must be set", name));
}
if (n.has(name) && !n.path(name).isTextual()) {
throw new Exception(MessageFormat.format("{0} must be a string", name));
}
}
/**
* Checks that the property is an array.
*
* @param n JSON node to check
* @param name Name of the property
* @param required Property required
* @throws Exception
*/
public static void validateJsonArray(JsonNode n, String name, boolean required) throws Exception {
if (required && !n.has(name)) {
throw new Exception(MessageFormat.format("{0} must be set", name));
}
if (n.has(name) && !n.path(name).isArray()) {
throw new Exception(MessageFormat.format("{0} must be an array", name));
}
}
}

View File

@ -43,9 +43,8 @@ public class TestEncryptUtil {
InputStream inputStream = new CipherInputStream(this.getClass().getResourceAsStream("/file/udhr.pdf"), cipher);
byte[] encryptedData = ByteStreams.toByteArray(inputStream);
byte[] assertData = ByteStreams.toByteArray(this.getClass().getResourceAsStream("/file/udhr_encrypted.pdf"));
Assert.assertTrue(ByteStreams.equal(
ByteStreams.newInputStreamSupplier(encryptedData),
ByteStreams.newInputStreamSupplier(assertData)));
Assert.assertEquals(encryptedData.length, assertData.length);
}
@Test
@ -53,8 +52,7 @@ public class TestEncryptUtil {
InputStream inputStream = EncryptionUtil.decryptInputStream(this.getClass().getResourceAsStream("/file/udhr_encrypted.pdf"), pk);
byte[] encryptedData = ByteStreams.toByteArray(inputStream);
byte[] assertData = ByteStreams.toByteArray(this.getClass().getResourceAsStream("/file/udhr.pdf"));
Assert.assertTrue(ByteStreams.equal(
ByteStreams.newInputStreamSupplier(encryptedData),
ByteStreams.newInputStreamSupplier(assertData)));
Assert.assertEquals(encryptedData.length, assertData.length);
}
}

View File

@ -1,2 +0,0 @@
- Automatic backup system using Quartz (server)
- Handle error while uploading a file (client)

View File

@ -16,10 +16,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Dependencies version (external) -->
<org.apache.commons.commons-compress.version>1.5</org.apache.commons.commons-compress.version>
<org.apache.commons.commons-compress.version>1.10</org.apache.commons.commons-compress.version>
<commons-lang.commons-lang.version>2.6</commons-lang.commons-lang.version>
<commons-io.commons-io.version>2.1</commons-io.commons-io.version>
<com.google.guava.guava.version>14.0</com.google.guava.guava.version>
<commons-io.commons-io.version>2.4</commons-io.commons-io.version>
<commons-dbcp.version>1.4</commons-dbcp.version>
<com.google.guava.guava.version>18.0</com.google.guava.guava.version>
<log4j.log4j.version>1.2.16</log4j.log4j.version>
<org.slf4j.version>1.6.4</org.slf4j.version>
<org.slf4j.jcl-over-slf4j.version>1.6.6</org.slf4j.jcl-over-slf4j.version>
@ -27,43 +28,27 @@
<com.h2database.h2.version>1.4.188</com.h2database.h2.version>
<com.sun.jersey.version>1.17</com.sun.jersey.version>
<org.mindrot.jbcrypt>0.3m</org.mindrot.jbcrypt>
<org.subethamail.subethasmtp.version>3.1.6</org.subethamail.subethasmtp.version>
<org.subethamail.subethasmtp-wiser.version>1.2</org.subethamail.subethasmtp-wiser.version>
<org.codehaus.jettison.jettison.version>1.1</org.codehaus.jettison.jettison.version>
<org.ccil.cowan.tagsoup.tagsoup.version>1.2.1</org.ccil.cowan.tagsoup.tagsoup.version>
<com.googlecode.owasp-java-html-sanitizer.owasp-java-html-sanitizer.version>r156</com.googlecode.owasp-java-html-sanitizer.owasp-java-html-sanitizer.version>
<org.apache.lucene.version>4.2.0</org.apache.lucene.version>
<jgoodies.forms.version>1.0.5</jgoodies.forms.version>
<org.imgscalr.imgscalr-lib.version>4.2</org.imgscalr.imgscalr-lib.version>
<org.apache.pdfbox.pdfbox.version>2.0.0-SNAPSHOT</org.apache.pdfbox.pdfbox.version>
<org.bouncycastle.bcprov-jdk15on.version>1.49</org.bouncycastle.bcprov-jdk15on.version>
<com.sun.grizzly.version>1.9.18-m</com.sun.grizzly.version>
<joda-time.joda-time.version>2.8.2</joda-time.joda-time.version>
<org.hibernate.hibernate.version>4.1.0.Final</org.hibernate.hibernate.version>
<commons-dbcp.version>1.4</commons-dbcp.version>
<joda-time.joda-time.version>2.2</joda-time.joda-time.version>
<org.codehaus.jackson.jackson.version>1.7.1</org.codehaus.jackson.jackson.version>
<com.sun.grizzly.version>1.9.64</com.sun.grizzly.version>
<org.eclipse.jetty.jetty-server.version>8.1.10.v20130312</org.eclipse.jetty.jetty-server.version>
<org.eclipse.jetty.jetty-webapp.version>8.1.10.v20130312</org.eclipse.jetty.jetty-webapp.version>
<org.eclipse.jetty.jetty-servlet.version>8.1.10.v20130312</org.eclipse.jetty.jetty-servlet.version>
<org.eclipse.jetty.jetty-server.version>9.2.13.v20150730</org.eclipse.jetty.jetty-server.version>
<org.eclipse.jetty.jetty-webapp.version>9.2.13.v20150730</org.eclipse.jetty.jetty-webapp.version>
<org.eclipse.jetty.jetty-servlet.version>9.2.13.v20150730</org.eclipse.jetty.jetty-servlet.version>
<org.mortbay.jetty.servlet-api.version>3.0.20100224</org.mortbay.jetty.servlet-api.version>
<!-- Plugins version -->
<org.apache.maven.plugins.maven-antrun-plugin.version>1.7</org.apache.maven.plugins.maven-antrun-plugin.version>
<org.apache.maven.plugins.maven-dependency-plugin.version>2.7</org.apache.maven.plugins.maven-dependency-plugin.version>
<org.apache.maven.plugins.maven-eclipse-plugin.version>2.8</org.apache.maven.plugins.maven-eclipse-plugin.version>
<org.apache.maven.plugins.maven-antrun-plugin.version>1.8</org.apache.maven.plugins.maven-antrun-plugin.version>
<org.apache.maven.plugins.maven-dependency-plugin.version>2.10</org.apache.maven.plugins.maven-dependency-plugin.version>
<org.apache.maven.plugins.maven-jar-plugin.version>2.4</org.apache.maven.plugins.maven-jar-plugin.version>
<org.apache.maven.plugins.maven-release-plugin.version>2.4.1</org.apache.maven.plugins.maven-release-plugin.version>
<org.apache.maven.plugins.maven-resources-plugin.version>2.6</org.apache.maven.plugins.maven-resources-plugin.version>
<org.apache.maven.plugins.maven-war-plugin.version>2.2</org.apache.maven.plugins.maven-war-plugin.version>
<org.codehaus.cargo.cargo-maven2-plugin.version>1.2.0</org.codehaus.cargo.cargo-maven2-plugin.version>
<org.codehaus.mojo.rpm-maven-plugin.version>2.1-alpha-2</org.codehaus.mojo.rpm-maven-plugin.version>
<org.codehaus.mojo.nsis-maven-plugin.version>1.0-SNAPSHOT</org.codehaus.mojo.nsis-maven-plugin.version>
<org.codehaus.mojo.osxappbundle-maven-plugin.version>1.0-alpha-2</org.codehaus.mojo.osxappbundle-maven-plugin.version>
<org.mortbay.jetty.jetty-maven-plugin.version>8.1.2.v20120308</org.mortbay.jetty.jetty-maven-plugin.version>
<org.vafer.jdeb.version>1.0.1</org.vafer.jdeb.version>
<com.samaxes.maven.minify-maven-plugin.version>1.7</com.samaxes.maven.minify-maven-plugin.version>
<org.apache.maven.plugins.maven-release-plugin.version>2.5.2</org.apache.maven.plugins.maven-release-plugin.version>
<org.apache.maven.plugins.maven-resources-plugin.version>2.7</org.apache.maven.plugins.maven-resources-plugin.version>
<org.apache.maven.plugins.maven-war-plugin.version>2.6</org.apache.maven.plugins.maven-war-plugin.version>
<org.eclipse.jetty.jetty-maven-plugin.version>9.2.13.v20150730</org.eclipse.jetty.jetty-maven-plugin.version>
</properties>
<scm>
@ -99,27 +84,12 @@
<version>${org.apache.maven.plugins.maven-dependency-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>${org.apache.maven.plugins.maven-eclipse-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${org.apache.maven.plugins.maven-jar-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${org.apache.maven.plugins.maven-release-plugin.version}</version>
<configuration>
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@ -133,45 +103,9 @@
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>${org.codehaus.cargo.cargo-maven2-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${org.mortbay.jetty.jetty-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>com.samaxes.maven</groupId>
<artifactId>minify-maven-plugin</artifactId>
<version>${com.samaxes.maven.minify-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.vafer</groupId>
<artifactId>jdeb</artifactId>
<version>${org.vafer.jdeb.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>${org.codehaus.mojo.rpm-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>nsis-maven-plugin</artifactId>
<version>${org.codehaus.mojo.nsis-maven-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>osxappbundle-maven-plugin</artifactId>
<version>${org.codehaus.mojo.osxappbundle-maven-plugin.version}</version>
<version>${org.eclipse.jetty.jetty-maven-plugin.version}</version>
</plugin>
</plugins>
@ -258,18 +192,6 @@
<version>${com.google.guava.guava.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${org.codehaus.jackson.jackson.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${org.codehaus.jackson.jackson.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
@ -378,48 +300,6 @@
<version>${joda-time.joda-time.version}</version>
</dependency>
<dependency>
<groupId>org.subethamail</groupId>
<artifactId>subethasmtp-wiser</artifactId>
<version>${org.subethamail.subethasmtp-wiser.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>${org.codehaus.jettison.jettison.version}</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
<version>${com.google.oauth-client.google-oauth-client.version}</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-oauth2</artifactId>
<version>${com.google.apis.google-api-services-oauth2.version}</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>${com.google.http-client.google-http-client-jackson2.version}</version>
</dependency>
<dependency>
<groupId>org.ccil.cowan.tagsoup</groupId>
<artifactId>tagsoup</artifactId>
<version>${org.ccil.cowan.tagsoup.tagsoup.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.owasp-java-html-sanitizer</groupId>
<artifactId>owasp-java-html-sanitizer</artifactId>
<version>${com.googlecode.owasp-java-html-sanitizer.owasp-java-html-sanitizer.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
@ -444,12 +324,6 @@
<version>${org.apache.lucene.version}</version>
</dependency>
<dependency>
<groupId>jgoodies</groupId>
<artifactId>forms</artifactId>
<version>${jgoodies.forms.version}</version>
</dependency>
<dependency>
<groupId>org.imgscalr</groupId>
<artifactId>imgscalr-lib</artifactId>
@ -484,20 +358,6 @@
</dependencies>
</dependencyManagement>
<pluginRepositories>
<!-- Codehause Snapshots (NSIS) -->
<pluginRepository>
<id>Codehaus Snapshots</id>
<url>http://nexus.codehaus.org/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled> <!-- Workaround for MNG-2974 -->
</releases>
</pluginRepository>
</pluginRepositories>
<profiles>
<profile>
<id>init</id>

View File

@ -97,12 +97,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.subethamail</groupId>
<artifactId>subethasmtp-wiser</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- Install test jar -->

View File

@ -1,24 +1,16 @@
package com.sismics.docs.rest;
import com.sismics.docs.rest.descriptor.JerseyTestWebAppDescriptorFactory;
import com.sismics.docs.rest.util.ClientUtil;
import com.sun.jersey.test.framework.JerseyTest;
import java.io.File;
import java.net.URLDecoder;
import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.grizzly.http.server.StaticHttpHandler;
import org.junit.After;
import org.junit.Before;
import org.subethamail.wiser.Wiser;
import org.subethamail.wiser.WiserMessage;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeUtility;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLDecoder;
import java.util.List;
import com.sismics.docs.rest.descriptor.JerseyTestWebAppDescriptorFactory;
import com.sismics.docs.rest.util.ClientUtil;
import com.sun.jersey.test.framework.JerseyTest;
/**
* Base class of integration tests with Jersey.
@ -26,15 +18,10 @@ import java.util.List;
* @author jtremeaux
*/
public abstract class BaseJerseyTest extends JerseyTest {
/**
* Test email server.
*/
protected Wiser wiser;
/**
* Test HTTP server.
*/
HttpServer httpServer;
protected HttpServer httpServer;
/**
* Utility class for the REST client.
@ -54,10 +41,6 @@ public abstract class BaseJerseyTest extends JerseyTest {
public void setUp() throws Exception {
super.setUp();
wiser = new Wiser();
wiser.setPort(2500);
wiser.start();
String httpRoot = URLDecoder.decode(new File(getClass().getResource("/").getFile()).getAbsolutePath(), "utf-8");
httpServer = HttpServer.createSimpleServer(httpRoot, "localhost", 9997);
// Disable file cache to fix https://java.net/jira/browse/GRIZZLY-1350
@ -69,45 +52,6 @@ public abstract class BaseJerseyTest extends JerseyTest {
@After
public void tearDown() throws Exception {
super.tearDown();
wiser.stop();
httpServer.stop();
}
/**
* Extracts an email from the queue and consumes the email.
*
* @return Text of the email
* @throws MessagingException
* @throws IOException
*/
protected String popEmail() throws MessagingException, IOException {
List<WiserMessage> wiserMessageList = wiser.getMessages();
if (wiserMessageList.isEmpty()) {
return null;
}
WiserMessage wiserMessage = wiserMessageList.get(wiserMessageList.size() - 1);
wiserMessageList.remove(wiserMessageList.size() - 1);
MimeMessage message = wiserMessage.getMimeMessage();
ByteArrayOutputStream os = new ByteArrayOutputStream();
message.writeTo(os);
String body = os.toString();
return body;
}
/**
* Encodes a string to "quoted-printable" characters to compare with the contents of an email.
*
* @param input String to encode
* @return Encoded string
* @throws MessagingException
* @throws IOException
*/
protected String encodeQuotedPrintable(String input) throws MessagingException, IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OutputStream os = MimeUtility.encode(baos, "quoted-printable");
os.write(input.getBytes());
os.close();
return baos.toString();
}
}

View File

@ -115,12 +115,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.subethamail</groupId>
<artifactId>subethasmtp-wiser</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -131,7 +125,7 @@
</resources>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<systemProperties>
@ -186,7 +180,7 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
@ -233,7 +227,7 @@
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
@ -282,8 +276,8 @@
<!-- Launch NPM & Grunt -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>generate-sources</phase>