1 package org.apache.maven.archiva.webdav;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import com.meterware.httpunit.PutMethodWebRequest;
23 import com.meterware.httpunit.WebRequest;
24 import com.meterware.httpunit.WebResponse;
26 import java.io.InputStream;
28 import javax.servlet.http.HttpServletResponse;
32 * Deploy / Put Test cases for RepositoryServlet.
34 * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
37 public class RepositoryServletDeployTest
38 extends AbstractRepositoryServletTestCase
40 public void testPutWithMissingParentCollection()
43 setupCleanRepo( repoRootInternal );
45 String putUrl = "http://machine.com/repository/internal/path/to/artifact.jar";
46 InputStream is = getClass().getResourceAsStream( "/artifact.jar" );
47 assertNotNull( "artifact.jar inputstream", is );
49 WebRequest request = new PutMethodWebRequest( putUrl, is, "application/octet-stream" );
51 WebResponse response = sc.getResponse( request );
52 assertResponseCreated( response );
53 assertFileContents( "artifact.jar\n", repoRootInternal, "path/to/artifact.jar" );
56 protected void assertResponseCreated( WebResponse response )
58 assertNotNull( "Should have recieved a response", response );
59 assertEquals( "Should have been a 201/CREATED response code.", HttpServletResponse.SC_CREATED, response