Package com.openshift.client

Examples of com.openshift.client.IApplication


  }

  @Test
  public void shouldRemoveEmbeddedCartridge() throws Exception {
    // pre-conditions
    IApplication application = ApplicationTestUtils.ensureHasExactly1Application(domain);
    EmbeddedCartridgeTestUtils.ensureHasEmbeddedCartridges(LatestVersionOf.mySQL(), application);
    int numOfEmbeddedCartridges = application.getEmbeddedCartridges().size();

    // operation
    application.removeEmbeddedCartridge(LatestVersionOf.mySQL().get(user));

    // verification
    assertTrue(application.getEmbeddedCartridges().size() == numOfEmbeddedCartridges - 1);
    assertThat(new ApplicationAssert(application))
        .hasNotEmbeddableCartridge(LatestVersionOf.mySQL());
  }
View Full Code Here


  }

  @Test
  public void shouldNotRemoveEmbeddedCartridgeThatWasNotAdded() throws SocketTimeoutException, OpenShiftException {
    // pre-conditions
    IApplication application = ApplicationTestUtils.ensureHasExactly1Application(domain);
    EmbeddedCartridgeTestUtils.silentlyDestroy(LatestVersionOf.mySQL(), application);
    int numOfEmbeddedCartridges = application.getEmbeddedCartridges().size();

    // operation
    application.removeEmbeddedCartridge(LatestVersionOf.mySQL().get(user));

    // verification
    IEmbeddableCartridge mySql = LatestVersionOf.mySQL().get(user);
    assertThat(new ApplicationAssert(application))
        .hasEmbeddableCartridges(numOfEmbeddedCartridges)
View Full Code Here

  }

  @Test
  public void shouldSeeCartridgeRemovedWithOtherUser() throws Exception {
    // pre-condition
    IApplication application = ApplicationTestUtils.ensureHasExactly1Application(domain);
    IEmbeddableCartridge mySqlEmbeddableCartridge =
        LatestVersionOf.mySQL().get(user);
    EmbeddedCartridgeTestUtils.ensureHasEmbeddedCartridge(mySqlEmbeddableCartridge, application);
    assertThat(new ApplicationAssert(application)
        .hasEmbeddedCartridge(LatestVersionOf.mySQL()));

    // operation
    // use user instance that's not the one used to create
    IUser user2 = new TestConnectionBuilder().defaultCredentials().disableSSLCertificateChecks().create().getUser();
    IApplication user2Application = user2.getDefaultDomain().getApplicationByName(application.getName());
    user2Application.removeEmbeddedCartridge(LatestVersionOf.mySQL().get(user2));
    assertThat(new ApplicationAssert(user2Application)
        .hasNotEmbeddableCartridges(LatestVersionOf.mySQL()));

    // verification
    application.refresh();
    assertThat(new ApplicationAssert(application)
        .hasNotEmbeddableCartridges(LatestVersionOf.mySQL()));
    assertEquals(application.getEmbeddedCartridges().size(), user2Application.getEmbeddedCartridges().size());
  }
View Full Code Here

    mockDirector
        .mockGetApplications("foobarz", GET_DOMAINS_FOOBARZ_APPLICATIONS_NOAPPS)
        .mockCreateApplication("foobarz", Samples.GET_DOMAINS_FOOBARZ_APPLICATIONS_DOWNLOADABLECART);

    // operation
    final IApplication app = domain.createApplication(
        "downloadablecart", CartridgeTestUtils.go11(), null, null, null, IHttpClient.NO_TIMEOUT,
        CartridgeTestUtils.foreman063(),
        CartridgeTestUtils.mysql51());

    // verifications
View Full Code Here

        .hasDescription(null)
        .hasDisplayName(null)
        .hasUrl(CartridgeTestUtils.GO_URL);

    // operation
    final IApplication app = domain.createApplication(
        "springeap6", CartridgeTestUtils.eap6(), null, null, null, IHttpClient.NO_TIMEOUT,
        CartridgeTestUtils.foreman063(),
        CartridgeTestUtils.mysql51());

    // verifications
    // cartridge was updated with name, description, display name
    new CartridgeAssert<IStandaloneCartridge>(app.getCartridge())
      .hasName("smarterclayton-go-1.1")
      .hasDescription("OpenShift Go cartridge")
      .hasDisplayName("Go 1.1")
      .hasUrl(CartridgeTestUtils.GO_URL);
  }
View Full Code Here

    // pre-conditions
    mockDirector
      .mockGetApplications("foobarz", GET_DOMAINS_FOOBARZ_APPLICATIONS_NOAPPS)
      .mockCreateApplication("foobarz", POST_JEKYLL_DOMAINS_FOOBARZ_APPLICATIONS);
    // operation
    final IApplication app = domain.createApplication("jekyll", CartridgeTestUtils.jenkins14());
    // verifications
    Messages messages = app.getMessages();
    assertThat(messages).isNotNull();
    assertThat(messages.getAll()).hasSize(3);
    List<Message> defaultMessages = messages.getBy(IField.DEFAULT);
    assertThat(defaultMessages).hasSize(3);
    List<Message> infoSeverityMessages = messages.getBy(IField.DEFAULT, ISeverity.INFO);
    assertThat(infoSeverityMessages).hasSize(1);
    new MessageAssert(infoSeverityMessages.get(0))
      .hasExitCode(0)
      .hasText("Application jekyll was created.");
    List<Message> debugSeverityMessages = app.getMessages().getBy(IField.DEFAULT, ISeverity.DEBUG);
    assertThat(debugSeverityMessages).hasSize(1);
    new MessageAssert(debugSeverityMessages.get(0))
      .hasExitCode(0)
      .hasText("The cartridge jenkins deployed a template application");
    List<Message> resultSeverityMessages = messages.getBy(IField.DEFAULT, ISeverity.RESULT);
View Full Code Here

  @Test
  public void shouldGetApplicationByNameCaseInsensitive() throws Throwable {
    // pre-conditions
    mockDirector.mockGetApplications("foobarz", GET_DOMAINS_FOOBARZ_APPLICATIONS_1EMBEDDED);
    // operation
    IApplication lowerCaseQueryResult = domain.getApplicationByName("springeap6");
    IApplication upperCaseQueryResult = domain.getApplicationByName("SPRINGEAP6");

    // verifications
    assertThat(lowerCaseQueryResult).isNotNull();
    assertThat(lowerCaseQueryResult.getName()).isEqualTo("springeap6");
    assertThat(upperCaseQueryResult).isNotNull();
    assertThat(upperCaseQueryResult.getName()).isEqualTo("springeap6");
  }
View Full Code Here

  public static IApplication createApplication(String name, IStandaloneCartridge cartridge, IDomain domain) {
    if (cartridge == null) {
      cartridge = getDefaultCartridge(domain);
    }
    IApplication application = domain.createApplication(name, cartridge);
    assertTrue(application.waitForAccessible(WAIT_FOR_APPLICATION));
    return application;
  }
View Full Code Here

  }

  public static IApplication getOrCreateApplication(IDomain domain, IStandaloneCartridge cartridge)
      throws OpenShiftException {
    for (Iterator<IApplication> it = domain.getApplications().iterator(); it.hasNext();) {
      IApplication application = it.next();
      if (cartridge == null
          || cartridge.equals(application.getCartridge())) {
        return application;
      }
    }

    return createApplication("app" + StringUtils.createRandomString(), cartridge, domain);
View Full Code Here

    }
  }

  protected static void destroyAllNotOfType(IStandaloneCartridge cartridge, List<IApplication> applications) {
    for (Iterator<IApplication> it = applications.iterator(); it.hasNext();) {
      IApplication application = it.next();
      if (!cartridge.equals(application.getCartridge())) {
        application.destroy();
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.openshift.client.IApplication

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.