Skip to content

Commit 284321b

Browse files
make review changes and add missing unit test files
1 parent 41f8a13 commit 284321b

File tree

8 files changed

+89
-7
lines changed

8 files changed

+89
-7
lines changed

core/src/test/java/oracle/weblogic/deploy/util/WLSDeployArchiveTest.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ public class WLSDeployArchiveTest {
2222
private static final String APPS_ARCHIVE_FILE_NAME = "target/unit-tests/appsArchive.zip";
2323
private static final String APP1_TO_ADD = "src/test/resources/my-app.war";
2424
private static final String APP2_TO_ADD = "src/test/resources/my-other-app.war";
25-
private static final String APP_DIR_TO_ADD = "src/test/resources/my-app/";
2625
private static final String APP1_ENTRY_NAME1 = "wlsdeploy/applications/my-app.war";
2726
private static final String APP1_ENTRY_NAME2 = "wlsdeploy/applications/my-app(1).war";
2827
private static final String APP1_ENTRY_NAME3 = "wlsdeploy/applications/my-app(2).war";
2928
private static final String APP1_ENTRY_NAME4 = "wlsdeploy/applications/my-app(3).war";
3029
private static final String APP2_ENTRY_NAME1 = "wlsdeploy/applications/my-other-app.war";
3130
private static final String APP2_ENTRY_NAME2 = "wlsdeploy/applications/my-other-app(1).war";
3231
private static final String APP2_ENTRY_NAME3 = "wlsdeploy/applications/my-other-app(2).war";
33-
private static final String INVALID_ENTRY_NAME = "wlsdeploy/applications/does-not-exist.war";
32+
private static final String APP_DIR_TO_ADD = "src/test/resources/my-app/";
3433
private static final String APP_DIR_ENTRY_NAME = "wlsdeploy/applications/my-app/";
34+
private static final String INVALID_APP_ENTRY_NAME = "wlsdeploy/applications/does-not-exist.war";
3535

3636
private static final String ZIP_FILE_EXISTING_EMPTY_FILE = "my-empty-zip.zip";
3737
private static final String ZIP_FILE_EXISTING_BINARIES_FILE = "DiscoveredDemoDomain.zip";
@@ -103,17 +103,23 @@ public void testAddDirectory() throws Exception {
103103
public void testIsAFile() throws Exception {
104104
WLSDeployArchive archive = new WLSDeployArchive(APPS_ARCHIVE_FILE_NAME);
105105
archive.addApplication(new File(APP1_TO_ADD));
106-
archive.addApplication(new File(APP_DIR_TO_ADD));
107106
Assert.assertTrue("File not found in archive: " + APP1_ENTRY_NAME1, archive.containsFile(APP1_ENTRY_NAME1));
108-
//Assert.assertTrue("Path not found in archive: " + APP_DIR_ENTRY_NAME, archive.containsPath(APP_DIR_ENTRY_NAME));
109107
Assert.assertTrue("File not found in archive: " + APP1_ENTRY_NAME1, archive.containsFileOrPath(APP1_ENTRY_NAME1));
110-
Assert.assertTrue("Path not found in archive: " + APP_DIR_ENTRY_NAME, archive.containsFileOrPath(APP_DIR_ENTRY_NAME));
111108
Assert.assertFalse("Is not a File", archive.containsFile(APP_DIR_ENTRY_NAME));
112-
Assert.assertFalse("Is not a Path", archive.containsPath(APP1_ENTRY_NAME1));
113-
Assert.assertFalse("File should not exist", archive.containsFileOrPath(INVALID_ENTRY_NAME));
109+
Assert.assertFalse("File should not exist", archive.containsFileOrPath(INVALID_APP_ENTRY_NAME));
114110
archive.close();
115111
}
116112

113+
@Test
114+
public void testIsAPath() throws Exception {
115+
WLSDeployArchive archive = new WLSDeployArchive(APPS_ARCHIVE_FILE_NAME);
116+
archive.addApplication(new File(APP_DIR_TO_ADD));
117+
Assert.assertTrue("Path not found in archive: " + APP_DIR_ENTRY_NAME, archive.containsPath(APP_DIR_ENTRY_NAME));
118+
Assert.assertTrue("Path not found in archive: " + APP_DIR_ENTRY_NAME,
119+
archive.containsFileOrPath(APP_DIR_ENTRY_NAME));
120+
Assert.assertFalse("Is not a Path", archive.containsPath(APP1_ENTRY_NAME1));
121+
}
122+
117123
@Test
118124
public void testClearAllBinariesWithEmptyZip() throws Exception {
119125
WLSDeployZipFileTest.copyFile(ZIP_FILE_EXISTING_BINARIES_FILE);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Manifest-Version: 1.0
2+
Archiver-Version: Plexus Archiver
3+
Built-By: RPATRICK
4+
Created-By: Apache Maven 3.3.3
5+
Build-Jdk: 1.8.0_60
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#Generated by Apache Maven
2+
#Thu Nov 19 18:16:35 CST 2015
3+
version=0.2-SNAPSHOT
4+
groupId=oracle.jcs.lifecycle
5+
artifactId=get-listen-address-app
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<artifactId>get-listen-address-app</artifactId>
5+
<packaging>war</packaging>
6+
7+
<parent>
8+
<groupId>oracle.jcs.lifecycle</groupId>
9+
<artifactId>las-system-test-apps</artifactId>
10+
<version>0.2-SNAPSHOT</version>
11+
<relativePath>../pom.xml</relativePath>
12+
</parent>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>javaee</groupId>
17+
<artifactId>javaee-api</artifactId>
18+
<version>5</version>
19+
<scope>provided</scope>
20+
</dependency>
21+
</dependencies>
22+
23+
<build>
24+
<plugins>
25+
<plugin>
26+
<groupId>org.apache.maven.plugins</groupId>
27+
<artifactId>maven-war-plugin</artifactId>
28+
<configuration>
29+
<webXml>${basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
30+
</configuration>
31+
</plugin>
32+
</plugins>
33+
</build>
34+
</project>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<web-app
3+
xmlns="http://java.sun.com/xml/ns/j2ee"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
version="2.5">
6+
<servlet>
7+
<servlet-name>Get Listen Address Servlet</servlet-name>
8+
<servlet-class>com.oracle.platform.GetListenAddressServlet</servlet-class>
9+
<run-as>
10+
<role-name>server-admin</role-name>
11+
</run-as>
12+
</servlet>
13+
<servlet-mapping>
14+
<servlet-name>Get Listen Address Servlet</servlet-name>
15+
<url-pattern>/listen</url-pattern>
16+
</servlet-mapping>
17+
<welcome-file-list>
18+
<welcome-file>/listen</welcome-file>
19+
</welcome-file-list>
20+
<security-role>
21+
<role-name>server-admin</role-name>
22+
</security-role>
23+
</web-app>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="ISO-8859-1"?>
2+
3+
<weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90">
4+
<run-as-role-assignment>
5+
<role-name>server-admin</role-name>
6+
<run-as-principal-name>weblogic</run-as-principal-name>
7+
</run-as-role-assignment>
8+
</weblogic-web-app>

0 commit comments

Comments
 (0)