@BeforeClass public static void init() throws OsmTransferException { logger.info("initializing ..."); JOSMFixture.createFunctionalTestFixture().init(); // don't use atomic upload, the test API server can't cope with large diff uploads Main.pref.put("osm-server.atomic-upload", false); File dataSetCacheOutputFile = new File( System.getProperty("java.io.tmpdir"), MultiFetchServerObjectReaderTest.class.getName() + ".dataset"); String p = System.getProperties().getProperty("useCachedDataset"); if (p != null && Boolean.parseBoolean(p.trim().toLowerCase())) { logger.info( MessageFormat.format("property ''{0}'' set, using cached dataset", "useCachedDataset")); return; } logger.info( MessageFormat.format( "property ''{0}'' not set to true, creating test dataset on the server. property is ''{1}''", "useCachedDataset", p)); // build and upload the test data set logger.info("creating test data set ...."); testDataSet = buildTestDataSet(); logger.info("uploading test data set ..."); createDataSetOnServer(testDataSet); try (PrintWriter pw = new PrintWriter( new OutputStreamWriter( new FileOutputStream(dataSetCacheOutputFile), StandardCharsets.UTF_8))) { logger.info( MessageFormat.format( "caching test data set in ''{0}'' ...", dataSetCacheOutputFile.toString())); try (OsmWriter w = new OsmWriter(pw, false, testDataSet.getVersion())) { w.header(); w.writeDataSources(testDataSet); w.writeContent(testDataSet); w.footer(); } } catch (IOException e) { fail( MessageFormat.format( "failed to open file ''{0}'' for writing", dataSetCacheOutputFile.toString())); } }
/** Setup test. */ @Before public void setUp() { JOSMFixture.createUnitTestFixture().init(); }
/** Setup test. */ @BeforeClass public static void setUp() { JOSMFixture.createUnitTestFixture().init(); }