}
}
public void testSearchSurvey() throws Throwable {
List<Integer> result = null;
SurveyRecord survey = null;
Set<String> col1 = new HashSet<String>();
col1.add("ignoredToo");
Set<String> col2 = new HashSet<String>();
col2.add("ignoREd");
try {
// test by ID
// searchSurveyByIds(id, description, group, isActive, isQuestionnaire, title, isPublic)
result = this.getSurveyManager().searchSurvey(1, null, null, null, null, null, null);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals("ignored", survey.getGroupName().trim());
// test by descr
result = this.getSurveyManager().searchSurvey(null, "n-1", null, null, null, null, null);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals("ignored", survey.getGroupName().trim());
// l=this.getSurveyManager().searchSurveyByIds(null, "<survey>", null, null, null, null, null);
// assertNull(l);
// test by group
result = this.getSurveyManager().searchSurvey(null, null, col1, null, null, null, null);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals("ignoredToo", survey.getGroupName().trim());
// test by isActive
result = this.getSurveyManager().searchSurvey(null, null, null, false, null, null, null);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals(2, survey.getId());
// test by isActive (2)
result = this.getSurveyManager().searchSurvey(null, null, null, true, null, null, null);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals(1, survey.getId());
// test by isQuestionnaire
result = this.getSurveyManager().searchSurvey(null, null, null, null, false, null, null);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals(2, survey.getId());
// test by isQuestionnaire (2)
result = this.getSurveyManager().searchSurvey(null, null, null, null, true, null, null);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals(1, survey.getId());
// test by profileUser
result = this.getSurveyManager().searchSurvey(null, null, null, null, null, "lo-1", null);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals(1, survey.getId());
result = this.getSurveyManager().searchSurvey(null, null, null, null, null, "mucci", null);
assertNotNull(result);
assertTrue(result.isEmpty());
// test by isRestricted
result = this.getSurveyManager().searchSurvey(null, null, null, null, null, null, true);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
// test by isRestricted (2)
result = this.getSurveyManager().searchSurvey(null, null, null, null, null, null, false);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals(1, survey.getId());
// test all fields
result = this.getSurveyManager().searchSurvey(1, "ne-1", col2, true, true, "le-1", false);
assertNotNull(result);
assertEquals(1, result.size());
survey = this.getSurveyManager().loadSurvey(result.get(0));
assertEquals(1, survey.getId());
// This should match all the surveys!
result = this.getSurveyManager().searchSurvey(null, null, null, null, null, null, null);
assertNotNull(result);
assertEquals(2, result.size());
} catch (Throwable t) {