Skip to content

Commit 3a38fee

Browse files
tommysdkbstansberry
authored andcommitted
[WFLY-2783] Bundle path not mandatory for embedded container
1 parent c1bbf0a commit 3a38fee

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

arquillian/container-embedded/src/main/java/org/jboss/as/arquillian/container/embedded/EmbeddedContainerConfiguration.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ public EmbeddedContainerConfiguration() {
4747
if ((modulePath == null || modulePath.isEmpty()) && jbossHome != null) {
4848
modulePath = jbossHome + "/modules";
4949
}
50-
51-
if ((bundlePath == null || bundlePath.isEmpty()) && jbossHome != null) {
52-
bundlePath = jbossHome + "/bundles";
53-
}
5450
}
5551

5652
/**
@@ -101,6 +97,8 @@ public void validate() throws ConfigurationException {
10197
super.validate();
10298
Validate.configurationDirectoryExists(jbossHome, "jbossHome '" + jbossHome + "' must exist");
10399
Validate.configurationDirectoryExists(modulePath, "modulePath '" + modulePath + "' must exist");
104-
Validate.configurationDirectoryExists(bundlePath, "bundlePath '" + bundlePath + "' must exist");
100+
if (bundlePath != null) {
101+
Validate.configurationDirectoryExists(bundlePath, "bundlePath '" + bundlePath + "' must exist");
102+
}
105103
}
106104
}

arquillian/container-embedded/src/test/java/org/jboss/as/arquillian/container/embedded/EmbeddedContainerConfigurationTestCase.java

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,27 @@ public void shouldValidateThatModulePathIsNonExisting() {
4141
validate(conf);
4242
}
4343

44-
@Test(expected = ConfigurationException.class)
45-
public void shouldValidateThatBundlePathIsNonExisting() {
44+
@Test
45+
public void shouldNotValidateBundlePathIfNonExisting() {
46+
final EmbeddedContainerConfiguration conf = new EmbeddedContainerConfiguration();
47+
conf.setBundlePath(null);
48+
validate(conf);
49+
}
50+
51+
@Test
52+
public void shouldValidateBundlePathIfExisting() {
4653
final EmbeddedContainerConfiguration conf = new EmbeddedContainerConfiguration();
47-
conf.setBundlePath("");
54+
conf.setBundlePath("/");
4855
validate(conf);
4956
}
5057

58+
@Test(expected = ConfigurationException.class)
59+
public void shouldValidateThatJbossHomePathIsNonExisting() {
60+
final EmbeddedContainerConfiguration conf = new EmbeddedContainerConfiguration();
61+
conf.setJbossHome(null);
62+
conf.validate();
63+
}
64+
5165
@Test
5266
public void shouldValidateThatModulePathAndBundlePathExists() {
5367
final EmbeddedContainerConfiguration conf = new EmbeddedContainerConfiguration();
@@ -59,13 +73,15 @@ public void shouldValidateThatModulePathAndBundlePathExists() {
5973
private void validate(final EmbeddedContainerConfiguration conf) {
6074
assertNotNull(conf.getJbossHome());
6175
assertNotNull(conf.getModulePath());
62-
assertNotNull(conf.getBundlePath());
6376
conf.validate();
6477
}
6578

6679
private static void createDir(final String path) {
67-
File dir = new File(path);
68-
if (!dir.exists())
69-
assertTrue("Failed to create directory", dir.mkdirs());
80+
if (path != null) {
81+
File dir = new File(path);
82+
if (!dir.exists()) {
83+
assertTrue("Failed to create directory", dir.mkdirs());
84+
}
85+
}
7086
}
7187
}

0 commit comments

Comments
 (0)