-
Notifications
You must be signed in to change notification settings - Fork 2
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
3 changed files
with
53 additions
and
10 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
32 changes: 32 additions & 0 deletions
32
willow-utils/src/test/java/com/nitorcreations/willow/utils/TestObfuscatorTool.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 com.nitorcreations.willow.utils; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.File; | ||
import java.io.PrintStream; | ||
|
||
import org.junit.Test; | ||
|
||
public class TestObfuscatorTool { | ||
@Test | ||
public void testTool() throws Exception { | ||
ObfuscatorTool.main(new String[] {"target/test-classes/root.properties"}); | ||
File enc = new File("target/test-classes/root.properties.encrypted"); | ||
File key = new File("target/test-classes/root.properties.key"); | ||
assertTrue(enc.exists()); | ||
assertTrue(key.exists()); | ||
System.setProperty("decrypt", ""); | ||
ByteArrayOutputStream output = new ByteArrayOutputStream(); | ||
PrintStream oldOut = System.out; | ||
System.setOut(new PrintStream(output)); | ||
ObfuscatorTool.main(new String[] {"target/test-classes/root.properties.encrypted", "target/test-classes/root.properties.key" }); | ||
System.setOut(oldOut); | ||
byte[] outputData = output.toByteArray(); | ||
ByteArrayInputStream in = new ByteArrayInputStream(outputData); | ||
MergeableProperties props = new MergeableProperties(); | ||
props.load(in); | ||
assertEquals("foo/bar", props.getProperty("included.file[1].extraprops")); | ||
} | ||
} |
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