ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/catalina/util/TestNetMaskSet.java

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

      
    
Rootfs path

      
    
Size
2445 (2.4 KB)
MD5
1e41e1ce6d48286b7bf8ecfac7513aa7
SHA1
b2708dc30125ef431a4b19dd6ac40dd0086f8221
SHA256
d5d55f1c320e6dffb198ca51b74904c307266624b990537cd821ff07a5db6d1d
SHA512

      
    
SHA1_git
8e43f8892b482190ec356a96457880c5ec197f5a
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestNetMaskSet.java | 2.4 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.util; import java.net.UnknownHostException; import java.util.Arrays; import java.util.List; import org.junit.Assert; import org.junit.Test; public class TestNetMaskSet { @Test public void testNetMaskSet() throws UnknownHostException { NetMaskSet nms = new NetMaskSet(); nms.addAll("192.168.0.0/24, 192.168.1.0/27, 192.168.2.2, 10.0.0.0/8"); Assert.assertTrue(nms.contains("192.168.0.5")); Assert.assertTrue(nms.contains("192.168.0.255")); Assert.assertTrue(nms.contains("192.168.1.0")); Assert.assertTrue(nms.contains("192.168.1.1")); Assert.assertTrue(nms.contains("192.168.1.31")); Assert.assertFalse(nms.contains("192.168.1.32")); Assert.assertTrue(nms.contains("192.168.2.2")); Assert.assertFalse(nms.contains("192.168.2.1")); Assert.assertFalse(nms.contains("192.168.2.3")); Assert.assertTrue(nms.contains("10.10.10.10")); Assert.assertTrue(nms.contains("10.20.30.40")); Assert.assertFalse(nms.contains("9.10.10.10")); Assert.assertFalse(nms.contains("11.10.10.10")); String s = nms.toString(); Assert.assertTrue(s.indexOf('[') == -1); Assert.assertTrue(s.indexOf(']') == -1); List<String> list = Arrays.asList(s.split("\\s*,\\s*")); Assert.assertTrue(list.contains("192.168.0.0/24")); Assert.assertTrue(list.contains("192.168.1.0/27")); Assert.assertTrue(list.contains("192.168.2.2")); Assert.assertTrue(list.contains("10.0.0.0/8")); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
35.1
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