use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class HelmServiceUtil method initHelmConfig.
public static HelmConfig.HelmConfigBuilder initHelmConfig(HelmConfig.HelmType defaultHelmType, JavaProject project, File manifest, File template, HelmConfig original) throws IOException {
if (original == null) {
original = new HelmConfig();
}
original.setChart(resolveFromPropertyOrDefault(PROPERTY_CHART, project, original::getChart, project.getArtifactId()));
original.setChartExtension(resolveFromPropertyOrDefault(PROPERTY_CHART_EXTENSION, project, original::getChartExtension, DEFAULT_CHART_EXTENSION));
original.setVersion(resolveFromPropertyOrDefault(PROPERTY_VERSION, project, original::getVersion, project.getVersion()));
original.setDescription(resolveFromPropertyOrDefault(PROPERTY_DESCRIPTION, project, original::getDescription, project.getDescription()));
original.setHome(resolveFromPropertyOrDefault(PROPERTY_HOME, project, original::getHome, project.getUrl()));
if (original.getSources() == null) {
original.setSources(project.getScmUrl() != null ? Collections.singletonList(project.getScmUrl()) : Collections.emptyList());
}
if (original.getMaintainers() == null && project.getMaintainers() != null) {
original.setMaintainers(project.getMaintainers().stream().filter(m -> StringUtils.isNotBlank(m.getName()) || StringUtils.isNotBlank(m.getEmail())).map(m -> new Maintainer(m.getName(), m.getEmail())).collect(Collectors.toList()));
}
original.setIcon(resolveFromPropertyOrDefault(PROPERTY_ICON, project, original::getIcon, findIconURL(manifest)));
original.setAdditionalFiles(getAdditionalFiles(original, project));
if (original.getParameterTemplates() == null) {
original.setParameterTemplates(findTemplates(template));
}
original.setTypes(resolveHelmTypes(defaultHelmType, project));
original.setSourceDir(resolveFromPropertyOrDefault(PROPERTY_SOURCE_DIR, project, original::getSourceDir, String.format("%s/META-INF/jkube/", project.getOutputDirectory())));
original.setOutputDir(resolveFromPropertyOrDefault(PROPERTY_OUTPUT_DIR, project, original::getOutputDir, String.format("%s/jkube/helm/%s", project.getBuildDirectory(), original.getChart())));
original.setTarballOutputDir(resolveFromPropertyOrDefault(PROPERTY_TARBALL_OUTPUT_DIR, project, original::getTarballOutputDir, project.getBuildDirectory().getAbsolutePath()));
return original.toBuilder();
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class OpenShiftResourceMojoTest method setUp.
@Before
public void setUp() {
mockedClusterAccess = mock(ClusterAccess.class, RETURNS_DEEP_STUBS);
mockedImageConfigResolver = mock(ImageConfigResolver.class, RETURNS_DEEP_STUBS);
MavenProject mockedMavenProject = mock(MavenProject.class, RETURNS_DEEP_STUBS);
JavaProject mockedJavaProject = mock(JavaProject.class, RETURNS_DEEP_STUBS);
JKubeServiceHub mockedJKubeServiceHub = mock(JKubeServiceHub.class, RETURNS_DEEP_STUBS);
Properties properties = new Properties();
this.openShiftResourceMojo = new OpenshiftResourceMojo();
this.openShiftResourceMojo.project = mockedMavenProject;
this.openShiftResourceMojo.settings = mock(Settings.class, RETURNS_DEEP_STUBS);
this.openShiftResourceMojo.jkubeServiceHub = mockedJKubeServiceHub;
this.openShiftResourceMojo.clusterAccess = mockedClusterAccess;
this.openShiftResourceMojo.log = mock(KitLogger.class, RETURNS_DEEP_STUBS);
this.openShiftResourceMojo.skipResourceValidation = true;
this.openShiftResourceMojo.projectHelper = mock(MavenProjectHelper.class, RETURNS_DEEP_STUBS);
this.openShiftResourceMojo.imageConfigResolver = mockedImageConfigResolver;
this.openShiftResourceMojo.javaProject = mockedJavaProject;
when(mockedMavenProject.getProperties()).thenReturn(properties);
when(mockedJavaProject.getArtifactId()).thenReturn("test-project");
when(mockedJavaProject.getGroupId()).thenReturn("org.eclipse.jkube");
when(mockedJavaProject.getProperties()).thenReturn(properties);
when(mockedJKubeServiceHub.getConfiguration().getProject()).thenReturn(mockedJavaProject);
when(mockedJKubeServiceHub.getConfiguration().getBasedir()).thenReturn(temporaryFolder.getRoot());
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class SpringBootGenerator method isSpringBootRepackage.
private boolean isSpringBootRepackage() {
JavaProject project = getProject();
Plugin plugin = JKubeProjectUtil.getPlugin(project, SpringBootConfigurationHelper.SPRING_BOOT_MAVEN_PLUGIN_ARTIFACT_ID);
if (Optional.ofNullable(plugin).map(Plugin::getExecutions).map(e -> e.contains("repackage")).orElse(false)) {
log.verbose("Using fat jar packaging as the spring boot plugin is using `repackage` goal execution");
return true;
}
return false;
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class VertxPortsExtractorTest method testNoVertxConfiguration.
@Test
public void testNoVertxConfiguration() {
JavaProject project = JavaProject.builder().plugins(Collections.singletonList(Plugin.builder().groupId(Constants.VERTX_MAVEN_PLUGIN_GROUP).artifactId(Constants.VERTX_MAVEN_PLUGIN_ARTIFACT).version("testversion").configuration(Collections.emptyMap()).build())).build();
Map<String, Integer> result = new VertxPortsExtractor(log).extract(project);
assertEquals(0, result.size());
}
use of org.eclipse.jkube.kit.common.JavaProject in project jkube by eclipse.
the class VertxPortsExtractorTest method testVertxConfigPathFromProject.
@Test
public void testVertxConfigPathFromProject() {
Map<String, Object> vertxConfig = new HashMap<>();
vertxConfig.put("vertxConfig", getAbsolutePath(VertxPortsExtractorTest.class.getResource("/config.json")));
Map<String, Object> configuration = new HashMap<>();
configuration.put("config", vertxConfig);
JavaProject project = JavaProject.builder().plugins(Collections.singletonList(Plugin.builder().groupId(Constants.VERTX_MAVEN_PLUGIN_GROUP).artifactId(Constants.VERTX_MAVEN_PLUGIN_ARTIFACT).version("testversion").executions(Collections.singletonList("testexec")).configuration(configuration).build())).build();
Map<String, Integer> result = new VertxPortsExtractor(log).extract(project);
assertEquals((Integer) 80, result.get("http.port"));
}
Aggregations