@Before public void start() { helper.createServer(); helper.server.start(); helper.createClient(); helper.client.start(); helper.waitForRegistration(1); }
/** * Delete a random ME. Revert delete. * * @throws ESException ESException * @throws SerializationException SerializationException */ @Test public void deleteAndRevertDeleteTest() throws SerializationException, ESException { System.out.println("DeleteAndRevertDeleteTest"); final IntegrationTestHelper testHelper = new IntegrationTestHelper(randomSeed, getTestProject()); testHelper.doDeleteAndRevert(); commitChanges(); assertTrue(ModelUtil.areEqual(getTestProject(), getCompareProject())); }
@Test public void testStreamingCloud() throws IOException, GeneralSecurityException { String[] ARGS = { "--apiKey=" + helper.getApiKey(), "--references=" + helper.PLATINUM_GENOMES_BRCA1_REFERENCES, "--datasetId=" + helper.PLATINUM_GENOMES_DATASET, "--output=" + outputPrefix, "--project=" + helper.getTestProject(), "--runner=BlockingDataflowPipelineRunner", "--stagingLocation=" + helper.getTestStagingGcsFolder(), "--useGrpc=true" }; testBase(ARGS); }
@Test public void can_write_replace_resource_in_json() { // write device timezone final String timeZone = "Europe/Paris"; WriteResponse response = helper.server.send(helper.getClient(), new WriteRequest(Mode.REPLACE, 3, 0, 15, timeZone)); // verify result assertEquals(ResponseCode.CHANGED, response.getCode()); // read the timezone to check the value changed ReadResponse readResponse = helper.server.send(helper.getClient(), new ReadRequest(3, 0, 15)); LwM2mResource resource = (LwM2mResource) readResponse.getContent(); assertEquals(timeZone, resource.getValue()); }
@Test public void can_write_object_instance() { // write device timezone and offset LwM2mResource utcOffset = LwM2mSingleResource.newStringResource(14, "+02"); LwM2mResource timeZone = LwM2mSingleResource.newStringResource(15, "Europe/Paris"); WriteResponse response = helper.server.send( helper.getClient(), new WriteRequest(Mode.REPLACE, 3, 0, utcOffset, timeZone)); // verify result assertEquals(ResponseCode.CHANGED, response.getCode()); // read the timezone to check the value changed ReadResponse readResponse = helper.server.send(helper.getClient(), new ReadRequest(3, 0)); LwM2mObjectInstance instance = (LwM2mObjectInstance) readResponse.getContent(); assertEquals(utcOffset, instance.getResource(14)); assertEquals(timeZone, instance.getResource(15)); }
@Test public void testPaginatedLocal() throws IOException, GeneralSecurityException { String[] ARGS = { "--apiKey=" + helper.getApiKey(), "--references=" + helper.PLATINUM_GENOMES_BRCA1_REFERENCES, "--datasetId=" + helper.PLATINUM_GENOMES_DATASET, "--output=" + outputPrefix, "--useGrpc=false" }; testBase(ARGS); }
@Test public void cannot_write_non_writable_resource() { // try to write unwritable resource like manufacturer on device final String manufacturer = "new manufacturer"; WriteResponse response = helper.server.send( helper.getClient(), new WriteRequest(Mode.REPLACE, 3, 0, 0, manufacturer)); // verify result assertEquals(ResponseCode.METHOD_NOT_ALLOWED, response.getCode()); }
@Ignore // TODO enable this test. For it to work, we'll need to add alpn to the classpath // and figure out https://github.com/googlegenomics/dataflow-java/issues/119 @Test public void testStreamingLocal() throws IOException, GeneralSecurityException { String[] ARGS = { "--apiKey=" + helper.getApiKey(), "--references=" + helper.PLATINUM_GENOMES_BRCA1_REFERENCES, "--datasetId=" + helper.PLATINUM_GENOMES_DATASET, "--output=" + outputPrefix, "--useGrpc=true" }; testBase(ARGS); }
/** * This move an element in a many reference list to another position. * * @throws EmfStoreException EmfStoreException * @throws SerializationException SerializationException */ @Test public void multiReferenceMoveTest() throws SerializationException, EmfStoreException { System.out.println("MultiReferenceMoveTest"); final IntegrationTestHelper testHelper = new IntegrationTestHelper(randomSeed, getTestProject()); new EMFStoreCommand() { @Override protected void doRun() { testHelper.doMultiReferenceMove(); } }.run(false); commitChanges(); assertTrue( IntegrationTestHelper.areEqual( getTestProject(), getCompareProject(), "MultiReferenceMoveTest")); }
private void testBase(String[] ARGS) throws IOException, GeneralSecurityException { // Run the pipeline. VariantSimilarity.main(ARGS); // Download the pipeline results. List<GraphResult> results = Lists.newArrayList(); for (GcsPath path : helper.gcsUtil.expand(GcsPath.fromUri(outputPrefix + "*"))) { BufferedReader reader = helper.openOutput(path.toString()); for (String line = reader.readLine(); line != null; line = reader.readLine()) { results.add(GraphResult.fromString(line)); } } // Check the pipeline results. assertEquals(helper.PLATINUM_GENOMES_NUMBER_OF_SAMPLES, results.size()); assertThat(results, CoreMatchers.allOf(CoreMatchers.hasItems(EXPECTED_RESULT))); }
@After public void tearDown() throws Exception { for (GcsPath path : helper.gcsUtil.expand(GcsPath.fromUri(outputPrefix + "*"))) { helper.deleteOutput(path.toString()); } }
@BeforeClass public static void setUpBeforeClass() throws Exception { helper = new IntegrationTestHelper(); outputPrefix = helper.getTestOutputGcsFolder() + "variantSimilarity"; }