use of org.neo4j.test.jar.JarBuilder in project neo4j by neo4j.
the class ProcedureJarLoaderTest method shouldWorkOnPathsWithSpaces.
@Test
void shouldWorkOnPathsWithSpaces() throws Exception {
// given
Path fileWithSpacesInName = testDirectory.createFile(new Random().nextInt() + " some spaces in the filename" + ".jar");
URL theJar = new JarBuilder().createJarFor(fileWithSpacesInName, ClassWithOneProcedure.class);
corruptJar(theJar);
AssertableLogProvider logProvider = new AssertableLogProvider(true);
ProcedureJarLoader jarloader = new ProcedureJarLoader(procedureCompiler(), logProvider.getLog(ProcedureJarLoader.class));
// when
assertThrows(ZipException.class, () -> jarloader.loadProceduresFromDir(parentDir(theJar)));
assertThat(logProvider).containsMessages(format("Plugin jar file: %s corrupted.", fileWithSpacesInName));
}
use of org.neo4j.test.jar.JarBuilder in project neo4j by neo4j.
the class ProcedureJarLoaderTest method shouldLoadProcedureFromJarWithSpacesInFilename.
@Test
void shouldLoadProcedureFromJarWithSpacesInFilename() throws Throwable {
// Given
URL jar = new JarBuilder().createJarFor(testDirectory.createFile(new Random().nextInt() + " some spaces in filename.jar"), ClassWithOneProcedure.class);
// When
List<CallableProcedure> procedures = jarloader.loadProceduresFromDir(parentDir(jar)).procedures();
// Then
List<ProcedureSignature> signatures = procedures.stream().map(CallableProcedure::signature).collect(toList());
assertThat(signatures).containsExactly(procedureSignature("org", "neo4j", "procedure", "impl", "myProcedure").out("someNumber", NTInteger).build());
assertThat(asList(procedures.get(0).apply(prepareContext(), new AnyValue[0], EMPTY_RESOURCE_TRACKER))).containsExactly(new AnyValue[] { Values.longValue(1337L) });
}
Aggregations