Search in sources :

Example 96 with Project

use of io.fabric8.openshift.api.model.Project in project fabric8 by fabric8io.

the class ProjectsPage method createProject.

/**
 * Creates a new project using the create projects wizard and asserts it appears on the projects page
 */
public void createProject(NewProjectFormData form) {
    goToProjectsPage();
    WebDriverFacade facade = getFacade();
    facade.untilLinkClicked(createProjectBy);
    By nextButton = By.xpath("//button[@ng-click='execute()']");
    // it can take a while to load pages in the wizard to lets increase the wait time lots! :)
    facade.setDefaultTimeoutInSeconds(60 * 9);
    String named = form.getNamed();
    facade.form().clearAndSendKeys(By.xpath("//input[@ng-model='entity.named']"), named).submitButton(nextButton).submit();
    facade.form().completeComboBox(By.xpath("//label[text() = 'Archetype']/following::input[@type='text']"), form.getArchetypeFilter()).submitButton(nextButton).submit();
    untilNextWizardPage(facade, nextButton);
    facade.form().submitButton(nextButton).submit();
    untilNextWizardPage(facade, nextButton);
    facade.form().completeComboBox(By.xpath("//label[text() = 'Flow']/following::input[@type='text']"), form.getJenkinsFileFilter()).submitButton(nextButton).submit();
    facade.untilIsDisplayed(By.xpath("//a[@href='/forge/repos' and text()='Done']"));
    logInfo("Created project: " + named);
    goToProjectsPage();
    // lets assert there's a link to the project page
    facade.untilIsDisplayed(By.partialLinkText(named));
}
Also used : WebDriverFacade(io.fabric8.selenium.WebDriverFacade) By(org.openqa.selenium.By)

Example 97 with Project

use of io.fabric8.openshift.api.model.Project in project fabric8 by fabric8io.

the class Example method main.

public static void main(String[] args) {
    String projectName = "admin-beer";
    if (args.length > 0) {
        projectName = args[0];
    }
    try {
        KubernetesClient kubernetes = new DefaultKubernetesClient();
        TaigaClient taiga = TaigaKubernetes.createTaiga(kubernetes, KubernetesHelper.defaultNamespace());
        System.out.println("Connecting to taiga on: " + taiga.getAddress());
        ProjectDTO myProject = taiga.getProjectBySlug(projectName);
        System.out.println("Found project: " + myProject + " by slug: " + projectName);
        System.out.println("Project id for slug: " + myProject + " is: " + taiga.getProjectIdForSlug(projectName));
        ProjectDTO notExist = taiga.getProjectBySlug("does-not-exist");
        System.out.println("Found non existing project: " + notExist);
        Map<String, ModuleDTO> modules = taiga.getModulesForProject(projectName);
        System.out.println("Available modules for " + projectName + " are: " + modules.keySet());
        // lets try find the module for gogs
        ModuleDTO gogsModule = taiga.moduleForProject(projectName, TaigaModule.GOGS);
        System.out.println("Gogs module for " + projectName + " is " + gogsModule);
        ProjectDTO autoCreateProject = taiga.getOrCreateProject("thingy");
        System.out.println("getOrCreateProject: " + autoCreateProject);
        List<ProjectDTO> projects = taiga.getProjects();
        for (ProjectDTO project : projects) {
            System.out.println("Project " + project.getId() + " has slug: " + project.getSlug() + " name " + project.getName());
        }
    } catch (Exception e) {
        System.out.println("Caught: " + e);
        e.printStackTrace();
    }
}
Also used : KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient) DefaultKubernetesClient(io.fabric8.kubernetes.client.DefaultKubernetesClient)

Aggregations

Test (org.junit.Test)51 ResourceConfig (io.fabric8.maven.core.config.ResourceConfig)29 File (java.io.File)14 Expectations (mockit.Expectations)14 ArrayList (java.util.ArrayList)13 BuildImageConfiguration (io.fabric8.maven.docker.config.BuildImageConfiguration)11 ImageConfiguration (io.fabric8.maven.docker.config.ImageConfiguration)11 ProcessorConfig (io.fabric8.maven.core.config.ProcessorConfig)9 IOException (java.io.IOException)8 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)8 VolumeConfig (io.fabric8.maven.core.config.VolumeConfig)7 GeneratorContext (io.fabric8.maven.generator.api.GeneratorContext)6 OpenShiftClient (io.fabric8.openshift.client.OpenShiftClient)6 PodTemplateSpec (io.fabric8.kubernetes.api.model.PodTemplateSpec)5 BuildConfig (io.fabric8.openshift.api.model.BuildConfig)5 MojoFailureException (org.apache.maven.plugin.MojoFailureException)5 MavenProject (org.apache.maven.project.MavenProject)5 KubernetesListBuilder (io.fabric8.kubernetes.api.model.KubernetesListBuilder)4 KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)4 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)3