use of org.eclipse.ceylon.model.loader.impl.reflect.CachedTOCJars in project ceylon by eclipse.
the class CachedTOCJarsTest method spacesOnPathTest.
@Test
public void spacesOnPathTest() throws IOException {
CachedTOCJars cachedTOCJars = new CachedTOCJars();
Module module = new Module();
module.setName(Collections.singletonList("testModule"));
module.setVersion("testVersion");
final File artifactFile = File.createTempFile("path with spaces", ".jar");
try {
artifactFile.deleteOnExit();
ZipOutputStream artifactOut = new ZipOutputStream(new FileOutputStream(artifactFile));
try {
artifactOut.putNextEntry(new ZipEntry(ALSO_INSIDE_JAR));
} finally {
artifactOut.close();
}
ArtifactResult artifact = new TestArtifactResult(artifactFile, module);
cachedTOCJars.addJar(artifact, module);
String uriPart = cachedTOCJars.getContentUri(module, ALSO_INSIDE_JAR).getSchemeSpecificPart();
// I'm not comparing URI part for equality to avoid symbolic links resolution issues.
Assert.assertTrue(uriPart, uriPart.endsWith(artifactFile.getName() + "!" + ALSO_INSIDE_JAR));
} finally {
artifactFile.delete();
}
}
Aggregations