Search in sources :

Example 6 with Config

use of org.neo4j.driver.v1.Config in project neo4j by neo4j.

the class TransactionGuardIntegrationTest method terminateLongRunningDriverPeriodicCommitQuery.

@Test
public void terminateLongRunningDriverPeriodicCommitQuery() throws Exception {
    GraphDatabaseAPI database = startDatabaseWithTimeoutCustomGuard();
    CommunityNeoServer neoServer = startNeoServer((GraphDatabaseFacade) database);
    org.neo4j.driver.v1.Config driverConfig = getDriverConfig();
    try (Driver driver = GraphDatabase.driver("bolt://localhost:" + boltPortCustomGuard, driverConfig);
        Session session = driver.session()) {
        URL url = prepareTestImportFile(8);
        session.run("USING PERIODIC COMMIT 5 LOAD CSV FROM '" + url + "' AS line CREATE ();").consume();
        fail("Transaction should be already terminated by execution guard.");
    } catch (Exception expected) {
    //
    }
    assertDatabaseDoesNotHaveNodes(database);
}
Also used : GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) CommunityNeoServer(org.neo4j.server.CommunityNeoServer) Driver(org.neo4j.driver.v1.Driver) URL(java.net.URL) GuardTimeoutException(org.neo4j.kernel.guard.GuardTimeoutException) RemoteException(java.rmi.RemoteException) ShellException(org.neo4j.shell.ShellException) IOException(java.io.IOException) Session(org.neo4j.driver.v1.Session) Test(org.junit.Test)

Example 7 with Config

use of org.neo4j.driver.v1.Config in project neo4j by neo4j.

the class TransactionGuardIntegrationTest method terminateLongRunningDriverQuery.

@Test
public void terminateLongRunningDriverQuery() throws Exception {
    GraphDatabaseAPI database = startDatabaseWithTimeout();
    CommunityNeoServer neoServer = startNeoServer((GraphDatabaseFacade) database);
    org.neo4j.driver.v1.Config driverConfig = getDriverConfig();
    try (Driver driver = GraphDatabase.driver("bolt://localhost:" + boltPortDatabaseWithTimeout, driverConfig);
        Session session = driver.session()) {
        org.neo4j.driver.v1.Transaction transaction = session.beginTransaction();
        transaction.run("create (n)").consume();
        transaction.success();
        fakeClock.forward(3, TimeUnit.SECONDS);
        try {
            transaction.run("create (n)").consume();
            fail("Transaction should be already terminated by execution guard.");
        } catch (Exception expected) {
        // ignored
        }
    }
    assertDatabaseDoesNotHaveNodes(database);
}
Also used : GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) CommunityNeoServer(org.neo4j.server.CommunityNeoServer) Driver(org.neo4j.driver.v1.Driver) GuardTimeoutException(org.neo4j.kernel.guard.GuardTimeoutException) RemoteException(java.rmi.RemoteException) ShellException(org.neo4j.shell.ShellException) IOException(java.io.IOException) Session(org.neo4j.driver.v1.Session) Test(org.junit.Test)

Example 8 with Config

use of org.neo4j.driver.v1.Config in project jdk8u_jdk by JetBrains.

the class EType method initStatic.

public static void initStatic() {
    boolean allowed = false;
    try {
        Config cfg = Config.getInstance();
        String temp = cfg.get("libdefaults", "allow_weak_crypto");
        if (temp != null && temp.equals("true"))
            allowed = true;
    } catch (Exception exc) {
        if (DEBUG) {
            System.out.println("Exception in getting allow_weak_crypto, " + "using default value " + exc.getMessage());
        }
    }
    allowWeakCrypto = allowed;
}
Also used : Config(sun.security.krb5.Config) KrbCryptoException(sun.security.krb5.KrbCryptoException) KrbException(sun.security.krb5.KrbException)

Example 9 with Config

use of org.neo4j.driver.v1.Config in project jdk8u_jdk by JetBrains.

the class ParseConfig method main.

public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf", System.getProperty("test.src", ".") + "/krb5.conf");
    Config config = Config.getInstance();
    config.listTable();
    String sample = "kdc.example.com kdc2.example.com";
    for (int i = 0; i < 4; i++) {
        String expected = config.getAll("realms", "EXAMPLE_" + i + ".COM", "kdc");
        if (!sample.equals(expected)) {
            throw new Exception("krb5.conf: unexpected kdc value \"" + expected + "\"");
        }
    }
    // JDK-8055045: IOOBE when reading an empty value
    config.get("empty1", "NOVAL.COM");
    config.get("empty2", "NOVAL.COM");
    config.get("quote1", "NOVAL.COM");
    config.get("quote2", "NOVAL.COM");
}
Also used : Config(sun.security.krb5.Config)

Example 10 with Config

use of org.neo4j.driver.v1.Config in project jdk8u_jdk by JetBrains.

the class DNS method main.

public static void main(String[] args) throws Exception {
    System.setProperty("java.security.krb5.conf", System.getProperty("test.src", ".") + "/no-such-file.conf");
    Config config = Config.getInstance();
    try {
        String r = config.getDefaultRealm();
        throw new Exception("What? There is a default realm " + r + "?");
    } catch (KrbException ke) {
        ke.printStackTrace();
        if (ke.getCause() != null) {
            throw new Exception("There should be no cause. Won't try DNS");
        }
    }
    String kdcs = config.getKDCList("X");
    if (!kdcs.equals("a.com.:88 b.com.:99") && !kdcs.equals("a.com. b.com.:99")) {
        throw new Exception("Strange KDC: [" + kdcs + "]");
    }
    ;
}
Also used : Config(sun.security.krb5.Config) KrbException(sun.security.krb5.KrbException) KrbException(sun.security.krb5.KrbException)

Aggregations

Test (org.junit.Test)9 Driver (org.neo4j.driver.v1.Driver)9 Config (sun.security.krb5.Config)8 Session (org.neo4j.driver.v1.Session)7 StatementResult (org.neo4j.driver.v1.StatementResult)4 IOException (java.io.IOException)3 Config (org.opencypher.Config)3 KrbException (sun.security.krb5.KrbException)3 RemoteException (java.rmi.RemoteException)2 GuardTimeoutException (org.neo4j.kernel.guard.GuardTimeoutException)2 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)2 CommunityNeoServer (org.neo4j.server.CommunityNeoServer)2 ShellException (org.neo4j.shell.ShellException)2 CyNodeLoadingHandler (uk.ac.rothamsted.rdf.neo4j.load.support.CyNodeLoadingHandler)2 CyNodeLoadingProcessor (uk.ac.rothamsted.rdf.neo4j.load.support.CyNodeLoadingProcessor)2 CyRelationLoadingHandler (uk.ac.rothamsted.rdf.neo4j.load.support.CyRelationLoadingHandler)2 CyRelationLoadingProcessor (uk.ac.rothamsted.rdf.neo4j.load.support.CyRelationLoadingProcessor)2 Neo4jDataManager (uk.ac.rothamsted.rdf.neo4j.load.support.Neo4jDataManager)2 RdfDataManager (uk.ac.rothamsted.rdf.neo4j.load.support.RdfDataManager)2 RdfDataManagerTest (uk.ac.rothamsted.rdf.neo4j.load.support.RdfDataManagerTest)2