Search in sources :

Example 96 with Attribute

use of edu.uci.ics.texera.api.schema.Attribute in project textdb by TextDB.

the class JsonSerializationTest method testTuple.

@Test
public void testTuple() {
    Schema schema = new Schema(Arrays.asList(new Attribute("_id", AttributeType._ID_TYPE), new Attribute("text", AttributeType.TEXT)));
    Tuple tuple = new Tuple(schema, Arrays.asList(IDField.newRandomID(), new TextField("tuple test text")));
    TestUtils.testJsonSerialization(tuple);
}
Also used : Attribute(edu.uci.ics.texera.api.schema.Attribute) Schema(edu.uci.ics.texera.api.schema.Schema) TextField(edu.uci.ics.texera.api.field.TextField) Tuple(edu.uci.ics.texera.api.tuple.Tuple) Test(org.junit.Test)

Example 97 with Attribute

use of edu.uci.ics.texera.api.schema.Attribute in project textdb by TextDB.

the class SchemaTest method testGetAttributes.

@Test
public void testGetAttributes() {
    List<Attribute> attributes = schema.getAttributes();
    Assert.assertEquals(this.attributes.length, attributes.size());
    for (Attribute attribute : this.attributes) {
        Assert.assertTrue(attributes.contains(attribute));
    }
}
Also used : Attribute(edu.uci.ics.texera.api.schema.Attribute) Test(org.junit.Test)

Example 98 with Attribute

use of edu.uci.ics.texera.api.schema.Attribute in project textdb by TextDB.

the class SchemaTest method testAddingNewAttribute.

@Test(expected = UnsupportedOperationException.class)
public void testAddingNewAttribute() {
    // Should fail due to immutability
    List<Attribute> attributes = schema.getAttributes();
    attributes.add(new Attribute("sampleField_3", AttributeType.STRING));
}
Also used : Attribute(edu.uci.ics.texera.api.schema.Attribute) Test(org.junit.Test)

Aggregations

Attribute (edu.uci.ics.texera.api.schema.Attribute)98 Test (org.junit.Test)81 Tuple (edu.uci.ics.texera.api.tuple.Tuple)78 ArrayList (java.util.ArrayList)76 Schema (edu.uci.ics.texera.api.schema.Schema)75 IField (edu.uci.ics.texera.api.field.IField)60 StringField (edu.uci.ics.texera.api.field.StringField)56 TextField (edu.uci.ics.texera.api.field.TextField)56 IntegerField (edu.uci.ics.texera.api.field.IntegerField)54 DoubleField (edu.uci.ics.texera.api.field.DoubleField)53 Span (edu.uci.ics.texera.api.span.Span)51 DateField (edu.uci.ics.texera.api.field.DateField)50 SimpleDateFormat (java.text.SimpleDateFormat)47 Dictionary (edu.uci.ics.texera.dataflow.dictionarymatcher.Dictionary)28 AttributeType (edu.uci.ics.texera.api.schema.AttributeType)9 IOperator (edu.uci.ics.texera.api.dataflow.IOperator)8 DataflowException (edu.uci.ics.texera.api.exception.DataflowException)6 TexeraException (edu.uci.ics.texera.api.exception.TexeraException)6 List (java.util.List)6 Collectors (java.util.stream.Collectors)5