Package org.exist.storage

Examples of org.exist.storage.BrokerPool$StatusReporter


                pool.release(broker);
        }
    }
   
    public void testCheckIndex() {
        BrokerPool pool = null;
        DBBroker broker = null;
        try
            pool = BrokerPool.getInstance();
            assertNotNull(pool);
            broker = pool.get(pool.getSecurityManager().getSystemSubject());
            AbstractGMLJDBCIndex index = (AbstractGMLJDBCIndex)pool.getIndexManager().getIndexById(AbstractGMLJDBCIndex.ID);
            //Unplugged
            if (index == null)
                System.out.println("No spatial index found");
            else
                assertTrue(index.checkIndex(broker));
        } catch (Exception e) {
            e.printStackTrace();
            fail(e.getMessage());
        } finally {
            if (pool !=null)
                pool.release(broker);
        }
    }
View Full Code Here


        brokerPool.enterServiceMode(user);
        return true;
    }

    public void exitServiceMode() throws PermissionDeniedException, EXistException {
        final BrokerPool brokerPool = factory.getBrokerPool();
        brokerPool.exitServiceMode(user);
    }
View Full Code Here

        }
        return true;
    }

    public boolean enterServiceMode() throws PermissionDeniedException, EXistException {
        final BrokerPool brokerPool = factory.getBrokerPool();
        brokerPool.enterServiceMode(user);
        return true;
    }
View Full Code Here

  public void testCollectionMaintainsLockWhenResourceIsSelectedNoLock() throws EXistException, InterruptedException {
   
    storeTestResource();

        DBBroker broker = null;
        BrokerPool pool = BrokerPool.getInstance();
       
    try {
      broker = pool.get(pool.getSecurityManager().getSystemSubject());
     
      Collection testCollection = broker.openCollection(TestConstants.TEST_COLLECTION_URI, Lock.READ_LOCK);
      try{

        XmldbURI docPath = TestConstants.TEST_COLLECTION_URI.append(DOCUMENT_NAME_URI);
       
        BinaryDocument binDoc = (BinaryDocument) broker.getXMLResource(docPath, Lock.NO_LOCK);
       
        // if document is not present, null is returned
        if(binDoc == null)
          fail("Binary document '" + docPath + " does not exist.");

       
        assertEquals("Collection does not have lock!", true, testCollection.getLock().hasLock());
       
      }finally{
          if(testCollection != null) testCollection.getLock().release(Lock.READ_LOCK);
      }
     
    } catch (Exception ex){
      fail("Error opening document" + ex);
       
    } finally {
      if(pool!=null){
        pool.release(broker);
      }
    }

    assertEquals(1, 1);
  }
View Full Code Here

  }
 

    private void storeTestResource() throws EXistException {
       
        BrokerPool pool = BrokerPool.getInstance();
        DBBroker broker = null;
        try {
            broker = pool.get(pool.getSecurityManager().getSystemSubject());
            TransactionManager transact = pool.getTransactionManager();
           
            Txn transaction = transact.beginTransaction();
            System.out.println("Transaction started ...");
           
            Collection collection = broker
                    .getOrCreateCollection(transaction, TestConstants.TEST_COLLECTION_URI);
           
            broker.saveCollection(transaction, collection);
           
            @SuppressWarnings("unused")
      BinaryDocument doc =
                    collection.addBinaryResource(transaction, broker,
                    DOCUMENT_NAME_URI , EMPTY_BINARY_FILE.getBytes(), "text/text");
           
            transact.commit(transaction);
            System.out.println("Transaction commited ...");
        } catch (Exception e) {
            fail(e.getMessage());
           
        } finally {
            pool.release(broker);
        }
    }
View Full Code Here

public class DocumentImplTest {

    @Test
    public void copyOf_calls_getMetadata() {

        BrokerPool mockBrokerPool = EasyMock.createMock(BrokerPool.class);
        Database mockDatabase = EasyMock.createMock(Database.class);
        Subject mockCurrentSubject = EasyMock.createMock(Subject.class);
        Group mockCurrentSubjectGroup= EasyMock.createMock(Group.class);
        SecurityManager mockSecurityManager = EasyMock.createMock(SecurityManager.class);
        PermissionFactory.sm = mockSecurityManager;
View Full Code Here

        assertEquals(1, doc.getMetadata_invCount());
    }

    @Test
    public void copyOf_calls_metadata_copyOf() {
        BrokerPool mockBrokerPool = EasyMock.createMock(BrokerPool.class);
        Database mockDatabase = EasyMock.createMock(Database.class);
        Subject mockCurrentSubject = EasyMock.createMock(Subject.class);
        Group mockCurrentSubjectGroup= EasyMock.createMock(Group.class);
        SecurityManager mockSecurityManager = EasyMock.createMock(SecurityManager.class);
        PermissionFactory.sm = mockSecurityManager;
View Full Code Here

        assertEquals(1, docMetadata.getCopyOf_invCount());
    }

    @Test
    public void copyOf_updates_metadata_created_and_lastModified() {
        BrokerPool mockBrokerPool = EasyMock.createMock(BrokerPool.class);
        Database mockDatabase = EasyMock.createMock(Database.class);
        Subject mockCurrentSubject = EasyMock.createMock(Subject.class);
        Group mockCurrentSubjectGroup= EasyMock.createMock(Group.class);
        SecurityManager mockSecurityManager = EasyMock.createMock(SecurityManager.class);
        PermissionFactory.sm = mockSecurityManager;
View Full Code Here

    @Test
    public void getTransformerFactory() {

        final  Hashtable<String,Object> testAttributes = new Hashtable<String,Object>();

        BrokerPool mockBrokerPool = EasyMock.createMock(BrokerPool.class);
        Configuration mockConfiguration = EasyMock.createMock(Configuration.class);

        expect(mockBrokerPool.getConfiguration()).andReturn(mockConfiguration);
        expect(mockConfiguration.getProperty(TransformerFactoryAllocator.PROPERTY_TRANSFORMER_CLASS)).andReturn(transformerFactoryClass);
        expect(mockBrokerPool.getConfiguration()).andReturn(mockConfiguration);
        expect(mockConfiguration.getProperty(TransformerFactoryAllocator.PROPERTY_TRANSFORMER_ATTRIBUTES)).andReturn(testAttributes);

        replay(mockBrokerPool, mockConfiguration);

        SAXTransformerFactory transformerFactory = TransformerFactoryAllocator.getTransformerFactory(mockBrokerPool);
View Full Code Here

  class EnterServiceMode implements Runnable {

    @Override
    public void run() {
          try {
            BrokerPool db = BrokerPool.getInstance();
       
            Subject subject = db.getSecurityManager().getSystemSubject();
        try {
          db.enterServiceMode(subject);
              System.out.println("enter servise mode "+Thread.currentThread());
         
          //do something
          Thread.sleep(100);
        } finally {
          db.exitServiceMode(subject);
        }
       
      } catch (Exception e) {
        fail(e.getMessage());
      }
View Full Code Here

TOP

Related Classes of org.exist.storage.BrokerPool$StatusReporter

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.