Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.Record


                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record recordNs1TypeA = newRecordOfType(new QName("ns1", "typeA"));
        Record recordNs2TypeA = newRecordOfType(new QName("ns2", "typeA"));

        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs1TypeA));
        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs2TypeA));
    }
View Full Code Here


                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record recordNs1TypeB = newRecordOfType(new QName("ns1", "typeB"));
        Record recordNs2TypeB = newRecordOfType(new QName("ns2", "typeB"));
        Record recordNs1TypeC = newRecordOfType(new QName("ns1", "typeC"));
        Record recordNs2TypeC = newRecordOfType(new QName("ns2", "typeC"));
        Record recordNs1TypeA = newRecordOfType(new QName("ns1", "typeA"));

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs1TypeA));

        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs1TypeB));
        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordNs2TypeB));
View Full Code Here

                .field(stringField.getId(), false)
                .update();

        // Create a record of type rt3 and check that this record is instanceOf any type in the hierarchy,
        // except rt6 which is outside of the hierarchy
        Record record = newRecordOfType(new QName("ns1", "rt3"));

        for (String rt : Lists.newArrayList("rt1", "rt2", "rt3", "rt4", "rt5", "rt6")) {
            String conf = makeIndexerConf(
                    "xmlns:ns1='ns1'",
                    Lists.newArrayList(
View Full Code Here

                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record record = repository.getDefaultTable().recordBuilder().id("record").build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, record));
    }
View Full Code Here

                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record record = repository.getDefaultTable().recordBuilder().id("record").build();

        assertNotNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, record));
    }
View Full Code Here

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        //
        // Test string field
        //
        Record zeus = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "string"), "zeus")
                .field(new QName("ns", "bool"), Boolean.TRUE)
                .field(new QName("ns", "int"), 5)
                .build();

        Record hera = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "string"), "hera")
                .field(new QName("ns", "int"), 10)
                .build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, hera));
        assertEquals(ImmutableSet.of(vtag1.getId()), idxConf.getRecordFilter()
                        .getIndexCase(Table.RECORD.name, zeus).getVersionTags());

        //
        // Test boolean field
        //
        Record trueRecord = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "bool"), Boolean.TRUE)
                .build();

        Record falseRecord = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "bool"), Boolean.FALSE)
                .build();
View Full Code Here

                Collections.<String>emptyList()
        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        Record trueRecord = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "bool"), Boolean.TRUE)
                .build();

        Record falseRecord = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "bool"), Boolean.FALSE)
                .build();

        Record nullRecord = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, trueRecord));
View Full Code Here

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        //
        // Record with exactly two properties should be matched by first rule
        //
        Record recordProp1Prop2 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val1", "prop2", "artemis"))
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "string"), "something")
                .build();

        assertEquals(Sets.newHashSet(vtag1.getId()),
                idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordProp1Prop2).getVersionTags());

        //
        // Record with more properties than prop1 & prop2 should be matched by second rule
        //
        Record recordProp1Prop2Prop3 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val1", "prop2", "artemis", "prop3", "val3"))
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "string"), "something")
                .build();

        assertEquals(Sets.newHashSet(vtag2.getId()),
                idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordProp1Prop2Prop3).getVersionTags());

        //
        // Record with one prop should not be matched by any rules
        //
        Record recordProp1 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val1"))
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "string"), "something")
                .build();
View Full Code Here

        );

        LilyIndexerConf idxConf = LilyIndexerConfBuilder.build(new ByteArrayInputStream(conf.getBytes()), repository);

        // An empty variant expression should only match record without variant properties
        Record recordProp1 = repository.getDefaultTable().recordBuilder()
                .id("record", ImmutableMap.of("prop1", "val1"))
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "string"), "something")
                .build();

        assertNull(idxConf.getRecordFilter().getIndexCase(Table.RECORD.name, recordProp1));

        Record record = repository.getDefaultTable().recordBuilder()
                .id("record")
                .recordType(new QName("ns1", "typeA"))
                .field(new QName("ns", "string"), "something")
                .build();
View Full Code Here

        // Update all fields
        else {
            fieldsToUpdate.addAll(recordTypeToUpdate.getFieldTypes());
        }

        Record record = testActionContext.repository.getRecordFactory().newRecord(recordId);

        // If there is a Link-field that links to specified record type we need to read the field
        // in order to update the record that is linked to
        boolean readRecord = false;
        for (TestFieldType field: fieldsToUpdate) {
            if (field.getLinkedRecordTypeName() != null || field.getLinkedRecordSource() != null) {
                readRecord = true;
                break;
            }
        }
        Record originalRecord = null;
        if (readRecord) {
            before = System.nanoTime();
            try {
                originalRecord = testActionContext.table.read(record.getId());
                long readDuration = System.nanoTime() - before;
View Full Code Here

TOP

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

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.