Search in sources :

Example 1 with IApplicationSource

use of org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource in project jbosstools-openshift by jbosstools.

the class NewApplicationWizardModelTest method setServerTemplateShouldSetUseLocalTemplateToFalse.

@Test
public void setServerTemplateShouldSetUseLocalTemplateToFalse() {
    // pre-conditions
    IApplicationSource source = mock(IApplicationSource.class);
    when(source.getSource()).thenReturn(template);
    // operations
    model.setServerAppSource(source);
    // verification
    assertThat(model.isUseLocalAppSource()).isFalse();
}
Also used : IApplicationSource(org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource) Test(org.junit.Test)

Example 2 with IApplicationSource

use of org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource in project jbosstools-openshift by jbosstools.

the class OpenShiftExplorerLabelProviderTest method getStyledTextForAnApplicationSourceWithoutTags.

@Test
public void getStyledTextForAnApplicationSourceWithoutTags() {
    IApplicationSource source = mock(IApplicationSource.class);
    when(source.getTags()).thenReturn(Collections.emptyList());
    when(source.getNamespace()).thenReturn("aNamespace");
    when(source.getName()).thenReturn("aname");
    assertEquals("", "aname () - aNamespace", provider.getStyledText(source).getString());
}
Also used : IApplicationSource(org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource) Test(org.junit.Test)

Example 3 with IApplicationSource

use of org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource in project jbosstools-openshift by jbosstools.

the class OpenShiftExplorerLabelProviderTest method getStyledTextForAnApplicationSource.

@Test
public void getStyledTextForAnApplicationSource() {
    IApplicationSource source = mock(IApplicationSource.class);
    when(source.getTags()).thenReturn(Arrays.asList("foo", "bar"));
    when(source.getNamespace()).thenReturn("aNamespace");
    when(source.getName()).thenReturn("aname");
    assertEquals("", "aname (foo, bar) - aNamespace", provider.getStyledText(source).getString());
}
Also used : IApplicationSource(org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource) Test(org.junit.Test)

Example 4 with IApplicationSource

use of org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource in project jbosstools-openshift by jbosstools.

the class NewApplicationWizardModelTest method setDefaultAppLabelForImageBasedApplications.

@Test
public void setDefaultAppLabelForImageBasedApplications() {
    // pre-conditions
    IApplicationSource source = mock(IApplicationSource.class);
    when(source.getKind()).thenReturn(ResourceKind.IMAGE_STREAM);
    IImageStream imageStream = mock(IImageStream.class);
    when(source.getSource()).thenReturn(imageStream);
    when(imageStream.getName()).thenReturn("my-image-stream");
    // operations
    model.setServerAppSource(source);
    // verification
    verify(model, Mockito.times(1)).setLabels(Arrays.asList(new Label("app", "my-image-stream")));
}
Also used : IApplicationSource(org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource) Label(org.jboss.tools.openshift.internal.ui.wizard.common.IResourceLabelsPageModel.Label) IImageStream(com.openshift.restclient.model.IImageStream) Test(org.junit.Test)

Example 5 with IApplicationSource

use of org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource in project jbosstools-openshift by jbosstools.

the class ApplicationSourceFromTemplateModel method handleSelectedAppSource.

private void handleSelectedAppSource(PropertyChangeEvent evt) {
    if (evt.getNewValue() instanceof IApplicationSource && ResourceKind.TEMPLATE.equals(((IApplicationSource) evt.getNewValue()).getKind())) {
        IApplicationSource source = (IApplicationSource) evt.getNewValue();
        ITemplate newTemplate = (ITemplate) source.getSource();
        if (!Objects.equals(newTemplate, this.template)) {
            this.template = newTemplate;
            updateTemplateParameters(newTemplate);
        }
    }
}
Also used : IApplicationSource(org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource) ITemplate(com.openshift.restclient.model.template.ITemplate)

Aggregations

IApplicationSource (org.jboss.tools.openshift.internal.ui.wizard.newapp.IApplicationSource)5 Test (org.junit.Test)4 IImageStream (com.openshift.restclient.model.IImageStream)1 ITemplate (com.openshift.restclient.model.template.ITemplate)1 Label (org.jboss.tools.openshift.internal.ui.wizard.common.IResourceLabelsPageModel.Label)1