From 88712f7610c1c51ee9a58e17ad9f3e1b8425eba9 Mon Sep 17 00:00:00 2001 From: Zhomart Mukhamejanov Date: Tue, 21 Aug 2018 12:19:02 -0700 Subject: Move ab_streaming_metadata under ab_config. Add new config: ab_config.verify_payload_metadata. Change-Id: I521dff92166c33dd9c2efa498dc599fe4bc83fde Signed-off-by: Zhomart Mukhamejanov Test: mmm, junit Bug: 77150191 --- .../systemupdatersample/UpdateConfigTest.java | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'updater_sample/tests/src/com/example/android/systemupdatersample/UpdateConfigTest.java') diff --git a/updater_sample/tests/src/com/example/android/systemupdatersample/UpdateConfigTest.java b/updater_sample/tests/src/com/example/android/systemupdatersample/UpdateConfigTest.java index 1cbd8601e..48d0e424d 100644 --- a/updater_sample/tests/src/com/example/android/systemupdatersample/UpdateConfigTest.java +++ b/updater_sample/tests/src/com/example/android/systemupdatersample/UpdateConfigTest.java @@ -44,10 +44,12 @@ import java.io.InputStreamReader; @SmallTest public class UpdateConfigTest { - private static final String JSON_NON_STREAMING = - "{\"name\": \"vip update\", \"url\": \"file:///builds/a.zip\", " - + " \"ab_install_type\": \"NON_STREAMING\"," - + " \"ab_config\": { \"force_switch_slot\": false } }"; + private static final String JSON_NON_STREAMING = "{" + + " \"name\": \"vip update\", \"url\": \"file:///my-builds/a.zip\"," + + " \"ab_install_type\": \"NON_STREAMING\"," + + " \"ab_config\": {" + + " \"force_switch_slot\": false," + + " \"verify_payload_metadata\": false } }"; @Rule public final ExpectedException thrown = ExpectedException.none(); @@ -71,7 +73,7 @@ public class UpdateConfigTest { assertSame("type is parsed", UpdateConfig.AB_INSTALL_TYPE_NON_STREAMING, config.getInstallType()); - assertEquals("url is parsed", "file:///builds/a.zip", config.getUrl()); + assertEquals("url is parsed", "file:///my-builds/a.zip", config.getUrl()); } @Test @@ -81,9 +83,9 @@ public class UpdateConfigTest { assertEquals("http://foo.bar/update.zip", config.getUrl()); assertSame(UpdateConfig.AB_INSTALL_TYPE_STREAMING, config.getInstallType()); assertEquals("payload.bin", - config.getStreamingMetadata().getPropertyFiles()[0].getFilename()); - assertEquals(195, config.getStreamingMetadata().getPropertyFiles()[0].getOffset()); - assertEquals(8, config.getStreamingMetadata().getPropertyFiles()[0].getSize()); + config.getAbConfig().getPropertyFiles()[0].getFilename()); + assertEquals(195, config.getAbConfig().getPropertyFiles()[0].getOffset()); + assertEquals(8, config.getAbConfig().getPropertyFiles()[0].getSize()); assertTrue(config.getAbConfig().getForceSwitchSlot()); } @@ -96,9 +98,12 @@ public class UpdateConfigTest { @Test public void getUpdatePackageFile_throwsErrorIfNotAFile() throws Exception { - String json = "{\"name\": \"upd\", \"url\": \"http://foo.bar\"," + String json = "{" + + " \"name\": \"upd\", \"url\": \"http://foo.bar\"," + " \"ab_install_type\": \"NON_STREAMING\"," - + " \"ab_config\": { \"force_switch_slot\": false } }"; + + " \"ab_config\": {" + + " \"force_switch_slot\": false," + + " \"verify_payload_metadata\": false } }"; UpdateConfig config = UpdateConfig.fromJson(json); thrown.expect(RuntimeException.class); config.getUpdatePackageFile(); @@ -107,7 +112,7 @@ public class UpdateConfigTest { @Test public void getUpdatePackageFile_works() throws Exception { UpdateConfig c = UpdateConfig.fromJson(JSON_NON_STREAMING); - assertEquals("/builds/a.zip", c.getUpdatePackageFile().getAbsolutePath()); + assertEquals("/my-builds/a.zip", c.getUpdatePackageFile().getAbsolutePath()); } private String readResource(int id) throws IOException { -- cgit v1.2.3