Package org.neo4j.server

Examples of org.neo4j.server.WrappingNeoServerBootstrapper


    config.configuration().setProperty(
        Configurator.WEBSERVER_PORT_PROPERTY_KEY, 7575);
    config.configuration().setProperty(
        Configurator.REST_API_PATH_PROPERTY_KEY,
        "http://localhost:7575/db/data/");
    WrappingNeoServerBootstrapper srv = new WrappingNeoServerBootstrapper(myDb, config);
    srv.start();

        PersistenceServiceProvider.configFile = "remote-config-beans.xml";
        ContextTrackingProvider.configFile = "remote-config-beans.xml";
        PersistenceService persistenceService = PersistenceServiceProvider.getPersistenceService();
        ContextTrackingService trackingService = ContextTrackingProvider.getTrackingService();
        Call call = new Call(1, 1, new Date());
        persistenceService.storeCall(call);
       
        assertNotSame("", call.getId());

        call = persistenceService.loadCall(call.getId());
        assertNotNull(call);

        Emergency emergency = new Emergency();
        persistenceService.storeEmergency(emergency);
        assertNotSame("", emergency.getId());

        emergency = persistenceService.loadEmergency(emergency.getId());
        assertNotNull(emergency);
       
        trackingService.attachEmergency(call.getId(), emergency.getId());

        Procedure procedure = new Procedure("MyProcedure");
        persistenceService.storeProcedure(procedure);
        assertNotSame("", procedure.getId());

        procedure = persistenceService.loadProcedure(procedure.getId());
        assertNotNull(procedure);

        trackingService.attachProcedure(emergency.getId(), procedure.getId());


        Vehicle vehicle = new Ambulance();

        persistenceService.storeVehicle(vehicle);
        assertNotSame("", vehicle.getId());

        vehicle = persistenceService.loadVehicle(vehicle.getId());
        assertNotNull(vehicle);


        trackingService.attachVehicle(procedure.getId(), vehicle.getId());

        Vehicle vehicle2 = new FireTruck();
        persistenceService.storeVehicle(vehicle2);
        assertNotSame("", vehicle2.getId());

        vehicle2 = persistenceService.loadVehicle(vehicle2.getId());
        assertNotNull(vehicle2);

        trackingService.attachVehicle(procedure.getId(), vehicle2.getId());

        ServiceChannel channel = new ServiceChannel("MyChannel");
        persistenceService.storeServiceChannel(channel);
        assertNotSame("", channel.getId());
       
        channel = persistenceService.loadServiceChannel(channel.getId());
        assertNotNull(channel);
       
        trackingService.attachServiceChannel(emergency.getId(), channel.getId());


        CypherParser parser = new CypherParser();
        ExecutionEngine engine = new ExecutionEngine(trackingService.getGraphDb());


        //Give me all the vehicle associated with the procedures that are part of the emergency that was created by this phoneCallId
        HttpClient client = new HttpClient();
        PostMethod method = new PostMethod("http://localhost:7575/db/data/ext/CypherPlugin/graphdb/execute_query");
        method.setRequestHeader("Content-type", "application/json");
        method.setRequestHeader("Accept", "application/json");
        String content = "{\"query\": \"start n=(calls, 'callId:" + call.getId() + "')  match (n)-[r:CREATES]->(x)-[i:INSTANTIATE]-> (w) -[u:USE]->v  return v\"}";
        method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
        client.executeMethod(method);
       
        Gson gson = new Gson();

    QueryResult result = gson.fromJson(method.getResponseBodyAsString(),
        new TypeToken<QueryResult>() {
        }.getType());

    System.out.println("results: " + result);
    Assert.assertEquals(2, result.getData().size());
    for (List<ResponseNode> data : result.getData()) {
      Map<String, String> props = data.get(0).getData();
      for (String key : props.keySet()) {
        System.out.println("Property ("+key+"): "+props.get(key));
      }
    }

        client = new HttpClient();
        method = new PostMethod("http://localhost:7575/db/data/ext/CypherPlugin/graphdb/execute_query");
        method.setRequestHeader("Content-type", "application/json");
        method.setRequestHeader("Accept", "application/json");
        content = "{\"query\": \"start v=(vehicles, 'vehicleId:" + vehicle.getId() + "')  match (v) <-[USE]- (w)    return w\"}";
        method.setRequestEntity(new StringRequestEntity(content, "application/json", "UTF-8"));
        client.executeMethod(method);
       
        gson = new Gson();

    result = gson.fromJson(method.getResponseBodyAsString(),
        new TypeToken<QueryResult>() {
        }.getType());
               
    System.out.println("results: " + result);
    Assert.assertEquals(1, result.getData().size());
    for (List<ResponseNode> data : result.getData()) {
      Map<String, String> props = data.get(0).getData();
      for (String key : props.keySet()) {
        System.out.println("Property ("+key+"): "+props.get(key));
      }
    }

   
//        tracking.detachVehicle(vehicleId);
//       
//        tracking.detachProcedure(procedureId);
//       
//        tracking.detachEmergency(emergencyId);
//       

        myDb.shutdown();
        srv.stop();
       

    }
View Full Code Here


      config.configuration().setProperty(
          Configurator.WEBSERVER_PORT_PROPERTY_KEY, 7575);
      config.configuration().setProperty(
          Configurator.REST_API_PATH_PROPERTY_KEY,
          SERVER_API_PATH_PROP);
      srv = new WrappingNeoServerBootstrapper(myDb, config);
      srv.start();
    }
        final CoreServer coreServer = new CoreServer();
        Runtime.getRuntime().addShutdownHook(new Thread() {
View Full Code Here

        config.configuration().setProperty(
                Configurator.WEBSERVER_PORT_PROPERTY_KEY, 7575);
        config.configuration().setProperty(
                Configurator.REST_API_PATH_PROPERTY_KEY,
                "http://localhost:7575/db/data/");
        srv = new WrappingNeoServerBootstrapper(myDb, config);
        srv.start();
       
        super.setUp();

        HumanTaskServiceConfiguration taskClientConf = new HumanTaskServiceConfiguration();
View Full Code Here

                Configurator.WEBSERVER_PORT_PROPERTY_KEY, 7575);
        config.configuration().setProperty(
                Configurator.REST_API_PATH_PROPERTY_KEY,
                "http://localhost:7575/db/data/");
       
        srv = new WrappingNeoServerBootstrapper(myDb, config);
       
        srv.start();

        super.setUp();
View Full Code Here

        ImpermanentGraphDatabase db = new ImpermanentGraphDatabase();

        ServerConfigurator config = new ServerConfigurator(db);
        config.configuration().setProperty("org.neo4j.server.credentials", "neo4j:master");
        config.getThirdpartyJaxRsPackages().add(new ThirdPartyJaxRsPackage("org.neo4j.server.extension.auth", "/admin"));
        testBootstrapper = new WrappingNeoServerBootstrapper(db, config);
        testBootstrapper.start();
    }
View Full Code Here

      config.configuration()
        .addProperty(Configurator.WEBSERVER_PORT_PROPERTY_KEY, port);
     
      logger.log(Level.INFO, "Starting Neo4j server on port {0}", new Object[] { String.valueOf(port) });

      neoServerBootstrapper = new WrappingNeoServerBootstrapper(api, config);
      neoServerBootstrapper.start();

    } catch (Exception e) {

      logger.log(Level.SEVERE, e.getMessage());
View Full Code Here

    /**
     * Start the web server.
     */
    public void start() {
        GraphDatabaseAPI databaseAPI = graphStore.getDatabaseAPI();
        this.server = new WrappingNeoServerBootstrapper(databaseAPI);
        this.server.start();
    }
View Full Code Here

     * //todo change to CommunityServerBuilder
     */
    private void startServerWrapper() {
        ServerConfigurator configurator = new ServerConfigurator((GraphDatabaseAPI) getDatabase());
        populateConfigurator(configurator);
        bootstrapper = new WrappingNeoServerBootstrapper((GraphDatabaseAPI) getDatabase(), configurator);
        bootstrapper.start();
    }
View Full Code Here

                return Collections.singletonList(new ThirdPartyJaxRsPackage("org.springframework.data.neo4j.rest.support","/test"));
            }
        };
        final Configuration configuration = configurator.configuration();
        configuration.setProperty(Configurator.WEBSERVER_PORT_PROPERTY_KEY, PORT);
        final WrappingNeoServerBootstrapper bootstrapper = new WrappingNeoServerBootstrapper(db, configurator);
        touched=0;
        bootstrapper.start();
        neoServer = bootstrapper.getServer();
    }
View Full Code Here

    @BeforeClass
    public static void startDb() throws Exception {
        db = new ImpermanentGraphDatabase();
        final ServerConfigurator configurator = new ServerConfigurator(db);
        configurator.configuration().setProperty(Configurator.WEBSERVER_PORT_PROPERTY_KEY,PORT);
        final WrappingNeoServerBootstrapper bootstrapper = new WrappingNeoServerBootstrapper(db, configurator);
        int exit = bootstrapper.start();
        if (exit != 0 ) throw new IllegalStateException("Server not started correctly.");
        neoServer = bootstrapper.getServer();

        tryConnect();
    }
View Full Code Here

TOP

Related Classes of org.neo4j.server.WrappingNeoServerBootstrapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.