Fixed the build

This commit is contained in:
Marcin Grzejszczak
2019-04-26 16:32:31 +04:00
parent 81c6560180
commit 2475abfa8b
6 changed files with 55 additions and 31 deletions

View File

@@ -18,7 +18,6 @@ package com.example;
import com.github.tomakehurst.wiremock.http.Fault;
import com.github.tomakehurst.wiremock.junit.WireMockClassRule;
import org.apache.http.MalformedChunkCodingException;
import org.apache.http.NoHttpResponseException;
import org.apache.http.client.ClientProtocolException;
import org.junit.ClassRule;
@@ -81,7 +80,7 @@ public class WiremockServerApplicationTests {
public void malformed() throws Exception {
stubFor(get(urlEqualTo("/resource"))
.willReturn(aResponse().withFault(Fault.MALFORMED_RESPONSE_CHUNK)));
this.expected.expectCause(instanceOf(MalformedChunkCodingException.class));
this.expected.expectCause(instanceOf(ClientProtocolException.class));
assertThat(this.service.go()).isEqualTo("Oops!");
}

View File

@@ -84,7 +84,6 @@ public class WiremockServerApplicationTests {
.willReturn(aResponse().withFault(Fault.MALFORMED_RESPONSE_CHUNK)));
// It's a different exception type than Jetty, but it's in the right ballpark
this.expected.expectCause(instanceOf(IOException.class));
this.expected.expectMessage("chunk");
assertThat(this.service.go()).isEqualTo("Oops!");
}

View File

@@ -6,7 +6,10 @@
<properties>
<org.eclipse.sisu.inject.version>0.1.1</org.eclipse.sisu.inject.version>
<org.eclipse.sisu.plexus.version>0.1.1</org.eclipse.sisu.plexus.version>
<sisu-guice.version>3.1.6</sisu-guice.version>
<sisu-guice.version>4.2.0</sisu-guice.version>
<guice.version>4.2.2</guice.version>
<guava.version>27.0-jre</guava.version>
<asm.version>7.1</asm.version>
<maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
<maven-dependency-plugin.version>3.0.0</maven-dependency-plugin.version>
@@ -52,6 +55,12 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-aether-provider</artifactId>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
@@ -97,10 +106,39 @@
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>${asm.version}</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<optional>true</optional>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
@@ -226,27 +264,4 @@
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>ide</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>15.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>1.3.9</version>
<scope>compile</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

View File

@@ -61,14 +61,22 @@ public class RabbitManager {
this.rabbitTemplate = rabbitTemplate;
}
@RabbitListener(bindings = @QueueBinding(value = @Queue, exchange = @Exchange(value = "input", durable = "true", autoDelete = "false", type = "topic"), key = "event"))
@RabbitListener(
bindings = @QueueBinding(
value = @Queue, exchange = @Exchange(value = "input",
durable = "true", autoDelete = "false", type = "topic"),
key = "event"))
public void newBook(Book book, @Headers Map<String, String> headers) {
LOG.info("Received new book with bookname = " + book.getName());
LOG.info("Headers = " + headers);
this.service.sendBook(book, headers.get("amqp_replyTo"));
}
@RabbitListener(bindings = @QueueBinding(value = @Queue, exchange = @Exchange(value = "input", durable = "true", autoDelete = "false", type = "topic"), key = "event2"))
@RabbitListener(
bindings = @QueueBinding(
value = @Queue, exchange = @Exchange(value = "input",
durable = "true", autoDelete = "false", type = "topic"),
key = "event2"))
public void newBook2(Book book, @Headers Map<String, String> headers) {
LOG.info("newBook2 Received new book with bookname = " + book.getName());
LOG.info("newBook2 Headers = " + headers);

View File

@@ -31,7 +31,9 @@ public class MessageSubscriberRabbitListener {
private Person person;
// tag::amqp_annotated_listener[]
@RabbitListener(bindings = @QueueBinding(value = @Queue("test.queue"), exchange = @Exchange(value = "contract-test.exchange", ignoreDeclarationExceptions = "true")))
@RabbitListener(bindings = @QueueBinding(value = @Queue("test.queue"),
exchange = @Exchange(value = "contract-test.exchange",
ignoreDeclarationExceptions = "true")))
public void handlePerson(Person person) {
this.person = person;
}

View File

@@ -40,7 +40,8 @@ import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@AutoConfigureStubRunner(repositoryRoot = "classpath:m2repo/repository/", ids = {
"org.springframework.cloud.contract.verifier.stubs:contextPathFraudDetectionServer" }, stubsMode = StubRunnerProperties.StubsMode.REMOTE)
"org.springframework.cloud.contract.verifier.stubs:contextPathFraudDetectionServer" },
stubsMode = StubRunnerProperties.StubsMode.REMOTE)
public class LoanApplicationServiceTests {
// end::autoconfigure_stubrunner[]