use of com.openshift.restclient.model.IPod in project jbosstools-openshift by jbosstools.
the class PortForwardingUtilsTest method shouldGetForwardablePortsOnStartedState.
@Test
@SuppressWarnings("unchecked")
public void shouldGetForwardablePortsOnStartedState() {
// given
final IPod pod = Mockito.mock(IPod.class);
final PortPair port = Mockito.mock(PortPair.class);
final IPortForwardable portForwardable = Mockito.mock(IPortForwardable.class);
Mockito.when(portForwardable.getPortPairs()).thenReturn(Arrays.asList(port));
Mockito.when(pod.accept(Mockito.any(CapabilityVisitor.class), Mockito.any(IPortForwardable.class))).thenReturn(portForwardable);
PortForwardingUtils.startPortForwarding(pod, port);
// when
final Set<PortPair> forwardablePorts = PortForwardingUtils.getForwardablePorts(pod);
// then
assertThat(forwardablePorts).isNotNull().containsExactly(port);
}
use of com.openshift.restclient.model.IPod in project jbosstools-openshift by jbosstools.
the class ResourceUtilsTest method podListWithDeploymentConfigKeyShouldReturnDeploymentConfigName.
@Test
public void podListWithDeploymentConfigKeyShouldReturnDeploymentConfigName() {
// given
final HashMap<String, String> podLabels = new HashMap<>();
podLabels.put("foo", "booh");
podLabels.put("bar", "car");
podLabels.put(ResourceUtils.DEPLOYMENT_CONFIG, "hooolahoo");
IPod pod = ResourceMocks.createResource(IPod.class, ResourceKind.POD, p -> when(p.getLabels()).thenReturn(podLabels));
List<IPod> pods = Arrays.asList(ResourceMocks.createResource(IPod.class, ResourceKind.POD), pod, ResourceMocks.createResource(IPod.class, ResourceKind.POD));
// when
String name = getDeploymentConfigNameFor(pods);
// then
assertThat(name).isEqualTo("hooolahoo");
}
Aggregations