use of org.openforis.idm.model.TestSurveyContext in project collect by openforis.
the class SurveyBuilder method survey.
public static Survey survey(NodeDefinitionBuilder... builders) {
String rootEntityName = "root";
Survey survey = new TestSurveyContext().createSurvey();
EntityDefinitionBuilder entityBuilder = new EntityDefinitionBuilder(rootEntityName, builders);
EntityDefinition rootEntityDef = (EntityDefinition) entityBuilder.buildInternal(survey);
Schema schema = survey.getSchema();
if (schema.getRootEntityDefinition(rootEntityName) != null) {
schema.removeRootEntityDefinition(rootEntityName);
}
schema.addRootEntityDefinition(rootEntityDef);
survey.refreshSurveyDependencies();
return survey;
}
use of org.openforis.idm.model.TestSurveyContext in project collect by openforis.
the class TestFixture method survey.
public static TestFixture survey(NodeDefinitionBuilder.EntityDefinitionBuilder entityDefinitionBuilder, RecordBuilder... recordBuilders) {
SurveyContext surveyContext = new TestSurveyContext();
Survey survey = surveyContext.createSurvey();
EntityDefinition rootEntityDef = (EntityDefinition) entityDefinitionBuilder.buildInternal(survey);
survey.getSchema().addRootEntityDefinition(rootEntityDef);
survey.refreshSurveyDependencies();
List<Record> records = new ArrayList<Record>();
for (RecordBuilder recordBuilder : recordBuilders) {
Record record = recordBuilder.build(survey);
records.add(record);
}
return new TestFixture(survey, Collections.unmodifiableList(records));
}
use of org.openforis.idm.model.TestSurveyContext in project collect by openforis.
the class LookupFunctionTest method setup.
@Before
public void setup() {
TestSurveyContext surveyContext = (TestSurveyContext) record.getSurveyContext();
surveyContext.lookupProvider.coordinate = TEST_COORDINATE;
surveyContext.lookupProvider.samplingPointData = TEST_SAMPLING_POINT_DATA;
}
use of org.openforis.idm.model.TestSurveyContext in project collect by openforis.
the class AbstractTest method createTestSurvey.
protected static Survey createTestSurvey() throws IdmlParseException {
InputStream is = AbstractTest.class.getClassLoader().getResourceAsStream("test.idm.xml");
SurveyContext surveyContext = new TestSurveyContext();
SurveyIdmlBinder parser = new SurveyIdmlBinder(surveyContext);
Survey survey = parser.unmarshal(is);
return survey;
}
Aggregations