use of edu.uci.ics.textdb.exp.projection.ProjectionPredicate in project textdb by TextDB.
the class ProjectSomeFieldsPredicateTest method testGenerateOperatorBean01.
/**
* Test the generateOperatorBean method.
* Build a SelectSomeFieldsPredicate, invoke the generateOperatorBean and check
* whether a ProjectionBean with the right attributes is returned.
* A list with some field names is used as the list of projected fields.
*/
@Test
public void testGenerateOperatorBean01() {
String operatorId = "zwx";
List<String> projectedFields = Arrays.asList("field0", "field1");
ProjectSomeFieldsPredicate projectSomeFieldsPredicate = new ProjectSomeFieldsPredicate(projectedFields);
PredicateBase computedProjectionBean = projectSomeFieldsPredicate.generateOperatorBean(operatorId);
PredicateBase expectedProjectionBean = new ProjectionPredicate(Arrays.asList("field0", "field1"));
expectedProjectionBean.setID(operatorId);
Assert.assertEquals(expectedProjectionBean, computedProjectionBean);
}
use of edu.uci.ics.textdb.exp.projection.ProjectionPredicate in project textdb by TextDB.
the class ProjectSomeFieldsPredicateTest method testGenerateOperatorBean00.
/**
* Test the generateOperatorBean method.
* Build a SelectSomeFieldsPredicate, invoke the generateOperatorBean and check
* whether a ProjectionBean with the right attributes is returned.
* An empty list is used as the list of projected fields.
*/
@Test
public void testGenerateOperatorBean00() {
String operatorId = "xxx";
List<String> projectedFields = Collections.emptyList();
ProjectSomeFieldsPredicate projectSomeFieldsPredicate = new ProjectSomeFieldsPredicate(projectedFields);
PredicateBase computedProjectionBean = projectSomeFieldsPredicate.generateOperatorBean(operatorId);
PredicateBase expectedProjectionBean = new ProjectionPredicate(Arrays.asList());
expectedProjectionBean.setID(operatorId);
Assert.assertEquals(expectedProjectionBean, computedProjectionBean);
}
use of edu.uci.ics.textdb.exp.projection.ProjectionPredicate in project textdb by TextDB.
the class ProjectSomeFieldsPredicateTest method testGenerateOperatorBean02.
/**
* Test the generateOperatorBean method.
* Build a SelectSomeFieldsPredicate, invoke the generateOperatorBean and check
* whether a ProjectionBean with the right attributes is returned.
* A list with some unordered field names is used as the list of projected fields.
*/
@Test
public void testGenerateOperatorBean02() {
String operatorId = "op00";
List<String> projectedFields = Arrays.asList("c", "a", "b");
ProjectSomeFieldsPredicate projectSomeFieldsPredicate = new ProjectSomeFieldsPredicate(projectedFields);
PredicateBase computedProjectionBean = projectSomeFieldsPredicate.generateOperatorBean(operatorId);
PredicateBase expectedProjectionBean = new ProjectionPredicate(Arrays.asList("c", "a", "b"));
expectedProjectionBean.setID(operatorId);
Assert.assertEquals(expectedProjectionBean, computedProjectionBean);
}
use of edu.uci.ics.textdb.exp.projection.ProjectionPredicate in project textdb by TextDB.
the class ProjectSomeFieldsPredicate method generateOperatorBean.
/**
* Return this operator converted to an { @code OperatorBean }.
* @param projectOperatorId The ID of the OperatorBean to be created.
*/
public PredicateBase generateOperatorBean(String projectOperatorId) {
ProjectionPredicate projectionPredicate = new ProjectionPredicate(this.getProjectedFields());
projectionPredicate.setID(projectOperatorId);
return projectionPredicate;
}
Aggregations