Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.ValueType


    @Test
    public void testRecord() throws Exception {
        converter = new AvroConverter();
        FieldType fieldType = control.createMock(FieldType.class);
        FieldTypes fieldTypesSnapshot = control.createMock(FieldTypes.class);
        ValueType valueType = new StringValueType();
        IdGenerator idGenerator = new IdGeneratorImpl();

        recordFactory.newRecord();
        expectLastCall().andReturn(new RecordImpl()).anyTimes();
        repository.getIdGenerator();
View Full Code Here


                    .getValueType("STRING"), new QName(ns, "stringField" + i), Scope.NON_VERSIONED));
            rtBuilder.field(fieldType.getId(), false);
        }
        rtBuilder.create();

        ValueType rvt = typeManager.getValueType("RECORD<"+rvtRTName.toString()+">");

        FieldType rvtFT = typeManager.createFieldType(typeManager.newFieldType(rvt, new QName(ns, "rvtField"),
                Scope.NON_VERSIONED));
        typeManager.recordTypeBuilder().name(new QName(ns, "rvtFieldRT")).field(rvtFT.getId(), false).create();
View Full Code Here

import static org.mockito.Mockito.when;

public class HierarchicalFacetPrefixFormatterTest {
    @Test
    public void testSingValue() throws Exception {
        ValueType valueType = new StringValueType();
        FieldType fieldType = mock(FieldType.class);
        when(fieldType.getValueType()).thenReturn(valueType);

        HierarchicalFacetPrefixFormatter formatter = new HierarchicalFacetPrefixFormatter();
        IndexValue value = new IndexValue(null, fieldType, "foo/bar");
View Full Code Here

    @Test
    public void testMultiValue() throws Exception {
        TypeManager typeManager = mock(TypeManager.class);
        when(typeManager.getValueType("STRING")).thenReturn(new StringValueType());

        ValueType valueType = new ListValueType(typeManager, "STRING");
        FieldType fieldType = mock(FieldType.class);
        when(fieldType.getValueType()).thenReturn(valueType);

        HierarchicalFacetPrefixFormatter formatter = new HierarchicalFacetPrefixFormatter();
        List<String> result = formatter.format(Lists.newArrayList(
View Full Code Here

    }

    private static void extract(Object value, FieldType fieldType, LinkCollector collector, FieldType ctxField,
            RecordId ctxRecord, LRepository repository) throws RepositoryException, InterruptedException {

        ValueType valueType = fieldType.getValueType();

        String baseType = valueType.getDeepestValueType().getBaseName();

        if (baseType.equals("LINK") || baseType.equals("RECORD")) {
            extract(value, collector, ctxField, ctxRecord, repository);
        }
    }
View Full Code Here

        String NS = "org.lilyproject.client.test";

        // Create a blob field type and record type
        TypeManager typeManager = repository.getTypeManager();
        ValueType blobType = typeManager.getValueType("BLOB");
        FieldType blobFieldType = typeManager.newFieldType(blobType, new QName(NS, "data"), Scope.VERSIONED);
        blobFieldType = typeManager.createFieldType(blobFieldType);

        RecordType recordType = typeManager.newRecordType(new QName(NS, "file"));
        recordType.addFieldTypeEntry(blobFieldType.getId(), true);
View Full Code Here

    }

    @Test
    public void testCreateSameNameFails() throws Exception {
        QName name = new QName(namespace, "testCreateSameNameFails");
        ValueType valueType = typeManager.getValueType("STRING");
        FieldType fieldType = typeManager.newFieldType(valueType , name, Scope.NON_VERSIONED);
        fieldType = typeManager.createFieldType(fieldType);

        ValueType valueType2 = typeManager.getValueType("INTEGER");
        FieldType fieldType2 = typeManager.newFieldType(valueType2, name, Scope.NON_VERSIONED);
        try {
            if (avro) {
                System.out.println("Expecting FieldTypeExistsException");
            }
View Full Code Here

    }

    @Test
    public void testUpdate() throws Exception {
        QName name = new QName(namespace, "testUpdate");
        ValueType valueType = typeManager.getValueType("STRING");
        FieldType fieldTypeCreate = typeManager.newFieldType(valueType , name, Scope.VERSIONED);
        fieldTypeCreate = typeManager.createFieldType(fieldTypeCreate);

        // Update name
        FieldType fieldTypeNewName = typeManager.newFieldType(fieldTypeCreate.getId(), valueType , new QName(namespace, "newName"), Scope.VERSIONED);
        fieldTypeNewName = typeManager.updateFieldType(fieldTypeNewName);
        assertEquals(fieldTypeCreate.getId(), fieldTypeNewName.getId());
        assertEquals(fieldTypeNewName, typeManager.getFieldTypeById(fieldTypeCreate.getId()));
        assertEquals(typeManager.getFieldTypeById(fieldTypeCreate.getId()), typeManager.getFieldTypeByName(new QName(namespace, "newName")));

        // Create new fieldType with first name
        ValueType valueType2 = typeManager.getValueType("INTEGER");
        FieldType fieldType2 = typeManager.newFieldType(valueType2 , name, Scope.NON_VERSIONED);
        fieldType2 = typeManager.createFieldType(fieldTypeCreate);
        assertEquals(fieldType2, typeManager.getFieldTypeByName(name));
    }
View Full Code Here

    }

    @Test
    public void testUpdateValueTypeFails() throws Exception {
        QName name = new QName(namespace, "testUpdateValueTypeFails");
        ValueType valueType = typeManager.getValueType("STRING");
        FieldType fieldType = typeManager.newFieldType(valueType , name, Scope.VERSIONED);
        fieldType = typeManager.createFieldType(fieldType);

        fieldType.setValueType(typeManager.getValueType("INTEGER"));
        try {
View Full Code Here

    }

    @Test
    public void testUpdateScopeFails() throws Exception {
        QName name = new QName(namespace, "testUpdateScopeFails");
        ValueType valueType = typeManager.getValueType("STRING");
        FieldType fieldType = typeManager.newFieldType(valueType , name, Scope.VERSIONED);
        fieldType = typeManager.createFieldType(fieldType);

        fieldType.setScope(Scope.NON_VERSIONED);
        try {
View Full Code Here

TOP

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

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.