-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
118 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/test/java/io/openliberty/tools/common/plugins/config/BaseConfigXmlTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.openliberty.tools.common.plugins.config; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.rules.TemporaryFolder; | ||
|
||
public class BaseConfigXmlTest { | ||
|
||
public static final String RESOURCES_DIR = "src/test/resources"; | ||
|
||
private static final String RESOURCES_INSTALL_DIR = RESOURCES_DIR + "/serverConfig"; | ||
|
||
protected File serverConfigDir = new File(RESOURCES_INSTALL_DIR); | ||
public File buildDir; | ||
|
||
@Rule | ||
public TemporaryFolder temp = new TemporaryFolder(); | ||
|
||
@Before | ||
public void setupInstallDir() throws IOException { | ||
serverConfigDir = temp.newFolder(); | ||
File src = new File(RESOURCES_INSTALL_DIR); | ||
FileUtils.copyDirectory(src, serverConfigDir); | ||
|
||
buildDir = temp.newFolder(); | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/test/java/io/openliberty/tools/common/plugins/config/ServerConfigXmlTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.openliberty.tools.common.plugins.config; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.io.File; | ||
import java.nio.file.Files; | ||
|
||
import org.junit.Test; | ||
|
||
public class ServerConfigXmlTest extends BaseConfigXmlTest { | ||
|
||
@Test | ||
public void createAppMonitorConfigTest() throws Exception { | ||
File serverDirectory = new File(serverConfigDir, "liberty/wlp/usr/servers/defaultServer"); | ||
|
||
ApplicationMonitorConfigXmlDocument appMonXml = new ApplicationMonitorConfigXmlDocument("test"); | ||
appMonXml.writeAppMonitorConfigXmlDocument(serverDirectory); | ||
|
||
File newFile = appMonXml.getAppMonitorConfigXmlFile(serverDirectory); | ||
String content = Files.readString(newFile.toPath()); | ||
assertTrue(content.contains("Generated by liberty-test-plugin")); | ||
assertTrue(content.contains("<applicationMonitor updateTrigger=\"${io.openliberty.tools.update.trigger}\"/>")); | ||
} | ||
} |