Package org.exoplatform.services.jcr.impl.core.itemfilters

Examples of org.exoplatform.services.jcr.impl.core.itemfilters.PatternQPathEntryFilter


         assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
         assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> nodePatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-node", -1)));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildNodesData(parentNode, nodePatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildNodesData(parentNode, nodePatterns);
               chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
                  QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
                  Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         con.setCanModify(true);
         parentNode = new PersistedNodeData("parent-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
         parentNode = new PersistedNodeData("parent-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*", -1)));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildPropertiesData(parentNode, propPatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildPropertiesData(parentNode, propPatterns);
               chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
                  parentNode.getQPath(), new InternalQName(null, "my-property1")), parentNode.getIdentifier(), 0,
                  PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         parentNode = new PersistedNodeData("parent-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
         parentNode = new PersistedNodeData("parent-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node14")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());

         // testConsistency
         con = new MyWorkspaceStorageConnection(true);
         wdc = new MyWorkspaceDataContainer(con);
         wsc = repository.getWorkspaceContainer("ws");
         wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
         cwdmNode1 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache1, new SystemDataContainerHolder(wdc));
         cwdmNode2 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache2, new SystemDataContainerHolder(wdc));
         parentNode = new PersistedNodeData("parent2-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         // Test getChildNodesData
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         PlainChangesLog chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node2")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node2")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode).size());
       
         // Test getChildPropertiesData
         parentNode = new PersistedNodeData("parent2-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node3")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "property")), parentNode.getIdentifier(), 0,
            PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node4")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
            PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode).size());

         // Test getReferencesData
         parentNode = new PersistedNodeData("parent2-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node5")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "reference")), parentNode.getIdentifier(), 0,
            PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
         parentNode = new PersistedNodeData("parent2-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node6")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
            PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> patterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-node", -1)));
         parentNode = new PersistedNodeData("parent2-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, patterns).size());
         parentNode = new PersistedNodeData("parent2-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath
            .makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 1), parentNode.getIdentifier(), 1, 1,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode, patterns).size());
        
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPattern2s =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*", -1)));
         parentNode = new PersistedNodeData("parent2-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
View Full Code Here


         assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
         assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> nodePatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-node", -1)));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildNodesData(parentNode, nodePatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildNodesData(parentNode, nodePatterns);
               chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
                  QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
                  Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
               cwdm.save(chlog);
            }
         };
         con.setCanModify(true);
         parentNode = new PersistedNodeData("parent-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
         parentNode = new PersistedNodeData("parent-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*", -1)));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildPropertiesData(parentNode, propPatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildPropertiesData(parentNode, propPatterns);
               chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
                  parentNode.getQPath(), new InternalQName(null, "my-property1")), parentNode.getIdentifier(), 0,
                  PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
               cwdm.save(chlog);
            }
         };
         parentNode = new PersistedNodeData("parent-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
         parentNode = new PersistedNodeData("parent-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node14")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());

         // testConsistency
         con = new MyWorkspaceStorageConnection(true);
         wdc = new MyWorkspaceDataContainer(con);
         wsc = repository.getWorkspaceContainer("ws");
         wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
         cwdmNode1 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache1, new SystemDataContainerHolder(wdc));
         cwdmNode2 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache2, new SystemDataContainerHolder(wdc));
         parentNode = new PersistedNodeData("parent2-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         // Test getChildNodesData
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         PlainChangesLog chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(chlog);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node2")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node2")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(chlog);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode).size());
       
         // Test getChildPropertiesData
         parentNode = new PersistedNodeData("parent2-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node3")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "property")), parentNode.getIdentifier(), 0,
            PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
         cwdmNode1.save(chlog);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node4")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
            PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
         cwdmNode1.save(chlog);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode).size());

         // Test getReferencesData
         parentNode = new PersistedNodeData("parent2-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node5")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "reference")), parentNode.getIdentifier(), 0,
            PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
         cwdmNode1.save(chlog);
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
         parentNode = new PersistedNodeData("parent2-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node6")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
            PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
         cwdmNode1.save(chlog);
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> patterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-node", -1)));
         parentNode = new PersistedNodeData("parent2-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(chlog);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, patterns).size());
         parentNode = new PersistedNodeData("parent2-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath
            .makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 1), parentNode.getIdentifier(), 1, 1,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(chlog);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode, patterns).size());
        
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPattern2s =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*", -1)));
         parentNode = new PersistedNodeData("parent2-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
View Full Code Here

         assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
         assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> nodePatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-node", -1)));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildNodesData(parentNode, nodePatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildNodesData(parentNode, nodePatterns);
               chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
                  QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
                  Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         con.setCanModify(true);
         parentNode = new PersistedNodeData("parent-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
         parentNode = new PersistedNodeData("parent-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*", -1)));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildPropertiesData(parentNode, propPatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildPropertiesData(parentNode, propPatterns);
               chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
                  parentNode.getQPath(), new InternalQName(null, "my-property1")), parentNode.getIdentifier(), 0,
                  PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         parentNode = new PersistedNodeData("parent-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
         parentNode = new PersistedNodeData("parent-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node14")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());

         // testConsistency
         con = new MyWorkspaceStorageConnection(true);
         wdc = new MyWorkspaceDataContainer(con);
         wsc = repository.getWorkspaceContainer("ws");
         wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
         cwdmNode1 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache1, new SystemDataContainerHolder(wdc));
         cwdmNode2 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache2, new SystemDataContainerHolder(wdc));
         parentNode = new PersistedNodeData("parent2-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         // Test getChildNodesData
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         PlainChangesLog chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node2")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node2")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode).size());
       
         // Test getChildPropertiesData
         parentNode = new PersistedNodeData("parent2-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node3")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "property")), parentNode.getIdentifier(), 0,
            PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node4")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "property2")), parentNode.getIdentifier(), 0,
            PropertyType.STRING, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode).size());

         // Test getReferencesData
         parentNode = new PersistedNodeData("parent2-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node5")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "reference")), parentNode.getIdentifier(), 0,
            PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
         parentNode = new PersistedNodeData("parent2-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node6")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(), QPath.makeChildPath(
            parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode.getIdentifier(), 0,
            PropertyType.REFERENCE, false, Arrays.asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> patterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-node", -1)));
         parentNode = new PersistedNodeData("parent2-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, patterns).size());
         parentNode = new PersistedNodeData("parent2-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath
            .makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 1), parentNode.getIdentifier(), 1, 1,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode, patterns).size());
        
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPattern2s =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*", -1)));
         parentNode = new PersistedNodeData("parent2-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
View Full Code Here

   public void testUUIDGetChildNodesDataPatternFilters() throws RepositoryException
   {
      NodeData rootData = (NodeData)cwdm.getItemData(testNode.getIdentifier());
      final List<QPathEntryFilter> nodePatterns =
         Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
            "node")));
      List<NodeData> list = cwdm.getChildNodesData(rootData, nodePatterns);
      checkNodeUUID(list);

   }
View Full Code Here

   public void testUUIDGetChildPropertiesDataPatternFilters() throws RepositoryException
   {
      NodeData rootData = (NodeData)cwdm.getItemData(testNode.getIdentifier());
      final List<QPathEntryFilter> nodePatterns =
         Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
            "node")));
      List<PropertyData> list = cwdm.getChildPropertiesData(rootData, nodePatterns);
      checkPropertyUUID(list);

   }
View Full Code Here

         assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
         assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> nodePatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
"my-node")));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildNodesData(parentNode, nodePatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildNodesData(parentNode, nodePatterns);
               chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
                  QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
                  Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         con.setCanModify(true);
         parentNode = new PersistedNodeData("parent-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
         parentNode = new PersistedNodeData("parent-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*")));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildPropertiesData(parentNode, propPatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildPropertiesData(parentNode, propPatterns);
               chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property"
                  + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null,
                  "my-property1")), parentNode.getIdentifier(), 0, PropertyType.STRING, false, Arrays
                  .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))),
                  new SimplePersistedSize(0))));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         parentNode = new PersistedNodeData("parent-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
         parentNode = new PersistedNodeData("parent-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node14")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());

         // testConsistency
         con = new MyWorkspaceStorageConnection(true);
         wdc = new MyWorkspaceDataContainer(con);
         wsc = repository.getWorkspaceContainer("ws");
         wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
         cwdmNode1 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache1, new SystemDataContainerHolder(wdc));
         cwdmNode2 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache2, new SystemDataContainerHolder(wdc));
         parentNode = new PersistedNodeData("parent2-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         // Test getChildNodesData
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         PlainChangesLog chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node2")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node2")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode).size());
       
         // Test getChildPropertiesData
         parentNode = new PersistedNodeData("parent2-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node3")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "property")),
            parentNode.getIdentifier(), 0, PropertyType.STRING, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node4")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "property2")), parentNode
               .getIdentifier(), 0, PropertyType.STRING, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode).size());

         // Test getReferencesData
         parentNode = new PersistedNodeData("parent2-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node5")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "reference")), parentNode
               .getIdentifier(), 0, PropertyType.REFERENCE, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
         parentNode = new PersistedNodeData("parent2-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node6")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode
               .getIdentifier(), 0, PropertyType.REFERENCE, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> patterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
"my-node")));
         parentNode = new PersistedNodeData("parent2-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, patterns).size());
         parentNode = new PersistedNodeData("parent2-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath
            .makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 1), parentNode.getIdentifier(), 1, 1,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode, patterns).size());
        
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPattern2s =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*")));
         parentNode = new PersistedNodeData("parent2-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
View Full Code Here

         assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
         assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> nodePatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
"my-node")));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildNodesData(parentNode, nodePatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildNodesData(parentNode, nodePatterns);
               chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
                  QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
                  Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         con.setCanModify(true);
         parentNode = new PersistedNodeData("parent-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
         parentNode = new PersistedNodeData("parent-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*")));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildPropertiesData(parentNode, propPatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildPropertiesData(parentNode, propPatterns);
               chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property"
                  + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null,
                  "my-property1")), parentNode.getIdentifier(), 0, PropertyType.STRING, false, Arrays
                  .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))),
                  new SimplePersistedSize(0))));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         parentNode = new PersistedNodeData("parent-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
         parentNode = new PersistedNodeData("parent-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node14")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());

         // testConsistency
         con = new MyWorkspaceStorageConnection(true);
         wdc = new MyWorkspaceDataContainer(con);
         wsc = repository.getWorkspaceContainer("ws");
         wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
         cwdmNode1 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache1, new SystemDataContainerHolder(wdc));
         cwdmNode2 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache2, new SystemDataContainerHolder(wdc));
         parentNode = new PersistedNodeData("parent2-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         // Test getChildNodesData
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         PlainChangesLog chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node2")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node2")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode).size());
       
         // Test getChildPropertiesData
         parentNode = new PersistedNodeData("parent2-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node3")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "property")),
            parentNode.getIdentifier(), 0, PropertyType.STRING, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node4")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "property2")), parentNode
               .getIdentifier(), 0, PropertyType.STRING, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode).size());

         // Test getReferencesData
         parentNode = new PersistedNodeData("parent2-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node5")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "reference")), parentNode
               .getIdentifier(), 0, PropertyType.REFERENCE, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
         parentNode = new PersistedNodeData("parent2-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node6")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode
               .getIdentifier(), 0, PropertyType.REFERENCE, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> patterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
"my-node")));
         parentNode = new PersistedNodeData("parent2-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, patterns).size());
         parentNode = new PersistedNodeData("parent2-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath
            .makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 1), parentNode.getIdentifier(), 1, 1,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode, patterns).size());
        
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPattern2s =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*")));
         parentNode = new PersistedNodeData("parent2-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
View Full Code Here

         assertNotNull(cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY));
         assertEquals(2, cwdmNode2.getItemData(parentNode, qpe, ItemType.PROPERTY).getPersistedVersion());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> nodePatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
"my-node")));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildNodesData(parentNode, nodePatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildNodesData(parentNode, nodePatterns);
               chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
                  QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
                  Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         con.setCanModify(true);
         parentNode = new PersistedNodeData("parent-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
         parentNode = new PersistedNodeData("parent-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, nodePatterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, nodePatterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, nodePatterns).size());
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPatterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*")));
         readAction = new Action(cwdmNode2)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               cwdm.getChildPropertiesData(parentNode, propPatterns);
            }
         };
         writeAction = new Action(cwdmNode1)
         {
            public void execute(NodeData parentNode) throws Exception
            {
               PlainChangesLog chlog = new PlainChangesLogImpl();
               cwdm.getChildPropertiesData(parentNode, propPatterns);
               chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property"
                  + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null,
                  "my-property1")), parentNode.getIdentifier(), 0, PropertyType.STRING, false, Arrays
                  .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))),
                  new SimplePersistedSize(0))));
               cwdm.save(new TransactionChangesLog(chlog));
            }
         };
         parentNode = new PersistedNodeData("parent-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.READ_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());
         parentNode = new PersistedNodeData("parent-id14", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent-node14")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         executeConcurrentReadNWrite(con, readAction, writeAction, Mode.WRITE_FIRST, parentNode);
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode, propPatterns).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode, propPatterns));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode, propPatterns).size());

         // testConsistency
         con = new MyWorkspaceStorageConnection(true);
         wdc = new MyWorkspaceDataContainer(con);
         wsc = repository.getWorkspaceContainer("ws");
         wconf = (WorkspaceEntry)wsc.getComponent(WorkspaceEntry.class);
         cwdmNode1 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache1, new SystemDataContainerHolder(wdc));
         cwdmNode2 =
            new CacheableWorkspaceDataManager(wconf, wdc, cache2, new SystemDataContainerHolder(wdc));
         parentNode = new PersistedNodeData("parent2-id", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         // Test getChildNodesData
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         PlainChangesLog chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("id-node" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id2", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node2")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("id-node2" + parentNode.getIdentifier(), QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "node2")), parentNode.getIdentifier(), 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode).size());
       
         // Test getChildPropertiesData
         parentNode = new PersistedNodeData("parent2-id3", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node3")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-property" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "property")),
            parentNode.getIdentifier(), 0, PropertyType.STRING, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(2, cwdmNode2.getChildPropertiesData(parentNode).size());
         parentNode = new PersistedNodeData("parent2-id4", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node4")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-property2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "property2")), parentNode
               .getIdentifier(), 0, PropertyType.STRING, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, "some data".getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode1.getChildPropertiesData(parentNode).size());
         assertNotNull(cwdmNode2.getChildPropertiesData(parentNode));
         assertEquals(0, cwdmNode2.getChildPropertiesData(parentNode).size());

         // Test getReferencesData
         parentNode = new PersistedNodeData("parent2-id5", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node5")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedPropertyData("id-reference" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "reference")), parentNode
               .getIdentifier(), 0, PropertyType.REFERENCE, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(2, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
         parentNode = new PersistedNodeData("parent2-id6", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node6")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getReferencesData(parentNode.getIdentifier(), false);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedPropertyData("id-reference2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new InternalQName(null, "reference2")), parentNode
               .getIdentifier(), 0, PropertyType.REFERENCE, false, Arrays
               .asList((ValueData)new ByteArrayPersistedValueData(0, parentNode.getIdentifier().getBytes("UTF-8"))),
            new SimplePersistedSize(0))));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode1.getReferencesData(parentNode.getIdentifier(), false).size());
         assertNotNull(cwdmNode2.getReferencesData(parentNode.getIdentifier(), false));
         assertEquals(0, cwdmNode2.getReferencesData(parentNode.getIdentifier(), false).size());
        
         // Test getChildNodesData by patterns
         final List<QPathEntryFilter> patterns =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
"my-node")));
         parentNode = new PersistedNodeData("parent2-id11", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node11")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createAddedState(new PersistedNodeData("my-node2" + parentNode.getIdentifier(),
            QPath.makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 2), parentNode.getIdentifier(), 1, 2,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(2, cwdmNode2.getChildNodesData(parentNode, patterns).size());
         parentNode = new PersistedNodeData("parent2-id12", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node12")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildNodesData(parentNode, patterns);
         chlog = new PlainChangesLogImpl();
         chlog.add(ItemState.createDeletedState(new PersistedNodeData("my-node" + parentNode.getIdentifier(), QPath
            .makeChildPath(parentNode.getQPath(), new QName("", "my-node"), 1), parentNode.getIdentifier(), 1, 1,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null)));
         cwdmNode1.save(new TransactionChangesLog(chlog));
         assertNotNull(cwdmNode1.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode1.getChildNodesData(parentNode, patterns).size());
         assertNotNull(cwdmNode2.getChildNodesData(parentNode, patterns));
         assertEquals(0, cwdmNode2.getChildNodesData(parentNode, patterns).size());
        
        
         // Test getChildPropertiesData by patterns
         final List<QPathEntryFilter> propPattern2s =
            Collections.singletonList((QPathEntryFilter)new PatternQPathEntryFilter(new PatternQPathEntry("",
               "my-property*")));
         parentNode = new PersistedNodeData("parent2-id13", QPath.makeChildPath(Constants.ROOT_PATH, new InternalQName(null, "parent2-node13")), Constants.ROOT_UUID, 1, 0,
            Constants.NT_UNSTRUCTURED, new InternalQName[0], null);
         con.setParentNode(parentNode);
         cwdmNode2.getChildPropertiesData(parentNode, propPattern2s);
View Full Code Here

TOP

Related Classes of org.exoplatform.services.jcr.impl.core.itemfilters.PatternQPathEntryFilter

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.