use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SurveyManagerIntegrationTest method publishSurveyTest.
@Test
public void publishSurveyTest() throws SurveyImportException {
CollectSurvey surveyWork = surveyManager.createTemporarySurveyFromPublished(survey.getUri(), adminUser);
assertEquals("Archenland NFI", surveyWork.getProjectName());
surveyWork.setProjectName("en", "New Project Name");
surveyManager.publish(surveyWork, adminUser);
CollectSurvey survey = surveyManager.getByUri(surveyWork.getUri());
assertFalse(survey.isTemporary());
assertEquals("New Project Name", survey.getProjectName("en"));
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SurveyManagerIntegrationTest method duplicateSurveySamplingDesignForEditTest.
@Test
public void duplicateSurveySamplingDesignForEditTest() {
insertTestSamplingDesign();
CollectSurvey surveyWork = surveyManager.createTemporarySurveyFromPublished(survey.getUri(), adminUser);
SamplingDesignSummaries summaries = samplingDesignManager.loadBySurvey(surveyWork.getId());
List<SamplingDesignItem> records = summaries.getRecords();
assertEquals(3, records.size());
{
SamplingDesignItem item = records.get(0);
assertEquals(Arrays.asList("7_81"), item.getLevelCodes());
assertEquals("EPSG:21035", item.getSrsId());
assertEquals(Double.valueOf(792200d), item.getX());
assertEquals(Double.valueOf(9484420d), item.getY());
}
{
SamplingDesignItem item = records.get(1);
assertEquals(Arrays.asList("7_81", "2"), item.getLevelCodes());
assertEquals("EPSG:21035", item.getSrsId());
assertEquals(Double.valueOf(792200d), item.getX());
assertEquals(Double.valueOf(9484420d), item.getY());
}
{
SamplingDesignItem item = records.get(2);
assertEquals(Arrays.asList("7_81", "3"), item.getLevelCodes());
assertEquals("EPSG:21035", item.getSrsId());
assertEquals(Double.valueOf(792200d), item.getX());
assertEquals(Double.valueOf(9484670d), item.getY());
}
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SurveyManagerIntegrationTest method createTemporarySurveyFromPublishedTest.
@Test
public void createTemporarySurveyFromPublishedTest() {
CollectSurvey surveyWork = surveyManager.createTemporarySurveyFromPublished(survey.getUri(), adminUser);
assertTrue(surveyWork.isTemporary());
{
CodeList list = survey.getCodeList("admin_unit");
List<CodeListItem> rootItems = codeListManager.loadRootItems(list);
assertEquals(8, rootItems.size());
List<CodeListItem> childItems = codeListManager.loadChildItems(rootItems.get(0));
assertEquals(3, childItems.size());
}
{
CodeList list = surveyWork.getCodeList("admin_unit");
List<CodeListItem> rootItems = codeListManager.loadRootItems(list);
assertEquals(8, rootItems.size());
List<CodeListItem> childItems = codeListManager.loadChildItems(rootItems.get(0));
assertEquals(3, childItems.size());
}
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SurveyValidatorIntegrationTest method invalidSurveyImportTest.
@Test(expected = SurveyValidationException.class)
public void invalidSurveyImportTest() throws SurveyValidationException, SurveyImportException {
InputStream is = ClassLoader.getSystemResourceAsStream("invalid.test.idm.xml");
CollectSurvey survey = surveyManager.importModel(is, "test_survey", true);
assertNull(survey);
}
use of org.openforis.collect.model.CollectSurvey in project collect by openforis.
the class SurveyValidatorIntegrationTest method validSurveyUnmarshallTest.
@Test
public void validSurveyUnmarshallTest() throws SurveyValidationException, SurveyImportException {
InputStream is = ClassLoader.getSystemResourceAsStream("test.idm.xml");
CollectSurvey survey = surveyManager.importModel(is, "test_survey", false);
assertNotNull(survey);
}
Aggregations