ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/catalina/ant/TestDeployTask.java

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

      
    
Rootfs path

      
    
Size
4767 (4.7 KB)
MD5
fd41b0478101a9f510f5f97cbd4cc9f4
SHA1
25eb01dca1bbe35fc5920e279e36f12fa835d233
SHA256
c12e142890308d3372f7809c15efa058f66d9c5ee77b3cc24977b365e2243d76
SHA512

      
    
SHA1_git
d87b2d140532a00c7366e423fe85aa74693d457b
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestDeployTask.java | 4.7 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.ant; import java.io.File; import java.io.IOException; import java.io.InputStream; import org.junit.Assert; import org.junit.Test; import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; import org.apache.tools.ant.BuildException; public class TestDeployTask extends TomcatBaseTest { @Test public void bug58086a() { DeployTask deployTask = new DeployTask() { @Override public void execute(String command, InputStream istream, String contentType, long contentLength) throws BuildException { Assert.assertEquals("/deploy?path=somepath", command); Assert.assertEquals("application/octet-stream", contentType); try { istream.close(); } catch (IOException ignore) { // Ignore } } }; setDefaults(deployTask); testExecute(deployTask, "file:./test/deployment/context.war"); testExecute(deployTask, new File("test/deployment/context.war").toURI().toString()); testExecute(deployTask, new File("test/deployment/context.war").getAbsolutePath()); testExecute(deployTask, "jar:" + new File("test/deployment/context.jar").toURI().toString() + "!/context.war"); testExecute(deployTask, new File("test/deployment/dir with spaces/context.war").toURI().toString()); testExecute(deployTask, new File("test/deployment/dir with spaces/context.war").getAbsolutePath()); testExecute(deployTask, "jar:" + new File("test/deployment/dir with spaces/context.jar").toURI().toString() + "!/context.war"); testExecute(deployTask, "file:./test/deployment/dir%20with%20spaces/context.war"); } @Test(expected = BuildException.class) public void bug58086b() { DeployTask deployTask = new DeployTask(); setDefaults(deployTask); testExecute(deployTask, "scheme:./test/deployment/context.war"); } @Test(expected = BuildException.class) public void bug58086c() { DeployTask deployTask = new DeployTask(); setDefaults(deployTask); testExecute(deployTask, "sc:./test/deployment/context.war"); } @Test(expected = BuildException.class) public void bug58086d() { DeployTask deployTask = new DeployTask(); setDefaults(deployTask); testExecute(deployTask, "file:./test/deployment/dir with spaces/context.war"); } @Test public void bug58086e() throws Exception { Tomcat tomcat = getTomcatInstance(); File root = new File("test/deployment"); tomcat.addWebapp("", root.getAbsolutePath()); tomcat.start(); DeployTask deployTask = new DeployTask() { @Override public void execute(String command, InputStream istream, String contentType, long contentLength) throws BuildException { Assert.assertEquals("/deploy?path=somepath", command); Assert.assertEquals("application/octet-stream", contentType); try { istream.close(); } catch (IOException ignore) { // Ignore } } }; setDefaults(deployTask); testExecute(deployTask, "http://localhost:" + getPort() + "/context.war"); } private void setDefaults(DeployTask deployTask) { deployTask.setUrl("someurl"); deployTask.setUsername("someuser"); deployTask.setPassword("somepassword"); deployTask.setPath("somepath"); } private void testExecute(DeployTask deployTask, String war) { deployTask.setWar(war); deployTask.execute(); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
26.15
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