use of org.eclipse.sw360.portal.common.datatables.data.DataTablesOrder in project sw360portal by sw360.
the class DataTablesParserTest method testName.
@Test
public void testName() throws Exception {
Map<String, String[]> parameterMap = getTestParameterMap();
DataTablesParameters parameters = DataTablesParser.parametersFrom(parameterMap);
assertThat(parameters, is(not(nullValue())));
assertThat(parameters.getDraw(), is(1));
assertThat(parameters.getLength(), is(10));
assertThat(parameters.getStart(), is(5));
DataTablesSearch search = parameters.getSearch();
assertThat(search, is(equalTo(new DataTablesSearch("lookingFor", false))));
List<DataTablesColumn> columns = parameters.getColumns();
assertThat(columns, hasSize(1));
DataTablesColumn column1 = columns.get(0);
assertThat(column1.isSearchable(), is(true));
assertThat(column1.getSearch(), is(equalTo(new DataTablesSearch("col0Sear", true))));
List<DataTablesOrder> orders = parameters.getOrders();
assertThat(columns, hasSize(1));
DataTablesOrder order = orders.get(0);
assertThat(order.getColumn(), is(0));
assertThat(order.isAscending(), is(true));
}
use of org.eclipse.sw360.portal.common.datatables.data.DataTablesOrder in project sw360portal by sw360.
the class DataTablesParser method parametersFrom.
protected static DataTablesParameters parametersFrom(Map<String, String[]> parameterMap) {
int draw = getSimpleInt(parameterMap, "draw");
int length = getSimpleInt(parameterMap, "length");
int start = getSimpleInt(parameterMap, "start");
List<DataTablesOrder> orders = getOrders(parameterMap);
List<DataTablesColumn> columns = getColumns(parameterMap);
DataTablesSearch search = getSearch(parameterMap, "search");
return new DataTablesParameters(draw, length, start, orders, columns, search);
}
Aggregations