ToolsImplCommon { public static ExtendedFileWrapper sourceFileToToolDescriptor(String url, SourceFile sourceFile) { ExtendedFileWrapper toolDescriptor = new ExtendedFileWrapper(); convertToTRSChecksums(sourceFile); toolDescriptor.setChecksum(convertToTRSChecksums(sourceFile)); toolDescriptor.setContent(sourceFile.getContent()); toolDescriptor.setUrl(url); toolDescriptor.setOriginalFile(sourceFile); return toolDescriptor; } private  ToolsImplCommon(); static ExtendedFileWrapper sourceFileToToolDescriptor(String url, SourceFile sourceFile); static Tool convertEntryToTool(Entry<?, ?> container, DockstoreWebserviceConfiguration config); static Tool convertEntryToTool(Entry<?, ?> container, DockstoreWebserviceConfiguration config, boolean showHiddenTags); static String getUrl(String newID, String baseURL); static String baseURL(DockstoreWebserviceConfiguration config); static FileWrapper sourceFileToToolTests(String urlWithWorkDirectory, SourceFile sourceFile); static String getUrlFromId(DockstoreWebserviceConfiguration config, String toolID); static final String WORKFLOW_PREFIX; static final String SERVICE_PREFIX; static final String DOCKER_IMAGE_SHA_TYPE_FOR_TRS; }
@Test public void wdlSourceFileToToolDescriptor() { SourceFile sourceFile = new SourceFile(); sourceFile.setType(DescriptorLanguage.FileType.DOCKSTORE_WDL); sourceFile.setPath("/Dockstore.wdl"); sourceFile.setAbsolutePath("/Dockstore.wdl"); sourceFile.setContent(PLACEHOLDER_CONTENT); sourceFile.setId(9001); FileWrapper actualToolDescriptor = ApiV2BetaVersionConverter.getOldWrapper(ToolsImplCommon.sourceFileToToolDescriptor("/Dockstore.wdl", sourceFile)); FileWrapper expectedToolDescriptor = new FileWrapper(); expectedToolDescriptor.setUrl("/Dockstore.wdl"); expectedToolDescriptor.setContent(PLACEHOLDER_CONTENT); assertEquals(actualToolDescriptor, expectedToolDescriptor); }
@Test public void cwlSourceFileToToolDescriptor() { SourceFile sourceFile = new SourceFile(); sourceFile.setType(DescriptorLanguage.FileType.DOCKSTORE_CWL); sourceFile.setPath("/Dockstore.cwl"); sourceFile.setAbsolutePath("/Dockstore.cwl"); sourceFile.setContent(PLACEHOLDER_CONTENT); sourceFile.setId(9001); FileWrapper actualToolDescriptor = ApiV2BetaVersionConverter.getOldWrapper(ToolsImplCommon.sourceFileToToolDescriptor("/Dockstore.cwl", sourceFile)); FileWrapper expectedToolDescriptor = new FileWrapper(); expectedToolDescriptor.setUrl("/Dockstore.cwl"); expectedToolDescriptor.setContent(PLACEHOLDER_CONTENT); assertEquals(actualToolDescriptor, expectedToolDescriptor); }