@Test public void testTwoWayMergeSanity() throws Exception { Map<String, String> expected = new HashMap<>(); expected.put("archiveMissingFile-archiveMissingFile", "Archive com.github.jomof:vectorial:0.0.0 is missing file"); expected.put("archiveMissingSha256-archiveMissingSha256", "Archive com.github.jomof:vectorial:0.0.0 is missing sha256"); expected.put("sqliteLinuxMultiple-sqliteLinuxMultiple", "Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed."); expected.put("sqliteLinuxMultiple-sqlite", "Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed."); expected.put("sqliteLinuxMultiple-singleABI", "Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed."); expected.put("sqliteLinuxMultiple-sqliteLinux", "Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed."); expected.put("archiveMissingSize-archiveMissingSize", "Archive com.github.jomof:vectorial:0.0.0 is missing size or it is zero"); expected.put("admob-admob", "Archive com.github.jomof:firebase/admob:2.1.3-rev8 is missing include"); expected.put("sqlite-sqliteLinuxMultiple", "Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed."); expected.put("singleABISqlite-singleABISqlite", "Package 'com.github.jomof:sqlite:3.16.2-rev45' contains multiple references to the same archive file " + "'sqlite-android-cxx-platform-12-armeabi.zip'"); expected.put("singleABI-sqliteLinuxMultiple", "Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed."); expected.put("singleABI-singleABI", "Package 'com.github.jomof:sqlite:0.0.0' contains multiple references to the same archive file " + "'sqlite-android-cxx-platform-12-armeabi.zip'"); expected.put("sqliteLinux-sqliteLinuxMultiple", "Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed."); expected.put("sqliteLinux-sqliteLinux", "Package 'com.github.jomof:sqlite:0.0.0' has multiple linux archives. Only one is allowed."); expected.put("sqliteiOS-sqliteiOS", "Package 'com.github.jomof:sqlite:3.16.2-rev33' contains multiple references to the same archive file " + "'sqlite-ios-platform-iPhoneOS-architecture-armv7-sdk-9.3.zip'"); expected.put("templateWithNullArchives-templateWithNullArchives", "Package 'com.github.jomof:firebase/" + "app:${version}' has malformed version, expected major.minor.point[-tweak] but there were no dots"); expected.put("templateWithNullArchives-templateWithOnlyFile", "Package 'com.github.jomof:" + "firebase/app:${version}' has malformed version, expected major.minor.point[-tweak] but there were no dots"); expected.put("templateWithOnlyFile-templateWithNullArchives", "Package 'com.github.jomof:firebase/" + "app:${version}' has malformed version, expected major.minor.point[-tweak] but there were no dots"); expected.put("templateWithOnlyFile-templateWithOnlyFile", "Package 'com.github.jomof:firebase/" + "app:${version}' has malformed version, expected major.minor.point[-tweak] but there were no dots"); expected.put("sqlite-sqlite", "Android archive com.github.jomof:sqlite:0.0.0 file sqlite-android-cxx-platform-12.zip is indistinguishable at build time from sqlite-android-cxx-platform-12.zip given the information in the manifest"); expected.put("sqlite-singleABI", "Android archive com.github.jomof:sqlite:0.0.0 file sqlite-android-cxx-platform-12-armeabi.zip is indistinguishable at build time from sqlite-android-cxx-platform-12.zip given the information in the manifest"); expected.put("sqliteAndroid-sqliteAndroid", "Android archive com.github.jomof:sqlite:3.16.2-rev33 file sqlite-android-cxx-platform-12.zip is indistinguishable at build time from sqlite-android-cxx-platform-12.zip given the information in the manifest"); expected.put("singleABI-sqlite", "Android archive com.github.jomof:sqlite:0.0.0 file sqlite-android-cxx-platform-12.zip is indistinguishable at build time from sqlite-android-cxx-platform-12-armeabi.zip given the information in the manifest"); expected.put("singleABI-singleABI", "Android archive com.github.jomof:sqlite:0.0.0 file sqlite-android-cxx-platform-12-armeabi.zip is indistinguishable at build time from sqlite-android-cxx-platform-12-armeabi.zip given the information in the manifest"); expected.put("indistinguishableAndroidArchives-indistinguishableAndroidArchives", "Android archive com.github.jomof:firebase/app:0.0.0 file archive2.zip is indistinguishable at build time from archive1.zip given the information in the manifest"); expected.put("singleABISqlite-singleABISqlite", "Android archive com.github.jomof:sqlite:3.16.2-rev45 file sqlite-android-cxx-platform-12-armeabi.zip is indistinguishable at build time from sqlite-android-cxx-platform-12-armeabi.zip given the information in the manifest"); expected.put("re2-re2", "Android archive com.github.jomof:re2:17.3.1-rev13 file re2-21-armeabi.zip is indistinguishable at build time from re2-21-armeabi.zip given the information in the manifest"); expected.put("fuzz1-fuzz1", "Manifest was missing coordinate"); expected.put("fuzz2-fuzz2", "Manifest was missing coordinate"); expected.put("openssl-openssl", "Android archive com.github.jomof:openssl:1.0.1-e-rev6 file openssl-android-stlport-21-armeabi.zip is indistinguishable at build time from openssl-android-stlport-21-armeabi.zip given the information in the manifest"); boolean somethingUnexpected = false; for (ResolvedManifests.NamedManifest manifest1 : ResolvedManifests.all()) { for (ResolvedManifests.NamedManifest manifest2 : ResolvedManifests.all()) { String key = manifest1.name + "-" + manifest2.name; String expectedFailure = expected.get(key); CDepManifestYml manifest; try { manifest = MergeCDepManifestYmls.merge(manifest1.resolved.cdepManifestYml, manifest2.resolved.cdepManifestYml); } catch (RuntimeException e) { continue; } try { CDepManifestYmlUtils.checkManifestSanity(manifest); if (expectedFailure != null) { TestCase.fail("Expected a failure."); } } catch (RuntimeException e) { String actual = e.getMessage(); if (!actual.equals(expectedFailure)) { System.out.printf("expected.put(\"%s\", \"%s\");\n", key, actual); somethingUnexpected = true; } } } } if (somethingUnexpected) { throw new RuntimeException("Saw unexpected results. See console."); } }
public static void checkManifestSanity(@NotNull CDepManifestYml cdepManifestYml) { new Checker().visit(cdepManifestYml, CDepManifestYml.class); }
CDepManifestYmlUtils { public static void checkManifestSanity(@NotNull CDepManifestYml cdepManifestYml) { new Checker().visit(cdepManifestYml, CDepManifestYml.class); } }
CDepManifestYmlUtils { public static void checkManifestSanity(@NotNull CDepManifestYml cdepManifestYml) { new Checker().visit(cdepManifestYml, CDepManifestYml.class); }  }
CDepManifestYmlUtils { public static void checkManifestSanity(@NotNull CDepManifestYml cdepManifestYml) { new Checker().visit(cdepManifestYml, CDepManifestYml.class); }  @NotNull static String convertManifestToString(@NotNull CDepManifestYml manifest); @NotNull static CDepManifestYml convertStringToManifest(@NotNull String content); static void checkManifestSanity(@NotNull CDepManifestYml cdepManifestYml); @NotNull static List<HardNameDependency> getTransitiveDependencies(@NotNull CDepManifestYml cdepManifestYml); }
CDepManifestYmlUtils { public static void checkManifestSanity(@NotNull CDepManifestYml cdepManifestYml) { new Checker().visit(cdepManifestYml, CDepManifestYml.class); }  @NotNull static String convertManifestToString(@NotNull CDepManifestYml manifest); @NotNull static CDepManifestYml convertStringToManifest(@NotNull String content); static void checkManifestSanity(@NotNull CDepManifestYml cdepManifestYml); @NotNull static List<HardNameDependency> getTransitiveDependencies(@NotNull CDepManifestYml cdepManifestYml);  }