diff --git a/pom.xml b/pom.xml
index e8c65bc360..19a9e58c53 100644
--- a/pom.xml
+++ b/pom.xml
@@ -377,21 +377,6 @@
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
- 1.5
-
-
-
- addSources
- addTestSources
- compile
- testCompile
-
-
-
-
org.codehaus.plexus
plexus-component-metadata
diff --git a/samples/pom.xml b/samples/pom.xml
index 340a4ceace..b8a0135455 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -32,6 +32,22 @@
+
+
+
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+ 1.5
+
+
+
+ testCompile
+
+
+
+
+
+
diff --git a/samples/samples-messaging-camel/.springBeans b/samples/samples-messaging-camel/.springBeans
new file mode 100644
index 0000000000..d6d529735f
--- /dev/null
+++ b/samples/samples-messaging-camel/.springBeans
@@ -0,0 +1,15 @@
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/samples-messaging-camel/pom.xml b/samples/samples-messaging-camel/pom.xml
index 188ba6cd06..99e090bb63 100644
--- a/samples/samples-messaging-camel/pom.xml
+++ b/samples/samples-messaging-camel/pom.xml
@@ -1,6 +1,6 @@
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.cloud.contract
@@ -56,12 +56,4 @@
test
-
-
-
- org.codehaus.gmavenplus
- gmavenplus-plugin
-
-
-
diff --git a/samples/samples-messaging-camel/src/main/groovy/.empty b/samples/samples-messaging-camel/src/main/groovy/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleter.groovy b/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleter.groovy
deleted file mode 100644
index c1ad517de9..0000000000
--- a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleter.groovy
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2013-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.contract.verifier.samples.camel
-
-import groovy.transform.CompileStatic
-import groovy.util.logging.Slf4j
-import org.apache.camel.Exchange
-import org.springframework.stereotype.Component
-
-import java.util.concurrent.atomic.AtomicBoolean
-
-@CompileStatic
-@Slf4j
-@Component
-class BookDeleter {
-
- /**
- Scenario for "should generate tests triggered by a message":
- client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
- server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
- */
- void bookDeleted(Exchange exchange) {
- BookDeleted bookDeleted = exchange.in.getBody(BookDeleted)
- log.info("Deleting book [$bookDeleted]")
- bookSuccessfulyDeleted.set(true)
- log.info("Book successfuly deleted [$bookSuccessfulyDeleted]")
- }
-
- AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false)
-}
diff --git a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookService.groovy b/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookService.groovy
deleted file mode 100644
index f60ec6fbe9..0000000000
--- a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookService.groovy
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2013-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.contract.verifier.samples.camel
-
-import groovy.transform.CompileStatic
-import groovy.util.logging.Slf4j
-import org.apache.camel.Exchange
-import org.springframework.stereotype.Service
-
-@Service
-@CompileStatic
-@Slf4j
-class BookService {
-
- /**
- Scenario for "should generate tests triggered by a method":
- client side: must have a possibility to "trigger" sending of a message to the given messageFrom
- server side: will run the method and await upon receiving message on the output messageFrom
-
- Method triggers sending a message to a source
- */
- void returnBook(Exchange exchange) {
- BookReturned bookReturned = exchange.in.getBody(BookReturned)
- log.info("Returning book [$bookReturned]")
- exchange.out.with {
- body = bookReturned
- setHeader('BOOK-NAME', bookReturned.bookName)
- }
- }
-}
diff --git a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleted.groovy b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookDeleted.java
similarity index 74%
rename from samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleted.groovy
rename to samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookDeleted.java
index 52af5fd871..4ca43d7594 100644
--- a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookDeleted.groovy
+++ b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookDeleted.java
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.camel
+package org.springframework.cloud.contract.verifier.samples.camel;
-import com.fasterxml.jackson.annotation.JsonCreator
-import groovy.transform.CompileStatic
+import java.io.Serializable;
-@CompileStatic
-class BookDeleted implements Serializable {
- final String bookName
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+@SuppressWarnings("serial")
+public class BookDeleted implements Serializable {
+ public final String bookName;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
- BookDeleted(String bookName) {
- this.bookName = bookName
+ public BookDeleted(String bookName) {
+ this.bookName = bookName;
}
}
diff --git a/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookDeleter.java b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookDeleter.java
new file mode 100644
index 0000000000..91b6deb88d
--- /dev/null
+++ b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookDeleter.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.camel;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.camel.Exchange;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class BookDeleter {
+
+ private static final Logger log = LoggerFactory.getLogger(BookDeleter.class);
+
+ /**
+ * Scenario for "should generate tests triggered by a message": client side: if sends
+ * a message to input.messageFrom then message will be sent to output.messageFrom
+ * server side: will send a message to input, verify the message contents and await
+ * upon receiving message on the output messageFrom
+ */
+ public void bookDeleted(Exchange exchange) {
+ BookDeleted bookDeleted = exchange.getIn().getBody(BookDeleted.class);
+ log.info("Deleting book " + bookDeleted);
+ bookSuccessfulyDeleted.set(true);
+ log.info("Book successfuly deleted [$bookSuccessfulyDeleted]");
+ }
+
+ private AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false);
+}
diff --git a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookReturned.groovy b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookReturned.java
similarity index 77%
rename from samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookReturned.groovy
rename to samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookReturned.java
index 373743a094..15feaabf05 100644
--- a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookReturned.groovy
+++ b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookReturned.java
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.camel
+package org.springframework.cloud.contract.verifier.samples.camel;
-import com.fasterxml.jackson.annotation.JsonCreator
-import groovy.transform.CompileStatic
+import java.io.Serializable;
-@CompileStatic
-class BookReturned implements Serializable {
- final String bookName
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+@SuppressWarnings("serial")
+public class BookReturned implements Serializable {
+ public final String bookName;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
BookReturned(String bookName) {
- this.bookName = bookName
+ this.bookName = bookName;
}
}
diff --git a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookRouteConfiguration.groovy b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookRouteConfiguration.java
similarity index 57%
rename from samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookRouteConfiguration.groovy
rename to samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookRouteConfiguration.java
index 06ed844919..ab268f1c21 100644
--- a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/BookRouteConfiguration.groovy
+++ b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookRouteConfiguration.java
@@ -14,38 +14,41 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.camel
+package org.springframework.cloud.contract.verifier.samples.camel;
+
+import org.apache.activemq.camel.component.ActiveMQComponent;
+import org.apache.camel.RoutesBuilder;
+import org.apache.camel.model.dataformat.JsonLibrary;
+import org.apache.camel.spring.SpringRouteBuilder;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
-import org.apache.activemq.camel.component.ActiveMQComponent
-import org.apache.camel.RoutesBuilder
-import org.apache.camel.model.dataformat.JsonLibrary
-import org.apache.camel.spring.SpringRouteBuilder
-import org.springframework.beans.factory.annotation.Value
-import org.springframework.context.annotation.Bean
-import org.springframework.context.annotation.Configuration
/**
* @author Marcin Grzejszczak
*/
@Configuration
-class BookRouteConfiguration {
+public class BookRouteConfiguration {
@Bean
- ActiveMQComponent activeMQComponent(@Value('${activemq.url:vm://localhost?broker.persistent=false}') String url) {
- return new ActiveMQComponent(brokerURL: url)
+ ActiveMQComponent activeMQComponent(@Value("${activemq.url:vm://localhost?broker.persistent=false}") String url) {
+ ActiveMQComponent component = new ActiveMQComponent();
+ component.setBrokerURL(url);
+ return component;
}
@Bean
- RoutesBuilder myRouter(BookService bookService, BookDeleter bookDeleter) {
+ RoutesBuilder myRouter(final BookService bookService, final BookDeleter bookDeleter) {
return new SpringRouteBuilder() {
@Override
public void configure() throws Exception {
// scenario 1 - from bean to output
- from("direct:start").unmarshal().json(JsonLibrary.Jackson, BookReturned).bean(bookService).to("jms:output")
+ from("direct:start").unmarshal().json(JsonLibrary.Jackson, BookReturned.class).bean(bookService).to("jms:output");
// scenario 2 - from input to output
- from("jms:input").unmarshal().json(JsonLibrary.Jackson, BookReturned).bean(bookService).to("jms:output")
+ from("jms:input").unmarshal().json(JsonLibrary.Jackson, BookReturned.class).bean(bookService).to("jms:output");
// scenario 3 - from input to no output
- from("jms:delete").unmarshal().json(JsonLibrary.Jackson, BookDeleted).bean(bookDeleter)
+ from("jms:delete").unmarshal().json(JsonLibrary.Jackson, BookDeleted.class).bean(bookDeleter);
}
};
diff --git a/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookService.java b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookService.java
new file mode 100644
index 0000000000..a963007f4c
--- /dev/null
+++ b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/BookService.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.camel;
+
+import org.apache.camel.Exchange;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+
+@Service
+public class BookService {
+
+ private static final Logger log = LoggerFactory.getLogger(BookService.class);
+
+ /**
+ * Scenario for "should generate tests triggered by a method": client side: must have
+ * a possibility to "trigger" sending of a message to the given messageFrom server
+ * side: will run the method and await upon receiving message on the output
+ * messageFrom
+ *
+ * Method triggers sending a message to a source
+ */
+ public void returnBook(Exchange exchange) {
+ BookReturned bookReturned = exchange.getIn().getBody(BookReturned.class);
+ log.info("Returning book [$bookReturned]");
+ exchange.getOut().setBody(bookReturned);
+ exchange.getOut().setHeader("BOOK-NAME", bookReturned.bookName);
+ }
+}
diff --git a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplication.groovy b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplication.java
similarity index 79%
rename from samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplication.groovy
rename to samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplication.java
index da6bddcb83..e12116f353 100644
--- a/samples/samples-messaging-camel/src/main/groovy/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplication.groovy
+++ b/samples/samples-messaging-camel/src/main/java/org/springframework/cloud/contract/verifier/samples/camel/CamelMessagingApplication.java
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.camel
+package org.springframework.cloud.contract.verifier.samples.camel;
-import org.springframework.boot.SpringApplication
-import org.springframework.boot.autoconfigure.SpringBootApplication
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
-class CamelMessagingApplication {
+public class CamelMessagingApplication {
- static void main(String[] args) {
- SpringApplication.run(CamelMessagingApplication.class, args)
+ public static void main(String[] args) {
+ SpringApplication.run(CamelMessagingApplication.class, args);
}
}
diff --git a/samples/samples-messaging-integration/.springBeans b/samples/samples-messaging-integration/.springBeans
new file mode 100644
index 0000000000..d6d529735f
--- /dev/null
+++ b/samples/samples-messaging-integration/.springBeans
@@ -0,0 +1,15 @@
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/samples-messaging-integration/src/main/groovy/.empty b/samples/samples-messaging-integration/src/main/groovy/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy b/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy
deleted file mode 100644
index e0041a8dcb..0000000000
--- a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2013-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.contract.verifier.samples.messaging
-
-import groovy.transform.CompileStatic
-import groovy.util.logging.Slf4j
-import org.springframework.messaging.Message
-import org.springframework.messaging.MessageHeaders
-import org.springframework.messaging.support.MessageBuilder
-
-import java.util.concurrent.atomic.AtomicBoolean
-
-@CompileStatic
-@Slf4j
-class BookListener {
-
- /**
- Scenario for "should generate tests triggered by a message":
- client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
- server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
- */
- Message returnBook(BookReturned bookReturned) {
- log.info("Returning book [$bookReturned]")
- return MessageBuilder.createMessage(bookReturned, new MessageHeaders([
- 'BOOK-NAME': bookReturned.bookName as Object
- ]))
- }
-
- /**
- Scenario for "should generate tests triggered by a message":
- client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
- server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
- */
- void bookDeleted(BookDeleted bookDeleted) {
- log.info("Deleting book [$bookDeleted]")
- bookSuccessfulyDeleted.set(true)
- }
-
- AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false)
-}
diff --git a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy b/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy
deleted file mode 100644
index 888df79bce..0000000000
--- a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2013-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.contract.verifier.samples.messaging
-
-import groovy.transform.CompileStatic
-import groovy.util.logging.Slf4j
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.beans.factory.annotation.Qualifier
-import org.springframework.messaging.MessageChannel
-import org.springframework.messaging.MessageHeaders
-import org.springframework.messaging.support.MessageBuilder
-import org.springframework.stereotype.Service
-
-@Service
-@CompileStatic
-@Slf4j
-class BookService {
-
- @Autowired @Qualifier("outputChannel") MessageChannel outputChannel
-
- /**
- Scenario for "should generate tests triggered by a method":
- client side: must have a possibility to "trigger" sending of a message to the given messageFrom
- server side: will run the method and await upon receiving message on the output messageFrom
-
- Method triggers sending a message to a source
- */
- void returnBook(BookReturned bookReturned) {
- log.info("Returning book [$bookReturned]")
- outputChannel.send(MessageBuilder.createMessage(bookReturned, new MessageHeaders([
- 'BOOK-NAME': bookReturned.bookName as Object
- ])))
- }
-}
diff --git a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.java
similarity index 73%
rename from samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy
rename to samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.java
index e43c21c9d2..19c6288bbe 100644
--- a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy
+++ b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.java
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.messaging
+package org.springframework.cloud.contract.verifier.samples.messaging;
-import com.fasterxml.jackson.annotation.JsonCreator
-import groovy.transform.CompileStatic
+import java.io.Serializable;
-@CompileStatic
-class BookDeleted {
- final String bookName
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+@SuppressWarnings("serial")
+public class BookDeleted implements Serializable {
+ public final String bookName;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
- BookDeleted(String bookName) {
- this.bookName = bookName
+ public BookDeleted(String bookName) {
+ this.bookName = bookName;
}
}
diff --git a/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.java b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.java
new file mode 100644
index 0000000000..f4f8349d2a
--- /dev/null
+++ b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.messaging.Message;
+import org.springframework.messaging.support.MessageBuilder;
+
+public class BookListener {
+
+ private static final Logger log = LoggerFactory.getLogger(BookListener.class);
+
+ /**
+ * Scenario for "should generate tests triggered by a message": client side: if sends
+ * a message to input.messageFrom then message will be sent to output.messageFrom
+ * server side: will send a message to input, verify the message contents and await
+ * upon receiving message on the output messageFrom
+ */
+ public Message returnBook(BookReturned bookReturned) {
+ log.info("Returning book [$bookReturned]");
+ return MessageBuilder.withPayload(bookReturned)
+ .setHeader("BOOK-NAME", bookReturned.bookName).build();
+ }
+
+ /**
+ * Scenario for "should generate tests triggered by a message": client side: if sends
+ * a message to input.messageFrom then message will be sent to output.messageFrom
+ * server side: will send a message to input, verify the message contents and await
+ * upon receiving message on the output messageFrom
+ */
+ public void bookDeleted(BookDeleted bookDeleted) {
+ log.info("Deleting book [$bookDeleted]");
+ bookSuccessfulyDeleted.set(true);
+ }
+
+ private AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false);
+}
diff --git a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.java
similarity index 77%
rename from samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy
rename to samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.java
index 130c19d468..eeb19ce99b 100644
--- a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy
+++ b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.java
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.messaging
+package org.springframework.cloud.contract.verifier.samples.messaging;
-import com.fasterxml.jackson.annotation.JsonCreator
-import groovy.transform.CompileStatic
+import java.io.Serializable;
-@CompileStatic
-class BookReturned {
- final String bookName
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+@SuppressWarnings("serial")
+public class BookReturned implements Serializable {
+ public final String bookName;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
BookReturned(String bookName) {
- this.bookName = bookName
+ this.bookName = bookName;
}
}
diff --git a/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookService.java b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookService.java
new file mode 100644
index 0000000000..f4e17eea14
--- /dev/null
+++ b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookService.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.messaging.MessageChannel;
+import org.springframework.messaging.support.MessageBuilder;
+import org.springframework.stereotype.Service;
+
+@Service
+public class BookService {
+
+ private static final Logger log = LoggerFactory.getLogger(BookService.class);
+
+ private @Autowired @Qualifier("outputChannel") MessageChannel outputChannel;
+
+ /**
+ * Scenario for "should generate tests triggered by a method": client side: must have
+ * a possibility to "trigger" sending of a message to the given messageFrom server
+ * side: will run the method and await upon receiving message on the output
+ * messageFrom
+ *
+ * Method triggers sending a message to a source
+ */
+ public void returnBook(BookReturned bookReturned) {
+ log.info("Returning book " + bookReturned);
+ outputChannel.send(MessageBuilder.withPayload(bookReturned)
+ .setHeader("BOOK-NAME", bookReturned.bookName).build());
+ }
+}
diff --git a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplication.groovy b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplication.java
similarity index 80%
rename from samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplication.groovy
rename to samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplication.java
index 811fcbdfc3..5e6dc1aa17 100644
--- a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplication.groovy
+++ b/samples/samples-messaging-integration/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/IntegrationMessagingApplication.java
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.messaging
+package org.springframework.cloud.contract.verifier.samples.messaging;
-import org.springframework.boot.SpringApplication
-import org.springframework.boot.autoconfigure.SpringBootApplication
-import org.springframework.context.annotation.ImportResource
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ImportResource;
@SpringBootApplication
@ImportResource("classpath*:integration-context.xml")
-class IntegrationMessagingApplication {
+public class IntegrationMessagingApplication {
- static void main(String[] args) {
- SpringApplication.run(IntegrationMessagingApplication.class, args)
+ public static void main(String[] args) {
+ SpringApplication.run(IntegrationMessagingApplication.class, args);
}
}
diff --git a/samples/samples-messaging-spring/.springBeans b/samples/samples-messaging-spring/.springBeans
new file mode 100644
index 0000000000..d6d529735f
--- /dev/null
+++ b/samples/samples-messaging-spring/.springBeans
@@ -0,0 +1,15 @@
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/samples-messaging-spring/src/main/groovy/.empty b/samples/samples-messaging-spring/src/main/groovy/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookListener.groovy b/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookListener.groovy
deleted file mode 100644
index 117bf6a9b6..0000000000
--- a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookListener.groovy
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright 2013-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.contract.verifier.samples.spring
-
-import com.fasterxml.jackson.databind.ObjectMapper
-import groovy.transform.CompileStatic
-import groovy.util.logging.Slf4j
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.jms.annotation.JmsListener
-import org.springframework.jms.core.JmsTemplate
-import org.springframework.jms.core.MessageCreator
-import org.springframework.stereotype.Service
-
-import javax.jms.JMSException
-import javax.jms.Message
-import javax.jms.Session
-import java.util.concurrent.atomic.AtomicBoolean
-
-@CompileStatic
-@Slf4j
-@Service
-class BookListener {
-
- @Autowired JmsTemplate jmsTemplate
- ObjectMapper objectMapper = new ObjectMapper()
-
- /**
- Scenario for "should generate tests triggered by a message":
- client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
- server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
- */
- @JmsListener(destination = "input")
- void returnBook(String messageAsString) {
- BookReturned bookReturned = objectMapper.readerFor(BookReturned).readValue(messageAsString) as BookReturned
- log.info("Returning book [$bookReturned]")
- MessageCreator messageCreator = new MessageCreator() {
- @Override
- public Message createMessage(Session session) throws JMSException {
- Message message = session.createObjectMessage(bookReturned);
- message.setStringProperty('BOOK-NAME', bookReturned.bookName)
- return message
- }
- };
- jmsTemplate.send('output', messageCreator)
- }
-
- /**
- Scenario for "should generate tests triggered by a message":
- client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
- server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
- */
- @JmsListener(destination = "delete")
- void bookDeleted(String bookDeletedAsString) {
- BookDeleted bookDeleted = objectMapper.readerFor(BookDeleted).readValue(bookDeletedAsString) as BookDeleted
- log.info("Deleting book [$bookDeleted]")
- bookSuccessfulyDeleted.set(true)
- }
-
- AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false)
-}
diff --git a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookService.groovy b/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookService.groovy
deleted file mode 100644
index b6413c21c4..0000000000
--- a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookService.groovy
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2013-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.contract.verifier.samples.spring
-
-import groovy.transform.CompileStatic
-import groovy.util.logging.Slf4j
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.jms.core.JmsTemplate
-import org.springframework.jms.core.MessageCreator
-import org.springframework.stereotype.Service
-
-import javax.jms.JMSException
-import javax.jms.Message
-import javax.jms.Session
-
-@Service
-@CompileStatic
-@Slf4j
-class BookService {
-
- @Autowired JmsTemplate jmsTemplate
-
- /**
- Scenario for "should generate tests triggered by a method":
- client side: must have a possibility to "trigger" sending of a message to the given messageFrom
- server side: will run the method and await upon receiving message on the output messageFrom
-
- Method triggers sending a message to a source
- */
- void returnBook(BookReturned bookReturned ) {
- log.info("Returning book [$bookReturned]")
- MessageCreator messageCreator = new MessageCreator() {
- @Override
- public Message createMessage(Session session) throws JMSException {
- Message message = session.createObjectMessage(bookReturned);
- message.setStringProperty('BOOK-NAME', bookReturned.bookName)
- return message
- }
- };
- jmsTemplate.send('output', messageCreator)
- }
-}
diff --git a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookDeleted.groovy b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookDeleted.java
similarity index 74%
rename from samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookDeleted.groovy
rename to samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookDeleted.java
index 3ee03c12ec..a4d52aa3b9 100644
--- a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookDeleted.groovy
+++ b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookDeleted.java
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.spring
+package org.springframework.cloud.contract.verifier.samples.spring;
-import com.fasterxml.jackson.annotation.JsonCreator
-import groovy.transform.CompileStatic
+import java.io.Serializable;
-@CompileStatic
-class BookDeleted implements Serializable {
- final String bookName
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+@SuppressWarnings("serial")
+public class BookDeleted implements Serializable {
+ public final String bookName;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
- BookDeleted(String bookName) {
- this.bookName = bookName
+ public BookDeleted(String bookName) {
+ this.bookName = bookName;
}
}
diff --git a/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookListener.java b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookListener.java
new file mode 100644
index 0000000000..14d717cf82
--- /dev/null
+++ b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookListener.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring;
+
+import java.io.IOException;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.annotation.JmsListener;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.jms.core.MessageCreator;
+import org.springframework.stereotype.Service;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Service
+public class BookListener {
+
+
+ private static final Logger log = LoggerFactory.getLogger(BookListener.class);
+
+
+ private @Autowired JmsTemplate jmsTemplate;
+ private ObjectMapper objectMapper = new ObjectMapper();
+
+ /**
+ * Scenario for "should generate tests triggered by a message": client side: if sends
+ * a message to input.messageFrom then message will be sent to output.messageFrom
+ * server side: will send a message to input, verify the message contents and await
+ * upon receiving message on the output messageFrom
+ */
+ @JmsListener(destination = "input")
+ public void returnBook(String messageAsString) throws Exception {
+ final BookReturned bookReturned = objectMapper.readerFor(BookReturned.class).readValue(messageAsString);
+ log.info("Returning book [$bookReturned]");
+ MessageCreator messageCreator = new MessageCreator() {
+ @Override
+ public Message createMessage(Session session) throws JMSException {
+ Message message = session.createObjectMessage(bookReturned);
+ message.setStringProperty("BOOK-NAME", bookReturned.bookName);
+ return message;
+ }
+ };
+ jmsTemplate.send("output", messageCreator);
+ }
+
+ /**
+ Scenario for "should generate tests triggered by a message":
+ client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
+ server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
+ * @throws IOException
+ * @throws JsonProcessingException
+ */
+ @JmsListener(destination = "delete")
+ public void bookDeleted(String bookDeletedAsString) throws Exception {
+ BookDeleted bookDeleted = objectMapper.readerFor(BookDeleted.class).readValue(bookDeletedAsString);
+ log.info("Deleting book " + bookDeleted);
+ bookSuccessfulyDeleted.set(true);
+ }
+
+ AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false);
+}
diff --git a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookReturned.groovy b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookReturned.java
similarity index 77%
rename from samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookReturned.groovy
rename to samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookReturned.java
index a875572a76..d86008439e 100644
--- a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/BookReturned.groovy
+++ b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookReturned.java
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.spring
+package org.springframework.cloud.contract.verifier.samples.spring;
-import com.fasterxml.jackson.annotation.JsonCreator
-import groovy.transform.CompileStatic
+import java.io.Serializable;
-@CompileStatic
-class BookReturned implements Serializable {
- String bookName
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+@SuppressWarnings("serial")
+public class BookReturned implements Serializable {
+ public final String bookName;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
BookReturned(String bookName) {
- this.bookName = bookName
+ this.bookName = bookName;
}
}
diff --git a/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookService.java b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookService.java
new file mode 100644
index 0000000000..dcb434044d
--- /dev/null
+++ b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/BookService.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.spring;
+
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.Session;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jms.core.JmsTemplate;
+import org.springframework.jms.core.MessageCreator;
+import org.springframework.stereotype.Service;
+
+@Service
+public class BookService {
+
+ private static final Logger log = LoggerFactory.getLogger(BookService.class);
+
+ private @Autowired JmsTemplate jmsTemplate;
+
+ /**
+ * Scenario for "should generate tests triggered by a method": client side: must have
+ * a possibility to "trigger" sending of a message to the given messageFrom server
+ * side: will run the method and await upon receiving message on the output
+ * messageFrom
+ *
+ * Method triggers sending a message to a source
+ */
+ public void returnBook(final BookReturned bookReturned) {
+ log.info("Returning book " + bookReturned);
+ MessageCreator messageCreator = new MessageCreator() {
+ @Override
+ public Message createMessage(Session session) throws JMSException {
+ Message message = session.createObjectMessage(bookReturned);
+ message.setStringProperty("BOOK-NAME", bookReturned.bookName);
+ return message;
+ }
+ };
+ jmsTemplate.send("output", messageCreator);
+ }
+}
diff --git a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/SpringMessagingApplication.groovy b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/SpringMessagingApplication.java
similarity index 83%
rename from samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/SpringMessagingApplication.groovy
rename to samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/SpringMessagingApplication.java
index c4a6676fb8..f082532983 100644
--- a/samples/samples-messaging-spring/src/main/groovy/org/springframework/cloud/contract/verifier/samples/spring/SpringMessagingApplication.groovy
+++ b/samples/samples-messaging-spring/src/main/java/org/springframework/cloud/contract/verifier/samples/spring/SpringMessagingApplication.java
@@ -14,17 +14,17 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.spring
+package org.springframework.cloud.contract.verifier.samples.spring;
-import org.springframework.boot.SpringApplication
-import org.springframework.boot.autoconfigure.SpringBootApplication
-import org.springframework.jms.annotation.EnableJms
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.jms.annotation.EnableJms;
@SpringBootApplication
@EnableJms
class SpringMessagingApplication {
static void main(String[] args) {
- SpringApplication.run(SpringMessagingApplication.class, args)
+ SpringApplication.run(SpringMessagingApplication.class, args);
}
}
diff --git a/samples/samples-messaging-stream/.springBeans b/samples/samples-messaging-stream/.springBeans
new file mode 100644
index 0000000000..d6d529735f
--- /dev/null
+++ b/samples/samples-messaging-stream/.springBeans
@@ -0,0 +1,15 @@
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/samples-messaging-stream/src/main/groovy/.empty b/samples/samples-messaging-stream/src/main/groovy/.empty
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy b/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy
deleted file mode 100644
index 6e70889df4..0000000000
--- a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.groovy
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2013-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.contract.verifier.samples.messaging
-
-import groovy.transform.CompileStatic
-import groovy.util.logging.Slf4j
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.cloud.stream.annotation.EnableBinding
-import org.springframework.cloud.stream.annotation.StreamListener
-import org.springframework.cloud.stream.messaging.Sink
-import org.springframework.cloud.stream.messaging.Source
-import org.springframework.messaging.MessageHeaders
-import org.springframework.messaging.support.MessageBuilder
-
-import java.util.concurrent.atomic.AtomicBoolean
-
-@CompileStatic
-@Slf4j
-@EnableBinding([DeleteSink, Sink])
-class BookListener {
-
- @Autowired Source source
-
- /**
- Scenario for "should generate tests triggered by a message":
- client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
- server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
- */
- @StreamListener(Sink.INPUT)
- void returnBook(BookReturned bookReturned) {
- log.info("Returning book [$bookReturned]")
- source.output().send(MessageBuilder.createMessage(bookReturned, new MessageHeaders([
- 'BOOK-NAME': bookReturned.bookName as Object
- ])))
- }
-
- /**
- Scenario for "should generate tests triggered by a message":
- client side: if sends a message to input.messageFrom then message will be sent to output.messageFrom
- server side: will send a message to input, verify the message contents and await upon receiving message on the output messageFrom
- */
- @StreamListener(DeleteSink.INPUT)
- void bookDeleted(BookDeleted bookDeleted) {
- log.info("Deleting book [$bookDeleted]")
- // ... doing some work
- bookSuccessfulyDeleted.set(true)
- }
-
- AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false)
-}
diff --git a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy b/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy
deleted file mode 100644
index 4e8a8adefa..0000000000
--- a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookService.groovy
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2013-2016 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.cloud.contract.verifier.samples.messaging
-
-import groovy.transform.CompileStatic
-import groovy.util.logging.Slf4j
-import org.springframework.beans.factory.annotation.Autowired
-import org.springframework.cloud.stream.messaging.Source
-import org.springframework.messaging.MessageHeaders
-import org.springframework.messaging.support.MessageBuilder
-import org.springframework.stereotype.Service
-
-@Service
-@CompileStatic
-@Slf4j
-class BookService {
-
- private final Source source
-
- @Autowired
- BookService(Source source) {
- this.source = source
- }
-
- /**
- Scenario for "should generate tests triggered by a method":
- client side: must have a possibility to "trigger" sending of a message to the given messageFrom
- server side: will run the method and await upon receiving message on the output messageFrom
-
- Method triggers sending a message to a source
- */
- void returnBook(BookReturned bookReturned) {
- log.info("Returning book [$bookReturned]")
- source.output().send(MessageBuilder.createMessage(bookReturned, new MessageHeaders([
- 'BOOK-NAME': bookReturned.bookName as Object
- ])))
- }
-}
diff --git a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.java
similarity index 73%
rename from samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy
rename to samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.java
index e43c21c9d2..19c6288bbe 100644
--- a/samples/samples-messaging-integration/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.groovy
+++ b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookDeleted.java
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.messaging
+package org.springframework.cloud.contract.verifier.samples.messaging;
-import com.fasterxml.jackson.annotation.JsonCreator
-import groovy.transform.CompileStatic
+import java.io.Serializable;
-@CompileStatic
-class BookDeleted {
- final String bookName
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+@SuppressWarnings("serial")
+public class BookDeleted implements Serializable {
+ public final String bookName;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
- BookDeleted(String bookName) {
- this.bookName = bookName
+ public BookDeleted(String bookName) {
+ this.bookName = bookName;
}
}
diff --git a/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.java b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.java
new file mode 100644
index 0000000000..86cf23b1b0
--- /dev/null
+++ b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookListener.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.cloud.stream.annotation.StreamListener;
+import org.springframework.cloud.stream.messaging.Sink;
+import org.springframework.cloud.stream.messaging.Source;
+import org.springframework.messaging.support.MessageBuilder;
+
+@EnableBinding({ DeleteSink.class, Sink.class })
+public class BookListener {
+
+ private static final Logger log = LoggerFactory.getLogger(BookListener.class);
+
+ @Autowired
+ private Source source;
+
+ /**
+ * Scenario for "should generate tests triggered by a message": client side: if sends
+ * a message to input.messageFrom then message will be sent to output.messageFrom
+ * server side: will send a message to input, verify the message contents and await
+ * upon receiving message on the output messageFrom
+ */
+ @StreamListener(Sink.INPUT)
+ public void returnBook(BookReturned bookReturned) {
+ log.info("Returning book " + bookReturned);
+ source.output().send(MessageBuilder.withPayload(bookReturned)
+ .setHeader("BOOK-NAME", bookReturned.bookName).build());
+ }
+
+ /**
+ * Scenario for "should generate tests triggered by a message": client side: if sends
+ * a message to input.messageFrom then message will be sent to output.messageFrom
+ * server side: will send a message to input, verify the message contents and await
+ * upon receiving message on the output messageFrom
+ */
+ @StreamListener(DeleteSink.INPUT)
+ public void bookDeleted(BookDeleted bookDeleted) {
+ log.info("Deleting book " + bookDeleted);
+ // ... doing some work
+ bookSuccessfulyDeleted.set(true);
+ }
+
+ public AtomicBoolean bookSuccessfulyDeleted = new AtomicBoolean(false);
+}
diff --git a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.java
similarity index 77%
rename from samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy
rename to samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.java
index 130c19d468..eeb19ce99b 100644
--- a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.groovy
+++ b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookReturned.java
@@ -14,17 +14,18 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.messaging
+package org.springframework.cloud.contract.verifier.samples.messaging;
-import com.fasterxml.jackson.annotation.JsonCreator
-import groovy.transform.CompileStatic
+import java.io.Serializable;
-@CompileStatic
-class BookReturned {
- final String bookName
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+@SuppressWarnings("serial")
+public class BookReturned implements Serializable {
+ public final String bookName;
@JsonCreator(mode = JsonCreator.Mode.PROPERTIES)
BookReturned(String bookName) {
- this.bookName = bookName
+ this.bookName = bookName;
}
}
diff --git a/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookService.java b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookService.java
new file mode 100644
index 0000000000..c6b1eea6dc
--- /dev/null
+++ b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/BookService.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2013-2016 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.cloud.contract.verifier.samples.messaging;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.stream.messaging.Source;
+import org.springframework.integration.support.MessageBuilder;
+import org.springframework.stereotype.Service;
+
+@Service
+public class BookService {
+
+ private static final Logger log = LoggerFactory.getLogger(BookService.class);
+
+ private final Source source;
+
+ @Autowired
+ public BookService(Source source) {
+ this.source = source;
+ }
+
+ /**
+ * Scenario for "should generate tests triggered by a method": client side: must have
+ * a possibility to "trigger" sending of a message to the given messageFrom server
+ * side: will run the method and await upon receiving message on the output
+ * messageFrom
+ *
+ * Method triggers sending a message to a source
+ */
+ public void returnBook(BookReturned bookReturned) {
+ log.info("Returning book " + bookReturned);
+ source.output().send(MessageBuilder.withPayload(bookReturned)
+ .setHeader("BOOK-NAME", bookReturned.bookName).build());
+ }
+}
diff --git a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/DeleteSink.groovy b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/DeleteSink.java
similarity index 79%
rename from samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/DeleteSink.groovy
rename to samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/DeleteSink.java
index aa6e72e4e4..f2da8f6449 100644
--- a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/DeleteSink.groovy
+++ b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/DeleteSink.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package org.springframework.cloud.contract.verifier.samples.messaging
+package org.springframework.cloud.contract.verifier.samples.messaging;
-import org.springframework.cloud.stream.annotation.Input
-import org.springframework.cloud.stream.messaging.Sink
-import org.springframework.messaging.SubscribableChannel
+import org.springframework.cloud.stream.annotation.Input;
+import org.springframework.cloud.stream.messaging.Sink;
+import org.springframework.messaging.SubscribableChannel;
/**
* @author Marcin Grzejszczak
*/
interface DeleteSink extends Sink {
- String INPUT = "delete";
+ static String INPUT = "delete";
@Input(DeleteSink.INPUT)
SubscribableChannel delete();
diff --git a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplication.groovy b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplication.java
similarity index 87%
rename from samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplication.groovy
rename to samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplication.java
index 9fa8eb8f86..fbeff3c4b5 100644
--- a/samples/samples-messaging-stream/src/main/groovy/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplication.groovy
+++ b/samples/samples-messaging-stream/src/main/java/org/springframework/cloud/contract/verifier/samples/messaging/StreamMessagingApplication.java
@@ -18,15 +18,15 @@ package org.springframework.cloud.contract.verifier.samples.messaging;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.stream.annotation.EnableBinding
+import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.messaging.Source;
@SpringBootApplication
-@EnableBinding([Source, Sink])
+@EnableBinding({Source.class, Sink.class})
class StreamMessagingApplication {
- static void main(String[] args) {
- SpringApplication.run(StreamMessagingApplication.class, args)
+ public static void main(String[] args) {
+ SpringApplication.run(StreamMessagingApplication.class, args);
}
}
diff --git a/spring-cloud-contract-spec/pom.xml b/spring-cloud-contract-spec/pom.xml
index 44c345eed0..dad4a8306c 100644
--- a/spring-cloud-contract-spec/pom.xml
+++ b/spring-cloud-contract-spec/pom.xml
@@ -33,6 +33,15 @@
org.codehaus.gmavenplus
gmavenplus-plugin
+
+
+
+ addSources
+ compile
+ testCompile
+
+
+
diff --git a/spring-cloud-contract-stub-runner/pom.xml b/spring-cloud-contract-stub-runner/pom.xml
index 947b6e87ba..f9391357a4 100644
--- a/spring-cloud-contract-stub-runner/pom.xml
+++ b/spring-cloud-contract-stub-runner/pom.xml
@@ -25,4 +25,26 @@
spring-cloud-contract-stub-runner-spring-cloud
+
+
+
+
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+ 1.5
+
+
+
+ addSources
+ addTestSources
+ compile
+ testCompile
+
+
+
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier-maven-plugin/pom.xml b/spring-cloud-contract-verifier-maven-plugin/pom.xml
index 5106db2b0c..71477a6de0 100644
--- a/spring-cloud-contract-verifier-maven-plugin/pom.xml
+++ b/spring-cloud-contract-verifier-maven-plugin/pom.xml
@@ -21,4 +21,26 @@
spring-cloud-contract-verifier-maven-plugin
+
+
+
+
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+ 1.5
+
+
+
+ addSources
+ addTestSources
+ compile
+ testCompile
+
+
+
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier/pom.xml b/spring-cloud-contract-verifier/pom.xml
index 13a37c80c1..ee54817a39 100644
--- a/spring-cloud-contract-verifier/pom.xml
+++ b/spring-cloud-contract-verifier/pom.xml
@@ -23,4 +23,26 @@
spring-cloud-contract-verifier-messaging
+
+
+
+
+ org.codehaus.gmavenplus
+ gmavenplus-plugin
+ 1.5
+
+
+
+ addSources
+ addTestSources
+ compile
+ testCompile
+
+
+
+
+
+
+
+
diff --git a/spring-cloud-contract-verifier/spring-cloud-contract-verifier-testing-utils/src/test/groovy/.empty b/spring-cloud-contract-verifier/spring-cloud-contract-verifier-testing-utils/src/test/groovy/.empty
new file mode 100644
index 0000000000..e69de29bb2