Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.RecordId


    public void multipleDependants() throws Exception {
        String idPrefix = newIdPrefix();

        final SchemaId dummyVtag = ids.getSchemaId(UUID.randomUUID());
        final SchemaId dependencyField = ids.getSchemaId(UUID.randomUUID());
        final RecordId dependant1 = ids.newRecordId(idPrefix + "dependant1");
        final RecordId dependant2 = ids.newRecordId(idPrefix + "dependant2");
        final RecordId dependency = ids.newRecordId(idPrefix + "dependency");

        // the dependant1 and dependant2 depend on the dependencyField of the dependency
        final HashMap<DependencyEntry, Set<SchemaId>> dependencies =
                new HashMap<DependencyEntry, Set<SchemaId>>();
        dependencies.put(new DependencyEntry(absId(dependency)),
                Sets.newHashSet(dependencyField));
        derefMap.updateDependants(absId(dependant1), dummyVtag, dependencies);
        derefMap.updateDependants(absId(dependant2), dummyVtag, dependencies);

        // consistency check dependant1
        final Set<DependencyEntry> dependenciesOf1 = derefMap.findDependencies(absId(dependant1), dummyVtag);
        assertEquals(1, dependenciesOf1.size());
        assertEquals(absId(dependency.getMaster()), dependenciesOf1.iterator().next().getDependency());

        // consistency check dependant2
        final Set<DependencyEntry> dependenciesOf2 = derefMap.findDependencies(absId(dependant1), dummyVtag);
        assertEquals(1, dependenciesOf2.size());
        assertEquals(absId(dependency.getMaster()), dependenciesOf2.iterator().next().getDependency());

        // check that both dependant1 and dependant2 are found as dependants of the dependency
        final DependantRecordIdsIterator dependants =
                derefMap.findDependantsOf(absId(dependency), dependencyField, dummyVtag);
        assertTrue(dependants.hasNext());
View Full Code Here


    public void resultIndependentOfOrder() throws Exception {
        for (int i = 0; i < 10; i++) {
            final SchemaId dummyVtag = ids.getSchemaId(UUID.randomUUID());
            final SchemaId dependencyField = ids.getSchemaId(UUID.randomUUID());

            final RecordId master = ids.newRecordId();
            final RecordId var1 = ids.newRecordId(master, Collections.singletonMap("prop1", "x"));
            final RecordId var2 = ids.newRecordId(master, map("prop1", "x", "prop2", "y"));

            Set<SchemaId> fields = Sets.newHashSet(dependencyField);

            Map<DependencyEntry, Set<SchemaId>> dependencies = Maps.newHashMap();
            dependencies.put(new DependencyEntry(absId(master)), fields);
View Full Code Here

        final SchemaId tag1 = ids.getSchemaId(UUID.randomUUID());
        final SchemaId tag2 = ids.getSchemaId(UUID.randomUUID());
        final SchemaId field = ids.getSchemaId(UUID.randomUUID());
        final Set<SchemaId> fields = Sets.newHashSet(field);

        final RecordId a = ids.newRecordId();
        final RecordId b = ids.newRecordId();

        derefMap.updateDependants(absId(a), tag1,
                Collections.singletonMap(new DependencyEntry(absId(b)), fields));

        assertEquals(Sets.newHashSet(absId(a)), asRecordIds(derefMap.findDependantsOf(absId(b), field, tag1)));
View Full Code Here

                tableMgr, mock(RecordFactory.class));
    }

    @Test
    public void testDelete_RecordById() throws Exception {
        RecordId recordId = mock(RecordId.class);
        remoteRepository.delete(recordId);
        ByteBuffer encodedRecordId = mock(ByteBuffer.class);
        when(avroConverter.convert(recordId)).thenReturn(encodedRecordId);

        remoteRepository.delete(recordId);
View Full Code Here

        verify(avroLily).delete(null, encodedRecordId, repositoryName, Table.RECORD.name, null, null);
    }

    @Test
    public void testDelete_RecordById_WithMutations() throws Exception {
        RecordId recordId = mock(RecordId.class);
        List<MutationCondition> mutationConditions = Lists.newArrayList(mock(MutationCondition.class));

        ByteBuffer encodedRecordId = mock(ByteBuffer.class);
        List<AvroMutationCondition> encodedMutationConditions = Lists.newArrayList(mock(AvroMutationCondition.class));
View Full Code Here

        verify(avroLily).delete(null, encodedRecordId, repositoryName, Table.RECORD.name, encodedMutationConditions, null);
    }

    @Test
    public void testDelete_FullRecord() throws Exception {
        RecordId recordId = mock(RecordId.class);
        Record record = mock(Record.class);
        Map<String, String> attributes = Maps.newHashMap();
        attributes.put("key", "value");

        when(record.getId()).thenReturn(recordId);
View Full Code Here

            }
        }
    }

    private void linkToOtherRecord(LRepository repository) throws Exception {
        RecordId id = lilyProxy.getLilyServerProxy().getClient().getDefaultRepository()
                .getIdGenerator().fromString("USER.subRec");
        repository.getDefaultTable().recordBuilder().id("testId").field(linkField, new Link(id)).update();
    }
View Full Code Here

        } else {
            tableName = Table.RECORD.name;
        }

        IdGenerator idGenerator = new IdGeneratorImpl();
        RecordId recordId = idGenerator.fromString(recordIdString);

        recordRow = new RecordRow();
        recordRow.recordId = recordId;



        // HBase record table
        Configuration conf = HBaseConfiguration.create();
        conf.set("hbase.zookeeper.quorum", zkConnectionString);
        HTableInterface table = new HTable(conf, tableName);

        // Type manager
        zk = new StateWatchingZooKeeper(zkConnectionString, zkSessionTimeout);
        typeMgr = new HBaseTypeManager(idGenerator, conf, zk, new HBaseTableFactoryImpl(conf));

        Get get = new Get(recordId.toBytes());
        get.setMaxVersions();
        Result row = table.get(get);

        NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long,byte[]>>> root = row.getMap();
View Full Code Here

    @GET
    @Produces("application/json")
    public EntityList<Record> get(@PathParam("id") String id, @Context UriInfo uriInfo) {
        LRepository repository = getRepository(uriInfo);
        LTable table = getTable(uriInfo);
        RecordId recordId = repository.getIdGenerator().fromString(id);
        try {
            Set<RecordId> recordIds = table.getVariants(recordId);

            List<Record> records = new ArrayList<Record>();
            for (RecordId variant : recordIds) {
View Full Code Here

        assertEquals(2, absoluteReferrers.size());
    }

    @Test
    public void testLinkIndexWithShortRecordIds() throws Exception {
        final RecordId id1 = ids.newRecordId("id1");
        final RecordId id2 = ids.newRecordId("id2");
        final RecordId id3 = ids.newRecordId("id3");
        final RecordId id4 = ids.newRecordId("id4");

        testLinkIndexRetrievalWithProvidedIds(id1, id2, id3, id4);
    }
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.api.RecordId

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.