ToolsImplCommon { public static FileWrapper sourceFileToToolTests(String urlWithWorkDirectory, SourceFile sourceFile) { DescriptorLanguage.FileType type = sourceFile.getType(); if (!type.equals(DescriptorLanguage.FileType.WDL_TEST_JSON) && !type.equals(DescriptorLanguage.FileType.CWL_TEST_JSON) && !type.equals( DescriptorLanguage.FileType.NEXTFLOW_TEST_PARAMS)) { LOG.error("This source file is not a recognized test file."); } ExtendedFileWrapper toolTests = new ExtendedFileWrapper(); List<Checksum> trsChecksums = convertToTRSChecksums(sourceFile); toolTests.setChecksum(trsChecksums); toolTests.setUrl(urlWithWorkDirectory + sourceFile.getPath()); toolTests.setContent(sourceFile.getContent()); toolTests.setOriginalFile(sourceFile); return toolTests; } 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 sourceFileToToolTests() { SourceFile sourceFile = new SourceFile(); sourceFile.setType(DescriptorLanguage.FileType.CWL_TEST_JSON); sourceFile.setPath("/test.cwl.json"); sourceFile.setAbsolutePath("/test.cwl.json"); sourceFile.setContent(PLACEHOLDER_CONTENT); sourceFile.setId(9001); FileWrapper actualToolTests = ApiV2BetaVersionConverter.getOldWrapper(ToolsImplCommon.sourceFileToToolTests("", sourceFile)); FileWrapper expectedToolTests = new FileWrapper(); expectedToolTests.setContent(PLACEHOLDER_CONTENT); expectedToolTests.setUrl("/test.cwl.json"); assertEquals(expectedToolTests, actualToolTests); }