use of io.fabric8.openshift.api.model.Project in project fabric8 by jboss-fuse.
the class DeployToProfileMojoTest method before.
// Fixtures setup
@Before
public void before() {
mojo.fabricServer = mock(Server.class);
project = new MavenProject();
project.setGroupId("io.fabric8");
project.setArtifactId("artifact");
project.setVersion(FABRIC_VERSION);
mojo.project = project;
deployResults = new DeployResults();
deployResults.setProfileId("profileId");
deployResults.setVersionId("versionId");
}
use of io.fabric8.openshift.api.model.Project in project jointware by isdream.
the class KubernetesKeyValueStyleGeneratorTest method testOpenShiftWithAllKind.
protected static void testOpenShiftWithAllKind() throws Exception {
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new Policy());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new Group());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new User());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new OAuthClient());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new ClusterRoleBinding());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new ImageStreamTag());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new ImageStream());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new Build());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new BuildConfig());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new RoleBinding());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new Route());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new PolicyBinding());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new OAuthAuthorizeToken());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new Role());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new Project());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new OAuthAccessToken());
info(OPENSHIFT_KIND, OpenShiftDocumentKeyValueStyleGenerator.class.getName(), new DeploymentConfig());
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class ResourceMojo method lateInit.
private void lateInit() throws MojoExecutionException {
if (goalFinder.runningWithGoal(project, session, "fabric8:watch") || goalFinder.runningWithGoal(project, session, "fabric8:watch")) {
Properties properties = project.getProperties();
properties.setProperty("fabric8.watch", "true");
}
platformMode = clusterAccess.resolvePlatformMode(mode, log);
log.info("Running in [[B]]%s[[B]] mode", platformMode.getLabel());
if (isOpenShiftMode()) {
Properties properties = project.getProperties();
if (!properties.contains(DOCKER_IMAGE_USER)) {
String namespace = clusterAccess.getNamespace();
log.info("Using docker image name of namespace: " + namespace);
properties.setProperty(DOCKER_IMAGE_USER, namespace);
}
if (!properties.contains(PlatformMode.FABRIC8_EFFECTIVE_PLATFORM_MODE)) {
properties.setProperty(PlatformMode.FABRIC8_EFFECTIVE_PLATFORM_MODE, platformMode.toString());
}
}
openShiftConverters = new HashMap<>();
openShiftConverters.put("ReplicaSet", new ReplicSetOpenShiftConverter());
openShiftConverters.put("Deployment", new DeploymentOpenShiftConverter(platformMode, getOpenshiftDeployTimeoutSeconds()));
// TODO : This converter shouldn't be here. See its javadoc.
openShiftConverters.put("DeploymentConfig", new DeploymentConfigOpenShiftConverter(getOpenshiftDeployTimeoutSeconds()));
openShiftConverters.put("Namespace", new NamespaceOpenShiftConverter());
handlerHub = new HandlerHub(project);
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class HelmMojo method generateHelmChartDirectory.
protected void generateHelmChartDirectory(String chartName, HelmConfig.HelmType type) throws MojoExecutionException {
File outputDir = prepareOutputDir(type);
File sourceDir = checkSourceDir(chartName, type);
if (sourceDir == null) {
return;
}
log.info("Creating Helm Chart \"%s\" for %s", chartName, type.getDescription());
log.verbose("SourceDir: %s", sourceDir);
log.verbose("OutputDir: %s", outputDir);
// Copy over all resource descriptors into the helm templates dir
File templatesDir = copyResourceFilesToTemplatesDir(outputDir, sourceDir);
// Save Helm chart
createChartYaml(chartName, outputDir);
// Copy over support files
copyTextFile(outputDir, "README");
copyTextFile(outputDir, "LICENSE");
Template template = findTemplate();
if (template != null) {
createTemplateParameters(outputDir, template, templatesDir);
}
// now lets create the tarball
File destinationFile = new File(project.getBuild().getDirectory(), chartName + "-" + project.getVersion() + "-" + type.getClassifier() + "." + getChartFileExtension());
MavenUtil.createArchive(outputDir.getParentFile(), destinationFile, this.archiver);
projectHelper.attachArtifact(project, getChartFileExtension(), type.getClassifier(), destinationFile);
}
use of io.fabric8.openshift.api.model.Project in project fabric8-maven-plugin by fabric8io.
the class JavaExecGeneratorMainClassDeterminationTest method testMainClassDeterminationFromConfig.
/**
* The main class is determined via config in a non-fat-jar deployment
* @throws MojoExecutionException
*/
@Test
public void testMainClassDeterminationFromConfig() throws MojoExecutionException {
new MockBuild();
new MockProcessorConfig("the.main.ClassName");
new MockMavenProject();
final GeneratorContext generatorContext = new GeneratorContext.Builder().project(new MavenProject()).config(new ProcessorConfig()).strategy(OpenShiftBuildStrategy.docker).logger(log).build();
JavaExecGenerator generator = new JavaExecGenerator(generatorContext);
final List<ImageConfiguration> images = new ArrayList<ImageConfiguration>();
List<ImageConfiguration> customized = generator.customize(images, false);
assertEquals("1 images returned", (long) 1, (long) customized.size());
ImageConfiguration imageConfig = customized.get(0);
assertEquals("Image name", "TheImageName", imageConfig.getName());
assertEquals("Main Class set as environment variable", "the.main.ClassName", imageConfig.getBuildConfiguration().getEnv().get(JavaExecGenerator.JAVA_MAIN_CLASS_ENV_VAR));
}
Aggregations