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();
}
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());
}
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());
}
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")));
}
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);
}
}
}
Aggregations