@Test public void concatUnixPathsTest() { assertEquals("foo/bar", concatUnixPaths("foo", "bar")); assertEquals("foo/bar", concatUnixPaths("foo/", "bar")); assertEquals("foo/bar", concatUnixPaths("foo/", "/bar")); assertEquals("foo/bar", concatUnixPaths("foo", "/bar")); assertEquals("foo/bar", concatUnixPaths("foo", "bar/")); assertEquals("foo/bar", concatUnixPaths("foo/", "bar/")); assertEquals("foo/bar", concatUnixPaths("foo/", "/bar/")); assertEquals("foo/bar", concatUnixPaths("foo", "/bar/")); assertEquals("foo/bar", concatUnixPaths("foo", "/", "bar")); assertEquals("foo/bar", concatUnixPaths("foo/", "/", "bar")); assertEquals("foo/bar", concatUnixPaths("foo/", "/", "/bar")); assertEquals("foo/bar", concatUnixPaths("foo", "/", "/bar")); assertEquals("foo/bar", concatUnixPaths("foo", "/", "bar/")); assertEquals("foo/bar", concatUnixPaths("foo/", "/", "bar/")); assertEquals("foo/bar", concatUnixPaths("foo/", "/", "/bar/")); assertEquals("foo/bar", concatUnixPaths("foo", "/", "/bar/")); assertEquals("/foo/bar", concatUnixPaths("/foo", "bar")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "bar")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "/bar")); assertEquals("/foo/bar", concatUnixPaths("/foo", "/bar")); assertEquals("/foo/bar", concatUnixPaths("/foo", "bar/")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "bar/")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "/bar/")); assertEquals("/foo/bar", concatUnixPaths("/foo", "/bar/")); assertEquals("/foo/bar", concatUnixPaths("/foo", "/", "bar")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "/", "bar")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "/", "/bar")); assertEquals("/foo/bar", concatUnixPaths("/foo", "/", "/bar")); assertEquals("/foo/bar", concatUnixPaths("/foo", "/", "bar/")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "/", "bar/")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "/", "/bar/")); assertEquals("/foo/bar", concatUnixPaths("/foo", "/", "/bar/")); assertEquals("/foo/bar", concatUnixPaths("/foo", "bar", "/")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "bar", "/")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "/bar", "/")); assertEquals("/foo/bar", concatUnixPaths("/foo", "/bar", "/")); assertEquals("/foo/bar", concatUnixPaths("/foo", "bar/", "/")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "bar/", "/")); assertEquals("/foo/bar", concatUnixPaths("/foo/", "/bar/", "/")); assertEquals("/foo/bar", concatUnixPaths("/foo", "/bar/", "/")); }
static String concatUnixPaths(String... elements) { StringBuilder result = new StringBuilder(); for (String element : elements) { if (element.endsWith("/")) { element = element.substring(0, element.length() - 1); } if (element.isEmpty()) { continue; } if (!element.startsWith("/") && result.length() > 0) { result.append('/'); } result.append(element); } return result.toString(); }
S2iProcessor { static String concatUnixPaths(String... elements) { StringBuilder result = new StringBuilder(); for (String element : elements) { if (element.endsWith("/")) { element = element.substring(0, element.length() - 1); } if (element.isEmpty()) { continue; } if (!element.startsWith("/") && result.length() > 0) { result.append('/'); } result.append(element); } return result.toString(); } }
S2iProcessor { static String concatUnixPaths(String... elements) { StringBuilder result = new StringBuilder(); for (String element : elements) { if (element.endsWith("/")) { element = element.substring(0, element.length() - 1); } if (element.isEmpty()) { continue; } if (!element.startsWith("/") && result.length() > 0) { result.append('/'); } result.append(element); } return result.toString(); }  }
S2iProcessor { static String concatUnixPaths(String... elements) { StringBuilder result = new StringBuilder(); for (String element : elements) { if (element.endsWith("/")) { element = element.substring(0, element.length() - 1); } if (element.isEmpty()) { continue; } if (!element.startsWith("/") && result.length() > 0) { result.append('/'); } result.append(element); } return result.toString(); }  @BuildStep(onlyIf = S2iBuild.class) CapabilityBuildItem capability(); @BuildStep(onlyIf = { IsNormal.class, S2iBuild.class }, onlyIfNot = NativeBuild.class) void s2iRequirementsJvm(S2iConfig s2iConfig,
            CurateOutcomeBuildItem curateOutcomeBuildItem,
            OutputTargetBuildItem out,
            PackageConfig packageConfig,
            JarBuildItem jarBuildItem,
            BuildProducer<KubernetesEnvBuildItem> envProducer,
            BuildProducer<BaseImageInfoBuildItem> builderImageProducer,
            BuildProducer<KubernetesCommandBuildItem> commandProducer); @BuildStep(onlyIf = { IsNormal.class, S2iBuild.class, NativeBuild.class }) void s2iRequirementsNative(S2iConfig s2iConfig,
            CurateOutcomeBuildItem curateOutcomeBuildItem,
            OutputTargetBuildItem out,
            PackageConfig packageConfig,
            NativeImageBuildItem nativeImage,
            BuildProducer<KubernetesEnvBuildItem> envProducer,
            BuildProducer<BaseImageInfoBuildItem> builderImageProducer,
            BuildProducer<KubernetesCommandBuildItem> commandProducer); @BuildStep(onlyIf = { IsNormal.class, S2iBuild.class }, onlyIfNot = NativeBuild.class) void s2iBuildFromJar(S2iConfig s2iConfig, ContainerImageConfig containerImageConfig,
            KubernetesClientBuildItem kubernetesClient,
            ContainerImageInfoBuildItem containerImage,
            ArchiveRootBuildItem archiveRoot, OutputTargetBuildItem out, PackageConfig packageConfig,
            List<GeneratedFileSystemResourceBuildItem> generatedResources,
            Optional<ContainerImageBuildRequestBuildItem> buildRequest,
            Optional<ContainerImagePushRequestBuildItem> pushRequest,
            BuildProducer<ArtifactResultBuildItem> artifactResultProducer,
            // used to ensure that the jar has been built
            JarBuildItem jar); @BuildStep(onlyIf = { IsNormal.class, S2iBuild.class, NativeBuild.class }) void s2iBuildFromNative(S2iConfig s2iConfig, ContainerImageConfig containerImageConfig,
            KubernetesClientBuildItem kubernetesClient,
            ContainerImageInfoBuildItem containerImage,
            ArchiveRootBuildItem archiveRoot, OutputTargetBuildItem out, PackageConfig packageConfig,
            List<GeneratedFileSystemResourceBuildItem> generatedResources,
            Optional<ContainerImageBuildRequestBuildItem> buildRequest,
            Optional<ContainerImagePushRequestBuildItem> pushRequest,
            BuildProducer<ArtifactResultBuildItem> artifactResultProducer,
            NativeImageBuildItem nativeImage); static void createContainerImage(KubernetesClientBuildItem kubernetesClient,
            GeneratedFileSystemResourceBuildItem openshiftManifests,
            S2iConfig s2iConfig,
            Path output,
            Path... additional); static Predicate<HasMetadata> distictByResourceKey(); }
S2iProcessor { static String concatUnixPaths(String... elements) { StringBuilder result = new StringBuilder(); for (String element : elements) { if (element.endsWith("/")) { element = element.substring(0, element.length() - 1); } if (element.isEmpty()) { continue; } if (!element.startsWith("/") && result.length() > 0) { result.append('/'); } result.append(element); } return result.toString(); }  @BuildStep(onlyIf = S2iBuild.class) CapabilityBuildItem capability(); @BuildStep(onlyIf = { IsNormal.class, S2iBuild.class }, onlyIfNot = NativeBuild.class) void s2iRequirementsJvm(S2iConfig s2iConfig,
            CurateOutcomeBuildItem curateOutcomeBuildItem,
            OutputTargetBuildItem out,
            PackageConfig packageConfig,
            JarBuildItem jarBuildItem,
            BuildProducer<KubernetesEnvBuildItem> envProducer,
            BuildProducer<BaseImageInfoBuildItem> builderImageProducer,
            BuildProducer<KubernetesCommandBuildItem> commandProducer); @BuildStep(onlyIf = { IsNormal.class, S2iBuild.class, NativeBuild.class }) void s2iRequirementsNative(S2iConfig s2iConfig,
            CurateOutcomeBuildItem curateOutcomeBuildItem,
            OutputTargetBuildItem out,
            PackageConfig packageConfig,
            NativeImageBuildItem nativeImage,
            BuildProducer<KubernetesEnvBuildItem> envProducer,
            BuildProducer<BaseImageInfoBuildItem> builderImageProducer,
            BuildProducer<KubernetesCommandBuildItem> commandProducer); @BuildStep(onlyIf = { IsNormal.class, S2iBuild.class }, onlyIfNot = NativeBuild.class) void s2iBuildFromJar(S2iConfig s2iConfig, ContainerImageConfig containerImageConfig,
            KubernetesClientBuildItem kubernetesClient,
            ContainerImageInfoBuildItem containerImage,
            ArchiveRootBuildItem archiveRoot, OutputTargetBuildItem out, PackageConfig packageConfig,
            List<GeneratedFileSystemResourceBuildItem> generatedResources,
            Optional<ContainerImageBuildRequestBuildItem> buildRequest,
            Optional<ContainerImagePushRequestBuildItem> pushRequest,
            BuildProducer<ArtifactResultBuildItem> artifactResultProducer,
            // used to ensure that the jar has been built
            JarBuildItem jar); @BuildStep(onlyIf = { IsNormal.class, S2iBuild.class, NativeBuild.class }) void s2iBuildFromNative(S2iConfig s2iConfig, ContainerImageConfig containerImageConfig,
            KubernetesClientBuildItem kubernetesClient,
            ContainerImageInfoBuildItem containerImage,
            ArchiveRootBuildItem archiveRoot, OutputTargetBuildItem out, PackageConfig packageConfig,
            List<GeneratedFileSystemResourceBuildItem> generatedResources,
            Optional<ContainerImageBuildRequestBuildItem> buildRequest,
            Optional<ContainerImagePushRequestBuildItem> pushRequest,
            BuildProducer<ArtifactResultBuildItem> artifactResultProducer,
            NativeImageBuildItem nativeImage); static void createContainerImage(KubernetesClientBuildItem kubernetesClient,
            GeneratedFileSystemResourceBuildItem openshiftManifests,
            S2iConfig s2iConfig,
            Path output,
            Path... additional); static Predicate<HasMetadata> distictByResourceKey(); static final String S2I; }