ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/jakarta/el/TestExpressionFactoryCache.java

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

      
    
Rootfs path

      
    
Size
2350 (2.3 KB)
MD5
6a42c131e9283be15e1aa62dbc1439a2
SHA1
ae199dac132c9fc2ff76ff3be55cd94195f5cac0
SHA256
ecee098eb556e42d35b3b41c1fa60e182432c2d93ed0be8a4580aa37ce35475e
SHA512

      
    
SHA1_git
636ba1c1bec41fab1dd9546a0b28f37ccd9ed7b0
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestExpressionFactoryCache.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 jakarta.el; import java.util.Arrays; import java.util.HashSet; import java.util.Set; import org.junit.Assert; import org.junit.Test; public class TestExpressionFactoryCache { private static class TestClassLoader extends ClassLoader { } @Test public void testCacheWithOneClassLoader() { ExpressionFactory factory; ClassLoader cl = new TestClassLoader(); ExpressionFactoryCache cache = new ExpressionFactoryCache(); factory = cache.getOrCreateExpressionFactory(cl); Assert.assertEquals(factory, cache.getOrCreateExpressionFactory(cl)); } @Test public void testCacheWithInserts() { final int numClassLoaders = 15; ClassLoader[] loaders = new ClassLoader[numClassLoaders]; ExpressionFactory[] factories = new ExpressionFactory[numClassLoaders]; ExpressionFactoryCache cache = new ExpressionFactoryCache(); for (int i = 0; i < numClassLoaders; i++) { loaders[i] = new TestClassLoader(); factories[i] = cache.getOrCreateExpressionFactory(loaders[i]); // make a second call, ensure the same instance comes back Assert.assertEquals(factories[i], cache.getOrCreateExpressionFactory(loaders[i])); } // use a Set<> to verify each factory is unique Set<ExpressionFactory> factorySet = new HashSet<>(Arrays.asList(factories)); Assert.assertEquals(numClassLoaders, factorySet.size()); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
47.6
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