use of org.neo4j.kernel.impl.proc.Procedures in project neo4j by neo4j.
the class StorageLayerTest method before.
@SuppressWarnings("deprecation")
@Before
public void before() {
db = (GraphDatabaseAPI) createGraphDatabase();
DependencyResolver resolver = db.getDependencyResolver();
this.disk = resolver.resolveDependency(StorageEngine.class).storeReadLayer();
this.state = new KernelStatement(null, null, disk.newStatement(), new Procedures(), new CanWrite(), LockTracer.NONE);
}
use of org.neo4j.kernel.impl.proc.Procedures in project neo4j by neo4j.
the class GraphDatabaseServiceExecuteTest method shouldBeAbleToUseResultsOfPointGeometryProcedureAsInputToDistanceFunction.
@Test
public void shouldBeAbleToUseResultsOfPointGeometryProcedureAsInputToDistanceFunction() throws Exception {
// given procedure that produces a point
GraphDatabaseService graphDb = new TestGraphDatabaseFactory().newImpermanentDatabase();
Procedures procedures = ((GraphDatabaseAPI) graphDb).getDependencyResolver().resolveDependency(Procedures.class);
procedures.registerProcedure(PointProcs.class);
// when calling procedure that produces a point
Result result = graphDb.execute("CALL spatial.pointGeometry(144.317718, -37.031738) YIELD geometry " + "RETURN distance(point({longitude: 144.317718, latitude: -37.031738}), geometry) AS dist");
// then
Double dist = (Double) result.next().get("dist");
assertThat(dist, equalTo(0.0));
}
use of org.neo4j.kernel.impl.proc.Procedures in project neo4j by neo4j.
the class EditionModule method setupSecurityModule.
protected static void setupSecurityModule(PlatformModule platformModule, Log log, Procedures procedures, String key) {
for (SecurityModule candidate : Service.load(SecurityModule.class)) {
if (candidate.matches(key)) {
try {
candidate.setup(new SecurityModule.Dependencies() {
@Override
public LogService logService() {
return platformModule.logging;
}
@Override
public Config config() {
return platformModule.config;
}
@Override
public Procedures procedures() {
return procedures;
}
@Override
public JobScheduler scheduler() {
return platformModule.jobScheduler;
}
@Override
public FileSystemAbstraction fileSystem() {
return platformModule.fileSystem;
}
@Override
public LifeSupport lifeSupport() {
return platformModule.life;
}
@Override
public DependencySatisfier dependencySatisfier() {
return platformModule.dependencies;
}
});
return;
} catch (Exception e) {
String errorMessage = "Failed to load security module.";
log.error(errorMessage);
throw new RuntimeException(errorMessage, e);
}
}
}
String errorMessage = "Failed to load security module with key '" + key + "'.";
log.error(errorMessage);
throw new IllegalArgumentException(errorMessage);
}
use of org.neo4j.kernel.impl.proc.Procedures in project neo4j by neo4j.
the class KernelStatementTest method assertStatementIsNotOpenWhileAcquireIsNotInvoked.
@Test(expected = NotInTransactionException.class)
public void assertStatementIsNotOpenWhileAcquireIsNotInvoked() {
KernelTransactionImplementation transaction = mock(KernelTransactionImplementation.class);
TxStateHolder txStateHolder = mock(TxStateHolder.class);
StorageStatement storeStatement = mock(StorageStatement.class);
AccessCapability accessCapability = mock(AccessCapability.class);
Procedures procedures = mock(Procedures.class);
KernelStatement statement = new KernelStatement(transaction, txStateHolder, storeStatement, procedures, accessCapability, LockTracer.NONE);
statement.assertOpen();
}
use of org.neo4j.kernel.impl.proc.Procedures in project neo4j by neo4j.
the class KernelStatementTest method shouldReleaseStorageStatementWhenForceClosed.
@Test
public void shouldReleaseStorageStatementWhenForceClosed() throws Exception {
// given
StorageStatement storeStatement = mock(StorageStatement.class);
KernelStatement statement = new KernelStatement(mock(KernelTransactionImplementation.class), null, storeStatement, new Procedures(), new CanWrite(), LockTracer.NONE);
statement.acquire();
// when
statement.forceClose();
// then
verify(storeStatement).release();
}
Aggregations