private void verifyMetadataPackagesConfigured() throws Exception {
    MetadataPackagesConfig config;
    {
      InputStream inputStream =
          activator.getClass().getClassLoader().getResourceAsStream(MetadataUtil.PACKAGES_FILENAME);
      String xml = IOUtils.toString(inputStream);
      config =
          Context.getSerializationService()
              .getDefaultSerializer()
              .deserialize(xml, MetadataPackagesConfig.class);
    }

    MetadataSharingService metadataSharingService =
        Context.getService(MetadataSharingService.class);

    // To catch the (common) case where someone gets the groupUuid wrong, we look for any installed
    // packages that
    // we are not expecting

    List<String> groupUuids = new ArrayList<String>();

    for (MetadataPackageConfig metadataPackage : config.getPackages()) {
      groupUuids.add(metadataPackage.getGroupUuid());
    }

    for (ImportedPackage importedPackage : metadataSharingService.getAllImportedPackages()) {
      if (!groupUuids.contains(importedPackage.getGroupUuid())) {
        fail(
            "Found a package with an unexpected groupUuid. Name: "
                + importedPackage.getName()
                + " , groupUuid: "
                + importedPackage.getGroupUuid());
      }
    }

    for (MetadataPackageConfig metadataPackage : config.getPackages()) {
      ImportedPackage installedPackage =
          metadataSharingService.getImportedPackageByGroup(metadataPackage.getGroupUuid());
      Integer actualVersion = installedPackage == null ? null : installedPackage.getVersion();
      assertEquals(
          "Failed to install "
              + metadataPackage.getFilenameBase()
              + ". Expected version: "
              + metadataPackage.getVersion()
              + " Actual version: "
              + actualVersion,
          metadataPackage.getVersion(),
          actualVersion);
    }

    // this doesn't strictly belong here, but we include it as an extra sanity check on the MDS
    // module
    for (Concept concept : conceptService.getAllConcepts()) {
      ValidateUtil.validate(concept);
    }
  }
  private void verifySentinelData() {
    // Verify a few pieces of sentinel data that should have been in the packages
    assertNotNull(userService.getRole("Organizational: Doctor"));
    MetadataUtils.existing(Role.class, RolePrivilegeMetadata._Role.ORGANIZATIONAL_DOCTOR);
    MetadataUtils.existing(
        Privilege.class, RolePrivilegeMetadata._Privilege.APP_COREAPPS_FIND_PATIENT);

    assertThat(
        conceptService.getConcept(5085).getUuid(), is("5085AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));
    assertThat(
        conceptService.getConcept(159947).getUuid(), is("159947AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"));

    assertThat(conceptService.getAllConcepts().size(), is(435));
  }