/** * Test columns as this dataset defintion contains custom definitions. An exception must be thrown * due to cannot change employee column type to label, as it's an anaylzed string in the EL index * mapping. */ @Test(expected = RuntimeException.class) public void testColumnsBadDefined() throws Exception { dataSetManager.lookupDataSet( DataSetFactory.newDataSetLookupBuilder() .dataset(EL_DATASET_BAD_COLUMNS_UUID) .sort(ExpenseReportsData.COLUMN_ID, SortOrder.ASCENDING) .buildLookup()); }
/** * ********************************************************************************************************************************************************************************************** * LOOKUP TESTING. * ********************************************************************************************************************************************************************************************** */ @Test(expected = RuntimeException.class) public void testSortingWithNonExstingColumn() throws Exception { DataSet result = dataSetManager.lookupDataSet( DataSetFactory.newDataSetLookupBuilder() .dataset(EL_DATASET_CUSTOM_COLUMNS_UUID) .sort("mycolumn", SortOrder.DESCENDING) .buildLookup()); }
@Test(expected = RuntimeException.class) public void testSortingWithNonDefinedColumn() throws Exception { DataSet result = dataSetManager.lookupDataSet( DataSetFactory.newDataSetLookupBuilder() .dataset(EL_DATASET_CUSTOM_COLUMNS2_UUID) .sort(ExpenseReportsData.COLUMN_DEPARTMENT, SortOrder.DESCENDING) .buildLookup()); }
/** Test using column defined in def (allColumns flag is set to false) */ @Test public void testGivenColumns() throws Exception { DataSet result = dataSetManager.lookupDataSet( DataSetFactory.newDataSetLookupBuilder() .dataset(EL_DATASET_CUSTOM_COLUMNS2_UUID) .sort(ExpenseReportsData.COLUMN_ID, SortOrder.ASCENDING) .buildLookup()); // Columns size assertion. Assert.assertNotNull(result.getColumns()); Assert.assertTrue(result.getColumns().size() == 4); // Columns id & type assertion. assertColumnIdAndType(result, ExpenseReportsData.COLUMN_ID, ColumnType.NUMBER); assertColumnIdAndType(result, ExpenseReportsData.COLUMN_EMPLOYEE, ColumnType.TEXT); assertColumnIdAndType(result, ExpenseReportsData.COLUMN_CITY, ColumnType.TEXT); assertColumnIdAndType(result, ExpenseReportsData.COLUMN_AMOUNT, ColumnType.NUMBER); }
/** * Test retrieving all columns from index mapping (no columns defined in def and allColumns flag * is set to true) */ @Test public void testAllColumns() throws Exception { DataSet result = dataSetManager.lookupDataSet( DataSetFactory.newDataSetLookupBuilder() .dataset(EL_DATASET_ALL_COLUMNS_UUID) .buildLookup()); // Columns size assertion. Assert.assertNotNull(result.getColumns()); Assert.assertTrue(result.getColumns().size() == 6); // Columns id & type assertion. assertColumnIdAndType(result, ExpenseReportsData.COLUMN_AMOUNT, ColumnType.NUMBER); assertColumnIdAndType(result, ExpenseReportsData.COLUMN_CITY, ColumnType.LABEL); assertColumnIdAndType(result, ExpenseReportsData.COLUMN_DATE, ColumnType.DATE); assertColumnIdAndType(result, ExpenseReportsData.COLUMN_DEPARTMENT, ColumnType.LABEL); assertColumnIdAndType(result, ExpenseReportsData.COLUMN_EMPLOYEE, ColumnType.TEXT); assertColumnIdAndType(result, ExpenseReportsData.COLUMN_ID, ColumnType.NUMBER); }