io.fabric8.openshift.client.dsl.DeployableScalableResource Java Examples

The following examples show how to use io.fabric8.openshift.client.dsl.DeployableScalableResource. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SupportUtilTest.java    From syndesis with Apache License 2.0 4 votes vote down vote up
@Test
public void createSupportZipFileTest() throws IOException {
    final NamespacedOpenShiftClient client = mock(NamespacedOpenShiftClient.class);

    final MixedOperation<Pod, PodList, DoneablePod, PodResource<Pod, DoneablePod>> pods = mock(mixedOperationType());
    when(pods.list()).thenReturn(new PodList());

    when(client.pods()).thenReturn(pods);

    final MixedOperation<BuildConfig, BuildConfigList, DoneableBuildConfig, BuildConfigResource<BuildConfig, DoneableBuildConfig, Void, Build>> bcs = mock(
        mixedOperationType());
    when(bcs.list()).thenReturn(new BuildConfigList());

    when(client.buildConfigs()).thenReturn(bcs);

    final MixedOperation<DeploymentConfig, DeploymentConfigList, DoneableDeploymentConfig, DeployableScalableResource<DeploymentConfig, DoneableDeploymentConfig>> dcs = mock(
        mixedOperationType());
    when(dcs.list()).thenReturn(new DeploymentConfigList());

    when(client.deploymentConfigs()).thenReturn(dcs);

    final MixedOperation<ConfigMap, ConfigMapList, DoneableConfigMap, Resource<ConfigMap, DoneableConfigMap>> cm = mock(mixedOperationType());
    when(cm.list()).thenReturn(new ConfigMapList());

    when(client.configMaps()).thenReturn(cm);

    final MixedOperation<ImageStreamTag, ImageStreamTagList, DoneableImageStreamTag, Resource<ImageStreamTag, DoneableImageStreamTag>> ist = mock(
        mixedOperationType());
    final ImageStreamTagList istl = new ImageStreamTagList();
    final List<ImageStreamTag> istList = new ArrayList<>();
    final ImageStreamTag imageStreamTag = new ImageStreamTag();
    imageStreamTag.setKind("ImageStreamTag");
    final ObjectMeta objectMeta = new ObjectMeta();
    objectMeta.setName("ImageStreamTag1");
    imageStreamTag.setMetadata(objectMeta);
    istList.add(imageStreamTag);
    istl.setItems(istList);

    when(ist.list()).thenReturn(istl);

    when(client.imageStreamTags()).thenReturn(ist);

    final IntegrationHandler integrationHandler = mock(IntegrationHandler.class);
    when(integrationHandler.list(anyInt(), anyInt())).thenReturn(new EmptyListResult<IntegrationOverview>());
    final IntegrationSupportHandler integrationSupportHandler = mock(IntegrationSupportHandler.class);

    final Logger log = mock(Logger.class);
    final SupportUtil supportUtil = new SupportUtil(client, integrationHandler, integrationSupportHandler, log);

    final Map<String, Boolean> configurationMap = new HashMap<>(ImmutableMap.of("int1", true, "int2", true));

    final File output = supportUtil.createSupportZipFile(configurationMap, 1, 20);

    try (final ZipFile zip = new ZipFile(output)) {
        final ZipEntry imageStreamTag1 = zip.getEntry("descriptors/ImageStreamTag/ImageStreamTag1.YAML");
        assertThat(imageStreamTag1).isNotNull();
        AssertionsForClassTypes.assertThat(zip.getInputStream(imageStreamTag1)).hasContent(SupportUtil.YAML.dump(imageStreamTag));
    }

    verify(log).info("Created Support file: {}", output);
    // tests that we haven't logged any error messages
    verifyZeroInteractions(log);
}
 
Example #2
Source File: DeploymentConfigOperator.java    From strimzi-kafka-operator with Apache License 2.0 4 votes vote down vote up
@Override
protected MixedOperation<DeploymentConfig, DeploymentConfigList, DoneableDeploymentConfig, DeployableScalableResource<DeploymentConfig, DoneableDeploymentConfig>> operation() {
    return client.deploymentConfigs();
}