Left 1 type of messaging contract - code triggers an output
we're removing 2 additional types of messaging contracts we're removing any leftovers of rabbit and kafka support - users will need to provide their own message receiver and a message sender
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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
|
||||
*
|
||||
* https://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.spec.internal;
|
||||
|
||||
class ClientInput extends Input {
|
||||
|
||||
ClientInput(Input request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,14 +17,8 @@
|
||||
package org.springframework.cloud.contract.spec.internal;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import groovy.lang.Closure;
|
||||
import groovy.lang.DelegatesTo;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* Represents an input for messaging. The input can be a message or some action inside the
|
||||
* application.
|
||||
@@ -35,49 +29,12 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class Input extends Common implements RegexCreatingProperty<ClientDslProperty> {
|
||||
|
||||
private static final Log log = LogFactory.getLog(Input.class);
|
||||
|
||||
private ClientPatternValueDslProperty property = new ClientPatternValueDslProperty();
|
||||
|
||||
private DslProperty<String> messageFrom;
|
||||
|
||||
private ExecutionProperty triggeredBy;
|
||||
|
||||
private Headers messageHeaders = new Headers();
|
||||
|
||||
private BodyType messageBody;
|
||||
|
||||
private ExecutionProperty assertThat;
|
||||
|
||||
private BodyMatchers bodyMatchers;
|
||||
|
||||
public Input() {
|
||||
}
|
||||
|
||||
public Input(Input input) {
|
||||
this.messageFrom = input.getMessageFrom();
|
||||
this.messageHeaders = input.getMessageHeaders();
|
||||
this.messageBody = input.getMessageBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of a destination from which message would come to trigger action in the
|
||||
* system.
|
||||
* @param messageFrom message destination
|
||||
*/
|
||||
public void messageFrom(String messageFrom) {
|
||||
this.messageFrom = new DslProperty<>(messageFrom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of a destination from which message would come to trigger action in the
|
||||
* system.
|
||||
* @param messageFrom message destination
|
||||
*/
|
||||
public void messageFrom(DslProperty messageFrom) {
|
||||
this.messageFrom = messageFrom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that needs to be executed to trigger action in the system.
|
||||
* @param triggeredBy method name that triggers the message
|
||||
@@ -86,11 +43,6 @@ public class Input extends Common implements RegexCreatingProperty<ClientDslProp
|
||||
this.triggeredBy = new ExecutionProperty(triggeredBy);
|
||||
}
|
||||
|
||||
public BodyType messageBody(Object bodyAsValue) {
|
||||
this.messageBody = new BodyType(bodyAsValue);
|
||||
return this.messageBody;
|
||||
}
|
||||
|
||||
public DslProperty value(ClientDslProperty client) {
|
||||
Object dynamicValue = client.getClientValue();
|
||||
Object concreteValue = client.getServerValue();
|
||||
@@ -129,14 +81,6 @@ public class Input extends Common implements RegexCreatingProperty<ClientDslProp
|
||||
this.property = property;
|
||||
}
|
||||
|
||||
public DslProperty<String> getMessageFrom() {
|
||||
return messageFrom;
|
||||
}
|
||||
|
||||
public void setMessageFrom(DslProperty<String> messageFrom) {
|
||||
this.messageFrom = messageFrom;
|
||||
}
|
||||
|
||||
public ExecutionProperty getTriggeredBy() {
|
||||
return triggeredBy;
|
||||
}
|
||||
@@ -145,22 +89,6 @@ public class Input extends Common implements RegexCreatingProperty<ClientDslProp
|
||||
this.triggeredBy = triggeredBy;
|
||||
}
|
||||
|
||||
public Headers getMessageHeaders() {
|
||||
return messageHeaders;
|
||||
}
|
||||
|
||||
public void setMessageHeaders(Headers messageHeaders) {
|
||||
this.messageHeaders = messageHeaders;
|
||||
}
|
||||
|
||||
public BodyType getMessageBody() {
|
||||
return messageBody;
|
||||
}
|
||||
|
||||
public void setMessageBody(BodyType messageBody) {
|
||||
this.messageBody = messageBody;
|
||||
}
|
||||
|
||||
public ExecutionProperty getAssertThat() {
|
||||
return assertThat;
|
||||
}
|
||||
@@ -169,14 +97,6 @@ public class Input extends Common implements RegexCreatingProperty<ClientDslProp
|
||||
this.assertThat = assertThat;
|
||||
}
|
||||
|
||||
public BodyMatchers getBodyMatchers() {
|
||||
return bodyMatchers;
|
||||
}
|
||||
|
||||
public void setBodyMatchers(BodyMatchers bodyMatchers) {
|
||||
this.bodyMatchers = bodyMatchers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientDslProperty anyAlphaUnicode() {
|
||||
return property.anyAlphaUnicode();
|
||||
@@ -282,44 +202,6 @@ public class Input extends Common implements RegexCreatingProperty<ClientDslProp
|
||||
return property.anyOf(values);
|
||||
}
|
||||
|
||||
/**
|
||||
* The message headers part of the contract.
|
||||
* @param consumer function to manipulate the message headers
|
||||
*/
|
||||
public void messageHeaders(Consumer<Headers> consumer) {
|
||||
this.messageHeaders = new Headers();
|
||||
consumer.accept(this.messageHeaders);
|
||||
}
|
||||
|
||||
/**
|
||||
* The stub matchers part of the contract.
|
||||
* @param consumer function to manipulate the message headers
|
||||
*/
|
||||
public void bodyMatchers(Consumer<BodyMatchers> consumer) {
|
||||
this.bodyMatchers = new BodyMatchers();
|
||||
consumer.accept(this.bodyMatchers);
|
||||
}
|
||||
|
||||
/**
|
||||
* The message headers part of the contract.
|
||||
* @param consumer function to manipulate the message headers
|
||||
*/
|
||||
public void messageHeaders(@DelegatesTo(Headers.class) Closure consumer) {
|
||||
this.messageHeaders = new Headers();
|
||||
consumer.setDelegate(this.messageHeaders);
|
||||
consumer.call();
|
||||
}
|
||||
|
||||
/**
|
||||
* The stub matchers part of the contract.
|
||||
* @param consumer function to manipulate the message headers
|
||||
*/
|
||||
public void bodyMatchers(@DelegatesTo(BodyMatchers.class) Closure consumer) {
|
||||
this.bodyMatchers = new BodyMatchers();
|
||||
consumer.setDelegate(this.bodyMatchers);
|
||||
consumer.call();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
@@ -329,34 +211,18 @@ public class Input extends Common implements RegexCreatingProperty<ClientDslProp
|
||||
return false;
|
||||
}
|
||||
Input input = (Input) o;
|
||||
return Objects.equals(messageFrom, input.messageFrom) && Objects.equals(triggeredBy, input.triggeredBy)
|
||||
&& Objects.equals(messageHeaders, input.messageHeaders)
|
||||
&& Objects.equals(messageBody, input.messageBody) && Objects.equals(assertThat, input.assertThat)
|
||||
&& Objects.equals(bodyMatchers, input.bodyMatchers);
|
||||
return Objects.equals(triggeredBy, input.triggeredBy) && Objects.equals(assertThat, input.assertThat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(messageFrom, triggeredBy, messageHeaders, messageBody, assertThat, bodyMatchers);
|
||||
return Objects.hash(triggeredBy, assertThat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Input{\n\tmessageFrom=" + messageFrom + ", \n\ttriggeredBy=" + triggeredBy + ", \n\tmessageHeaders="
|
||||
+ messageHeaders + ", \n\tmessageBody=" + messageBody + ", \n\tassertThat=" + assertThat
|
||||
+ ", \n\tbodyMatchers=" + bodyMatchers + "} \n\t" + super.toString();
|
||||
}
|
||||
|
||||
public static class BodyType extends DslProperty {
|
||||
|
||||
public BodyType(Object clientValue, Object serverValue) {
|
||||
super(clientValue, serverValue);
|
||||
}
|
||||
|
||||
public BodyType(Object singleValue) {
|
||||
super(singleValue);
|
||||
}
|
||||
|
||||
return "Input{\n\t" + ", \n\ttriggeredBy=" + triggeredBy + ", \n\tassertThat=" + assertThat + "} \n\t"
|
||||
+ super.toString();
|
||||
}
|
||||
|
||||
private class ClientPatternValueDslProperty extends PatternValueDslProperty<ClientDslProperty> {
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2020 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
|
||||
*
|
||||
* https://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.spec.internal;
|
||||
|
||||
class ServerInput extends Input {
|
||||
|
||||
ServerInput(Input request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user