forked from playframework/play1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1719] fix moduleOrder to handle Dynamic revisions and "id" options …
…or with/without version number [#1719] Fix Configuration by adding jpa. and hibernate configuration * update ivy to version 2.3.0 [#1719] fix retrieving list of modules (filter lib, modules) [#1719] Add tests for retrieving modules
- Loading branch information
Showing
10 changed files
with
190 additions
and
33 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
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
package play.deps; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.text.ParseException; | ||
import java.util.List; | ||
|
||
import org.apache.commons.io.FileUtils; | ||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import play.Play; | ||
import play.PlayBuilder; | ||
|
||
public class YamlParserTest { | ||
|
||
@BeforeClass | ||
public static void setUp(){ | ||
// Play | ||
new PlayBuilder().build(); | ||
System.setProperty("play.version", Play.version); | ||
|
||
// We will create a "tmp/modules" directory to simulate the play dependencies | ||
File moduleDir = new File(Play.applicationPath, "modules"); | ||
moduleDir.mkdirs(); | ||
|
||
String[] moduleNames = {"crud", "deadbolt-1.5.4", "pdf-1.5"}; | ||
try { | ||
for (String module : moduleNames) { | ||
File moduleFile = new File(moduleDir, module); | ||
moduleFile.createNewFile(); | ||
} | ||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
@AfterClass | ||
public static void cleanUp(){ | ||
File moduleDir = new File(Play.applicationPath, "modules"); | ||
try { | ||
FileUtils.deleteDirectory(moduleDir); | ||
} catch (IOException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
|
||
@Test(expected = FileNotFoundException.class) | ||
public void fileNotFoundTest() throws Exception { | ||
List<String> modules = null; | ||
try { | ||
modules = YamlParser.getOrderedModuleList(new File(Play.applicationPath, "fakeFile.yml")); | ||
} catch (Exception e) { | ||
assertTrue(e.getMessage().startsWith("There was a problem to find the file")); | ||
throw e; | ||
} | ||
} | ||
|
||
|
||
@Test | ||
public void retrieveModulesTest() { | ||
List<String> modules = null; | ||
try { | ||
modules = YamlParser.getOrderedModuleList(new File(getClass().getResource("/play/deps/dependencies_test1.yml").toURI())); | ||
} catch (Exception e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
assertNotNull(modules); | ||
assertEquals("crud", modules.get(0)); | ||
assertEquals("deadbolt-1.5.4", modules.get(1)); | ||
assertEquals("pdf-1.5", modules.get(2)); | ||
} | ||
|
||
@Test | ||
public void retrieveModulesTest2() { | ||
List<String> modules = null; | ||
try { | ||
modules = YamlParser.getOrderedModuleList(new File(getClass().getResource("/play/deps/dependencies_test2.yml").toURI())); | ||
} catch (Exception e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
assertNotNull(modules); | ||
assertEquals("pdf-1.5", modules.get(0)); | ||
assertEquals("deadbolt-1.5.4", modules.get(1)); | ||
assertEquals("crud", modules.get(2)); | ||
} | ||
|
||
|
||
} |
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,12 @@ | ||
# Application dependencies | ||
|
||
require: | ||
- play | ||
- crud | ||
- play -> deadbolt 1.5.4 | ||
- play -> cobertura 2.4: | ||
id: test | ||
- play -> pdf [0.9,) | ||
- commons-lang -> commons-lang 2.5 | ||
- commons-codec 1.7 | ||
- net.sf.json-lib -> json-lib 2.4 jdk15 |
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,12 @@ | ||
# Application dependencies | ||
|
||
require: | ||
- play | ||
- play -> pdf [0.9,) | ||
- play -> deadbolt 1.5.4 | ||
- play -> cobertura 2.4: | ||
id: test | ||
- commons-lang -> commons-lang 2.5 | ||
- commons-codec 1.7 | ||
- net.sf.json-lib -> json-lib 2.4 jdk15 | ||
- crud |