< prev index next >
jdk/test/tools/jmod/hashes/HashesTest.java
Print this page
*** 1,7 ****
/**
! * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/**
! * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 86,96 ****
jmod("m3");
// build m1
compileModule("m1", modSrc);
// no hash is recorded since m1 has outgoing edges
! jmod("m1", "--modulepath", jmods.toString(), "--hash-modules", ".*");
// compile org.bar and org.foo
compileModule("org.bar", modSrc);
compileModule("org.foo", modSrc);
--- 86,96 ----
jmod("m3");
// build m1
compileModule("m1", modSrc);
// no hash is recorded since m1 has outgoing edges
! jmod("m1", "--module-path", jmods.toString(), "--hash-modules", ".*");
// compile org.bar and org.foo
compileModule("org.bar", modSrc);
compileModule("org.foo", modSrc);
*** 107,138 ****
for (String mn : modules) {
assertFalse(hashes(mn).isPresent());
}
// hash m1 in m2
! jmod("m2", "--modulepath", jmods.toString(), "--hash-modules", "m1");
checkHashes(hashes("m2").get(), "m1");
// hash m1 in m2
! jmod("m2", "--modulepath", jmods.toString(), "--hash-modules", ".*");
checkHashes(hashes("m2").get(), "m1");
// create m2.jmod with no hash
jmod("m2");
// run jmod hash command to hash m1 in m2 and m3
! runJmod(Arrays.asList("hash", "--modulepath", jmods.toString(),
"--hash-modules", ".*"));
checkHashes(hashes("m2").get(), "m1");
checkHashes(hashes("m3").get(), "m1");
jmod("org.bar");
jmod("org.foo");
! jmod("org.bar", "--modulepath", jmods.toString(), "--hash-modules", "org.*");
checkHashes(hashes("org.bar").get(), "org.foo");
! jmod("m3", "--modulepath", jmods.toString(), "--hash-modules", ".*");
checkHashes(hashes("m3").get(), "org.foo", "org.bar", "m1");
}
private void checkHashes(ModuleHashes hashes, String... hashModules) {
assertTrue(hashes.names().equals(Set.of(hashModules)));
--- 107,138 ----
for (String mn : modules) {
assertFalse(hashes(mn).isPresent());
}
// hash m1 in m2
! jmod("m2", "--module-path", jmods.toString(), "--hash-modules", "m1");
checkHashes(hashes("m2").get(), "m1");
// hash m1 in m2
! jmod("m2", "--module-path", jmods.toString(), "--hash-modules", ".*");
checkHashes(hashes("m2").get(), "m1");
// create m2.jmod with no hash
jmod("m2");
// run jmod hash command to hash m1 in m2 and m3
! runJmod(Arrays.asList("hash", "--module-path", jmods.toString(),
"--hash-modules", ".*"));
checkHashes(hashes("m2").get(), "m1");
checkHashes(hashes("m3").get(), "m1");
jmod("org.bar");
jmod("org.foo");
! jmod("org.bar", "--module-path", jmods.toString(), "--hash-modules", "org.*");
checkHashes(hashes("org.bar").get(), "org.foo");
! jmod("m3", "--module-path", jmods.toString(), "--hash-modules", ".*");
checkHashes(hashes("m3").get(), "org.foo", "org.bar", "m1");
}
private void checkHashes(ModuleHashes hashes, String... hashModules) {
assertTrue(hashes.names().equals(Set.of(hashModules)));
*** 183,193 ****
});
}
private void compileModule(String moduleName, Path src) throws IOException {
Path msrc = src.resolve(moduleName);
! assertTrue(CompilerUtils.compile(msrc, mods, "-modulesourcepath", src.toString()));
}
private void jmod(String moduleName, String... options) throws IOException {
Path mclasses = mods.resolve(moduleName);
Path outfile = jmods.resolve(moduleName + ".jmod");
--- 183,193 ----
});
}
private void compileModule(String moduleName, Path src) throws IOException {
Path msrc = src.resolve(moduleName);
! assertTrue(CompilerUtils.compile(msrc, mods, "--module-source-path", src.toString()));
}
private void jmod(String moduleName, String... options) throws IOException {
Path mclasses = mods.resolve(moduleName);
Path outfile = jmods.resolve(moduleName + ".jmod");
< prev index next >