|
|
@ -93,62 +93,91 @@ public class SearchDevice extends BaseDeviceManagementTest {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// @Test
|
|
|
|
@Test
|
|
|
|
// public void doValidLocationSearch() throws Exception{
|
|
|
|
public void doValidLocationSearch() throws Exception{
|
|
|
|
//
|
|
|
|
|
|
|
|
// SearchContext context = new SearchContext();
|
|
|
|
SearchContext context = new SearchContext();
|
|
|
|
// List<Condition> conditions = new ArrayList<>();
|
|
|
|
List<Condition> conditions = new ArrayList<>();
|
|
|
|
//
|
|
|
|
|
|
|
|
// Condition cond = new Condition();
|
|
|
|
Condition cond = new Condition();
|
|
|
|
// cond.setKey("LOCATION");
|
|
|
|
cond.setKey("LOCATION");
|
|
|
|
// cond.setOperator("=");
|
|
|
|
cond.setOperator("=");
|
|
|
|
// cond.setValue("Karan");
|
|
|
|
cond.setValue("Karan");
|
|
|
|
// cond.setState(Condition.State.AND);
|
|
|
|
cond.setState(Condition.State.AND);
|
|
|
|
// conditions.add(cond);
|
|
|
|
conditions.add(cond);
|
|
|
|
//
|
|
|
|
|
|
|
|
// context.setConditions(conditions);
|
|
|
|
context.setConditions(conditions);
|
|
|
|
//
|
|
|
|
|
|
|
|
// SearchManagerService service = new SearchManagerServiceImpl();
|
|
|
|
SearchManagerService service = new SearchManagerServiceImpl();
|
|
|
|
// List<DeviceWrapper> deviceWrappers = service.search(context);
|
|
|
|
List<DeviceWrapper> deviceWrappers = service.search(context);
|
|
|
|
//
|
|
|
|
|
|
|
|
// Gson gson = new Gson();
|
|
|
|
Gson gson = new Gson();
|
|
|
|
// String bbbb = gson.toJson(deviceWrappers);
|
|
|
|
String bbbb = gson.toJson(deviceWrappers);
|
|
|
|
// log.info("Valid Search " + bbbb);
|
|
|
|
log.info("Valid Search " + bbbb);
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// for (DeviceWrapper dw : deviceWrappers) {
|
|
|
|
for (DeviceWrapper dw : deviceWrappers) {
|
|
|
|
// log.debug(dw.getDevice().getDescription());
|
|
|
|
log.debug(dw.getDevice().getDescription());
|
|
|
|
// log.debug(dw.getDevice().getDeviceIdentifier());
|
|
|
|
log.debug(dw.getDevice().getDeviceIdentifier());
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
//
|
|
|
|
|
|
|
|
// @Test
|
|
|
|
@Test
|
|
|
|
// public void doInvalidLocationSearch() throws Exception{
|
|
|
|
public void doInvalidLocationSearch() throws Exception{
|
|
|
|
//
|
|
|
|
|
|
|
|
// SearchContext context = new SearchContext();
|
|
|
|
SearchContext context = new SearchContext();
|
|
|
|
// List<Condition> conditions = new ArrayList<>();
|
|
|
|
List<Condition> conditions = new ArrayList<>();
|
|
|
|
//
|
|
|
|
|
|
|
|
// Condition cond = new Condition();
|
|
|
|
Condition cond = new Condition();
|
|
|
|
// cond.setKey("LOCATION");
|
|
|
|
cond.setKey("LOCATION");
|
|
|
|
// cond.setOperator("=");
|
|
|
|
cond.setOperator("=");
|
|
|
|
// cond.setValue("Colombo");
|
|
|
|
cond.setValue("Colombo");
|
|
|
|
// cond.setState(Condition.State.AND);
|
|
|
|
cond.setState(Condition.State.AND);
|
|
|
|
// conditions.add(cond);
|
|
|
|
conditions.add(cond);
|
|
|
|
//
|
|
|
|
|
|
|
|
// context.setConditions(conditions);
|
|
|
|
context.setConditions(conditions);
|
|
|
|
//
|
|
|
|
|
|
|
|
// SearchManagerService service = new SearchManagerServiceImpl();
|
|
|
|
SearchManagerService service = new SearchManagerServiceImpl();
|
|
|
|
// List<DeviceWrapper> deviceWrappers = service.search(context);
|
|
|
|
List<DeviceWrapper> deviceWrappers = service.search(context);
|
|
|
|
//
|
|
|
|
|
|
|
|
// Gson gson = new Gson();
|
|
|
|
Gson gson = new Gson();
|
|
|
|
// String bbbb = gson.toJson(deviceWrappers);
|
|
|
|
String bbbb = gson.toJson(deviceWrappers);
|
|
|
|
// log.info("Invalid Search " + bbbb);
|
|
|
|
log.info("Invalid Search " + bbbb);
|
|
|
|
//
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// for (DeviceWrapper dw : deviceWrappers) {
|
|
|
|
for (DeviceWrapper dw : deviceWrappers) {
|
|
|
|
// log.debug(dw.getDevice().getDescription());
|
|
|
|
log.debug(dw.getDevice().getDescription());
|
|
|
|
// log.debug(dw.getDevice().getDeviceIdentifier());
|
|
|
|
log.debug(dw.getDevice().getDeviceIdentifier());
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void doStringSearch() throws Exception{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SearchContext context = new SearchContext();
|
|
|
|
|
|
|
|
List<Condition> conditions = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Condition cond = new Condition();
|
|
|
|
|
|
|
|
cond.setKey("deviceModel");
|
|
|
|
|
|
|
|
cond.setOperator("=");
|
|
|
|
|
|
|
|
cond.setValue("SM-T520");
|
|
|
|
|
|
|
|
cond.setState(Condition.State.AND);
|
|
|
|
|
|
|
|
conditions.add(cond);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context.setConditions(conditions);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SearchManagerService service = new SearchManagerServiceImpl();
|
|
|
|
|
|
|
|
List<DeviceWrapper> deviceWrappers = service.search(context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gson gson = new Gson();
|
|
|
|
|
|
|
|
String bbbb = gson.toJson(deviceWrappers);
|
|
|
|
|
|
|
|
log.info("Invalid Search " + bbbb);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (DeviceWrapper dw : deviceWrappers) {
|
|
|
|
|
|
|
|
log.debug(dw.getDevice().getDescription());
|
|
|
|
|
|
|
|
log.debug(dw.getDevice().getDeviceIdentifier());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|