ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/tomcat/util/file/TestConfigFileLoader.java

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

      
    
Rootfs path

      
    
Size
2388 (2.3 KB)
MD5
bea2e3d27cf65dce707620532d525df7
SHA1
4f06d1134f7bad31cbf41d6ae07fa6a462f15e36
SHA256
1c6bff5c796587f3c2d9d022284a085c334fd1af1bb14ef5d2e28ce626e52d9f
SHA512

      
    
SHA1_git
2aff43cd1cc999029fae67120cf9ec49e7bb38d7
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestConfigFileLoader.java | 2.3 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.tomcat.util.file; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; import org.apache.catalina.Globals; import org.apache.catalina.startup.CatalinaBaseConfigurationSource; import org.apache.catalina.webresources.TomcatURLStreamHandlerFactory; public class TestConfigFileLoader { @BeforeClass public static void setup() { TomcatURLStreamHandlerFactory.getInstance(); System.setProperty(Globals.CATALINA_BASE_PROP, ""); ConfigFileLoader.setSource(new CatalinaBaseConfigurationSource(new File(System.getProperty(Globals.CATALINA_BASE_PROP)), null)); } @Test public void test01() throws IOException { doTest("classpath:org/apache/catalina/mbeans-descriptors.xml"); } @Test(expected=FileNotFoundException.class) public void test02() throws IOException { doTest("classpath:org/apache/catalina/foo"); } @Test public void test03() throws IOException { doTest("test/webresources/dir1"); } @Test(expected=FileNotFoundException.class) public void test04() throws IOException { doTest("test/webresources/unknown"); } private void doTest(String path) throws IOException { try (InputStream is = ConfigFileLoader.getSource().getResource(path).getInputStream()) { Assert.assertNotNull(is); } } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
44.74
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