Package org.jboss.dna.graph

Examples of org.jboss.dna.graph.Graph$AccessQueryProcessor


        engine = configuration.build();
        engine.start();

        // Verify that the graph has been updated correctly ...
        Graph config = engine.getGraph(JcrConfiguration.DEFAULT_CONFIGURATION_SOURCE_NAME);
        Subgraph subgraph = config.getSubgraphOfDepth(6).at("/");
        assertThat(subgraph.getNode("/dna:sources"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/Source2"), is(notNullValue()));
        assertThat(subgraph.getNode("/dna:sources/Source2"), hasProperty(DnaLexicon.CLASSNAME,
                                                                         InMemoryRepositorySource.class.getName()));
        assertThat(subgraph.getNode("/dna:repositories"), is(notNullValue()));
View Full Code Here


            // This needs to check configProps directly to avoid an infinite loop
            String skipImport = (String)configProps.get(DNA_SKIP_IMPORT);
            if (!Boolean.valueOf(skipImport)) {

                // Set up some sample nodes in the graph to match the expected test configuration
                Graph graph = Graph.create(repository.getRepositorySourceName(),
                                           engine.getRepositoryConnectionFactory(),
                                           executionContext);
                Path destinationPath = executionContext.getValueFactories().getPathFactory().createRootPath();

                InputStream xmlStream = getClass().getResourceAsStream("/tck/repositoryForTckTests.xml");
                graph.importXmlFrom(xmlStream).into(destinationPath);

                graph.createWorkspace().named("otherWorkspace");
            }
        } catch (Exception ex) {
            // The TCK tries to quash this exception. Print it out to be more obvious.
            ex.printStackTrace();
            throw new IllegalStateException("Failed to initialize the repository with text content.", ex);
View Full Code Here

    @Test
    public void shouldReturnFalseFromIsSameIfTheRepositoryInstanceIsDifferent() throws Exception {
        // Set up the store ...
        InMemoryRepositorySource source2 = new InMemoryRepositorySource();
        source2.setName("store");
        Graph store2 = Graph.create(source2, context);
        store2.importXmlFrom(AbstractJcrTest.class.getClassLoader().getResourceAsStream("cars.xml")).into("/");
        JcrSession jcrSession2 = mock(JcrSession.class);
        stub(jcrSession2.nodeTypeManager()).toReturn(nodeTypes);
        SessionCache cache2 = new SessionCache(jcrSession2, store2.getCurrentWorkspaceName(), context, nodeTypes, store2);

        Workspace workspace2 = mock(Workspace.class);
        Repository repository2 = mock(Repository.class);
        stub(jcrSession2.getWorkspace()).toReturn(workspace2);
        stub(jcrSession2.getRepository()).toReturn(repository2);
View Full Code Here

    @Test
    public void shouldReturnFalseFromIsSameIfTheWorkspaceNameIsDifferent() throws Exception {
        // Set up the store ...
        InMemoryRepositorySource source2 = new InMemoryRepositorySource();
        source2.setName("store");
        Graph store2 = Graph.create(source2, context);
        store2.importXmlFrom(AbstractJcrTest.class.getClassLoader().getResourceAsStream("cars.xml")).into("/");
        JcrSession jcrSession2 = mock(JcrSession.class);
        stub(jcrSession2.nodeTypeManager()).toReturn(nodeTypes);
        SessionCache cache2 = new SessionCache(jcrSession2, store2.getCurrentWorkspaceName(), context, nodeTypes, store2);

        Workspace workspace2 = mock(Workspace.class);
        Repository repository2 = mock(Repository.class);
        stub(jcrSession2.getWorkspace()).toReturn(workspace2);
        stub(jcrSession2.getRepository()).toReturn(repository2);
View Full Code Here

    @Test
    public void shouldReturnFalseFromIsSameIfTheNodeUuidIsDifferent() throws Exception {
        // Set up the store ...
        InMemoryRepositorySource source2 = new InMemoryRepositorySource();
        source2.setName("store");
        Graph store2 = Graph.create(source2, context);
        store2.importXmlFrom(AbstractJcrTest.class.getClassLoader().getResourceAsStream("cars.xml")).into("/");
        JcrSession jcrSession2 = mock(JcrSession.class);
        stub(jcrSession2.nodeTypeManager()).toReturn(nodeTypes);
        SessionCache cache2 = new SessionCache(jcrSession2, store2.getCurrentWorkspaceName(), context, nodeTypes, store2);

        Workspace workspace2 = mock(Workspace.class);
        Repository repository2 = mock(Repository.class);
        stub(jcrSession2.getWorkspace()).toReturn(workspace2);
        stub(jcrSession2.getRepository()).toReturn(repository2);
View Full Code Here

    @Test
    public void shouldReturnTrueFromIsSameIfTheNodeUuidAndWorkspaceNameAndRepositoryInstanceAreSame() throws Exception {
        // Set up the store ...
        InMemoryRepositorySource source2 = new InMemoryRepositorySource();
        source2.setName("store");
        Graph store2 = Graph.create(source2, context);
        store2.importXmlFrom(AbstractJcrTest.class.getClassLoader().getResourceAsStream("cars.xml")).into("/");
        JcrSession jcrSession2 = mock(JcrSession.class);
        stub(jcrSession2.nodeTypeManager()).toReturn(nodeTypes);
        SessionCache cache2 = new SessionCache(jcrSession2, store2.getCurrentWorkspaceName(), context, nodeTypes, store2);

        Workspace workspace2 = mock(Workspace.class);
        stub(jcrSession2.getWorkspace()).toReturn(workspace2);
        stub(jcrSession2.getRepository()).toReturn(repository);
        stub(workspace2.getName()).toReturn("workspace1");
View Full Code Here

        NameFactory nameFactory = valueFactories.getNameFactory();
        ValueFactory<Long> longFactory = valueFactories.getLongFactory();
        ProjectionParser projectionParser = ProjectionParser.getInstance();

        // Create a graph to access the configuration ...
        Graph config = Graph.create(configurationSourceName, connectionFactory, context);

        // Read the federated repositories subgraph (of max depth 4)...
        Subgraph repositories = config.getSubgraphOfDepth(4).at(getConfigurationSourcePath());

        // Set up the default cache policy by reading the "dna:federation" node ...
        CachePolicy defaultCachePolicy = null;
        Node federation = repositories.getNode(DNA_FEDERATION_SEGMENT);
        if (federation == null) {
View Full Code Here

            this.context = context;
            this.connectionFactory = connectionFactory;
        }

        private Graph workspaceGraph( String workspaceName ) {
            Graph graph = Graph.create(this.sourceName, connectionFactory, context);

            if (workspaceName != null) {
                graph.useWorkspace(workspaceName);
            }

            return graph;
        }
View Full Code Here

        @Override
        public QueryResults search( String workspaceName,
                                    String searchExpression,
                                    int maxRowCount,
                                    int offset ) {
            Graph graph = Graph.create(sourceName, connectionFactory, context);

            if (workspaceName != null) {
                graph.useWorkspace(workspaceName);
            }

            return graph.search(searchExpression, maxRowCount, offset);
        }
View Full Code Here

     * @throws RepositoryException if another error occurs
     */
    List<JcrNodeType> registerNodeTypes( JcrNodeTypeSource nodeTypeSource )
        throws InvalidNodeTypeDefinitionException, NodeTypeExistsException, RepositoryException {
        assert nodeTypeSource != null;
        Graph nodeTypesGraph = nodeTypeSource.getNodeTypes();
        Subgraph nodeTypesSubgraph = nodeTypesGraph.getSubgraphOfDepth(3).at("/");
        return registerNodeTypes(nodeTypesSubgraph, nodeTypesSubgraph.getLocation());
    }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.Graph$AccessQueryProcessor

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.