@Test( expectedExceptions = {ServerException.class}, expectedExceptionsMessageRegExp = SERVER_EXCEPTION_MESSAGE_WHEN_SPEC_IS_NULL) public void throwWhenEditorSpecIsNull() throws Exception { when(pluginFQNParser.parsePluginFQN(any())).thenReturn(PLUGIN_FQN); doReturn(pluginMeta).when(yamlDownloader).getYamlResponseAndParse(any()); doReturn(null).when(pluginMeta).getSpec(); service = new CdnSupportService( commandRunner, pluginFQNParser, yamlDownloader, DEFAULT_REGISTRY_URL, EDITOR_REF); service.getPaths(); }
@GET @Path("paths") @Produces(APPLICATION_JSON) public String getPaths() throws Exception { if (editorToPrefetch == null) { throw new NotFoundException("No editor is configured for CDN resource pre-fetching"); } if (dockerImage == null) { PluginMeta editorMeta = getEditorMeta(); dockerImage = getDockerImage(editorMeta); } JsonNode json = inspectDockerImage(); return json.path("Labels").path(LABEL_NAME).asText("[]"); }
CdnSupportService extends Service { @GET @Path("paths") @Produces(APPLICATION_JSON) public String getPaths() throws Exception { if (editorToPrefetch == null) { throw new NotFoundException("No editor is configured for CDN resource pre-fetching"); } if (dockerImage == null) { PluginMeta editorMeta = getEditorMeta(); dockerImage = getDockerImage(editorMeta); } JsonNode json = inspectDockerImage(); return json.path("Labels").path(LABEL_NAME).asText("[]"); } }
CdnSupportService extends Service { @GET @Path("paths") @Produces(APPLICATION_JSON) public String getPaths() throws Exception { if (editorToPrefetch == null) { throw new NotFoundException("No editor is configured for CDN resource pre-fetching"); } if (dockerImage == null) { PluginMeta editorMeta = getEditorMeta(); dockerImage = getDockerImage(editorMeta); } JsonNode json = inspectDockerImage(); return json.path("Labels").path(LABEL_NAME).asText("[]"); } @Inject  CdnSupportService(
      PluginFQNParser pluginFQNParser,
      HttpYamlDownloader yamlDownloader,
      @Named("che.workspace.plugin_registry_url") String registryUrl,
      @Nullable @Named("che.fabric8.cdn.prefetch.editor") String editorToPrefetch); @VisibleForTesting  CdnSupportService(
      CommandRunner commandRunner,
      PluginFQNParser pluginFQNParser,
      HttpYamlDownloader yamlDownloader,
      @Named("che.workspace.plugin_registry_url") String registryUrl,
      @Nullable @Named("che.fabric8.cdn.prefetch.editor") String editorToPrefetch); }
CdnSupportService extends Service { @GET @Path("paths") @Produces(APPLICATION_JSON) public String getPaths() throws Exception { if (editorToPrefetch == null) { throw new NotFoundException("No editor is configured for CDN resource pre-fetching"); } if (dockerImage == null) { PluginMeta editorMeta = getEditorMeta(); dockerImage = getDockerImage(editorMeta); } JsonNode json = inspectDockerImage(); return json.path("Labels").path(LABEL_NAME).asText("[]"); } @Inject  CdnSupportService(
      PluginFQNParser pluginFQNParser,
      HttpYamlDownloader yamlDownloader,
      @Named("che.workspace.plugin_registry_url") String registryUrl,
      @Nullable @Named("che.fabric8.cdn.prefetch.editor") String editorToPrefetch); @VisibleForTesting  CdnSupportService(
      CommandRunner commandRunner,
      PluginFQNParser pluginFQNParser,
      HttpYamlDownloader yamlDownloader,
      @Named("che.workspace.plugin_registry_url") String registryUrl,
      @Nullable @Named("che.fabric8.cdn.prefetch.editor") String editorToPrefetch); @GET @Path("paths") @Produces(APPLICATION_JSON) String getPaths(); }
CdnSupportService extends Service { @GET @Path("paths") @Produces(APPLICATION_JSON) public String getPaths() throws Exception { if (editorToPrefetch == null) { throw new NotFoundException("No editor is configured for CDN resource pre-fetching"); } if (dockerImage == null) { PluginMeta editorMeta = getEditorMeta(); dockerImage = getDockerImage(editorMeta); } JsonNode json = inspectDockerImage(); return json.path("Labels").path(LABEL_NAME).asText("[]"); } @Inject  CdnSupportService(
      PluginFQNParser pluginFQNParser,
      HttpYamlDownloader yamlDownloader,
      @Named("che.workspace.plugin_registry_url") String registryUrl,
      @Nullable @Named("che.fabric8.cdn.prefetch.editor") String editorToPrefetch); @VisibleForTesting  CdnSupportService(
      CommandRunner commandRunner,
      PluginFQNParser pluginFQNParser,
      HttpYamlDownloader yamlDownloader,
      @Named("che.workspace.plugin_registry_url") String registryUrl,
      @Nullable @Named("che.fabric8.cdn.prefetch.editor") String editorToPrefetch); @GET @Path("paths") @Produces(APPLICATION_JSON) String getPaths();  }