@RequestMapping(MODULE_URL + "subscribed")
  public String subscribed(HttpSession httpSession, ModelMap model) {
    ImportedPackage importedPackage = getService().getSubscribedDictionary();
    if (importedPackage.hasSubscriptionErrors()) {
      httpSession.setAttribute(
          WebConstants.OPENMRS_ERROR_ATTR,
          "Unable to subscribe to url: " + importedPackage.getSubscriptionStatus());
    }

    model.addAttribute("dictionary", getService().getSubscribedDictionary());
    model.addAttribute("url", importedPackage.getSubscriptionUrl());

    return null;
  }
  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);
    }
  }