-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue #7 and add new integration test for FSM
- Loading branch information
1 parent
d37e4f3
commit df7b3df
Showing
7 changed files
with
82 additions
and
17 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
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
64 changes: 64 additions & 0 deletions
64
fsm/src/test/java/de/marza/firstspirit/modules/logging/fsm/FsmIT.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,64 @@ | ||
package de.marza.firstspirit.modules.logging.fsm; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.apache.commons.io.filefilter.WildcardFileFilter; | ||
import org.junit.BeforeClass; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ErrorCollector; | ||
|
||
import java.io.File; | ||
import java.io.InputStream; | ||
import java.util.Collection; | ||
import java.util.Properties; | ||
import java.util.zip.ZipEntry; | ||
import java.util.zip.ZipFile; | ||
|
||
import static org.hamcrest.Matchers.is; | ||
import static org.hamcrest.Matchers.notNullValue; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
|
||
public class FsmIT { | ||
|
||
private static final String MODULE_DESCRIPTOR = "META-INF/module.xml"; | ||
private static Properties pomProperties; | ||
|
||
@Rule | ||
public ErrorCollector errors = new ErrorCollector(); | ||
|
||
@BeforeClass | ||
public static void setUpBefore() throws Exception { | ||
pomProperties = new Properties(); | ||
final ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader(); | ||
final InputStream inputStream = systemClassLoader.getResourceAsStream("moduleTest.properties"); | ||
pomProperties.load(inputStream); | ||
} | ||
|
||
/** | ||
* Check if FSM is valid | ||
*/ | ||
@Test | ||
public void testisFSMValid() throws Exception { | ||
final File directory = new File("target"); | ||
final Collection<File> files = FileUtils.listFiles(directory, new WildcardFileFilter("*.fsm"), null); | ||
assertTrue("FSM doesn't contain any files", files.iterator().hasNext()); | ||
if (files.iterator().hasNext()) { | ||
final ZipFile _fsmZip = new ZipFile(files.iterator().next()); | ||
final ZipEntry license = _fsmZip.getEntry("LICENSE"); | ||
errors.checkThat("Couldn't find module descriptor (module.xml) in fsm file", license, | ||
is(notNullValue())); | ||
final ZipEntry moduleXML = _fsmZip.getEntry(MODULE_DESCRIPTOR); | ||
errors.checkThat("Couldn't find module descriptor (module.xml) in fsm file", moduleXML, | ||
is(notNullValue())); | ||
final ZipEntry consoleLib = _fsmZip.getEntry("lib/console-" | ||
+ pomProperties.getProperty("version") + ".jar"); | ||
errors.checkThat("Couldn't find lib in fsm file", consoleLib, is(notNullValue())); | ||
final ZipEntry toolbarLib = _fsmZip.getEntry("lib/toolbar-" | ||
+ pomProperties.getProperty("version") + ".jar"); | ||
errors.checkThat("Couldn't find lib in fsm file", toolbarLib, is(notNullValue())); | ||
} | ||
|
||
} | ||
|
||
} |
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