Examples of SchemaId


Examples of org.lilyproject.repository.api.SchemaId

    }

    @Test
    public void testEmptyRecordType() throws Exception {
        QName name = new QName("aNamespace", "aName");
        SchemaId id = new SchemaIdImpl(UUID.randomUUID());
        RecordType recordType = new RecordTypeImpl(id, name);
        typeManager.newRecordType(id, name);
        expectLastCall().andReturn(recordType);

        control.replay();
        converter = new AvroConverter();
        AvroRecordType avroRecordType = new AvroRecordType();
        AvroSchemaId avroSchemaId = new AvroSchemaId();
        avroSchemaId.idBytes = ByteBuffer.wrap(id.getBytes());
        avroRecordType.id = avroSchemaId;
        AvroQName avroQName = new AvroQName();
        avroQName.namespace = "aNamespace";
        avroQName.name = "aName";
        avroRecordType.name = avroQName;
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

    }

    @Test
    public void testRecordTypeVersion() throws Exception {
        QName name = new QName("aNamespace", "aName");
        SchemaId id = new SchemaIdImpl(UUID.randomUUID());
        RecordType recordType = new RecordTypeImpl(id, name);
        typeManager.newRecordType(id, name);
        expectLastCall().andReturn(recordType);

        control.replay();
        converter = new AvroConverter();
        recordType.setVersion(1L);
        AvroRecordType avroRecordType = new AvroRecordType();
        AvroSchemaId avroSchemaId = new AvroSchemaId();
        avroSchemaId.idBytes = ByteBuffer.wrap(id.getBytes());
        avroRecordType.id = avroSchemaId;
        AvroQName avroQName = new AvroQName();
        avroQName.namespace = "aNamespace";
        avroQName.name = "aName";
        avroRecordType.name = avroQName;
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

    }

    @Test
    public void testRecordTypeFieldTypeEntries() throws Exception {
        QName name = new QName("aNamespace", "aName");
        SchemaId recordTypeId = new SchemaIdImpl(UUID.randomUUID());
        RecordType recordType = new RecordTypeImpl(recordTypeId, name);
        typeManager.newRecordType(recordTypeId, name);
        expectLastCall().andReturn(recordType);

        SchemaId fieldTypeId1 = new SchemaIdImpl(UUID.randomUUID());
        SchemaId fieldTypeId2 = new SchemaIdImpl(UUID.randomUUID());
        FieldTypeEntryImpl fieldTypeEntry1 = new FieldTypeEntryImpl(fieldTypeId1, true);
        FieldTypeEntryImpl fieldTypeEntry2 = new FieldTypeEntryImpl(fieldTypeId2, false);
        typeManager.newFieldTypeEntry(fieldTypeId1, true);
        expectLastCall().andReturn(fieldTypeEntry1);
        typeManager.newFieldTypeEntry(fieldTypeId2, false);
        expectLastCall().andReturn(fieldTypeEntry2);

        control.replay();
        converter = new AvroConverter();
        recordType.addFieldTypeEntry(fieldTypeEntry1);
        recordType.addFieldTypeEntry(fieldTypeEntry2);
        AvroRecordType avroRecordType = new AvroRecordType();
        AvroSchemaId avroRecordTypeId = new AvroSchemaId();
        avroRecordTypeId.idBytes = ByteBuffer.wrap(recordTypeId.getBytes());
        avroRecordType.id = avroRecordTypeId;
        AvroQName avroQName = new AvroQName();
        avroQName.namespace = "aNamespace";
        avroQName.name = "aName";
        avroRecordType.name = avroQName;
        // fieldTypeEntries and supertypes are by default empty instead of null
        avroRecordType.fieldTypeEntries =
                new GenericData.Array<AvroFieldTypeEntry>(0, Schema.createArray(AvroFieldTypeEntry.SCHEMA$));
        AvroFieldTypeEntry avroFieldTypeEntry = new AvroFieldTypeEntry();
        AvroSchemaId avroFieldTypeId1 = new AvroSchemaId();
        avroFieldTypeId1.idBytes = ByteBuffer.wrap(fieldTypeId1.getBytes());
        avroFieldTypeEntry.id = avroFieldTypeId1;
        avroFieldTypeEntry.mandatory = true;
        avroRecordType.fieldTypeEntries.add(avroFieldTypeEntry);
        Set<AvroFieldTypeEntry> expectedFieldTypeEntries = new HashSet<AvroFieldTypeEntry>();
        expectedFieldTypeEntries.add(avroFieldTypeEntry);
        avroFieldTypeEntry = new AvroFieldTypeEntry();
        AvroSchemaId avroFieldTypeId2 = new AvroSchemaId();
        avroFieldTypeId2.idBytes = ByteBuffer.wrap(fieldTypeId2.getBytes());
        avroFieldTypeEntry.id = avroFieldTypeId2;
        avroFieldTypeEntry.mandatory = false;
        avroRecordType.fieldTypeEntries.add(avroFieldTypeEntry);
        expectedFieldTypeEntries.add(avroFieldTypeEntry);
        avroRecordType.supertypes = new GenericData.Array<AvroSupertype>(0, Schema.createArray(AvroSupertype.SCHEMA$));
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

    }

    @Test
    public void testRecordTypeSupertypes() throws Exception {
        QName name = new QName("aNamespace", "aName");
        SchemaId recordTypeId = new SchemaIdImpl(UUID.randomUUID());
        RecordType recordType = new RecordTypeImpl(recordTypeId, name);
        typeManager.newRecordType(recordTypeId, name);
        expectLastCall().andReturn(recordType);

        control.replay();
        converter = new AvroConverter();
        SchemaId supertypeId1 = new SchemaIdImpl(UUID.randomUUID());
        recordType.addSupertype(supertypeId1, 1L);
        SchemaId supertypeId2 = new SchemaIdImpl(UUID.randomUUID());
        recordType.addSupertype(supertypeId2, 2L);
        AvroRecordType avroRecordType = new AvroRecordType();
        AvroSchemaId avroRecordTypeId = new AvroSchemaId();
        avroRecordTypeId.idBytes = ByteBuffer.wrap(recordTypeId.getBytes());
        avroRecordType.id = avroRecordTypeId;
        AvroQName avroQName = new AvroQName();
        avroQName.namespace = "aNamespace";
        avroQName.name = "aName";
        avroRecordType.name = avroQName;
        // fieldTypeEntries and supertypes are by default empty instead of null
        avroRecordType.fieldTypeEntries =
                new GenericData.Array<AvroFieldTypeEntry>(0, Schema.createArray(AvroFieldTypeEntry.SCHEMA$));
        avroRecordType.supertypes = new GenericData.Array<AvroSupertype>(0, Schema.createArray(AvroSupertype.SCHEMA$));
        AvroSupertype avroSupertype1 = new AvroSupertype();
        AvroSchemaId avroSupertypeId1 = new AvroSchemaId();
        avroSupertypeId1.idBytes = ByteBuffer.wrap(supertypeId1.getBytes());
        avroSupertype1.recordTypeId = avroSupertypeId1;
        avroSupertype1.recordTypeVersion = 1L;
        avroRecordType.supertypes.add(avroSupertype1);
        Set<AvroSupertype> expectedSupertypes = new HashSet<AvroSupertype>();
        expectedSupertypes.add(avroSupertype1);
        AvroSupertype avroSupertype2 = new AvroSupertype();
        AvroSchemaId avroSupertypeId2 = new AvroSchemaId();
        avroSupertypeId2.idBytes = ByteBuffer.wrap(supertypeId2.getBytes());
        avroSupertype2.recordTypeId = avroSupertypeId2;
        avroSupertype2.recordTypeVersion = 2L;
        avroRecordType.supertypes.add(avroSupertype2);
        expectedSupertypes.add(avroSupertype2);
        assertEquals(recordType, converter.convert(avroRecordType, typeManager));
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

    public FieldType convert(AvroFieldType avroFieldType, TypeManager typeManager)
            throws RepositoryException, InterruptedException {
        ValueType valueType = convert(avroFieldType.getValueType(), typeManager);
        QName name = convert(avroFieldType.getName());
        SchemaId id = convert(avroFieldType.getId());
        if (id != null) {
            return typeManager.newFieldType(id, valueType, name, convert(avroFieldType.getScope()));
        }
        return typeManager.newFieldType(valueType, name, convert(avroFieldType.getScope()));
    }
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

    public AvroScope convert(Scope scope) {
        return scope == null ? null : AvroScope.values()[scope.ordinal()];
    }

    public RecordType convert(AvroRecordType avroRecordType, TypeManager typeManager) throws RepositoryException {
        SchemaId recordTypeId = convert(avroRecordType.getId());
        QName recordTypeName = convert(avroRecordType.getName());
        RecordType recordType = typeManager.newRecordType(recordTypeId, recordTypeName);
        recordType.setVersion(avroRecordType.getVersion());
        List<AvroFieldTypeEntry> fieldTypeEntries = avroRecordType.getFieldTypeEntries();
        if (fieldTypeEntries != null) {
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

                .recordType(rt1.getName())
                .field(ft1.getName(), "deref test main")
                .field(ft2.getName(), new Link(linkedRecord.getId()))
                .create();

        SchemaId vtag = typeManager.getFieldTypeByName(VersionTag.LAST).getId();
        DependantRecordIdsIterator it = null;

        try {
            it = derefMap.findDependantsOf(absId(linkedRecord.getId()),
                    ft1.getId(), vtag);
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

            Map<SchemaId, FieldTypeEntry> fieldTypeMap = Maps.newHashMap();

            for (Pair<SchemaId, Long> recordSuperTypePair : recordSupertypeMap.keySet()) {
                RecordType superRecordType = recordSupertypeMap.get(recordSuperTypePair);
                for (FieldTypeEntry fieldTypeEntry : superRecordType.getFieldTypeEntries()) {
                    SchemaId fieldTypeId = fieldTypeEntry.getFieldTypeId();
                    if (fieldTypeMap.containsKey(fieldTypeId)) {
                        // Only overwrite an existing entry if we have one that is mandatory
                        if (fieldTypeEntry.isMandatory()) {
                            fieldTypeMap.put(fieldTypeId, fieldTypeEntry);
                        }
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

    @Test
    public void emptyDependencies() throws Exception {
        String idPrefix = newIdPrefix();

        final SchemaId dummyVtag = ids.getSchemaId(UUID.randomUUID());
        final SchemaId dummyField = ids.getSchemaId(UUID.randomUUID());
        final RecordId id1 = ids.newRecordId(idPrefix + "id1");

        final HashMap<DependencyEntry, Set<SchemaId>> empty =
                new HashMap<DependencyEntry, Set<SchemaId>>();
        derefMap.updateDependants(absId(id1), dummyVtag, empty);
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

    @Test
    public void oneDependency() throws Exception {
        String idPrefix = newIdPrefix();

        final SchemaId dummyVtag = ids.getSchemaId(UUID.randomUUID());
        final SchemaId dependencyField = ids.getSchemaId(UUID.randomUUID());
        final SchemaId anotherField = ids.getSchemaId(UUID.randomUUID());
        final RecordId dependant = ids.newRecordId(idPrefix + idPrefix + "dependant");
        final RecordId dependency = ids.newRecordId(idPrefix + idPrefix + "dependency");
        final RecordId dependencyAfterUpdate = ids.newRecordId(idPrefix + idPrefix + "dependencyAfterUpdate");

        // the dependant depends on the dependencyField of the dependency
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.