Examples of EncodedBuffer


Examples of org.dbxml.core.corba.db.EncodedBuffer

         String newcolname = "testchild";
         // Config XML for valid collection created
         String colconf = "<collection compressed=\"true\" name=\"" + newcolname + "\" >" ;
            colconf = colconf + "<filer class=\"org.dbxml.core.filer.BTreeFiler\" gzip=\"true\"/>" ;
            colconf = colconf + "</collection>" ;
         EncodedBuffer colconfbuf = new EncodedBuffer(-1, EmptyBytes, colconf.getBytes() );
        
         // Create the collection
         tempcol = colman.createCollection(newcolname, colconfbuf);
        
         // Verify that collection created, and that name was set correctly
         assertTrue( tempcol.getName().equals( newcolname ) );

         // Now drop the collection
         colman.dropCollection( newcolname );
                
         // Attempt to create a collection with an empty configuration
         try {
            exceptioncaught = false;
            String empty = "";
            EncodedBuffer emptybuf = new EncodedBuffer(-1, EmptyBytes, empty.getBytes() );
            tempcol = colman.createCollection("NullConfig", emptybuf );
           
         } catch( APIException e ) {
            exceptioncaught = true;
            assertTrue( e.faultCode == FaultCodes.JAVA_RUNTIME_ERROR );
         } finally {
            assertTrue( exceptioncaught );
         }
        
         // Attempt to create a collection with a malformed configuration
         try {
            exceptioncaught = false;
           
            // Bad configuration file
            String malconf = "<bad config>lkjasf";
            EncodedBuffer malconfbuf = new EncodedBuffer(-1, EmptyBytes, malconf.getBytes() );
           
            // Attempt to create the collection
            tempcol = colman.createCollection("malconf", malconfbuf );
           
         } catch( APIException e ) {
            exceptioncaught = true;
            assertTrue( e.faultCode == FaultCodes.JAVA_RUNTIME_ERROR );
         } finally {
            assertTrue( exceptioncaught );
         }

         // Attempt to create a collection with an invalid configuration, missing name attribute
         try {
            exceptioncaught = false;
           
            // Bad configuration file
            String invalidconf = "<collection>" ;
            invalidconf = invalidconf + "<filer class=\"org.dbxml.core.filer.BTreeFiler\" gzip=\"true\"/>" ;
            invalidconf = invalidconf + "</collection>" ;
           
            EncodedBuffer invalidconfbuf = new EncodedBuffer(-1, EmptyBytes, invalidconf.getBytes() );
           
            // Attempt to create the collection
            tempcol = colman.createCollection("invalid", invalidconfbuf );
           
            // Test that the collection was created by calling getName() on it
            assertTrue( tempcol.getName().equals("invalid") );
           
            colman.dropCollection("invalid");
           
         } catch( APIException e ) {
            exceptioncaught = true;
            assertTrue( e.faultCode == FaultCodes.COL_CANNOT_CREATE );
         } finally {
            assertTrue( exceptioncaught );
         }

         // Attempt to create a collection without a filer attribute, this should be allowed

         exceptioncaught = false;
        
         String nofilerconf = "<collection name=\"nofiler\">" ;
         nofilerconf = nofilerconf + "</collection>" ;
        
         EncodedBuffer nofilerconfbuf = new EncodedBuffer(-1, EmptyBytes, nofilerconf.getBytes() );
        
         // Attempt to create the collection
         tempcol = colman.createCollection("nofiler", nofilerconfbuf );
        
         colman.dropCollection("nofiler");
View Full Code Here

Examples of org.dbxml.core.corba.db.EncodedBuffer

         String newcolname = "coltodrop";
         // Config XML for valid collection created
         String colconf = "<collection compressed=\"true\" name=\"" + newcolname + "\">" ;
            colconf = colconf + "<filer class=\"org.dbxml.core.filer.BTreeFiler\" gzip=\"true\"/>" ;
            colconf = colconf + "</collection>" ;
         EncodedBuffer colconfbuf = new EncodedBuffer(-1, EmptyBytes, colconf.getBytes() );
        
         // Create a collection
         tempcol = colman.createCollection(newcolname, colconfbuf);
         // Verify that collection created, and that name was set correctly
         assertTrue( tempcol.getName().equals( newcolname ) );
View Full Code Here

Examples of org.dbxml.core.corba.db.EncodedBuffer

         // Try adding a normal index
         try {
        
            String indexconf = "<index class=\"org.dbxml.core.indexer.ValueIndexer\" name=\"goodindex\" pattern=\"goodindex\" />";
            EncodedBuffer indexconfbuf = new EncodedBuffer(-1, EmptyBytes, indexconf.getBytes() );
            colman.createIndexer( indexconfbuf );
                      
         } catch( APIException e ) {
            fail( e.getMessage() );
         }

         // Try re-adding the same index, should thow IDX_DUPLICATE_INDEX
         try {
            exceptioncaught = false ;
            String indexconf = "<index class=\"org.dbxml.core.indexer.ValueIndexer\" name=\"goodindex\" pattern=\"goodindex\" />";
            EncodedBuffer indexconfbuf = new EncodedBuffer(-1, EmptyBytes, indexconf.getBytes() );
            colman.createIndexer( indexconfbuf );
                      
         } catch( APIException e ) {
            exceptioncaught = true ;
            assertTrue( e.faultCode == FaultCodes.IDX_DUPLICATE_INDEX );
         } finally {
            assertTrue( exceptioncaught == true );
         }

         // Try adding an index without a name in the configuration, IDX_CANNOT_CREATE
         try {
           
            exceptioncaught = false;
            String nonameindexconf = "<index class=\"org.dbxml.core.indexer.ValueIndexer\" pattern=\"nonameindex\" />";
            EncodedBuffer nonameindexconfbuf = new EncodedBuffer(-1, EmptyBytes, nonameindexconf.getBytes() );
            colman.createIndexer( nonameindexconfbuf );
           
         } catch( APIException e ) {
            exceptioncaught = true;
            assertTrue( e.faultCode == FaultCodes.IDX_CANNOT_CREATE );
         } finally {
            assertTrue( exceptioncaught == true );
         }
        
         // Try adding an index without a class
         try {
            exceptioncaught = false;
            String noclassindexconf = "<index name=\"noclass\" pattern=\"noclassindex\" />";
            EncodedBuffer noclassindexconfbuf = new EncodedBuffer(-1, EmptyBytes, noclassindexconf.getBytes() );
            colman.createIndexer( noclassindexconfbuf );
           
         } catch( APIException e ) {
            exceptioncaught = true;
            assertTrue( e.faultCode == FaultCodes.IDX_CANNOT_CREATE );
View Full Code Here

Examples of org.dbxml.core.corba.db.EncodedBuffer

        
         // Add an 5 indexers, verify that 5 were added, try to retrieve each of them by name
         for( int i = 1 ; i < 6 ; i++ ) {
            String indexname = "index" + i ;
            String indexconf = "<index class=\"org.dbxml.core.indexer.ValueIndexer\" name=\"" + indexname + "\" pattern=\"goodindex\" />";
            EncodedBuffer indexconfbuf = new EncodedBuffer(-1, EmptyBytes, indexconf.getBytes() );
            colman.createIndexer( indexconfbuf );
           
            assertTrue( colman.listIndexers().length == i );
           
            // Since we are not gauranteed the order these are returned in we must loop over each
View Full Code Here

Examples of org.dbxml.core.corba.db.EncodedBuffer

         // Add an 5 indexers
         for( int i = 1 ; i <= numindexes ; i++ ) {
            String indexname = "index" + i ;
            String indexconf = "<index class=\"org.dbxml.core.indexer.ValueIndexer\" name=\"" + indexname + "\" pattern=\"goodindex\" />";
            EncodedBuffer indexconfbuf = new EncodedBuffer(-1, EmptyBytes, indexconf.getBytes() );
            colman.createIndexer( indexconfbuf );
         }
        
         // Remove each indexer individually, verify the count and that it is deleted
         for( int i = 1 ; i <= numindexes ; i++ ) {
View Full Code Here

Examples of org.dbxml.core.corba.db.EncodedBuffer

   public void testCreateXMLObject() {
      try {
     
         // Create a normal XMLObject
         String objectconf = "<xmlobject class=\"org.dbxml.tests.TestXmlObject\" name=\"testxmlobject\"/>";
         EncodedBuffer objectconfbuf = new EncodedBuffer(-1, EmptyBytes, objectconf.getBytes() );
         colman.createXMLObject( objectconfbuf );
     
         // Try re-adding the same XMLObject, should throw OBJ_DUPLICATE_OBJECT
         try {
        
            exceptioncaught = false;
            colman.createXMLObject( objectconfbuf );
           
         } catch( APIException e) {
            exceptioncaught = true;
            assertTrue( e.faultCode == FaultCodes.OBJ_DUPLICATE_OBJECT );
         } finally {
            assertTrue( exceptioncaught );
         }
        
         // Try to add an object with no name in configuration
         try {
        
            // Create an XMLObject w/o name attribute
            String nonameobjectconf = "<xmlobject class=\"org.dbxml.tests.TestXmlObject\" />";
            EncodedBuffer nonameobjectconfbuf = new EncodedBuffer(-1, EmptyBytes, nonameobjectconf.getBytes() );
            colman.createXMLObject( nonameobjectconfbuf );
           
         } catch( APIException e) {
            exceptioncaught = true;
            assertTrue( e.faultCode == FaultCodes.OBJ_CANNOT_CREATE );
         } finally {
            assertTrue( exceptioncaught );
         }

         // Try to add an object with no class in configuration
         try {
        
            // Create an XMLObject w/o class attribute
            String nonameobjectconf = "<xmlobject name=\"noclassxmlobject\"/>";
            EncodedBuffer nonameobjectconfbuf = new EncodedBuffer(-1, EmptyBytes, nonameobjectconf.getBytes() );
            colman.createXMLObject( nonameobjectconfbuf );
           
         } catch( APIException e) {
            exceptioncaught = true;
            assertTrue( e.faultCode == FaultCodes.OBJ_CANNOT_CREATE );
         } finally {
            assertTrue( exceptioncaught );
         }

         // Try to add an object with a blank configuration
         try {
        
            // Create an XMLObject w/o class attribute
            String nonameobjectconf = "";
            EncodedBuffer nonameobjectconfbuf = new EncodedBuffer(-1, EmptyBytes, nonameobjectconf.getBytes() );
            colman.createXMLObject( nonameobjectconfbuf );
           
         } catch( APIException e) {
            exceptioncaught = true;
            assertTrue( e.faultCode == FaultCodes.JAVA_RUNTIME_ERROR );
View Full Code Here

Examples of org.dbxml.core.corba.db.EncodedBuffer

     
         // Create XMLObjects, verify that they were added, try to retrieve each of them by name
         for( int i = 1 ; i < 6 ; i++ ) {
            String objectname = "xmlobject" + i ;
            String objectconf = "<xmlobject class=\"org.dbxml.tests.TestXmlObject\" name=\"" + objectname + "\" />";
            EncodedBuffer objectconfbuf = new EncodedBuffer(-1, EmptyBytes, objectconf.getBytes() );
            colman.createXMLObject( objectconfbuf );

            assertTrue( colman.listXMLObjects().length == i );
           
            // Since we are not gauranteed the order these are returned in we must loop over each
View Full Code Here

Examples of org.dbxml.core.corba.db.EncodedBuffer

   public void testDropXMLObject() {
      try {
        
         // Add an XMLObject to drop
         String objectconf = "<xmlobject class=\"org.dbxml.tests.TestXmlObject\" name=\"droptest\" />";
         EncodedBuffer objectconfbuf = new EncodedBuffer(-1, EmptyBytes, objectconf.getBytes() );
         colman.createXMLObject( objectconfbuf );
     
         // Drop the object
         colman.dropXMLObject( "droptest" );
        
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.