public void register(Application app) throws IOException {
    Collection<SolrInputDocument> docs = new HashSet<SolrInputDocument>();
    SolrClient solr = getSolrClient();
    try {
      SolrInputDocument buffer = new SolrInputDocument();
      buffer.setField("id", java.util.UUID.randomUUID().toString()
          .substring(0, 11));
      buffer.setField("org_s", app.getOrganization());
      buffer.setField("name_s", app.getName());
      buffer.setField("desc_s", app.getDescription());
      if (app.getIcon() != null) {
        buffer.setField("icon_s", app.getIcon());
      }
      buffer.setField("type_s", "AppStoreEntry");
      buffer.setField("like_i", 0);
      buffer.setField("download_i", 0);

      // Keep only YARN data model for yarnfile field
      String yarnFile = OBJECT_MAPPER.writeValueAsString(app);
      LOG.info("app:{}", yarnFile);
      Service yarnApp = OBJECT_MAPPER.readValue(yarnFile, Service.class);
      buffer.setField("yarnfile_s", OBJECT_MAPPER.writeValueAsString(yarnApp));

      docs.add(buffer);
      commitSolrChanges(solr, docs);
    } catch (SolrServerException | IOException e) {
      throw new IOException("Unable to register application " +
          "in Application Store. ", e);
    }
  }
@Test
  void testRegister() throws Exception {
    Application example = new Application();
    example.setOrganization("jenkins-ci.org");
    example.setName("jenkins");
    example.setDescription("World leading open source automation system.");
    example.setIcon("/css/img/feather.png");
    spy.register(example);
    List<AppStoreEntry> apps = spy.getRecommendedApps();
    assertEquals(1, apps.size());
  }