Package org.structr.core.entity.relationship

Examples of org.structr.core.entity.relationship.NodeHasLocation


    try {

      final List<GenericNode> nodes = createTestNodes(GenericNode.class, 2);
      final NodeInterface startNode = nodes.get(0);
      final NodeInterface endNode   = nodes.get(1);
      NodeHasLocation rel           = null;

      assertTrue(startNode != null);
      assertTrue(endNode != null);

      try (final Tx tx = app.tx()) {

        rel = app.create(startNode, endNode, NodeHasLocation.class);
        tx.success();
      }

      try (final Tx tx = app.tx()) {

        assertEquals(startNode.getUuid(), rel.getSourceNodeId());
        assertEquals(endNode.getUuid(), rel.getTargetNodeId());
        assertEquals(RelType.IS_AT.name(), rel.getType());
        assertEquals(NodeHasLocation.class, rel.getClass());
      }

    } catch (FrameworkException ex) {

      logger.log(Level.SEVERE, ex.toString());
View Full Code Here


          List<GenericNode> nodes        = createTestNodes(GenericNode.class, 2);
          final NodeInterface startNode  = nodes.get(0);
          final NodeInterface endNode    = nodes.get(1);
          final RelationshipType relType = RelType.IS_AT;
          NodeHasLocation rel       = app.create(startNode, endNode, NodeHasLocation.class);

          assertTrue(rel != null);
          assertTrue(rel.getType().equals(relType.name()));

        }
      }

      tx.success();
View Full Code Here

   */
  public void test02ModifyRelationship() {

    try {

      final NodeHasLocation rel = (createTestRelationships(NodeHasLocation.class, 1)).get(0);
      final PropertyKey key1         = new StringProperty("jghsdkhgshdhgsdjkfgh");
      final String val1              = "54354354546806849870";

      try (final Tx tx = app.tx()) {
       
        rel.setProperty(key1, val1);
        tx.success();
      }
     
      try (final Tx tx = app.tx()) {
       
        assertTrue("Expected relationship to have a value for key '" + key1.dbName() + "'", rel.getRelationship().hasProperty(key1.dbName()));

        assertEquals(val1, rel.getRelationship().getProperty(key1.dbName()));

        Object vrfy1 = rel.getProperty(key1);
        assertEquals(val1, vrfy1);
      }
     
      final String val2 = "öljkhöohü8osdfhoödhi";

      try (final Tx tx = app.tx()) {
       
        rel.setProperty(key1, val2);
        tx.success();
      }

      try (final Tx tx = app.tx()) {
       
        Object vrfy2 = rel.getProperty(key1);
        assertEquals(val2, vrfy2);
      }

    } catch (FrameworkException ex) {

View Full Code Here

  public void test03SearchRelationship() {

    try {

      final NodeHasLocation rel = createTestRelationships(NodeHasLocation.class, 1).get(0);
      final PropertyKey key1    = new StringProperty("jghsdkhgshdhgsdjkfgh").indexed();
      final Class type          = NodeHasLocation.class;
      final String val1         = "54354354546806849870";
     
      final Result<RelationshipInterface> result;

      try (final Tx tx = app.tx()) {
       
        rel.setProperty(key1, val1);
        tx.success();
      }

      try (final Tx tx = app.tx()) {
       
        assertTrue(rel.getProperty(key1).equals(val1));

        result = app.relationshipQuery(type).and(key1, val1).getResult();

        assertTrue(result.size() == 1);
        assertTrue(result.get(0).equals(rel));
      }

      final String val2 = "ölllldjöoa8w4rasf";

      try (final Tx tx = app.tx()) {
       
        rel.setProperty(key1, val2);
        tx.success();
      }

      assertTrue(result.size() == 1);
      assertTrue(result.get(0).equals(rel));
View Full Code Here

TOP

Related Classes of org.structr.core.entity.relationship.NodeHasLocation

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.