Package org.jboss.dna.graph.property

Examples of org.jboss.dna.graph.property.Name


    protected String value( Object value ) {
        return context.getValueFactories().getStringFactory().create(value);
    }
   
    private boolean verifyProperty(SubgraphNode node, String propNameStr, String expectedValue) {
        Name propName = name(propNameStr);
        for( Property prop : node.getProperties()) {
            if (prop.getName().equals(propName) ) {
                for (Object nextVal : prop.getValuesAsArray()) {
                    String valueStr = value(nextVal);
                    if( valueStr.equals(expectedValue)) {
View Full Code Here


        }
        return false;
    }
   
    private boolean verifyHasProperty(SubgraphNode node, String propNameStr) {
        Name propName = name(propNameStr);
        for( Property prop : node.getProperties()) {
            if (prop.getName().equals(propName) ) {
                return true;
            }
        }
View Full Code Here

  }
 
  @Test
  public void shouldCreateName() {
    String nodeName = "myNodeName";
    Name name = nodeFactory.name(nodeName);
   
    assertNotNull(name);
    assertEquals(nodeName, name.getString());
   
  }
View Full Code Here

        return context.getValueFactories().getPathFactory().create(path);
    }

    @Test
    public void shouldCreatePlanNodeWithNameAndNoParent() {
        Name name = name("something");
        node = new AstNode(name);
        assertThat(node.getName(), is(name));
        assertThat(node.getParent(), is(nullValue()));
    }
View Full Code Here

        assertThat(node.getParent(), is(nullValue()));
    }

    @Test
    public void shouldCreatePlanNodeWithNameAndParent() {
        Name name = name("something");
        parent = new AstNode(name("parent"));
        node = new AstNode(parent, name);
        assertThat(node.getName(), is(name));
        assertThat(node.getParent(), is(sameInstance(parent)));
        assertThat(parent.getFirstChild(), is(sameInstance(node)));
View Full Code Here

                // Index the node ...
                Location location = locationIter.next();
                Path path = location.getPath();
                Location parent = readSubgraph.getLocationFor(path.getParent());
                Name childName = path.getLastSegment().getName();
                Collection<Property> nodePoperties = readSubgraph.getPropertiesFor(location).values();
                CreateNodeRequest create = new CreateNodeRequest(parent, workspaceName, childName, nodePoperties);
                create.setActualLocationOfNode(location); // set this so we don't have to figure it out
                process(create);
                if (create.isCancelled() || create.hasError()) return;
View Full Code Here

            if (children != null) {
                final Collection<SVNDirEntry> entries = SVNRepositoryUtil.getDir(workspaceRoot, "");
                for (SVNDirEntry entry : entries) {
                    // All of the children of a directory will be another directory or a file, but never a "jcr:content" node ...
                    String localName = entry.getName();
                    Name childName = nameFactory().create(defaultNamespaceUri, localName);
                    Path childPath = pathFactory().create(requestedPath, childName);
                    children.add(Location.create(childPath));
                }
            }
            // There are no properties on the root ...
        } else {
            try {
                // Generate the properties for this File object ...
                PropertyFactory factory = getExecutionContext().getPropertyFactory();
                DateTimeFactory dateFactory = getExecutionContext().getValueFactories().getDateFactory();

                // Figure out the kind of node this represents ...
                SVNNodeKind kind = getNodeKind(workspaceRoot, requestedPath, accessData.getRepositoryRootUrl(), workspaceName);
                if (kind == SVNNodeKind.DIR) {
                    String directoryPath = getPathAsString(requestedPath);
                    if (!accessData.getRepositoryRootUrl().equals(workspaceName)) {
                        directoryPath = directoryPath.substring(1);
                    }
                    if (children != null) {
                        // Decide how to represent the children ...
                        Collection<SVNDirEntry> dirEntries = SVNRepositoryUtil.getDir(workspaceRoot, directoryPath);
                        for (SVNDirEntry entry : dirEntries) {
                            // All of the children of a directory will be another directory or a file,
                            // but never a "jcr:content" node ...
                            String localName = entry.getName();
                            Name childName = nameFactory().create(defaultNamespaceUri, localName);
                            Path childPath = pathFactory().create(requestedPath, childName);
                            children.add(Location.create(childPath));
                        }
                    }
                    if (properties != null) {
View Full Code Here

    @Test
    public void shouldRegisterValidTypes() throws Exception {
        nodeTypes = new CndNodeTypeSource(CND_LOCATION + "validType.cnd");

        repoTypeManager.registerNodeTypes(nodeTypes);
        Name testNodeName = context.getValueFactories().getNameFactory().create(TestLexicon.Namespace.URI, "testType");

        NodeType nodeType = repoTypeManager.getNodeType(testNodeName);
        assertThat(nodeType, is(notNullValue()));
        assertThat(nodeType.isMixin(), is(true));
        assertThat(nodeType.hasOrderableChildNodes(), is(true));
View Full Code Here

    }

    @Test
    public void shouldNotFindInvalidPropertyDefinition() throws Exception {
        // This property name is not defined for any of our test types
        Name badName = nameFactory.create("undefinedName");
        JcrPropertyDefinition propDef;

        propDef = repoTypeManager.findPropertyDefinition(NODE_TYPE_A, Collections.<Name>emptyList(), badName, null, true, true);
        assertThat(propDef, is(nullValue()));
View Full Code Here

        try {
            Value[] requiredPrimaryTypes = childNodeNode.getProperty(JcrLexicon.REQUIRED_PRIMARY_TYPES.getString(registry))
                                                        .getValues();
            assertEquals(requiredPrimaryTypes.length, requiredPrimaryTypeNames.size());
            for (int i = 0; i < requiredPrimaryTypes.length; i++) {
                Name rptName = context.getValueFactories().getNameFactory().create(requiredPrimaryTypes[i].getString());
                assertEquals(requiredPrimaryTypeNames.contains(rptName), true);
            }
        } catch (PathNotFoundException pnfe) {
            assertEquals(requiredPrimaryTypeNames.size(), 0);
        }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.property.Name

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.