Skip to content

Commit

Permalink
resolved deprecated warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rsearls committed Jun 9, 2021
1 parent bd838ff commit fea3d98
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
@@ -1,6 +1,5 @@
package org.jboss.resteasy.specimpl;

import jakarta.ws.rs.ext.RuntimeDelegate;
import org.jboss.resteasy.core.Headers;
import org.jboss.resteasy.plugins.delegates.LocaleDelegate;
import org.jboss.resteasy.resteasy_jaxrs.i18n.Messages;
Expand Down Expand Up @@ -359,7 +358,7 @@ public Map<String, NewCookie> getCookies()
else
{
String str = toHeaderString(obj);
NewCookie cookie = RuntimeDelegate.getInstance()
NewCookie cookie = ResteasyProviderFactory.getInstance()
.createHeaderDelegate(NewCookie.class)
.fromString(str);
cookies.put(cookie.getName(), cookie);
Expand All @@ -374,7 +373,7 @@ public EntityTag getEntityTag()
Object d = metadata.getFirst(HttpHeaders.ETAG);
if (d == null) return null;
if (d instanceof EntityTag) return (EntityTag) d;
return RuntimeDelegate.getInstance()
return ResteasyProviderFactory.getInstance()
.createHeaderDelegate(EntityTag.class)
.fromString(toHeaderString(d));
}
Expand Down
Expand Up @@ -23,12 +23,12 @@
import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.Variant;

import jakarta.ws.rs.ext.RuntimeDelegate;
import org.jboss.resteasy.core.ResteasyContext;
import org.jboss.resteasy.core.request.ServerDrivenNegotiation;
import org.jboss.resteasy.spi.HttpRequest;
import org.jboss.resteasy.spi.HttpResponse;
import org.jboss.resteasy.spi.ResteasyConfiguration;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import org.jboss.resteasy.util.DateUtil;

/**
Expand Down Expand Up @@ -90,7 +90,7 @@ public List<EntityTag> convertEtag(List<String> tags)
String[] split = tag.split(",");
for (String etag : split)
{
result.add(RuntimeDelegate.getInstance()
result.add(ResteasyProviderFactory.getInstance()
.createHeaderDelegate(EntityTag.class)
.fromString(etag.trim()));
}
Expand Down
Expand Up @@ -33,7 +33,7 @@ public void testLocale() throws Exception

Assert.assertEquals(getExpected(BASE + "00", "cannotGuessCollectionType"), Messages.MESSAGES.cannotGuessCollectionType());
Assert.assertEquals(getExpected(BASE + "20", "discoveryFailedForMethod", "class", "method", "s"), Messages.MESSAGES.discoveryFailedForMethod("class", "method", "s"));
Assert.assertEquals(getExpected(BASE + "35", "failedToInjectLinks", new Integer(17)), Messages.MESSAGES.failedToInjectLinks(new Integer(17)));
Assert.assertEquals(getExpected(BASE + "35", "failedToInjectLinks", Integer.valueOf(17)), Messages.MESSAGES.failedToInjectLinks(Integer.valueOf(17)));
Assert.assertEquals(getExpected(BASE + "60", "notEnoughtUriParameters", 3, 5), Messages.MESSAGES.notEnoughtUriParameters(3, 5));
}

Expand Down
@@ -1,5 +1,6 @@
package org.jboss.resteasy.test.core.basic;

import jakarta.ws.rs.ext.RuntimeDelegate;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit.Arquillian;
Expand Down Expand Up @@ -63,7 +64,9 @@ public void testResourceValid() {
Response response = base.request().get();

Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
CacheControl cc = CacheControl.valueOf(response.getHeaderString("cache-control"));
CacheControl cc = RuntimeDelegate.getInstance()
.createHeaderDelegate(CacheControl.class)
.fromString(response.getHeaderString("cache-control"));
Assert.assertFalse("Cache should not be private", cc.isPrivate());
Assert.assertEquals("Wrong age of cache", 3600, cc.getMaxAge());

Expand All @@ -82,7 +85,9 @@ public void testResourceNoCach() {
Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
String value = response.getHeaderString("cache-control");
Assert.assertEquals("Wrong value of cache header", "no-cache", value);
CacheControl cc = CacheControl.valueOf(value);
CacheControl cc = RuntimeDelegate.getInstance()
.createHeaderDelegate(CacheControl.class)
.fromString(value);
Assert.assertTrue("Wrong value of cache header", cc.isNoCache());

response.close();
Expand All @@ -98,7 +103,9 @@ public void testResourceCompositeNoCache() {
Response response = base.request().get();

Assert.assertEquals(HttpServletResponse.SC_OK, response.getStatus());
CacheControl cc = CacheControl.valueOf(response.getHeaderString("cache-control"));
CacheControl cc = RuntimeDelegate.getInstance()
.createHeaderDelegate(CacheControl.class)
.fromString(response.getHeaderString("cache-control"));
Assert.assertTrue("There must be no-store", cc.isNoStore());
Assert.assertTrue("There must be must-revalidate", cc.isMustRevalidate());
Assert.assertTrue("Cache must be private", cc.isPrivate());
Expand Down
Expand Up @@ -8,7 +8,7 @@
import jakarta.ws.rs.core.Cookie;
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.ext.Provider;
import jakarta.ws.rs.ext.RuntimeDelegate;
import org.jboss.resteasy.spi.ResteasyProviderFactory;

@Provider
@PreMatching
Expand All @@ -22,7 +22,7 @@ public void filter(ContainerRequestContext requestContext) throws IOException {

final Cookie cookie = requestContext.getCookies().get(OLD_COOKIE_NAME);
if (cookie != null) {
String value = RuntimeDelegate.getInstance()
String value = ResteasyProviderFactory.getInstance()
.createHeaderDelegate(Cookie.class)
.toString(new Cookie(NEW_COOKIE_NAME, cookie.getValue()));
requestContext.getHeaders().add(HttpHeaders.COOKIE, value);
Expand Down
Expand Up @@ -81,14 +81,14 @@ public Response postFoo(DataSource source) throws Exception {
@Produces(MediaType.TEXT_PLAIN)
@POST
public Response postIntProduce(DataSource source) throws Exception {
return Response.ok().entity(new Integer(8)).build();
return Response.ok().entity(Integer.valueOf(8)).build();
}

@Path("postInt")
@Consumes(MediaType.APPLICATION_OCTET_STREAM)
@POST
public Response postInt(DataSource source) throws Exception {
return Response.ok().entity(new Integer(8)).build();
return Response.ok().entity(Integer.valueOf(8)).build();
}

@Path("postIntegerProduce")
Expand Down
Expand Up @@ -8,6 +8,6 @@
public class RequestFilterAbortWith implements ClientRequestFilter {
@Override
public void filter(ClientRequestContext requestContext) throws IOException {
requestContext.abortWith(Response.ok(new Integer(42)).build());
requestContext.abortWith(Response.ok(Integer.valueOf(42)).build());
}
}

0 comments on commit fea3d98

Please sign in to comment.