From f6d6fc9e4ea2231c4d2174c2687c96996e0571e1 Mon Sep 17 00:00:00 2001 From: Artem Bilan Date: Mon, 6 Jun 2016 16:24:10 -0400 Subject: [PATCH] Remove `JsonConverterCompatibilityTests` The test isn't compatible with `4.2.x` and `4.1.x` and its purpose is demonstration. Therefore only the `master` version is enough. --- .../JsonConverterCompatibilityTests.java | 104 ------------------ 1 file changed, 104 deletions(-) delete mode 100644 spring-integration-amqp/src/test/java/org/springframework/integration/amqp/support/JsonConverterCompatibilityTests.java diff --git a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/support/JsonConverterCompatibilityTests.java b/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/support/JsonConverterCompatibilityTests.java deleted file mode 100644 index d302be6fea..0000000000 --- a/spring-integration-amqp/src/test/java/org/springframework/integration/amqp/support/JsonConverterCompatibilityTests.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 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.integration.amqp.support; - -import static org.hamcrest.Matchers.instanceOf; -import static org.junit.Assert.assertThat; - -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; - -import org.springframework.amqp.core.MessageProperties; -import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; -import org.springframework.amqp.rabbit.core.ChannelCallback; -import org.springframework.amqp.rabbit.core.RabbitTemplate; -import org.springframework.amqp.rabbit.support.DefaultMessagePropertiesConverter; -import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter; -import org.springframework.integration.amqp.rule.BrokerRunning; -import org.springframework.integration.json.ObjectToJsonTransformer; -import org.springframework.messaging.Message; -import org.springframework.messaging.support.GenericMessage; - -import com.rabbitmq.client.AMQP.BasicProperties; -import com.rabbitmq.client.Channel; - -/** - * @author Gary Russell - * @since 4.3 - * - */ -public class JsonConverterCompatibilityTests { - - private static final String JSON_TESTQ = "si.json.tests"; - - @Rule - public BrokerRunning brokerRunning = BrokerRunning.isRunningWithEmptyQueues(JSON_TESTQ); - - private RabbitTemplate rabbitTemplate; - - @Before - public void setUp() { - this.rabbitTemplate = new RabbitTemplate(new CachingConnectionFactory("localhost")); - this.rabbitTemplate.setMessageConverter(new Jackson2JsonMessageConverter()); - } - - @After - public void tearDown() { - this.brokerRunning.removeTestQueues(); - ((CachingConnectionFactory) this.rabbitTemplate.getConnectionFactory()).destroy(); - } - - @Test - public void testInbound() { - @SuppressWarnings("unchecked") - final Message out = (Message) new ObjectToJsonTransformer() - .transform(new GenericMessage(new Foo())); - MessageProperties messageProperties = new MessageProperties(); - DefaultAmqpHeaderMapper.outboundMapper().fromHeadersToRequest(out.getHeaders(), messageProperties); - final BasicProperties props = new DefaultMessagePropertiesConverter().fromMessageProperties(messageProperties, - "UTF-8"); - this.rabbitTemplate.execute(new ChannelCallback() { - - @Override - public Void doInRabbit(Channel channel) throws Exception { - channel.basicPublish("", JSON_TESTQ, props, out.getPayload().getBytes()); - return null; - } - - }); - - Object received = this.rabbitTemplate.receiveAndConvert(JSON_TESTQ); - assertThat(received, instanceOf(Foo.class)); - } - - public static class Foo { - - private String bar = "bar"; - - public String getBar() { - return this.bar; - } - - public void setBar(String bar) { - this.bar = bar; - } - - } - -}