diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompOverWebsocketBinaryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompOverWebsocketBinaryTest.java deleted file mode 100644 index f0d37825a3..0000000000 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompOverWebsocketBinaryTest.java +++ /dev/null @@ -1,30 +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.activemq.artemis.tests.integration.stomp; - -import java.nio.charset.Charset; - -import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame; -import io.netty.handler.codec.http.websocketx.WebSocketFrame; -import io.netty.buffer.Unpooled; - -public class StompOverWebsocketBinaryTest extends AbstractStompOverWebsocketTest { - - protected WebSocketFrame createFrame(String msg) { - return new BinaryWebSocketFrame(Unpooled.copiedBuffer(msg, Charset.forName("UTF-8"))); - } -} diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/AbstractStompOverWebsocketTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompOverWebsocketTest.java similarity index 83% rename from tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/AbstractStompOverWebsocketTest.java rename to tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompOverWebsocketTest.java index ba760fb9c8..4d900babce 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/AbstractStompOverWebsocketTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompOverWebsocketTest.java @@ -18,8 +18,13 @@ package org.apache.activemq.artemis.tests.integration.stomp; import java.net.URI; import java.net.URISyntaxException; +import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; @@ -31,16 +36,33 @@ import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame; import io.netty.handler.codec.http.websocketx.CloseWebSocketFrame; import io.netty.handler.codec.http.websocketx.PongWebSocketFrame; +import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker; import io.netty.handler.codec.http.websocketx.WebSocketClientHandshakerFactory; import io.netty.handler.codec.http.websocketx.WebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketVersion; import io.netty.handler.codec.string.StringDecoder; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; -public abstract class AbstractStompOverWebsocketTest extends StompTest { +@RunWith(Parameterized.class) +public class StompOverWebsocketTest extends StompTest { private ChannelPromise handshakeFuture; + private final boolean useBinaryFrames; + + @Parameterized.Parameters(name = "useBinaryFrames={0}") + public static Collection data() { + List list = Arrays.asList(new Object[][]{{Boolean.TRUE}, {Boolean.FALSE}}); + return list; + } + + public StompOverWebsocketTest(Boolean useBinaryFrames) { + super(); + this.useBinaryFrames = useBinaryFrames; + } + @Override protected void addChannelHandlers(SocketChannel ch) throws URISyntaxException { ch.pipeline().addLast("http-codec", new HttpClientCodec()); @@ -123,5 +145,14 @@ public abstract class AbstractStompOverWebsocketTest extends StompTest { } } - abstract WebSocketFrame createFrame(String msg); + + protected WebSocketFrame createFrame(String msg) { + if (useBinaryFrames) { + return new BinaryWebSocketFrame(Unpooled.copiedBuffer(msg, Charset.forName("UTF-8"))); + } + else { + return new TextWebSocketFrame(msg); + } + } + } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompOverWebsocketTextTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompOverWebsocketTextTest.java deleted file mode 100644 index ac11d71542..0000000000 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompOverWebsocketTextTest.java +++ /dev/null @@ -1,27 +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.activemq.artemis.tests.integration.stomp; - -import io.netty.handler.codec.http.websocketx.TextWebSocketFrame; -import io.netty.handler.codec.http.websocketx.WebSocketFrame; - -public class StompOverWebsocketTextTest extends AbstractStompOverWebsocketTest { - - protected WebSocketFrame createFrame(String msg) { - return new TextWebSocketFrame(msg); - } -}