Skip to content

Commit

Permalink
2.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
forozco committed Sep 18, 2019
1 parent 735fc30 commit 95cae21
Show file tree
Hide file tree
Showing 56 changed files with 236 additions and 251 deletions.
2 changes: 1 addition & 1 deletion .baseline/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@
<module name="NestedTryDepth"/> <!-- Java Coding Guide: Try/catch blocks: never nested -->
<module name="NonEmptyAtclauseDescription"/> <!-- Java Style Guide: At-clauses -->
<module name="ParameterName"> <!-- Java Style Guide: Parameter names -->
<property name="format" value="^[a-z][a-zA-Z0-9]+$"/>
<property name="format" value="^_?[a-z][a-zA-Z0-9]+$"/>
<message key="name.invalidPattern" value="Parameter name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="SingleLineJavadoc"/> <!-- Java Style Guide: General form -->
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.netflix.nebula:gradle-dependency-lock-plugin:7.0.1'
classpath 'com.netflix.nebula:nebula-publishing-plugin:13.5.1'
classpath 'com.palantir.baseline:gradle-baseline-java:2.6.0'
classpath 'com.palantir.baseline:gradle-baseline-java:2.7.0'
classpath 'com.palantir.gradle.gitversion:gradle-git-version:0.12.2'
classpath 'gradle.plugin.org.inferred:gradle-processors:3.1.0'
classpath 'com.palantir.gradle.consistentversions:gradle-consistent-versions:1.12.4'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ private static Optional<HostAndPort> meshProxy(Optional<ProxyConfiguration> prox
private static ProxySelector fixedProxySelectorFor(Proxy proxy) {
return new ProxySelector() {
@Override
public List<Proxy> select(URI uri) {
public List<Proxy> select(URI _uri) {
return ImmutableList.of(proxy);
}

@Override
public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {}
public void connectFailed(URI _uri, SocketAddress _sa, IOException _ioe) {}
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private LongAsStringDeserializer() {
}

@Override
public Long deserialize(JsonParser jsonParser, DeserializationContext ctxt) throws IOException {
public Long deserialize(JsonParser jsonParser, DeserializationContext _ctxt) throws IOException {
switch (jsonParser.currentToken()) {
case VALUE_NUMBER_INT:
return jsonParser.getLongValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.assertj.core.api.Assertions.fail;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.startsWith;

import com.google.common.collect.Lists;
import com.palantir.conjure.java.client.config.ClientConfiguration;
Expand Down Expand Up @@ -126,7 +125,7 @@ public void testConnectionError_whenOneCallFailsThenSubsequentNewCallsCanStillSu
proxy.string();
fail("fail");
} catch (RetryableException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(startsWith("Failed to complete the request due to an IOException")));
assertThat(e.getMessage()).startsWith("Failed to complete the request due to an IOException");
}

// Subsequent call (with the same proxy instance) succeeds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ public void testCannotDecorateInterfaceWithOptionalPathParam() {
createTestConfig("http://localhost:" + server.getPort()));
fail("fail");
} catch (RuntimeException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(is("Cannot use Guava Optionals with PathParams. (Class: com.palantir.conjure"
assertThat(e.getMessage()).isEqualTo(
"Cannot use Guava Optionals with PathParams. (Class: com.palantir.conjure"
+ ".java.client.jaxrs.JaxRsClientGuavaOptionalHandlingTest$CannotDecorateInterface,"
+ " Method: path, Param: arg0)")));
+ " Method: path, Param: arg0)");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,10 @@ public void testCannotDecorateInterfaceWithOptionalPathParam() {
createTestConfig("http://localhost:" + server.getPort()));
fail("fail");
} catch (RuntimeException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(is("Cannot use Java8 Optionals with PathParams. (Class: com.palantir.conjure."
assertThat(e.getMessage()).isEqualTo(
"Cannot use Java8 Optionals with PathParams. (Class: com.palantir.conjure."
+ "java.client.jaxrs.JaxRsClientJava8OptionalHandlingTest$CannotDecorateInterface,"
+ " Method: path, Param: arg0)")));
+ " Method: path, Param: arg0)");
}
}

Expand Down Expand Up @@ -189,7 +190,7 @@ public void testAbsentIntQuery() throws Exception {
public void testIntQuery() throws Exception {
proxy.queryInt(OptionalInt.of(1234), "str2");
RecordedRequest takeRequest = server.takeRequest();
assertThat(takeRequest.getRequestLine()).is(new HamcrestCondition<>(is("GET /foo/int?opt=1234&req=str2 HTTP/1.1")));
assertThat(takeRequest.getRequestLine()).isEqualTo("GET /foo/int?opt=1234&req=str2 HTTP/1.1");
}

@Test
Expand Down Expand Up @@ -219,7 +220,7 @@ public void testAbsentDoubleQuery() throws Exception {
public void testDoubleQuery() throws Exception {
proxy.queryDouble(OptionalDouble.of(1234.567), "str2");
RecordedRequest takeRequest = server.takeRequest();
assertThat(takeRequest.getRequestLine()).is(new HamcrestCondition<>(is("GET /foo/double?opt=1234.567&req=str2 HTTP/1.1")));
assertThat(takeRequest.getRequestLine()).isEqualTo("GET /foo/double?opt=1234.567&req=str2 HTTP/1.1");
}

@Test
Expand Down Expand Up @@ -249,7 +250,7 @@ public void testAbsentLongQuery() throws Exception {
public void testLongQuery() throws Exception {
proxy.queryLong(OptionalLong.of(12345678901234L), "str2");
RecordedRequest takeRequest = server.takeRequest();
assertThat(takeRequest.getRequestLine()).is(new HamcrestCondition<>(is("GET /foo/long?opt=12345678901234&req=str2 HTTP/1.1")));
assertThat(takeRequest.getRequestLine()).isEqualTo("GET /foo/long?opt=12345678901234&req=str2 HTTP/1.1");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@

import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Expand Down Expand Up @@ -91,8 +89,8 @@ public void testClientIsInstrumentedWithTracer() throws InterruptedException {
Maps.immutableEntry(SpanType.CLIENT_OUTGOING, "OkHttp: wait-for-body"))));

RecordedRequest request = server.takeRequest();
assertThat(request.getHeader(TraceHttpHeaders.TRACE_ID)).is(new HamcrestCondition<>(is(traceId)));
assertThat(request.getHeader(TraceHttpHeaders.SPAN_ID)).is(new HamcrestCondition<>(is(not(parentTrace.getSpanId()))));
assertThat(request.getHeader(TraceHttpHeaders.TRACE_ID)).isEqualTo(traceId);
assertThat(request.getHeader(TraceHttpHeaders.SPAN_ID)).isNotEqualTo(parentTrace.getSpanId());
}

@Test
Expand Down Expand Up @@ -139,7 +137,7 @@ public void testLimiterAcquisitionMultiThread() {
addTraceSubscriber(observedTraceIds);
runTwoRequestsInParallel();
removeTraceSubscriber();
assertThat(observedTraceIds).is(new HamcrestCondition<>(hasSize(2)));
assertThat(observedTraceIds).hasSize(2);
}

private void runTwoRequestsInParallel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
public final class GuavaOptionalAwareDecoderTest extends TestBase {

@ClassRule
public static final DropwizardAppRule<Configuration> APP = new DropwizardAppRule<>(GuavaTestServer.class,
public static final DropwizardAppRule<Configuration> APP = new DropwizardAppRule<>(
GuavaTestServer.class,
"src/test/resources/test-server.yml");

@Rule
Expand All @@ -59,13 +60,15 @@ public void before() {

@Test
public void testOptional() {
assertThat(service.getOptional("something")).is(new HamcrestCondition<>(is(com.google.common.base.Optional.of(ImmutableMap.of("something", "something")))));
assertThat(service.getOptional(null)).is(new HamcrestCondition<>(is(com.google.common.base.Optional.<ImmutableMap<String, String>>absent())));
assertThat(service.getOptional("something")).isEqualTo(
com.google.common.base.Optional.of(ImmutableMap.of("something", "something")));
assertThat(service.getOptional(null)).isEqualTo(
com.google.common.base.Optional.<ImmutableMap<String, String>>absent());
}

@Test
public void testNonOptional() {
assertThat(service.getNonOptional("something")).is(new HamcrestCondition<>(is(ImmutableMap.of("something", "something"))));
assertThat(service.getNonOptional("something")).isEqualTo(ImmutableMap.of("something", "something"));
assertThat(service.getNonOptional(null)).is(new HamcrestCondition<>(is(ImmutableMap.<String, String>of())));
}

Expand All @@ -75,7 +78,8 @@ public void testThrowsNotFound() {
service.getThrowsNotFound(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: NOT_FOUND (Default:NotFound)")));
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString(
"RemoteException: NOT_FOUND (Default:NotFound)")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("NOT_FOUND")));
}
}
Expand All @@ -86,8 +90,10 @@ public void testThrowsNotAuthorized() {
service.getThrowsNotAuthorized(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: javax.ws.rs.NotAuthorizedException")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("javax.ws.rs.NotAuthorizedException")));
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString(
"RemoteException: javax.ws.rs.NotAuthorizedException")));
assertThat(e.getError().errorCode()).is(
new HamcrestCondition<>(is("javax.ws.rs.NotAuthorizedException")));
}
}

Expand All @@ -97,7 +103,8 @@ public void testOptionalThrowsNotAuthorized() {
service.getOptionalThrowsNotAuthorized(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: javax.ws.rs.NotAuthorizedException")));
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString(
"RemoteException: javax.ws.rs.NotAuthorizedException")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("javax.ws.rs.NotAuthorizedException")));
}
}
Expand All @@ -108,7 +115,8 @@ public void testThrowsFordidden() {
service.getThrowsForbidden(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: PERMISSION_DENIED (Default:PermissionDenied)")));
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString(
"RemoteException: PERMISSION_DENIED (Default:PermissionDenied)")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("PERMISSION_DENIED")));
}
}
Expand All @@ -119,15 +127,16 @@ public void testOptionalThrowsForbbbden() {
service.getOptionalThrowsForbidden(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: PERMISSION_DENIED (Default:PermissionDenied)")));
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString(
"RemoteException: PERMISSION_DENIED (Default:PermissionDenied)")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("PERMISSION_DENIED")));
}
}

@Test
public void testOptionalString() {
assertThat(service.getOptionalString(null)).is(new HamcrestCondition<>(is(com.google.common.base.Optional.absent())));
assertThat(service.getOptionalString("foo")).is(new HamcrestCondition<>(is(com.google.common.base.Optional.of("foo"))));
assertThat(service.getOptionalString(null)).isEqualTo(com.google.common.base.Optional.absent());
assertThat(service.getOptionalString("foo")).isEqualTo(com.google.common.base.Optional.of("foo"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,25 @@ public final class HeaderAccessUtilsTest {

@Test
public void caseInsensitiveContainsShouldReturnTrueIgnoringCase() {
assertThat(HeaderAccessUtils.caseInsensitiveContains(TEST_HEADERS_MAP, "hEaDeR")).is(new HamcrestCondition<>(is(true)));
assertThat(HeaderAccessUtils.caseInsensitiveContains(TEST_HEADERS_MAP, "hEaDeR")).is(
new HamcrestCondition<>(is(true)));
}

@Test
public void caseInsensitiveContainsShouldReturnFalseForNonExistentKey() {
assertThat(HeaderAccessUtils.caseInsensitiveContains(TEST_HEADERS_MAP, "invalid")).is(new HamcrestCondition<>(is(false)));
assertThat(HeaderAccessUtils.caseInsensitiveContains(TEST_HEADERS_MAP, "invalid")).is(
new HamcrestCondition<>(is(false)));
}

@Test
public void caseInsensitiveGetReturnsNullForNotExistingHeader() {
assertThat(HeaderAccessUtils.caseInsensitiveGet(TEST_HEADERS_MAP, "invalid")).is(new HamcrestCondition<>(is(nullValue())));
assertThat(HeaderAccessUtils.caseInsensitiveGet(TEST_HEADERS_MAP, "invalid")).is(
new HamcrestCondition<>(is(nullValue())));
}

@Test
public void caseInsensitiveGetReturnsAllExistingHeaders() {
assertThat(HeaderAccessUtils.caseInsensitiveGet(TEST_HEADERS_MAP, "HeADER")).is(new HamcrestCondition<>(contains("value1", "value2", "value3", "value4", "value5")));
assertThat(HeaderAccessUtils.caseInsensitiveGet(TEST_HEADERS_MAP, "HeADER")).is(
new HamcrestCondition<>(contains("value1", "value2", "value3", "value4", "value5")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public void testUsesDelegateWithNonInputStreamBodyType() throws Exception {
@Test
public void testStandardClientsUseByteArrayDelegateEncoder() {
String data = "bytes";
assertThat(service.readInputStream(new ByteArrayInputStream(bytes(data)))).is(new HamcrestCondition<>(is(data)));
assertThat(service.readInputStream(new ByteArrayInputStream(bytes(data)))).is(
new HamcrestCondition<>(is(data)));
}

private static byte[] bytes(String text) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,16 @@ public void before() {

@Test
public void testOptional() {
assertThat(service.getOptional("something")).is(new HamcrestCondition<>(is(Optional.of(ImmutableMap.of("something", "something")))));
assertThat(service.getOptional(null)).is(new HamcrestCondition<>(is(Optional.<ImmutableMap<String, String>>empty())));
assertThat(service.getOptional("something")).is(
new HamcrestCondition<>(is(Optional.of(ImmutableMap.of("something", "something")))));
assertThat(service.getOptional(null)).is(
new HamcrestCondition<>(is(Optional.<ImmutableMap<String, String>>empty())));
}

@Test
public void testNonOptional() {
assertThat(service.getNonOptional("something")).is(new HamcrestCondition<>(is(ImmutableMap.of("something", "something"))));
assertThat(service.getNonOptional("something")).is(
new HamcrestCondition<>(is(ImmutableMap.of("something", "something"))));
assertThat(service.getNonOptional(null)).is(new HamcrestCondition<>(is(ImmutableMap.<String, String>of())));
}

Expand All @@ -76,7 +79,8 @@ public void testThrowsNotFound() {
service.getThrowsNotFound(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: NOT_FOUND (Default:NotFound)")));
assertThat(e.getMessage()).is(
new HamcrestCondition<>(containsString("RemoteException: NOT_FOUND (Default:NotFound)")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("NOT_FOUND")));
}
}
Expand All @@ -87,7 +91,8 @@ public void testThrowsNotAuthorized() {
service.getThrowsNotAuthorized(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: javax.ws.rs.NotAuthorizedException")));
assertThat(e.getMessage()).is(
new HamcrestCondition<>(containsString("RemoteException: javax.ws.rs.NotAuthorizedException")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("javax.ws.rs.NotAuthorizedException")));
}
}
Expand All @@ -98,7 +103,8 @@ public void testOptionalThrowsNotAuthorized() {
service.getOptionalThrowsNotAuthorized(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: javax.ws.rs.NotAuthorizedException")));
assertThat(e.getMessage()).is(
new HamcrestCondition<>(containsString("RemoteException: javax.ws.rs.NotAuthorizedException")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("javax.ws.rs.NotAuthorizedException")));
}
}
Expand All @@ -109,7 +115,8 @@ public void testThrowsFordidden() {
service.getThrowsForbidden(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: PERMISSION_DENIED (Default:PermissionDenied)")));
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString(
"RemoteException: PERMISSION_DENIED (Default:PermissionDenied)")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("PERMISSION_DENIED")));
}
}
Expand All @@ -120,7 +127,8 @@ public void testOptionalThrowsFordidden() {
service.getOptionalThrowsForbidden(null);
fail("fail");
} catch (RemoteException e) {
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString("RemoteException: PERMISSION_DENIED (Default:PermissionDenied)")));
assertThat(e.getMessage()).is(new HamcrestCondition<>(containsString(
"RemoteException: PERMISSION_DENIED (Default:PermissionDenied)")));
assertThat(e.getError().errorCode()).is(new HamcrestCondition<>(is("PERMISSION_DENIED")));
}
}
Expand Down
Loading

0 comments on commit 95cae21

Please sign in to comment.