Search in sources :

Example 1 with ResourceProperty

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

the class ResourceDetailsContentProviderTest method shouldReturnResourcePropertyGivenBuildConfigBuildStrategyExists.

@Test
public void shouldReturnResourcePropertyGivenBuildConfigBuildStrategyExists() {
    // given
    IBuildConfig bc = createBuildConfig("42", null, null, null, null, null, null, createSourceBuildStrategy("42"));
    // when
    Object[] children = contentProvider.getChildren(bc);
    // then
    ResourceProperty property = getResourceProperty(ResourceDetailsContentProvider.LABEL_STRATEGY, children);
    assertThat(property).isNotNull();
    assertThat(property.isUnknownValue()).isFalse();
}
Also used : ResourceProperty(org.jboss.tools.openshift.internal.ui.wizard.newapp.ResourceDetailsContentProvider.ResourceProperty) IBuildConfig(com.openshift.restclient.model.IBuildConfig) Test(org.junit.Test)

Example 2 with ResourceProperty

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

the class ResourceDetailsLabelProviderTest method getStyledTextForResourcePropertyWithoutParams.

@Test
public void getStyledTextForResourcePropertyWithoutParams() {
    ResourceProperty resourceProperty = mock(ResourceProperty.class);
    when(resourceProperty.getProperty()).thenReturn("prop1");
    when(resourceProperty.getValue()).thenReturn("property value");
    assertEquals("Prop1: property value", labelsProvider.getStyledText(resourceProperty).toString());
}
Also used : ResourceProperty(org.jboss.tools.openshift.internal.ui.wizard.newapp.ResourceDetailsContentProvider.ResourceProperty) Test(org.junit.Test)

Example 3 with ResourceProperty

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

the class ResourceDetailsLabelProviderTest method getStyledTextForResourcePropertyWithParams.

@Test
public void getStyledTextForResourcePropertyWithParams() {
    ResourceProperty resourceProperty = mock(ResourceProperty.class);
    when(resourceProperty.getProperty()).thenReturn("Prop");
    when(resourceProperty.getValue()).thenReturn("surname ${surname}");
    assertEquals("Prop: surname Bocharov", labelsProvider.getStyledText(resourceProperty).toString());
}
Also used : ResourceProperty(org.jboss.tools.openshift.internal.ui.wizard.newapp.ResourceDetailsContentProvider.ResourceProperty) Test(org.junit.Test)

Example 4 with ResourceProperty

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

the class ResourceDetailsLabelProviderTest method getStyledTextForResourcePropertyWithParamsInMap.

@Test
public void getStyledTextForResourcePropertyWithParamsInMap() {
    ResourceProperty resourceProperty = mock(ResourceProperty.class);
    when(resourceProperty.getProperty()).thenReturn("Prop");
    Map<String, String> params = new HashMap<>();
    params.put("${name}", "is name");
    params.put("surname", "${surname}");
    when(resourceProperty.getValue()).thenReturn(params);
    assertEquals("Prop: Dmitrii=is name,surname=Bocharov", labelsProvider.getStyledText(resourceProperty).toString());
}
Also used : ResourceProperty(org.jboss.tools.openshift.internal.ui.wizard.newapp.ResourceDetailsContentProvider.ResourceProperty) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 5 with ResourceProperty

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

the class ResourceDetailsLabelProviderTest method getStyledTextWithNotProvidedLabel.

@Test
public void getStyledTextWithNotProvidedLabel() {
    ResourceProperty resourceProperty = mock(ResourceProperty.class);
    when(resourceProperty.getProperty()).thenReturn("prop1");
    when(resourceProperty.isUnknownValue()).thenReturn(false);
    when(resourceProperty.getValue()).thenReturn("");
    assertEquals("Prop1: (Not Provided)", labelsProvider.getStyledText(resourceProperty).toString());
}
Also used : ResourceProperty(org.jboss.tools.openshift.internal.ui.wizard.newapp.ResourceDetailsContentProvider.ResourceProperty) Test(org.junit.Test)

Aggregations

ResourceProperty (org.jboss.tools.openshift.internal.ui.wizard.newapp.ResourceDetailsContentProvider.ResourceProperty)9 Test (org.junit.Test)8 IBuildConfig (com.openshift.restclient.model.IBuildConfig)2 IResource (com.openshift.restclient.model.IResource)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 StyledString (org.eclipse.jface.viewers.StyledString)1