Package org.lilyproject.repository.model.api

Examples of org.lilyproject.repository.model.api.RepositoryModel


        IdGenerator idGenerator = new IdGeneratorImpl();
        configuration = HBASE_PROXY.getConf();
        zooKeeper = new StateWatchingZooKeeper(HBASE_PROXY.getZkConnectString(), 10000);
        hbaseTableFactory = new HBaseTableFactoryImpl(HBASE_PROXY.getConf());

        RepositoryModel repositoryModel = new RepositoryModelImpl(zooKeeper);

        typeManager = new HBaseTypeManager(idGenerator, configuration, zooKeeper, hbaseTableFactory);

        DFSBlobStoreAccess dfsBlobStoreAccess = new DFSBlobStoreAccess(HBASE_PROXY.getBlobFS(), new Path("/lily/blobs"));
        List<BlobStoreAccess> blobStoreAccesses = Collections.<BlobStoreAccess>singletonList(dfsBlobStoreAccess);
View Full Code Here


        return lilyServerTestUtility;
    }

    public void createRepository(String repositoryName) {
        try {
            RepositoryModel model = new RepositoryModelImpl(getZooKeeper());
            if (!model.repositoryExistsAndActive(repositoryName)) {
                model.create(repositoryName);
                model.waitUntilRepositoryInState(repositoryName, RepositoryDefinition.RepositoryLifecycleState.ACTIVE,
                        100000);
            }
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
View Full Code Here

    /**
     * Trying to get a non-existing table should fail.
     */
    @Test(expected = RepositoryExistsException.class)
    public void testCreateRepositoryTwice() throws Exception {
        RepositoryModel repositoryModel = repoSetup.getRepositoryModel();
        repositoryModel.create("somerepo");
        repositoryModel.create("somerepo");
    }
View Full Code Here

     * Tests that two repositories can have a table with the same name containing records with the
     * same id's, without conflict.
     */
    @Test
    public void testTwoRepositoriesSameTableSameId() throws Exception {
        RepositoryModel repositoryModel = repoSetup.getRepositoryModel();
        repositoryModel.create("company1");
        repositoryModel.create("company2");
        assertTrue(repositoryModel.waitUntilRepositoryInState("company1", RepositoryDefinition.RepositoryLifecycleState.ACTIVE, 60000L));
        assertTrue(repositoryModel.waitUntilRepositoryInState("company2", RepositoryDefinition.RepositoryLifecycleState.ACTIVE, 60000L));

        TypeManager typeMgr = repositoryManager.getDefaultRepository().getTypeManager();
        FieldType fieldType1 = typeMgr.createFieldType("STRING", new QName("test", "field1"), Scope.NON_VERSIONED);
        RecordType recordType1 = typeMgr.recordTypeBuilder()
                .name(new QName("test", "rt1"))
View Full Code Here

    }

    @Test
    public void testBasicTableManagement() throws Exception {
        String repositoryName = "tablemgmttest";
        RepositoryModel repositoryModel = repoSetup.getRepositoryModel();
        repositoryModel.create(repositoryName);
        assertTrue(repositoryModel.waitUntilRepositoryInState(repositoryName, RepositoryDefinition.RepositoryLifecycleState.ACTIVE, 60000L));

        LRepository repository = repositoryManager.getRepository(repositoryName);
        TableManager tableManager = repository.getTableManager();

        List<RepositoryTable> tables = tableManager.getTables();
View Full Code Here

    }

    private static HBaseRepository createHBaseRepository(String repositoryName, String tableName, ZooKeeperItf zk,
                                                         Configuration conf, HBaseTableFactory hbaseTableFactory)
            throws KeeperException, InterruptedException, IOException, RepositoryException {
        RepositoryModel repositoryModel = new RepositoryModelImpl(zk);
        IdGenerator idGenerator = new IdGeneratorImpl();
        TypeManager typeManager = new HBaseTypeManager(idGenerator, conf, zk, hbaseTableFactory);
        RecordFactory recordFactory = new RecordFactoryImpl();

        RepositoryManager repositoryManager = new HBaseRepositoryManager(typeManager, idGenerator,
View Full Code Here

    @Test
    public void testTwoModelInstances() throws Exception {
        ZooKeeperItf zk1 = ZkUtil.connect("localhost:" + zkClientPort, 15000);
        ZooKeeperItf zk2 = ZkUtil.connect("localhost:" + zkClientPort, 15000);
        RepositoryModel repositoryModel1 = new RepositoryModelImpl(zk1);
        RepositoryModel repositoryModel2 = new RepositoryModelImpl(zk2);

        TestListener model1Listener = new TestListener();
        assertEquals(1, repositoryModel1.getRepositories(model1Listener).size());

        TestListener model2Listener = new TestListener();
        assertEquals(1, repositoryModel2.getRepositories(model2Listener).size());

        repositoryModel1.create("repo1");
        repositoryModel1.create("repo2");
        repositoryModel2.create("repo3");
        repositoryModel2.create("repo4");

        model2Listener.waitForEvents(4);
        model1Listener.waitForEvents(4);

        assertEquals(5, repositoryModel1.getRepositories().size());
        assertEquals(5, repositoryModel2.getRepositories().size());

        ((RepositoryModelImpl)repositoryModel1).close();
        ((RepositoryModelImpl)repositoryModel2).close();

        zk1.close();
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.model.api.RepositoryModel

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.