Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.RecordId


            }

            // In case of failures we print out "load" messages, the main junit thread is expected to
            // test that the failures variable is 0.

            RecordId recordId = repository.getIdGenerator().fromBytes(event.getRow());

            try {
                RecordEvent recordEvent = new RecordEvent(event.getPayload(), idGenerator);

                if (recordEvent.getType().equals(RecordEvent.Type.INDEX)) {
                    log.debug("Ignoring incoming re-index event for message verification");
                    return;
                }

                if (expectedEvents.isEmpty()) {
                    System.err
                            .println("No events are expected, but we just got event " + recordEvent.toJson() + " on " + recordId);
                    failures++;
                    return;
                }

                Pair<RecordId, RecordEvent> expectedPair = expectedEvents.remove(0);
                RecordId expectedId = expectedPair.getV1();
                RecordEvent expectedEvent = expectedPair.getV2();

                if (expectedEvent == null) {
                    failures++;
                    printSomethingLoad();
View Full Code Here


    public void testDelete_WithAttributes() throws Exception {
        ByteBuffer recordIdBytes = mock(ByteBuffer.class);
        Map<String, String> attributes = Maps.newHashMap();
        attributes.put("atrKey", "atrValue");

        RecordId recordId = mock(RecordId.class);
        when(avroConverter.convertAvroRecordId(recordIdBytes, repository)).thenReturn(recordId);

        Record toDelete = mock(Record.class);
        when(table.newRecord(recordId)).thenReturn(toDelete);
View Full Code Here

    @Test
    public void testDelete_NoAttributes() throws Exception {
        ByteBuffer recordIdBytes = mock(ByteBuffer.class);
        List<AvroMutationCondition> avroMutationConditions = Lists.newArrayList(mock(AvroMutationCondition.class));

        RecordId recordId = mock(RecordId.class);
        List<MutationCondition> mutationConditions = Lists.newArrayList(mock(MutationCondition.class));

        when(avroConverter.convertAvroRecordId(recordIdBytes, repository)).thenReturn(recordId);
        when(avroConverter.convertFromAvro(avroMutationConditions, repository)).thenReturn(mutationConditions);
View Full Code Here

        ByteBuffer recordIdBytes = mock(ByteBuffer.class);
        List<AvroMutationCondition> avroMutationConditions = Lists.newArrayList(mock(AvroMutationCondition.class));
        Map<String, String> attributes = Maps.newHashMap();
        attributes.put("atrKey", "atrValue");

        RecordId recordId = mock(RecordId.class);
        List<MutationCondition> mutationConditions = Lists.newArrayList(mock(MutationCondition.class));

        when(avroConverter.convertAvroRecordId(recordIdBytes, repository)).thenReturn(recordId);
        when(avroConverter.convertFromAvro(avroMutationConditions, repository)).thenReturn(mutationConditions);
View Full Code Here

        typeManager.getValueType("STRING");
        expectLastCall().andReturn(valueType).anyTimes();
        control.replay();

        Record record = new RecordImpl();
        RecordId recordId = repository.getIdGenerator().newRecordId();
        record.setId(recordId);
        // Scope.NON_VERSIONED recordType and master record type are the same
        record.setRecordType(Scope.NON_VERSIONED, new QName("ns", "nvrt"), 1L);
        record.setRecordType(Scope.VERSIONED, new QName("ns", "vrt"), 2L);
        record.setRecordType(Scope.VERSIONED_MUTABLE, new QName("ns", "vmrt"), 3L);
View Full Code Here

        // FIXME: it's more efficient to read all records at once
        // but make sure missing records are also treated (handled here via null linkedRecord in case of RecordNotFoundException
        if (ctx.record != null) {
            List links = IndexerUtils.flatList(ctx.record, fieldType);
            for (Link link: (List<Link>)links) {
                RecordId linkedRecordId = link.resolve(ctx.contextRecord, idGenerator);
                Record linkedRecord = null;
                String tableName = link.getTable() != null ? link.getTable() : indexUpdateBuilder.getTable();
                LTable table = repository.getTable(tableName);
                try {
                    linkedRecord = VersionTag.getIdRecord(linkedRecordId, indexUpdateBuilder.getVTag(), table, repository);
View Full Code Here

        if (buffer == null) {
            return true;
        }

        final RecordId recordId = idGenerator.fromBytes(new DataInputImpl(buffer, offset, length));

        final SortedMap<String, String> recordVariantProperties = recordId.getVariantProperties();

        // check if the record has all expected variant properties
        if (containsAllExpectedDimensions(recordVariantProperties) &&
                hasSameValueForValuedDimensions(recordVariantProperties)) {
View Full Code Here

     * <p>[I guess] this is only of importance when expressions would be like "+prop=>-prop", e.g.
     * the same prop was first forward-dereferenced and then backward-dereferenced, otherwise
     * it would not be in the moreDimensionedVariants map.
     */
    public Dep minus(IdGenerator idGenerator, Set<String> vprops) {
        RecordId master = id.getMaster();
        Map<String, String> variantProps = Maps.newHashMap(id.getVariantProperties());
        Set<String> newVprops = Sets.newHashSet(vprops);

        for (String prop: vprops) {
            variantProps.remove(prop);
View Full Code Here

    /**
     * Called for expressions of the kind "+prop".
     */
    public Dep plus(IdGenerator idGenerator, Map<String, String> propsToAdd) {
        RecordId master = id.getMaster();

        Map<String, String> newVariantProperties = Maps.newHashMap(id.getVariantProperties());
        Set<String> newVprops = Sets.newHashSet(this.moreDimensionedVariants);

        for (String key: propsToAdd.keySet()) {
View Full Code Here

    }

    @Test
    public void testDeleteRecordCleansUpData() throws Exception {
        Record record = createDefaultRecord();
        RecordId recordId = record.getId();
        repository.delete(recordId);

        record = repository.newRecord(recordId);
        record.setRecordType(recordType2.getName(), recordType2.getVersion());
        record.setField(fieldType4.getName(), 555);
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.