http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/integration/test/UnsharedDurableConsumeTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/integration/test/UnsharedDurableConsumeTest.java b/src/test/java/org/apache/rocketmq/jms/integration/test/UnsharedDurableConsumeTest.java deleted file mode 100644 index 809dbae..0000000 --- a/src/test/java/org/apache/rocketmq/jms/integration/test/UnsharedDurableConsumeTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.integration.test; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import javax.jms.Connection; -import javax.jms.ConnectionFactory; -import javax.jms.Message; -import javax.jms.MessageConsumer; -import javax.jms.MessageListener; -import javax.jms.MessageProducer; -import javax.jms.Session; -import javax.jms.TextMessage; -import javax.jms.Topic; -import org.apache.rocketmq.jms.RocketMQConnectionFactory; -import org.apache.rocketmq.jms.RocketMQSession; -import org.apache.rocketmq.jms.exception.DuplicateSubscriptionException; -import org.apache.rocketmq.jms.integration.source.AppConfig; -import org.apache.rocketmq.jms.integration.source.Constant; -import org.apache.rocketmq.jms.integration.source.RocketMQAdmin; -import org.apache.rocketmq.jms.integration.source.support.ConditionMatcher; -import org.apache.rocketmq.jms.integration.source.support.TimeLimitAssert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = AppConfig.class) -public class UnsharedDurableConsumeTest { - - @Autowired - private RocketMQAdmin rocketMQAdmin; - - /** - * Test each message will be deliver to only one consumer if these consumers are in unshared durable subscription. - * - * <p>Test step: - * 1. Create a unshared durable consumer(consumerA) via the first connection(connectionA) - * 2. Create a unshared durable consumer(consumerB) via another connection(connectionB) - * 3. Result: - * a. The creating consumerB should throw a JMSException as consumerA and consumberB have the same subscription - * b. All messages should be received by consumerA - * - * @throws Exception - * @see {@link RocketMQSession} - */ - @Test - public void testEachMessageOnlyConsumeByOneConsumer() throws Exception { - final String rmqTopicName = "coffee" + UUID.randomUUID().toString(); - rocketMQAdmin.createTopic(rmqTopicName, 2); - - ConnectionFactory factory = new RocketMQConnectionFactory(Constant.NAME_SERVER_ADDRESS, Constant.CLIENT_ID); - Connection connectionA = null, connectionB = null; - final String subscriptionName = "MySubscription"; - final List<Message> receivedA = new ArrayList(); - - try { - // consumerA - connectionA = factory.createConnection(); - Session sessionA = connectionA.createSession(); - connectionA.start(); - Topic topic = sessionA.createTopic(rmqTopicName); - MessageConsumer consumerA = sessionA.createDurableConsumer(topic, subscriptionName); - consumerA.setMessageListener(new MessageListener() { - @Override public void onMessage(Message message) { - receivedA.add(message); - } - }); - - Thread.sleep(1000 * 2); - - // consumerB - try { - connectionB = factory.createConnection(); - Session sessionB = connectionB.createSession(); - sessionB.createDurableConsumer(topic, subscriptionName); - assertFalse("Doesn't get the expected " + DuplicateSubscriptionException.class.getSimpleName(), true); - } - catch (DuplicateSubscriptionException e) { - assertTrue(true); - } - - connectionA.start(); - - //producer - TextMessage message = sessionA.createTextMessage("a"); - MessageProducer producer = sessionA.createProducer(topic); - for (int i = 0; i < 10; i++) { - producer.send(message); - } - - TimeLimitAssert.doAssert(new ConditionMatcher() { - @Override public boolean match() { - return receivedA.size() == 10; - } - }, 5); - } - finally { - connectionA.close(); - connectionB.close(); - rocketMQAdmin.deleteTopic(rmqTopicName); - } - } - -}
http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/integration/test/listener/SimpleTextListenerTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/integration/test/listener/SimpleTextListenerTest.java b/src/test/java/org/apache/rocketmq/jms/integration/test/listener/SimpleTextListenerTest.java deleted file mode 100644 index 528a42b..0000000 --- a/src/test/java/org/apache/rocketmq/jms/integration/test/listener/SimpleTextListenerTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.integration.test.listener; - -import org.apache.commons.lang3.time.StopWatch; -import org.apache.rocketmq.jms.integration.source.AppConfig; -import org.apache.rocketmq.jms.integration.source.SimpleTextListener; -import org.apache.rocketmq.jms.integration.source.support.ConditionMatcher; -import org.apache.rocketmq.jms.integration.source.support.TimeLimitAssert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jms.core.JmsTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.apache.rocketmq.jms.integration.source.SimpleTextListener.DESTINATION; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = AppConfig.class) -public class SimpleTextListenerTest { - - private static final Logger log = LoggerFactory.getLogger(SimpleTextListenerTest.class); - - @Autowired - private JmsTemplate jmsTemplate; - - @Autowired - private SimpleTextListener simpleTextListener; - - @Test - public void testListener() throws Exception { - jmsTemplate.convertAndSend(DESTINATION, "first"); - StopWatch watch = new StopWatch(); - watch.start(); - - TimeLimitAssert.doAssert(new ConditionMatcher() { - @Override public boolean match() { - return simpleTextListener.getReceivedMsg().size() == 1; - } - }, 60); - } -} http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/JMSBytesMessageTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/JMSBytesMessageTest.java b/src/test/java/org/apache/rocketmq/jms/msg/JMSBytesMessageTest.java deleted file mode 100644 index 20520f6..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/JMSBytesMessageTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg; - -import javax.jms.MessageNotReadableException; -import javax.jms.MessageNotWriteableException; -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class JMSBytesMessageTest { - - private byte[] receiveData = "receive data test".getBytes(); - private byte[] sendData = "send data test".getBytes(); - - @Test - public void testGetData() throws Exception { - JMSBytesMessage readMessage = new JMSBytesMessage(receiveData); - assertThat(new String(receiveData), is(new String(readMessage.getBody()))); - - JMSBytesMessage sendMessage = new JMSBytesMessage(); - sendMessage.writeBytes(sendData, 0, sendData.length); - assertThat(new String(sendData), is(new String(sendMessage.getBody()))); - } - - @Test - public void testGetBodyLength() throws Exception { - JMSBytesMessage msg = new JMSBytesMessage(receiveData); - assertThat(msg.getBodyLength(), is(new Long(receiveData.length))); - } - - @Test - public void testReadBytes1() throws Exception { - JMSBytesMessage msg = new JMSBytesMessage(receiveData); - byte[] receiveValue = new byte[receiveData.length]; - msg.readBytes(receiveValue); - assertThat(new String(receiveValue), is(new String(receiveData))); - } - - @Test - public void testReadBytes2() throws Exception { - JMSBytesMessage msg = new JMSBytesMessage(receiveData); - - byte[] receiveValue1 = new byte[2]; - msg.readBytes(receiveValue1); - assertThat(new String(receiveData).substring(0, 2), is(new String(receiveValue1))); - - byte[] receiveValue2 = new byte[2]; - msg.readBytes(receiveValue2); - assertThat(new String(receiveData).substring(2, 4), is(new String(receiveValue2))); - - } - - @Test - public void testWriteBytes() throws Exception { - JMSBytesMessage msg = new JMSBytesMessage(); - msg.writeBytes(sendData); - assertThat(new String(msg.getBody()), is(new String(sendData))); - } - - @Test(expected = MessageNotReadableException.class) - public void testNotReadableException() throws Exception { - JMSBytesMessage msg = new JMSBytesMessage(); - msg.writeBoolean(true); - msg.readBoolean(); - } - - @Test(expected = MessageNotWriteableException.class) - public void testNotWritableException() throws Exception { - JMSBytesMessage msg = new JMSBytesMessage(receiveData); - msg.writeBoolean(true); - } - - @Test - public void testClearBody() throws Exception { - JMSBytesMessage msg = new JMSBytesMessage(receiveData); - msg.clearBody(); - msg.writeBoolean(true); - } - - @Test - public void testReset() throws Exception { - JMSBytesMessage msg = new JMSBytesMessage(receiveData); - byte[] b = new byte[2]; - msg.readBytes(b); - msg.reset(); - msg.readBytes(b); - assertThat(new String(receiveData).substring(0, 2), is(new String(b))); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/JMSMapMessageTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/JMSMapMessageTest.java b/src/test/java/org/apache/rocketmq/jms/msg/JMSMapMessageTest.java deleted file mode 100644 index cb34653..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/JMSMapMessageTest.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg; - -import javax.jms.JMSException; -import javax.jms.MessageNotWriteableException; -import org.junit.Test; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -public class JMSMapMessageTest { - - @Test - public void testGetBoolean() throws Exception { - JMSMapMessage msg = new JMSMapMessage(); - - // get an empty value will return false - assertThat(msg.getBoolean("man"), is(false)); - - // get an not empty value - msg.setBoolean("man", true); - assertThat(msg.getBoolean("man"), is(true)); - - // key is null - try { - msg.getBoolean(null); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - - // in read-only model - msg.setReadOnly(true); - try { - msg.setBoolean("man", true); - assertTrue(false); - } - catch (MessageNotWriteableException e) { - assertTrue(true); - } - - // both read and write are allowed after clearBody() - msg.clearBody(); - msg.setBoolean("man", false); - msg.getBoolean("man"); - - // map is empty after clearBody() - msg.clearBody(); - assertThat(msg.getBoolean("man"), is(false)); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/JMSObjectMessageTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/JMSObjectMessageTest.java b/src/test/java/org/apache/rocketmq/jms/msg/JMSObjectMessageTest.java deleted file mode 100644 index 82d0165..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/JMSObjectMessageTest.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg; - -import java.io.Serializable; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class JMSObjectMessageTest { - - @Test - public void testGetObject() throws Exception { - final User user = new User("jack", 20); - JMSObjectMessage msg = new JMSObjectMessage(user); - assertThat((User)msg.getObject(), is(user)); - } - - @Test - public void testGetBody() throws Exception { - final User user = new User("jack", 20); - JMSObjectMessage msg = new JMSObjectMessage(user); - assertThat((User)msg.getBody(Object.class), is((User)msg.getObject())); - } - - private class User implements Serializable { - private String name; - private int age; - - private User(String name, int age) { - this.name = name; - this.age = age; - } - - @Override - public boolean equals(Object obj) { - return EqualsBuilder.reflectionEquals(this, obj); - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/JMSTextMessageTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/JMSTextMessageTest.java b/src/test/java/org/apache/rocketmq/jms/msg/JMSTextMessageTest.java deleted file mode 100644 index d9c0cac..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/JMSTextMessageTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg; - -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class JMSTextMessageTest { - private String text = "jmsRocketMQTextMessage test"; - - @Test - public void testGetBody() throws Exception { - JMSTextMessage msg = new JMSTextMessage(text); - assertThat(msg.getBody(String.class), is(text)); - } - - @Test - public void testSetText() throws Exception { - JMSTextMessage msg = new JMSTextMessage(); - msg.setText(text); - assertThat(msg.getText(), is(text)); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/convert/JMS2RMQMessageConvertTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/convert/JMS2RMQMessageConvertTest.java b/src/test/java/org/apache/rocketmq/jms/msg/convert/JMS2RMQMessageConvertTest.java deleted file mode 100644 index 13a048c..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/convert/JMS2RMQMessageConvertTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg.convert; - -import org.apache.rocketmq.common.message.MessageExt; -import org.apache.rocketmq.jms.destination.RocketMQTopic; -import org.apache.rocketmq.jms.msg.AbstractJMSMessage; -import org.apache.rocketmq.jms.msg.JMSTextMessage; -import org.apache.rocketmq.jms.msg.enums.JMSHeaderEnum; -import org.apache.rocketmq.jms.msg.enums.JMSMessageModelEnum; -import org.junit.Test; - -import static org.apache.rocketmq.jms.msg.enums.JMSMessageModelEnum.MSG_MODEL_NAME; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class JMS2RMQMessageConvertTest { - - @Test - public void testConvert() throws Exception { - AbstractJMSMessage jmsMessage = new JMSTextMessage("text"); - - // given - jmsMessage.setJMSDestination(new RocketMQTopic("topic")); - jmsMessage.setJMSMessageID("ID:XXX"); - jmsMessage.setJMSTimestamp(1488273583542L); - jmsMessage.setJMSExpiration(0L); - - jmsMessage.setStringProperty("MyProperty", "MyValue"); - - // when - MessageExt rmqMessage = JMS2RMQMessageConvert.convert(jmsMessage); - - // then - assertThat(rmqMessage.getTopic(), is("topic")); - assertThat(rmqMessage.getUserProperty(JMSHeaderEnum.JMSMessageID.name()), is("ID:XXX")); - assertThat(rmqMessage.getBornTimestamp(), is(1488273583542L)); - assertThat(rmqMessage.getUserProperty(JMSHeaderEnum.JMSExpiration.name()), is("0")); - assertThat(rmqMessage.getKeys(), is("ID:XXX")); - - assertThat(rmqMessage.getUserProperty(JMS2RMQMessageConvert.USER_PROPERTY_PREFIX + "MyProperty"), is("MyValue")); - assertThat(rmqMessage.getUserProperty(MSG_MODEL_NAME), is(JMSMessageModelEnum.STRING.name())); - assertThat(new String(rmqMessage.getBody()), is("text")); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/convert/RMQ2JMSMessageConvertTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/convert/RMQ2JMSMessageConvertTest.java b/src/test/java/org/apache/rocketmq/jms/msg/convert/RMQ2JMSMessageConvertTest.java deleted file mode 100644 index 1d5bb11..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/convert/RMQ2JMSMessageConvertTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg.convert; - -import javax.jms.Message; -import org.apache.rocketmq.common.message.MessageExt; -import org.apache.rocketmq.jms.msg.JMSBytesMessage; -import org.apache.rocketmq.jms.msg.enums.JMSHeaderEnum; -import org.apache.rocketmq.jms.msg.enums.JMSMessageModelEnum; -import org.apache.rocketmq.jms.msg.enums.JMSPropertiesEnum; -import org.apache.rocketmq.jms.support.JMSUtils; -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class RMQ2JMSMessageConvertTest { - - @Test - public void testConvert() throws Exception { - MessageExt rmqMessage = new MessageExt(); - - // given - rmqMessage.setBody("body".getBytes()); - rmqMessage.putUserProperty(JMSMessageModelEnum.MSG_MODEL_NAME, JMSMessageModelEnum.BYTE.name()); - rmqMessage.putUserProperty(JMSHeaderEnum.JMSMessageID.name(), "ID:YYY"); - rmqMessage.setBornTimestamp(1488273585542L); - rmqMessage.putUserProperty(JMSHeaderEnum.JMSExpiration.name(), "0"); - rmqMessage.setReconsumeTimes(2); - rmqMessage.setTopic("topic"); - - rmqMessage.putUserProperty(JMSPropertiesEnum.JMSXDeliveryCount.name(), "2"); - rmqMessage.putUserProperty(JMS2RMQMessageConvert.USER_PROPERTY_PREFIX + "MyProperty", "MyValue"); - - // when - Message jmsMessage = RMQ2JMSMessageConvert.convert(rmqMessage); - - // then - assertThat(JMSBytesMessage.class.isInstance(jmsMessage), is(true)); - assertThat(jmsMessage.getJMSMessageID(), is("ID:YYY")); - assertThat(jmsMessage.getJMSTimestamp(), is(1488273585542L)); - assertThat(jmsMessage.getJMSExpiration(), is(0L)); - assertThat(jmsMessage.getJMSRedelivered(), is(true)); - assertThat(JMSUtils.getDestinationName(jmsMessage.getJMSDestination()), is("topic")); - - assertThat(jmsMessage.getStringProperty("MyProperty"), is("MyValue")); - assertThat(jmsMessage.getIntProperty(JMSPropertiesEnum.JMSXDeliveryCount.name()), is(3)); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/enums/JMSMessageModelEnumTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/enums/JMSMessageModelEnumTest.java b/src/test/java/org/apache/rocketmq/jms/msg/enums/JMSMessageModelEnumTest.java deleted file mode 100644 index 28255dd..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/enums/JMSMessageModelEnumTest.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg.enums; - -import org.apache.rocketmq.jms.msg.JMSTextMessage; -import org.junit.Test; - -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; - -public class JMSMessageModelEnumTest { - @Test - public void testToMsgModelEnum() throws Exception { - assertThat(JMSMessageModelEnum.toMsgModelEnum(new JMSTextMessage("text")), is(JMSMessageModelEnum.STRING)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/serialize/MapSerializeTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/serialize/MapSerializeTest.java b/src/test/java/org/apache/rocketmq/jms/msg/serialize/MapSerializeTest.java deleted file mode 100644 index 5204fb3..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/serialize/MapSerializeTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg.serialize; - -import java.util.HashMap; -import java.util.Map; -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class MapSerializeTest { - - @Test - public void serializeAndDeserialize() throws Exception { - Map map = new HashMap(); - map.put("name", "John"); - map.put("age", 20); - - byte[] bytes = MapSerialize.instance().serialize(map); - Map newMap = MapSerialize.instance().deserialize(bytes); - - assertThat(map.size(), is(newMap.size())); - assertThat(newMap.get("name").toString(), is("John")); - assertThat(newMap.get("age").toString(), is("20")); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/serialize/ObjectSerializeTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/serialize/ObjectSerializeTest.java b/src/test/java/org/apache/rocketmq/jms/msg/serialize/ObjectSerializeTest.java deleted file mode 100644 index 1661b08..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/serialize/ObjectSerializeTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg.serialize; - -import java.io.Serializable; -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class ObjectSerializeTest { - - @Test - public void serializeAndDeserialize() throws Exception { - Person person = new Person(); - person.setName("John"); - person.setAge(30); - - byte[] bytes = ObjectSerialize.instance().serialize(person); - Person newPerson = (Person)ObjectSerialize.instance().deserialize(bytes); - - assertThat(newPerson.getName(), is(person.getName())); - assertThat(newPerson.getAge(), is(person.getAge())); - } - - private static class Person implements Serializable { - private static final long serialVersionUID = -4981805070659153282L; - - private String name; - private int age; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getAge() { - return age; - } - - public void setAge(int age) { - this.age = age; - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/msg/serialize/StringSerializeTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/msg/serialize/StringSerializeTest.java b/src/test/java/org/apache/rocketmq/jms/msg/serialize/StringSerializeTest.java deleted file mode 100644 index 4e6a54a..0000000 --- a/src/test/java/org/apache/rocketmq/jms/msg/serialize/StringSerializeTest.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.msg.serialize; - -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class StringSerializeTest { - - @Test - public void serializeAndDeserialize() throws Exception { - String text = "MyText"; - - byte[] bytes = StringSerialize.instance().serialize(text); - String newText = StringSerialize.instance().deserialize(bytes); - - assertThat(text, is(newText)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/support/JMSUtilsTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/support/JMSUtilsTest.java b/src/test/java/org/apache/rocketmq/jms/support/JMSUtilsTest.java deleted file mode 100644 index 2d9c901..0000000 --- a/src/test/java/org/apache/rocketmq/jms/support/JMSUtilsTest.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.support; - -import org.apache.rocketmq.jms.destination.RocketMQQueue; -import org.apache.rocketmq.jms.destination.RocketMQTopic; -import org.junit.Test; - -import static org.hamcrest.core.Is.is; -import static org.hamcrest.core.IsNull.notNullValue; -import static org.junit.Assert.assertThat; - -public class JMSUtilsTest { - - @Test - public void getTopicName() throws Exception { - RocketMQTopic topic = new RocketMQTopic("topic"); - assertThat(JMSUtils.getDestinationName(topic), is("topic")); - - RocketMQQueue queue = new RocketMQQueue("queue"); - assertThat(JMSUtils.getDestinationName(queue), is("queue")); - } - - @Test - public void getConsumerGroup() throws Exception { - final String subscriptionName = "subscriptionName"; - final String clientID = "clientID"; - String consumerGroupA = JMSUtils.getConsumerGroup(subscriptionName, clientID, true); - assertThat(consumerGroupA.contains(subscriptionName), is(true)); - assertThat(consumerGroupA.contains(clientID), is(true)); - assertThat(consumerGroupA.substring(subscriptionName.length() + clientID.length() + 2).length(), is(36)); - - String consumerGroupB = JMSUtils.getConsumerGroup(subscriptionName, clientID, false); - assertThat(consumerGroupB.contains(subscriptionName), is(true)); - assertThat(consumerGroupB.contains(clientID), is(true)); - assertThat(consumerGroupB.length(), is(subscriptionName.length() + clientID.length() + 1)); - - String consumerGroupC = JMSUtils.getConsumerGroup(null, null, true); - assertThat(consumerGroupC.length(), is(36)); - } - - @Test - public void uuid() throws Exception { - assertThat(JMSUtils.uuid(), notNullValue()); - } - - @Test - public void string2Bytes() throws Exception { - String source = "source"; - - assertThat(JMSUtils.bytes2String(JMSUtils.string2Bytes(source)), is(source)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/support/ObjectTypeCastTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/support/ObjectTypeCastTest.java b/src/test/java/org/apache/rocketmq/jms/support/ObjectTypeCastTest.java deleted file mode 100644 index 21fc50b..0000000 --- a/src/test/java/org/apache/rocketmq/jms/support/ObjectTypeCastTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.support; - -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class ObjectTypeCastTest { - - @Test - public void testConvert2String() throws Exception { - assertThat(ObjectTypeCast.cast2String("name"), is("name")); - } - - @Test - public void testConvert2Long() throws Exception { - assertThat(ObjectTypeCast.cast2Long(100l), is(100l)); - } - - @Test - public void testConvert2Integer() throws Exception { - assertThat(ObjectTypeCast.cast2Integer(100), is(100)); - } - - @Test - public void testConvert2Boolean() throws Exception { - assertThat(ObjectTypeCast.cast2Boolean(true), is(true)); - } - - @Test - public void testConvert2Object() throws Exception { - final ObjectTypeCast obj = new ObjectTypeCast(); - assertThat(ObjectTypeCast.cast2Object(obj, ObjectTypeCast.class), is(obj)); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/support/PredictionTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/support/PredictionTest.java b/src/test/java/org/apache/rocketmq/jms/support/PredictionTest.java deleted file mode 100644 index 50a29a8..0000000 --- a/src/test/java/org/apache/rocketmq/jms/support/PredictionTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.apache.rocketmq.jms.support; - -import java.util.Date; -import org.junit.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -public class PredictionTest { - - @Test - public void checkNotNull() throws Exception { - Prediction.checkNotNull(new Date(), "Date could not be null"); - - try { - Prediction.checkNotNull(null, "Argument could not be null"); - assertThat("Haven't throw IllegalArgumentException", false); - } - catch (IllegalArgumentException e) { - assertThat(e.getMessage(), is("Argument could not be null")); - } - } - - @Test - public void checkNotBlank() throws Exception { - Prediction.checkNotBlank("name", "Name could not be null"); - - try { - Prediction.checkNotBlank(null, "Name could not be null"); - assertThat("Haven't throw IllegalArgumentException", false); - } - catch (IllegalArgumentException e) { - assertThat(e.getMessage(), is("Name could not be null")); - } - - try { - Prediction.checkNotBlank(" ", "Name could not be null"); - assertThat("Haven't throw IllegalArgumentException", false); - } - catch (IllegalArgumentException e) { - assertThat(e.getMessage(), is("Name could not be null")); - } - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/src/test/java/org/apache/rocketmq/jms/support/PrimitiveTypeCastTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/rocketmq/jms/support/PrimitiveTypeCastTest.java b/src/test/java/org/apache/rocketmq/jms/support/PrimitiveTypeCastTest.java deleted file mode 100644 index 53ae0da..0000000 --- a/src/test/java/org/apache/rocketmq/jms/support/PrimitiveTypeCastTest.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.rocketmq.jms.support; - -import java.util.Date; -import javax.jms.JMSException; -import org.junit.Test; - -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2Boolean; -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2Byte; -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2ByteArray; -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2Char; -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2Double; -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2Float; -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2Int; -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2Long; -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2Short; -import static org.apache.rocketmq.jms.support.PrimitiveTypeCast.cast2String; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -public class PrimitiveTypeCastTest { - - @Test - public void testConvert2Boolean() throws Exception { - assertThat(cast2Boolean(new Boolean(true)), is(true)); - assertThat(cast2Boolean(null), is(false)); - - assertThat(cast2Boolean("true"), is(true)); - assertThat(cast2Boolean("hello"), is(false)); - - try { - cast2Boolean(new Date()); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } - - @Test - public void testConvert2Byte() throws Exception { - final byte b = Byte.parseByte("101", 2); - assertThat(cast2Byte(b), is(b)); - - assertThat(cast2Byte(new String("5")), is(b)); - try { - assertThat(cast2Byte(null), is(b)); - assertTrue(false); - } - catch (RuntimeException e) { - assertTrue(true); - } - - try { - cast2Byte("abc"); - assertTrue(false); - } - catch (RuntimeException e) { - assertTrue(true); - } - - try { - cast2Byte(new Date()); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } - - @Test - public void testConvert2Short() throws Exception { - final Short s = new Short("12"); - assertThat(cast2Short(s), is(s)); - - assertThat(cast2Short("3"), is(new Short("3"))); - - try { - cast2Short(new Date()); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } - - @Test - public void testConvert2Char() throws Exception { - final char c = 'a'; - assertThat(cast2Char(c), is(c)); - - try { - cast2Char("a"); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } - - @Test - public void testConvert2Int() throws Exception { - assertThat(cast2Int(12), is(12)); - - assertThat(cast2Int("12"), is(12)); - assertThat(cast2Int(Byte.parseByte("11", 2)), is(3)); - - try { - cast2Int(new Date()); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } - - @Test - public void testConvert2Long() throws Exception { - assertThat(cast2Long(12), is(12l)); - - assertThat(cast2Long("12"), is(12l)); - - try { - cast2Int(new Date()); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } - - @Test - public void testConvert2Float() throws Exception { - assertThat(cast2Float(12.00f), is(12f)); - - assertThat(cast2Float("12.00"), is(12f)); - - try { - cast2Float(12); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } - - @Test - public void testConvert2Double() throws Exception { - assertThat(cast2Double(12.00d), is(12d)); - - assertThat(cast2Double("12.00"), is(12d)); - assertThat(cast2Double(12.00f), is(12d)); - - try { - cast2Double(12); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } - - @Test - public void testConvert2String() throws Exception { - assertThat(cast2String(12.00d), is("12.0")); - - assertThat(cast2String("12.00"), is("12.00")); - assertThat(cast2String(true), is("true")); - - try { - cast2String(new Date()); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } - - @Test - public void testConvert2ByteArray() throws Exception { - byte[] arr = new byte[] {Byte.parseByte("11", 2), Byte.parseByte("101", 2)}; - - assertThat(cast2ByteArray(arr), is(arr)); - - try { - cast2ByteArray("10"); - assertTrue(false); - } - catch (JMSException e) { - assertTrue(true); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/style/checkstyle-suppressions.xml ---------------------------------------------------------------------- diff --git a/style/checkstyle-suppressions.xml b/style/checkstyle-suppressions.xml deleted file mode 100644 index 0174c40..0000000 --- a/style/checkstyle-suppressions.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> - -<!DOCTYPE suppressions PUBLIC - "-//Puppy Crawl//DTD Suppressions 1.0//EN" - "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> - -<suppressions> - <suppress files="LICENSE"/> - <suppress files="NOTICE"/> -</suppressions> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/style/copyright/Apache.xml ---------------------------------------------------------------------- diff --git a/style/copyright/Apache.xml b/style/copyright/Apache.xml deleted file mode 100644 index 2db86d0..0000000 --- a/style/copyright/Apache.xml +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You 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. - --> - -<component name="CopyrightManager"> - <copyright> - <option name="myName" value="Apache"/> - <option name="notice" - value="Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You 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."/> - </copyright> -</component> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/style/copyright/profiles_settings.xml ---------------------------------------------------------------------- diff --git a/style/copyright/profiles_settings.xml b/style/copyright/profiles_settings.xml deleted file mode 100644 index 4c0e521..0000000 --- a/style/copyright/profiles_settings.xml +++ /dev/null @@ -1,64 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You 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. - --> - -<component name="CopyrightManager"> - <settings default="Apache"> - <module2copyright> - <element module="All" copyright="Apache"/> - </module2copyright> - <LanguageOptions name="GSP"> - <option name="fileTypeOverride" value="3"/> - <option name="prefixLines" value="false"/> - </LanguageOptions> - <LanguageOptions name="HTML"> - <option name="fileTypeOverride" value="3"/> - <option name="prefixLines" value="false"/> - </LanguageOptions> - <LanguageOptions name="JAVA"> - <option name="fileTypeOverride" value="3"/> - <option name="addBlankAfter" value="false"/> - </LanguageOptions> - <LanguageOptions name="JSP"> - <option name="fileTypeOverride" value="3"/> - <option name="prefixLines" value="false"/> - </LanguageOptions> - <LanguageOptions name="JSPX"> - <option name="fileTypeOverride" value="3"/> - <option name="prefixLines" value="false"/> - </LanguageOptions> - <LanguageOptions name="MXML"> - <option name="fileTypeOverride" value="3"/> - <option name="prefixLines" value="false"/> - </LanguageOptions> - <LanguageOptions name="Properties"> - <option name="fileTypeOverride" value="3"/> - <option name="block" value="false"/> - </LanguageOptions> - <LanguageOptions name="SPI"> - <option name="fileTypeOverride" value="3"/> - <option name="block" value="false"/> - </LanguageOptions> - <LanguageOptions name="XML"> - <option name="fileTypeOverride" value="3"/> - <option name="prefixLines" value="false"/> - </LanguageOptions> - <LanguageOptions name="__TEMPLATE__"> - <option name="separateBefore" value="true"/> - <option name="lenBefore" value="1"/> - </LanguageOptions> - </settings> -</component> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/style/rmq_checkstyle.xml ---------------------------------------------------------------------- diff --git a/style/rmq_checkstyle.xml b/style/rmq_checkstyle.xml deleted file mode 100644 index b100601..0000000 --- a/style/rmq_checkstyle.xml +++ /dev/null @@ -1,135 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You 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. - --> - -<!DOCTYPE module PUBLIC - "-//Puppy Crawl//DTD Check Configuration 1.3//EN" - "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> -<!--Refer http://checkstyle.sourceforge.net/reports/google-java-style.html#s2.2-file-encoding --> -<module name="Checker"> - - <property name="localeLanguage" value="en"/> - - <!--To configure the check to report on the first instance in each file--> - <module name="FileTabCharacter"/> - - <!-- header --> - <module name="RegexpHeader"> - <property name="header" value="/\*\nLicensed to the Apache Software Foundation*"/> - </module> - - <module name="RegexpSingleline"> - <property name="format" value="System\.out\.println"/> - <property name="message" value="Prohibit invoking System.out.println in source code !"/> - </module> - - <module name="RegexpSingleline"> - <property name="format" value="//FIXME"/> - <property name="message" value="Recommended fix FIXME task !"/> - </module> - - <!--<module name="RegexpSingleline">--> - <!--<property name="format" value="//TODO"/>--> - <!--<property name="message" value="Recommended fix TODO task !"/>--> - <!--</module>--> - - <module name="RegexpSingleline"> - <property name="format" value="@alibaba"/> - <property name="message" value="Recommended remove @alibaba keyword!"/> - </module> - <module name="RegexpSingleline"> - <property name="format" value="@taobao"/> - <property name="message" value="Recommended remove @taobao keyword!"/> - </module> - <module name="RegexpSingleline"> - <property name="format" value="@author"/> - <property name="message" value="Recommended remove @author tag in javadoc!"/> - </module> - - <module name="RegexpSingleline"> - <property name="format" - value=".*[\u3400-\u4DB5\u4E00-\u9FA5\u9FA6-\u9FBB\uF900-\uFA2D\uFA30-\uFA6A\uFA70-\uFAD9\uFF00-\uFFEF\u2E80-\u2EFF\u3000-\u303F\u31C0-\u31EF]+.*"/> - <property name="message" value="Not allow chinese character !"/> - </module> - - <module name="FileLength"> - <property name="max" value="3000"/> - </module> - - <module name="TreeWalker"> - - <module name="UnusedImports"> - <property name="processJavadoc" value="true"/> - </module> - <module name="RedundantImport"/> - - <!--<module name="IllegalImport" />--> - - <!--Checks that classes that override equals() also override hashCode()--> - <module name="EqualsHashCode"/> - <!--Checks for over-complicated boolean expressions. Currently finds code like if (topic == true), topic || true, !false, etc.--> - <module name="SimplifyBooleanExpression"/> - <module name="OneStatementPerLine"/> - <module name="UnnecessaryParentheses"/> - <!--Checks for over-complicated boolean return statements. For example the following code--> - <module name="SimplifyBooleanReturn"/> - - <!--Check that the default is after all the cases in producerGroup switch statement--> - <module name="DefaultComesLast"/> - <!--Detects empty statements (standalone ";" semicolon)--> - <module name="EmptyStatement"/> - <!--Checks that long constants are defined with an upper ell--> - <module name="UpperEll"/> - <module name="ConstantName"> - <property name="format" value="(^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$)|(^log$)"/> - </module> - <!--Checks that local, non-final variable names conform to producerGroup format specified by the format property--> - <module name="LocalVariableName"/> - <!--Validates identifiers for local, final variables, including catch parameters--> - <module name="LocalFinalVariableName"/> - <!--Validates identifiers for non-static fields--> - <module name="MemberName"/> - <!--Validates identifiers for class type parameters--> - <module name="ClassTypeParameterName"> - <property name="format" value="^[A-Z0-9]*$"/> - </module> - <!--Validates identifiers for method type parameters--> - <module name="MethodTypeParameterName"> - <property name="format" value="^[A-Z0-9]*$"/> - </module> - <module name="PackageName"/> - <module name="ParameterName"/> - <module name="StaticVariableName"/> - <module name="TypeName"/> - <!--Checks that there are no import statements that use the * notation--> - <module name="AvoidStarImport"/> - - <!--whitespace--> - <module name="GenericWhitespace"/> - <module name="NoWhitespaceBefore"/> - <module name="WhitespaceAfter"/> - <module name="NoWhitespaceAfter"/> - <module name="WhitespaceAround"> - <property name="allowEmptyConstructors" value="true"/> - <property name="allowEmptyMethods" value="true"/> - </module> - <module name="Indentation"/> - <module name="MethodParamPad"/> - <module name="ParenPad"/> - <module name="TypecastParenPad"/> - </module> -</module> http://git-wip-us.apache.org/repos/asf/incubator-rocketmq-externals/blob/725026db/style/rmq_codeStyle.xml ---------------------------------------------------------------------- diff --git a/style/rmq_codeStyle.xml b/style/rmq_codeStyle.xml deleted file mode 100644 index cd95ee6..0000000 --- a/style/rmq_codeStyle.xml +++ /dev/null @@ -1,157 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one or more - ~ contributor license agreements. See the NOTICE file distributed with - ~ this work for additional information regarding copyright ownership. - ~ The ASF licenses this file to You 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. - --> - -<code_scheme name="rocketmq"> - <option name="USE_SAME_INDENTS" value="true"/> - <option name="IGNORE_SAME_INDENTS_FOR_LANGUAGES" value="true"/> - <option name="OTHER_INDENT_OPTIONS"> - <value> - <option name="INDENT_SIZE" value="4"/> - <option name="CONTINUATION_INDENT_SIZE" value="4"/> - <option name="TAB_SIZE" value="4"/> - <option name="USE_TAB_CHARACTER" value="false"/> - <option name="SMART_TABS" value="false"/> - <option name="LABEL_INDENT_SIZE" value="0"/> - <option name="LABEL_INDENT_ABSOLUTE" value="false"/> - <option name="USE_RELATIVE_INDENTS" value="false"/> - </value> - </option> - <option name="PREFER_LONGER_NAMES" value="false"/> - <option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000"/> - <option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="1000"/> - <option name="PACKAGES_TO_USE_IMPORT_ON_DEMAND"> - <value/> - </option> - <option name="IMPORT_LAYOUT_TABLE"> - <value> - <package name="" withSubpackages="true" static="false"/> - <emptyLine/> - <package name="" withSubpackages="true" static="true"/> - </value> - </option> - <option name="JD_ALIGN_PARAM_COMMENTS" value="false"/> - <option name="JD_ALIGN_EXCEPTION_COMMENTS" value="false"/> - <option name="JD_P_AT_EMPTY_LINES" value="false"/> - <option name="JD_KEEP_INVALID_TAGS" value="false"/> - <option name="JD_DO_NOT_WRAP_ONE_LINE_COMMENTS" value="true"/> - <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/> - <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/> - <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/> - <option name="ELSE_ON_NEW_LINE" value="true"/> - <option name="WHILE_ON_NEW_LINE" value="true"/> - <option name="CATCH_ON_NEW_LINE" value="true"/> - <option name="FINALLY_ON_NEW_LINE" value="true"/> - <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/> - <option name="ALIGN_MULTILINE_FOR" value="false"/> - <option name="SPACE_AFTER_TYPE_CAST" value="false"/> - <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true"/> - <option name="METHOD_PARAMETERS_WRAP" value="1"/> - <option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true"/> - <option name="LABELED_STATEMENT_WRAP" value="1"/> - <option name="WRAP_COMMENTS" value="true"/> - <option name="METHOD_ANNOTATION_WRAP" value="1"/> - <option name="CLASS_ANNOTATION_WRAP" value="1"/> - <option name="FIELD_ANNOTATION_WRAP" value="1"/> - <JavaCodeStyleSettings> - <option name="CLASS_NAMES_IN_JAVADOC" value="3"/> - </JavaCodeStyleSettings> - <XML> - <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true"/> - </XML> - <ADDITIONAL_INDENT_OPTIONS fileType="haml"> - <option name="INDENT_SIZE" value="2"/> - </ADDITIONAL_INDENT_OPTIONS> - <codeStyleSettings language="Groovy"> - <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/> - <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/> - <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/> - <option name="ELSE_ON_NEW_LINE" value="true"/> - <option name="CATCH_ON_NEW_LINE" value="true"/> - <option name="FINALLY_ON_NEW_LINE" value="true"/> - <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/> - <option name="ALIGN_MULTILINE_FOR" value="false"/> - <option name="SPACE_AFTER_TYPE_CAST" value="false"/> - <option name="METHOD_PARAMETERS_WRAP" value="1"/> - <option name="METHOD_ANNOTATION_WRAP" value="1"/> - <option name="CLASS_ANNOTATION_WRAP" value="1"/> - <option name="FIELD_ANNOTATION_WRAP" value="1"/> - <option name="PARENT_SETTINGS_INSTALLED" value="true"/> - <indentOptions> - <option name="CONTINUATION_INDENT_SIZE" value="4"/> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="HOCON"> - <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/> - <option name="PARENT_SETTINGS_INSTALLED" value="true"/> - </codeStyleSettings> - <codeStyleSettings language="JAVA"> - <option name="KEEP_CONTROL_STATEMENT_IN_ONE_LINE" value="false"/> - <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/> - <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/> - <option name="ELSE_ON_NEW_LINE" value="true"/> - <option name="WHILE_ON_NEW_LINE" value="true"/> - <option name="CATCH_ON_NEW_LINE" value="true"/> - <option name="FINALLY_ON_NEW_LINE" value="true"/> - <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/> - <option name="ALIGN_MULTILINE_FOR" value="false"/> - <option name="SPACE_AFTER_TYPE_CAST" value="false"/> - <option name="SPACE_BEFORE_ARRAY_INITIALIZER_LBRACE" value="true"/> - <option name="METHOD_PARAMETERS_WRAP" value="1"/> - <option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true"/> - <option name="LABELED_STATEMENT_WRAP" value="1"/> - <option name="METHOD_ANNOTATION_WRAP" value="1"/> - <option name="CLASS_ANNOTATION_WRAP" value="1"/> - <option name="FIELD_ANNOTATION_WRAP" value="1"/> - <option name="PARENT_SETTINGS_INSTALLED" value="true"/> - <indentOptions> - <option name="CONTINUATION_INDENT_SIZE" value="4"/> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="JSON"> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/> - <option name="PARENT_SETTINGS_INSTALLED" value="true"/> - </codeStyleSettings> - <codeStyleSettings language="Scala"> - <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1"/> - <option name="KEEP_BLANK_LINES_IN_CODE" value="1"/> - <option name="KEEP_BLANK_LINES_BEFORE_RBRACE" value="1"/> - <option name="ELSE_ON_NEW_LINE" value="true"/> - <option name="WHILE_ON_NEW_LINE" value="true"/> - <option name="CATCH_ON_NEW_LINE" value="true"/> - <option name="FINALLY_ON_NEW_LINE" value="true"/> - <option name="ALIGN_MULTILINE_PARAMETERS" value="false"/> - <option name="ALIGN_MULTILINE_FOR" value="false"/> - <option name="METHOD_PARAMETERS_WRAP" value="1"/> - <option name="METHOD_ANNOTATION_WRAP" value="1"/> - <option name="CLASS_ANNOTATION_WRAP" value="1"/> - <option name="FIELD_ANNOTATION_WRAP" value="1"/> - <option name="PARENT_SETTINGS_INSTALLED" value="true"/> - <indentOptions> - <option name="INDENT_SIZE" value="4"/> - <option name="CONTINUATION_INDENT_SIZE" value="4"/> - <option name="TAB_SIZE" value="4"/> - </indentOptions> - </codeStyleSettings> - <codeStyleSettings language="XML"> - <indentOptions> - <option name="CONTINUATION_INDENT_SIZE" value="4"/> - </indentOptions> - </codeStyleSettings> -</code_scheme> \ No newline at end of file