You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2016/03/19 19:42:01 UTC
svn commit: r1735795 - in /axis/axis2/java/core/trunk: ./ modules/kernel/
modules/kernel/src/org/apache/axis2/deployment/repository/util/
modules/kernel/test/org/apache/axis2/deployment/repository/
modules/kernel/test/org/apache/axis2/deployment/reposi...
Author: veithen
Date: Sat Mar 19 18:42:01 2016
New Revision: 1735795
URL: http://svn.apache.org/viewvc?rev=1735795&view=rev
Log:
AXIS2-5747: Fix DeploymentFileData#getName() so that it returns a consistent value for instances created from URLs. This should fix an issue introduced by AXIS2-5314.
Added:
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/deployment/repository/
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/deployment/repository/util/
axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/deployment/repository/util/DeploymentFileDataTest.java (with props)
Modified:
axis/axis2/java/core/trunk/modules/kernel/pom.xml
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
axis/axis2/java/core/trunk/pom.xml
Modified: axis/axis2/java/core/trunk/modules/kernel/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/pom.xml?rev=1735795&r1=1735794&r2=1735795&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/kernel/pom.xml Sat Mar 19 18:42:01 2016
@@ -96,10 +96,20 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>com.google.truth</groupId>
+ <artifactId>truth</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<url>http://axis.apache.org/axis2/java/core/</url>
<scm>
Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java?rev=1735795&r1=1735794&r2=1735795&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/repository/util/DeploymentFileData.java Sat Mar 19 18:42:01 2016
@@ -82,7 +82,12 @@ public class DeploymentFileData {
* @return the name of the referenced file
*/
public String getName() {
- return file.getName(); // No need to check for null due to constructor check
+ if (file != null) {
+ return file.getName();
+ } else {
+ String path = url.getPath();
+ return path.substring(path.lastIndexOf('/') + 1);
+ }
}
Added: axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/deployment/repository/util/DeploymentFileDataTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/deployment/repository/util/DeploymentFileDataTest.java?rev=1735795&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/deployment/repository/util/DeploymentFileDataTest.java (added)
+++ axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/deployment/repository/util/DeploymentFileDataTest.java Sat Mar 19 18:42:01 2016
@@ -0,0 +1,44 @@
+/*
+ * 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.axis2.deployment.repository.util;
+
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.mock;
+
+import java.io.File;
+import java.net.URL;
+
+import org.apache.axis2.deployment.Deployer;
+import org.junit.Test;
+
+public class DeploymentFileDataTest {
+ @Test
+ public void testGetNameWithFile() {
+ DeploymentFileData dfd = new DeploymentFileData(new File("somedir", "myservice.aar"));
+ assertThat(dfd.getName()).isEqualTo("myservice.aar");
+ }
+
+ @Test
+ public void testGetNameWithURL() throws Exception {
+ DeploymentFileData dfd = new DeploymentFileData(
+ new URL("http://myserver.local/myservice.aar"), mock(Deployer.class),
+ DeploymentFileData.class.getClassLoader());
+ assertThat(dfd.getName()).isEqualTo("myservice.aar");
+ }
+}
Propchange: axis/axis2/java/core/trunk/modules/kernel/test/org/apache/axis2/deployment/repository/util/DeploymentFileDataTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis2/java/core/trunk/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/pom.xml?rev=1735795&r1=1735794&r2=1735795&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/pom.xml (original)
+++ axis/axis2/java/core/trunk/pom.xml Sat Mar 19 18:42:01 2016
@@ -727,6 +727,11 @@
<version>${axiom.version}</version>
</dependency>
<dependency>
+ <groupId>com.google.truth</groupId>
+ <artifactId>truth</artifactId>
+ <version>0.28</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.ws.commons.axiom</groupId>
<artifactId>xml-truth</artifactId>
<version>${axiom.version}</version>
@@ -737,6 +742,11 @@
<version>${axiom.version}</version>
</dependency>
<dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.10.19</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.ws.xmlschema</groupId>
<artifactId>xmlschema-core</artifactId>
<version>${xmlschema.version}</version>