Skip to content

Commit

Permalink
refactor: remove unused component
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa committed May 8, 2024
1 parent 91be299 commit d1a0c25
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
import org.eclipse.jkube.kit.build.service.docker.DockerServiceHub;
import org.eclipse.jkube.kit.build.service.docker.access.DockerAccess;
import org.eclipse.jkube.kit.build.service.docker.auth.AuthConfigFactory;
import org.eclipse.jkube.kit.build.api.helper.ConfigHelper;
import org.eclipse.jkube.kit.build.service.docker.config.DockerMachineConfiguration;
import org.eclipse.jkube.kit.config.image.WatchMode;
import org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver;
import org.eclipse.jkube.kit.common.JavaProject;
import org.eclipse.jkube.kit.common.KitLogger;
import org.eclipse.jkube.kit.common.util.AnsiLogger;
Expand Down Expand Up @@ -199,10 +197,6 @@ public abstract class AbstractDockerMojo extends AbstractMojo
@Parameter(property = "jkube.profile")
protected String profile;

// Handler for external configurations
@Component
protected ImageConfigResolver imageConfigResolver;

/**
* Skip extended authentication
*/
Expand Down Expand Up @@ -377,7 +371,6 @@ public final void execute() throws MojoExecutionException, MojoFailureException
protected void init() {
log = new AnsiLogger(getLog(), useColorForLogging(), verbose, !settings.getInteractiveMode(), getLogPrefix());
authConfigFactory = new AuthConfigFactory(log);
imageConfigResolver.setLog(log);
clusterAccess = new ClusterAccess(initClusterConfiguration());
runtimeMode = getConfiguredRuntimeMode();
}
Expand Down Expand Up @@ -429,7 +422,6 @@ protected void doExecute() throws MojoExecutionException {
protected abstract void executeInternal() throws IOException, MojoExecutionException;

protected JKubeConfiguration initJKubeConfiguration() throws DependencyResolutionRequiredException {
ConfigHelper.validateExternalPropertyActivation(javaProject, images);
return JKubeConfiguration.builder()
.project(MavenUtil.convertMavenProjectToJKubeProject(project, session))
.sourceDirectory(sourceDirectory)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import javax.validation.ConstraintViolationException;

import org.eclipse.jkube.generator.api.GeneratorContext;
import org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver;

import org.eclipse.jkube.generator.api.DefaultGeneratorManager;
import org.eclipse.jkube.kit.common.KitLogger;
Expand Down Expand Up @@ -69,9 +68,6 @@ public class ResourceMojo extends AbstractJKubeMojo {
// Filename for holding the build timestamp
public static final String DOCKER_BUILD_TIMESTAMP = "docker/build.timestamp";

@Component
protected ImageConfigResolver imageConfigResolver;

/**
* Should we use the project's compile-time classpath to scan for additional enrichers/generators?
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
<!-- Components typically detected by annotations, but moved here because of
https://github.com/codehaus-plexus/plexus-containers/issues/4 -->
<component>
<role>org.eclipse.jkube.kit.build.api.config.handler.property.PropertyConfigHandler</role>
<implementation>org.eclipse.jkube.kit.build.api.config.handler.property.PropertyConfigHandler</implementation>
<role>org.eclipse.jkube.kit.build.api.config.property.PropertyConfigHandler</role>
<implementation>org.eclipse.jkube.kit.build.api.config.property.PropertyConfigHandler</implementation>
<isolated-realm>false</isolated-realm>
</component>
<component>
Expand Down Expand Up @@ -132,10 +132,5 @@
<implementation>org.eclipse.jkube.kit.build.service.docker.DockerAccessFactory</implementation>
<isolated-realm>false</isolated-realm>
</component>
<component>
<role>org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver</role>
<implementation>org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver</implementation>
<isolated-realm>false</isolated-realm>
</component>
</components>
</component-set>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.Properties;

import io.fabric8.kubernetes.client.KubernetesClient;
import org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver;
import org.eclipse.jkube.kit.common.JKubeConfiguration;
import org.eclipse.jkube.kit.common.JavaProject;
import org.eclipse.jkube.kit.config.access.ClusterAccess;
Expand Down Expand Up @@ -95,7 +94,6 @@ void setUp(@TempDir Path temporaryFolder) throws Exception {
settings = mavenSettings;
kubernetesManifest = kubernetesManifestFile;
resourceDir = temporaryFolder.resolve("src").resolve("main").resolve("jkube").toFile().getAbsoluteFile();
imageConfigResolver = new ImageConfigResolver();
buildStrategy = JKubeBuildStrategy.jib;
setPluginContext(new HashMap<>());
}};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@
<!-- Components typically detected by annotations, but moved here because of
https://github.com/codehaus-plexus/plexus-containers/issues/4 -->
<component>
<role>org.eclipse.jkube.kit.build.api.config.handler.property.PropertyConfigHandler</role>
<implementation>org.eclipse.jkube.kit.build.api.config.handler.property.PropertyConfigHandler</implementation>
<role>org.eclipse.jkube.kit.build.api.config.property.PropertyConfigHandler</role>
<implementation>org.eclipse.jkube.kit.build.api.config.property.PropertyConfigHandler</implementation>
<isolated-realm>false</isolated-realm>
</component>
<component>
Expand Down Expand Up @@ -132,10 +132,5 @@
<implementation>org.eclipse.jkube.kit.build.service.docker.DockerAccessFactory</implementation>
<isolated-realm>false</isolated-realm>
</component>
<component>
<role>org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver</role>
<implementation>org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver</implementation>
<isolated-realm>false</isolated-realm>
</component>
</components>
</component-set>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.apache.maven.settings.Settings;
import org.eclipse.jkube.kit.build.api.helper.ImageConfigResolver;
import org.eclipse.jkube.kit.common.KitLogger;
import org.eclipse.jkube.kit.config.access.ClusterConfiguration;
import org.eclipse.jkube.kit.config.image.ImageConfiguration;
Expand All @@ -35,13 +34,10 @@
import java.util.Collections;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

class OpenShiftResourceMojoTest {

Expand Down Expand Up @@ -105,8 +101,6 @@ void executeInternal_resolvesGroupInImageNameToClusterAccessNamespace_whenNamesp
.build())
.build();
resourceMojo.images = Collections.singletonList(imageConfiguration);
resourceMojo.imageConfigResolver = mock(ImageConfigResolver.class);
when(resourceMojo.imageConfigResolver.resolve(eq(imageConfiguration), any())).thenReturn(Collections.singletonList(imageConfiguration));
resourceMojo.access = ClusterConfiguration.builder().namespace("namespace-from-cluster-access").build();
// When
resourceMojo.execute();
Expand All @@ -126,8 +120,6 @@ void execute_resolvesGroupInImageNameToNamespaceSetViaConfiguration_whenNoNamesp
.build())
.build();
resourceMojo.images = Collections.singletonList(imageConfiguration);
resourceMojo.imageConfigResolver = mock(ImageConfigResolver.class);
when(resourceMojo.imageConfigResolver.resolve(eq(imageConfiguration), any())).thenReturn(Collections.singletonList(imageConfiguration));
resourceMojo.namespace = "namespace-configured-via-plugin";
// When
resourceMojo.execute();
Expand Down

0 comments on commit d1a0c25

Please sign in to comment.