Skip to content

Commit

Permalink
Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bvfalcon committed Aug 16, 2022
1 parent da45922 commit 9f33b87
Show file tree
Hide file tree
Showing 1,228 changed files with 11,062 additions and 11,467 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

import ${package}.MyResource;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
</dependency>
-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

import org.glassfish.grizzly.http.server.HttpServer;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class MyResourceTest {

private HttpServer server;
private WebTarget target;

@Before
@BeforeEach
public void setUp() throws Exception {
// start the server
server = Main.startServer();
Expand All @@ -32,7 +32,7 @@ public void setUp() throws Exception {
target = c.target(Main.BASE_URI);
}

@After
@AfterEach
public void tearDown() throws Exception {
server.stop();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -40,10 +40,10 @@
import org.glassfish.jersey.test.JerseyTest;

import org.hamcrest.Matchers;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Asynchronous connector test.
Expand Down Expand Up @@ -210,7 +210,7 @@ public String call() throws Exception {
}
});

assertTrue("Waiting for results has timed out.", latch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS));
assertTrue(latch.await(5 * getAsyncTimeoutMultiplier(), TimeUnit.SECONDS), "Waiting for results has timed out.");
final long toc = System.currentTimeMillis();

assertEquals("DONE-1", r1.get());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -44,12 +44,12 @@
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

/**
* @author Paul Sandoz
Expand Down Expand Up @@ -398,7 +398,7 @@ public void testAuthGetWithDigestFilter() {
}

@Test
@Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
@Disabled("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ " Allow repeatable write in jersey?")
public void testAuthPost() {
CredentialsProvider credentialsProvider = new org.apache.http.impl.client.BasicCredentialsProvider();
Expand Down Expand Up @@ -474,7 +474,7 @@ public void testAuthInteractiveGet() {
}

@Test
@Ignore("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
@Disabled("JERSEY-1750: Cannot retry request with a non-repeatable request entity. How to buffer the entity?"
+ " Allow repeatable write in jersey?")
public void testAuthInteractivePost() {
CredentialsProvider credentialsProvider = new org.apache.http.impl.client.BasicCredentialsProvider();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -34,11 +34,11 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Paul Sandoz
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -27,7 +27,7 @@
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Custom logging filter.
Expand All @@ -43,28 +43,28 @@ public class CustomLoggingFilter implements ContainerRequestFilter, ContainerRes
@Override
public void filter(ClientRequestContext context) throws IOException {
System.out.println("CustomLoggingFilter.preFilter called");
assertEquals(context.getConfiguration().getProperty("foo"), "bar");
assertEquals("bar", context.getConfiguration().getProperty("foo"));
preFilterCalled++;
}

@Override
public void filter(ClientRequestContext context, ClientResponseContext clientResponseContext) throws IOException {
System.out.println("CustomLoggingFilter.postFilter called");
assertEquals(context.getConfiguration().getProperty("foo"), "bar");
assertEquals("bar", context.getConfiguration().getProperty("foo"));
postFilterCalled++;
}

@Override
public void filter(ContainerRequestContext context) throws IOException {
System.out.println("CustomLoggingFilter.preFilter called");
assertEquals(context.getProperty("foo"), "bar");
assertEquals("bar", context.getProperty("foo"));
preFilterCalled++;
}

@Override
public void filter(ContainerRequestContext context, ContainerResponseContext containerResponseContext) throws IOException {
System.out.println("CustomLoggingFilter.postFilter called");
assertEquals(context.getProperty("foo"), "bar");
assertEquals("bar", context.getProperty("foo"));
postFilterCalled++;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -30,8 +30,8 @@
import org.glassfish.jersey.test.JerseyTest;

import org.apache.http.client.config.RequestConfig;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* @author Ondrej Kosatka
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -36,8 +36,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;

/**
* Apache connector follow redirect tests.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -34,8 +34,8 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;

import org.junit.Test;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Paul Sandoz
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -63,11 +63,11 @@
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.HttpContext;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

/**
* @author Jakub Podlesak
Expand Down Expand Up @@ -160,11 +160,11 @@ public void _testConnectionPoolSharing(final boolean sharingEnabled) throws Exce
try {
target.request().get();
if (exceptionExpected) {
Assert.fail("Exception expected");
Assertions.fail("Exception expected");
}
} catch (Exception e) {
if (!exceptionExpected) {
Assert.fail("Exception not expected");
Assertions.fail("Exception not expected");
}
} finally {
clientTwo.close();
Expand Down Expand Up @@ -603,10 +603,10 @@ public void shutdown() {
final String response = rootTarget.path("error2").request().get(String.class);
fail("Exception expected. Received: " + response);
} catch (InternalServerErrorException isee) {
assertEquals("Received unexpected data.", "Error2.", isee.getResponse().readEntity(String.class));
assertEquals("Error2.", isee.getResponse().readEntity(String.class), "Received unexpected data.");
// Test buffering:
// second read would fail if entity was not buffered
assertEquals("Unexpected data in the entity buffer.", "Error2.", isee.getResponse().readEntity(String.class));
assertEquals("Error2.", isee.getResponse().readEntity(String.class), "Unexpected data in the entity buffer.");
}

assertEquals(0, connectionCounter.get());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand All @@ -22,8 +22,8 @@
import org.glassfish.jersey.logging.LoggingFeature;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import javax.ws.rs.POST;
import javax.ws.rs.Path;
Expand Down Expand Up @@ -65,8 +65,8 @@ public void testInputStreamEntity() {
InputStreamEntity entity = new InputStreamEntity(bais);

try (Response response = target().request().post(Entity.entity(entity, MediaType.APPLICATION_OCTET_STREAM))) {
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
Assertions.assertEquals(200, response.getStatus());
Assertions.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
}
}

Expand All @@ -75,8 +75,8 @@ public void testByteArrayEntity() {
ByteArrayEntity entity = new ByteArrayEntity(ECHO_MESSAGE.getBytes());

try (Response response = target().request().post(Entity.entity(entity, MediaType.APPLICATION_OCTET_STREAM))) {
Assert.assertEquals(200, response.getStatus());
Assert.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
Assertions.assertEquals(200, response.getStatus());
Assertions.assertEquals(ECHO_MESSAGE, response.readEntity(String.class));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -43,9 +43,9 @@
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;

import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Paul Sandoz
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2021 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -41,11 +41,11 @@
import org.glassfish.jersey.test.JerseyTest;

import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Paul Sandoz
Expand Down
Loading

0 comments on commit 9f33b87

Please sign in to comment.