ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/catalina/tribes/group/TestGroupChannelStartStop.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/catalina/tribes/group/TestGroupChannelStartStop.java
Status
scanned
Type
file
Name
TestGroupChannelStartStop.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
4880 (4.8 KB)
MD5
c01580247a9fd8c2a824e01d85b94260
SHA1
eed263deefe9a07d3f1cf9d3e4bc084a696d1053
SHA256
2af87c97b4f63cd5bf1c29b243fccfff1134bbe0a095d8c81aef2a1c76bc490e
SHA512

      
    
SHA1_git
cdc47b6156434429801f0ad065d2dc889ab16b6e
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestGroupChannelStartStop.java | 4.8 KB |

/* * 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.catalina.tribes.group; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.apache.catalina.tribes.Channel; import org.apache.catalina.tribes.transport.ReceiverBase; public class TestGroupChannelStartStop { private GroupChannel channel = null; private int udpPort = 45543; @Before public void setUp() throws Exception { channel = new GroupChannel(); ((ReceiverBase) channel.getChannelReceiver()).setHost("localhost"); } @After public void tearDown() throws Exception { try { channel.stop(Channel.DEFAULT); } catch (Exception ignore) { // Ignore } } @Test public void testDoubleFullStart() throws Exception { int count = 0; try { channel.start(Channel.DEFAULT); count++; } catch ( Exception x){x.printStackTrace();} try { channel.start(Channel.DEFAULT); count++; } catch ( Exception x){x.printStackTrace();} Assert.assertEquals(count,2); channel.stop(Channel.DEFAULT); } @Test public void testScrap() throws Exception { System.out.println(channel.getChannelReceiver().getClass()); ((ReceiverBase)channel.getChannelReceiver()).setMaxThreads(1); } @Test public void testDoublePartialStart() throws Exception { //try to double start the RX int count = 0; try { channel.start(Channel.SND_RX_SEQ); channel.start(Channel.MBR_RX_SEQ); count++; } catch ( Exception x){x.printStackTrace();} try { channel.start(Channel.MBR_RX_SEQ); count++; } catch ( Exception x){ // expected } Assert.assertEquals(count,1); channel.stop(Channel.DEFAULT); //double the membership sender count = 0; try { channel.start(Channel.SND_RX_SEQ); channel.start(Channel.MBR_TX_SEQ); count++; } catch ( Exception x){x.printStackTrace();} try { channel.start(Channel.MBR_TX_SEQ); count++; } catch ( Exception x){ // expected } Assert.assertEquals(count,1); channel.stop(Channel.DEFAULT); count = 0; try { channel.start(Channel.SND_RX_SEQ); count++; } catch ( Exception x){x.printStackTrace();} try { channel.start(Channel.SND_RX_SEQ); count++; } catch ( Exception x){ // expected } Assert.assertEquals(count,1); channel.stop(Channel.DEFAULT); count = 0; try { channel.start(Channel.SND_TX_SEQ); count++; } catch ( Exception x){x.printStackTrace();} try { channel.start(Channel.SND_TX_SEQ); count++; } catch ( Exception x){ // expected } Assert.assertEquals(count,1); channel.stop(Channel.DEFAULT); } @Test public void testFalseOption() throws Exception { int flag = 0xFFF0;//should get ignored by the underlying components int count = 0; try { channel.start(flag); count++; } catch ( Exception x){x.printStackTrace();} try { channel.start(flag); count++; } catch ( Exception x){ // expected } Assert.assertEquals(count,2); channel.stop(Channel.DEFAULT); } @Test public void testUdpReceiverStart() throws Exception { ReceiverBase rb = (ReceiverBase)channel.getChannelReceiver(); rb.setUdpPort(udpPort); channel.start(Channel.DEFAULT); Thread.sleep(1000); channel.stop(Channel.DEFAULT); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
24.34
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9