@Test public void testGetRelativeURIWhenStandalone() { final Path includedModelPath = mock(Path.class); when(includedModelPath.getFileName()).thenReturn("file1"); assertEquals("file1", pathsHelper.getRelativeURI(null, includedModelPath)); }
@Override public String getRelativeURI(final Path dmnModelPath, final Path includedModelPath) { if (Objects.isNull(dmnModelPath)) { return includedModelPath.getFileName(); } final org.uberfire.java.nio.file.Path nioDMN = convertPath(normalizePath(dmnModelPath)); final org.uberfire.java.nio.file.Path nioIncluded = convertPath(normalizePath(includedModelPath)); final org.uberfire.java.nio.file.Path nioRelative = nioDMN.relativize(nioIncluded); final String strRelative = FilenameUtils.separatorsToUnix(nioRelative.toString()); if (strRelative.startsWith("../")) { return strRelative.substring(3); } else { return strRelative; } }
DMNPathsHelperImpl implements DMNPathsHelper { @Override public String getRelativeURI(final Path dmnModelPath, final Path includedModelPath) { if (Objects.isNull(dmnModelPath)) { return includedModelPath.getFileName(); } final org.uberfire.java.nio.file.Path nioDMN = convertPath(normalizePath(dmnModelPath)); final org.uberfire.java.nio.file.Path nioIncluded = convertPath(normalizePath(includedModelPath)); final org.uberfire.java.nio.file.Path nioRelative = nioDMN.relativize(nioIncluded); final String strRelative = FilenameUtils.separatorsToUnix(nioRelative.toString()); if (strRelative.startsWith("../")) { return strRelative.substring(3); } else { return strRelative; } } }
DMNPathsHelperImpl implements DMNPathsHelper { @Override public String getRelativeURI(final Path dmnModelPath, final Path includedModelPath) { if (Objects.isNull(dmnModelPath)) { return includedModelPath.getFileName(); } final org.uberfire.java.nio.file.Path nioDMN = convertPath(normalizePath(dmnModelPath)); final org.uberfire.java.nio.file.Path nioIncluded = convertPath(normalizePath(includedModelPath)); final org.uberfire.java.nio.file.Path nioRelative = nioDMN.relativize(nioIncluded); final String strRelative = FilenameUtils.separatorsToUnix(nioRelative.toString()); if (strRelative.startsWith("../")) { return strRelative.substring(3); } else { return strRelative; } } DMNPathsHelperImpl(); @Inject  DMNPathsHelperImpl(final RefactoringQueryService refactoringQueryService,
                              final DMNImportTypesHelper importTypesHelper,
                              final @Named("ioStrategy") IOService ioService); }
DMNPathsHelperImpl implements DMNPathsHelper { @Override public String getRelativeURI(final Path dmnModelPath, final Path includedModelPath) { if (Objects.isNull(dmnModelPath)) { return includedModelPath.getFileName(); } final org.uberfire.java.nio.file.Path nioDMN = convertPath(normalizePath(dmnModelPath)); final org.uberfire.java.nio.file.Path nioIncluded = convertPath(normalizePath(includedModelPath)); final org.uberfire.java.nio.file.Path nioRelative = nioDMN.relativize(nioIncluded); final String strRelative = FilenameUtils.separatorsToUnix(nioRelative.toString()); if (strRelative.startsWith("../")) { return strRelative.substring(3); } else { return strRelative; } } DMNPathsHelperImpl(); @Inject  DMNPathsHelperImpl(final RefactoringQueryService refactoringQueryService,
                              final DMNImportTypesHelper importTypesHelper,
                              final @Named("ioStrategy") IOService ioService); @Override List<Path> getModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getDMNModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getPMMLModelsPaths(final WorkspaceProject workspaceProject); @Override String getRelativeURI(final Path dmnModelPath,
                                 final Path includedModelPath); }
DMNPathsHelperImpl implements DMNPathsHelper { @Override public String getRelativeURI(final Path dmnModelPath, final Path includedModelPath) { if (Objects.isNull(dmnModelPath)) { return includedModelPath.getFileName(); } final org.uberfire.java.nio.file.Path nioDMN = convertPath(normalizePath(dmnModelPath)); final org.uberfire.java.nio.file.Path nioIncluded = convertPath(normalizePath(includedModelPath)); final org.uberfire.java.nio.file.Path nioRelative = nioDMN.relativize(nioIncluded); final String strRelative = FilenameUtils.separatorsToUnix(nioRelative.toString()); if (strRelative.startsWith("../")) { return strRelative.substring(3); } else { return strRelative; } } DMNPathsHelperImpl(); @Inject  DMNPathsHelperImpl(final RefactoringQueryService refactoringQueryService,
                              final DMNImportTypesHelper importTypesHelper,
                              final @Named("ioStrategy") IOService ioService); @Override List<Path> getModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getDMNModelsPaths(final WorkspaceProject workspaceProject); @Override List<Path> getPMMLModelsPaths(final WorkspaceProject workspaceProject); @Override String getRelativeURI(final Path dmnModelPath,
                                 final Path includedModelPath);  }