Skip to content

Commit

Permalink
Revert "[RESTEASY-1555] Move deprecated SerializableProvider into res…
Browse files Browse the repository at this point in the history
…teasy-legacy module (#1002)"

This reverts commit d338eb6.
  • Loading branch information
asoldano committed Dec 7, 2016
1 parent ed8b897 commit d3573d7
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 0 deletions.
@@ -0,0 +1,58 @@
package org.jboss.resteasy.test.resource.param;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.resteasy.client.jaxrs.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.test.resource.param.resource.SerializableWithParametersObject;
import org.jboss.resteasy.test.resource.param.resource.SerializableWithParametersResource;
import org.jboss.resteasy.utils.PortProviderUtil;
import org.jboss.resteasy.utils.TestUtil;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

import javax.ws.rs.client.Invocation;

/**
* @tpSubChapter Resource
* @tpChapter Integration tests
* @tpSince RESTEasy 3.0.16
* @tpTestCaseDetails Regression test for RESTEASY-839
*/
@RunWith(Arquillian.class)
@RunAsClient
public class SerializableWithParametersTest {

@Deployment
public static Archive<?> deploy() {
WebArchive war = TestUtil.prepareArchive(SerializableWithParametersTest.class.getSimpleName());
war.addClass(SerializableWithParametersObject.class);
war.addAsResource(SerializableWithParametersTest.class.getPackage(), "javax.ws.rs.ext.Providers", "META-INF/services/javax.ws.rs.ext.Providers");
return TestUtil.finishContainerPrepare(war, null, SerializableWithParametersResource.class);
}

private String generateURL(String path) {
return PortProviderUtil.generateURL(path, SerializableWithParametersTest.class.getSimpleName());
}

/**
* @tpTestDetails Get serializable object.
* Test was updated by RESTEASY-1269 in this
* commit: https://github.com/resteasy/Resteasy/commit/bb8657c9808763d4c4b9227f6a2fcf47b9146636
* Serializable provider was deprecated in RESTEASY-1461
* @tpSince RESTEasy 3.0.16
*/
@SuppressWarnings("deprecation")
@Test
public void testSerialize() throws Exception {
ResteasyClient client = new ResteasyClientBuilder().register(org.jboss.resteasy.plugins.providers.SerializableProvider.class).build();
Invocation.Builder request = client.target(generateURL("/test")).request();
SerializableWithParametersObject foo = request.get(SerializableWithParametersObject.class);
Assert.assertEquals("Wrong response", new SerializableWithParametersObject("abc"), foo);
client.close();
}
}
@@ -0,0 +1,27 @@
package org.jboss.resteasy.test.resource.param.resource;

import java.io.Serializable;

public class SerializableWithParametersObject implements Serializable {
private static final long serialVersionUID = -1068336400309384949L;
private String s;

public SerializableWithParametersObject(final String s) {
this.s = s;
}

public String toString() {
return "Foo[" + s + "]";
}

public boolean equals(Object o) {
if (o == null || !(o instanceof SerializableWithParametersObject)) {
return false;
}
return this.s.equals(SerializableWithParametersObject.class.cast(o).s);
}

public int hashCode() {
return super.hashCode();
}
}
@@ -0,0 +1,14 @@
package org.jboss.resteasy.test.resource.param.resource;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;

@Path("test")
public class SerializableWithParametersResource {
@GET
@SuppressWarnings("deprecation")
public Response test() {
return Response.ok().entity(new SerializableWithParametersObject("abc")).type(org.jboss.resteasy.plugins.providers.SerializableProvider.APPLICATION_SERIALIZABLE + ";q=0.5").build();
}
}

0 comments on commit d3573d7

Please sign in to comment.