Package org.exist.storage.serializers

Examples of org.exist.storage.serializers.Serializer


          pool = startDB();
          assertNotNull(pool);
          broker = pool.get(pool.getSecurityManager().getSystemSubject());
          assertNotNull(broker);
         
            Serializer serializer = broker.getSerializer();
            serializer.reset();           
            DocumentImpl doc = broker.getXMLResource(XmldbURI.ROOT_COLLECTION_URI.append("destination/test3/test.xml"), Lock.READ_LOCK);
            assertNotNull("Document should be null", doc);
      } catch (Exception e) {
        e.printStackTrace();
          fail(e.getMessage());             
View Full Code Here


      System.out.println("testRead() ...\n");
      pool = startDB();
      assertNotNull(pool);
      broker = pool.get(pool.getSecurityManager().getSystemSubject());
      assertNotNull(broker);
      Serializer serializer = broker.getSerializer();
      serializer.reset();

      DocumentImpl doc = broker.getXMLResource(XmldbURI.ROOT_COLLECTION_URI.append("test").append(testCollectionName).append("new_test.xml"), Lock.READ_LOCK);
      assertNotNull("Document should not be null", doc);
      String data = serializer.serialize(doc);
      assertNotNull(data);
      //System.out.println(data);
      doc.getUpdateLock().release(Lock.READ_LOCK);
      } catch (Exception e) {           
          fail(e.getMessage());      
View Full Code Here

      System.out.println("testReadAborted() ...\n");
      pool = startDB();
      assertNotNull(pool);
      broker = pool.get(pool.getSecurityManager().getSystemSubject());
      assertNotNull(broker);
      Serializer serializer = broker.getSerializer();
      serializer.reset();

      DocumentImpl doc = broker.getXMLResource(XmldbURI.ROOT_COLLECTION_URI.append("test").append(testCollectionName).append(subCollection).append("test2.xml"),  Lock.READ_LOCK);
      assertNotNull("Document should not be null", doc);
      String data = serializer.serialize(doc);
      assertNotNull(data);
      //System.out.println(data);
      doc.getUpdateLock().release(Lock.READ_LOCK);

      doc = broker.getXMLResource(XmldbURI.ROOT_COLLECTION_URI.append("test").append(testCollectionName).append("new_test2.xml"), Lock.READ_LOCK);
View Full Code Here

    }
 
    @Test
    public void testOptimizations() throws XPathException, SAXException, PermissionDeniedException {
           
        Serializer serializer = broker.getSerializer();
        serializer.reset();
        DocumentSet docs = root.allDocs(broker, new DefaultDocumentSet(), true);

        System.out.println("------------ Testing NativeElementIndex.findChildNodesByTagName ---------");
        // parent set: 1.1.1; child set: 1.1.1.1, 1.1.1.2, 1.1.1.3, 1.1.2.1, 1.2.1
        ExtNodeSet nestedSet = (ExtNodeSet) executeQuery(broker, "//section[@n = '1.1.1']", 1, null);
View Full Code Here

        }
        return seq;
    }

    private static String serialize(DBBroker broker, Item item) throws SAXException, XPathException {
        Serializer serializer = broker.getSerializer();
 
        serializer.reset();
        String value;
        if(Type.subTypeOf(item.getType(), Type.NODE)) {
            value = serializer.serialize((NodeValue) item);
        } else
            value = item.getStringValue();
        }
        return value;
    }
View Full Code Here

     
      assertNotNull(docType);
     
      assertEquals("-//OASIS//DTD DITA Reference//EN", docType.getPublicId());
     
      Serializer serializer = broker.getSerializer();
      serializer.reset();
     
      serializer.setProperties(OUTPUT_PROPERTIES);
     
      String serialized = serializer.serialize(doc);

      System.out.println(serialized);
      assertTrue("Checking for Public Id in output", serialized.contains("-//OASIS//DTD DITA Reference//EN"));
       
     
View Full Code Here

     
      assertNotNull(docType);
     
      assertEquals("-//OASIS//DTD DITA Topic//EN", docType.getPublicId());
     
      Serializer serializer = broker.getSerializer();
      serializer.reset();
     
      serializer.setProperties(OUTPUT_PROPERTIES);
     
      String serialized = serializer.serialize(doc);
     
      System.out.println(serialized);
     
      assertTrue("Checking for Public Id in output", serialized.contains("-//OASIS//DTD DITA Topic//EN"));
     
View Full Code Here

            }
           
            Sequence seq = xquery.execute("/products", null, AccessContext.TEST);
            assertEquals(seq.getItemCount(), 1);
           
            Serializer serializer = broker.getSerializer();
            System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));
           
            seq = xquery.execute("//product", null, AccessContext.TEST);
            assertEquals(ITEMS_TO_APPEND, seq.getItemCount());
           
            seq = xquery.execute("//product[price > 0.0]", null, AccessContext.TEST);
View Full Code Here

            }

            Sequence seq = xquery.execute("/products", null, AccessContext.TEST);
            assertEquals(seq.getItemCount(), 1);

            Serializer serializer = broker.getSerializer();
            System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));

            seq = xquery.execute("//product", null, AccessContext.TEST);
            assertEquals(ITEMS_TO_APPEND, seq.getItemCount());

            seq = xquery.execute("//product[@name = 'n20']", null, AccessContext.TEST);
            assertEquals(1, seq.getItemCount());

            store(broker, "attribs.xml", "<test attr1='aaa' attr2='bbb'>ccc</test>");
            query = "update insert attribute attr1 { 'eee' } into /test";

            System.out.println("testing duplicate attribute ...");
            xquery.execute(query, null, AccessContext.TEST);

            seq = xquery.execute("xmldb:document('" + TEST_COLLECTION + "/attribs.xml')/test[@attr1 = 'eee']", null, AccessContext.TEST);
            assertEquals(1, seq.getItemCount());
            System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));

            System.out.println("testAppendAttributes: PASS");
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
View Full Code Here

            }

            Sequence seq = xquery.execute("/products", null, AccessContext.TEST);
            assertEquals(seq.getItemCount(), 1);

            Serializer serializer = broker.getSerializer();
            System.out.println(serializer.serialize((NodeValue) seq.itemAt(0)));

            seq = xquery.execute("//product", null, AccessContext.TEST);
            assertEquals(ITEMS_TO_APPEND + 1, seq.getItemCount());

            seq = xquery.execute("//product[price > 0.0]", null, AccessContext.TEST);
View Full Code Here

TOP

Related Classes of org.exist.storage.serializers.Serializer

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.