Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Rhbz1124630 - remove RESTEasy dependency from client #37

Merged
merged 9 commits into from Dec 10, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 22 additions & 2 deletions pom.xml
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>org.zanata</groupId>
<artifactId>zanata-parent</artifactId>
<version>20</version>
<version>21-SNAPSHOT</version>
<relativePath>../parent</relativePath>
</parent>

Expand All @@ -35,9 +35,10 @@
</repositories>

<properties>
<zanata.api.version>3.4.1</zanata.api.version>
<zanata.api.version>3.6.0-SNAPSHOT</zanata.api.version>
<zanata.common.version>3.3.0</zanata.common.version>
<resteasy.version>3.0.1.Final</resteasy.version>
<jersey.version>1.17.1</jersey.version>
</properties>

<build>
Expand Down Expand Up @@ -73,6 +74,22 @@
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -202,9 +219,12 @@
</dependencies>

<modules>
<module>stub-server</module>
<module>zanata-cli</module>
<module>zanata-client-commands</module>
<module>zanata-maven-plugin</module>
<module>zanata-rest-client</module>
</modules>
</project>


174 changes: 174 additions & 0 deletions stub-server/pom.xml
@@ -0,0 +1,174 @@
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.zanata</groupId>
<artifactId>client</artifactId>
<version>3.6.0-SNAPSHOT</version>
</parent>
<artifactId>stub-server</artifactId>
<name>stub-server</name>

<!-- Should be the same as zanata-client/pom.xml -->
<scm>
<connection>scm:git:git://github.com/zanata/zanata-client.git</connection>
<developerConnection>scm:git:git@github.com:zanata/zanata-client.git</developerConnection>
<url>https://github.com/zanata/zanata-client</url>
<tag>HEAD</tag>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jetty.version>9.0.3.v20130506</jetty.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
</dependency>
<dependency>
<groupId>org.zanata</groupId>
<artifactId>zanata-common-api</artifactId>
<exclusions>
<exclusion>
<!-- mock server uses RESTEasy -->
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.zanata</groupId>
<artifactId>zanata-adapter-po</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>${jetty.version}</version>
</dependency>

<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>async-http-servlet-3.0</artifactId>
<version>${resteasy.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<exclusions>
<exclusion>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxb-provider</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-multipart-provider</artifactId>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.scannotation</groupId>
<artifactId>scannotation</artifactId>
<version>1.0.3</version>
<exclusions>
<exclusion>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<failIfNoTests>false</failIfNoTests>
</configuration>
</plugin>
<plugin>
<groupId>com.ning.maven.plugins</groupId>
<artifactId>maven-duplicate-finder-plugin</artifactId>
<configuration>
<ignoredResources>
<!-- from jetty dependencies we have a couple about.html -->
<ignoredResource>about.html</ignoredResource>
</ignoredResources>
</configuration>
</plugin>
</plugins>
</build>
</project>






@@ -0,0 +1,53 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.zanata.rest.service;

import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;

import org.zanata.rest.dto.Account;

/**
* @author Patrick Huang <a
* href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
@Path(AccountResource.SERVICE_PATH)
public class MockAccountResource implements AccountResource {
@Context
UriInfo uriInfo;
private Account account =
new Account("admin@zanata.org", "Administrator", "admin",
"guesswhat");

@Override
public Response get() {
return Response.ok(account).build();
}

@Override
public Response put(Account account) {
return Response.created(uriInfo.getRequestUri()).build();
}
}

@@ -0,0 +1,79 @@
/*
* Copyright 2014, Red Hat, Inc. and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.zanata.rest.service;

import java.util.Set;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.Path;

import org.zanata.common.LocaleId;
import org.zanata.rest.dto.ProcessStatus;
import org.zanata.rest.dto.resource.Resource;
import org.zanata.rest.dto.resource.TranslationsResource;

/**
* @author Patrick Huang <a
* href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
@Path(AsynchronousProcessResource.SERVICE_PATH)
public class MockAsynchronousProcessResource implements
AsynchronousProcessResource {
@Override
public ProcessStatus startSourceDocCreation(String idNoSlash,
String projectSlug, String iterationSlug, Resource resource,
Set<String> extensions, @DefaultValue("true") boolean copytrans) {
return MockResourceUtil.notUsedByClient();
}

@Override
public ProcessStatus startSourceDocCreationOrUpdate(String idNoSlash,
String projectSlug, String iterationSlug, Resource resource,
Set<String> extensions, @DefaultValue("true") boolean copytrans) {
ProcessStatus processStatus = new ProcessStatus();
processStatus.setStatusCode(ProcessStatus.ProcessStatusCode.Running);
processStatus.setPercentageComplete(50);
processStatus.setUrl("process1");
return processStatus;
}

@Override
public ProcessStatus startTranslatedDocCreationOrUpdate(String idNoSlash,
String projectSlug, String iterationSlug, LocaleId locale,
TranslationsResource translatedDoc, Set<String> extensions,
String merge) {
ProcessStatus processStatus = new ProcessStatus();
processStatus.setStatusCode(ProcessStatus.ProcessStatusCode.Running);
processStatus.setPercentageComplete(50);
processStatus.setUrl("process2");
return processStatus;
}

@Override
public ProcessStatus getProcessStatus(String processId) {
ProcessStatus processStatus = new ProcessStatus();
processStatus.setStatusCode(ProcessStatus.ProcessStatusCode.Finished);
processStatus.setPercentageComplete(100);
processStatus.setUrl(processId);
return processStatus;
}
}