Search in sources :

Example 1 with AppsAPIGroupDSL

use of io.fabric8.kubernetes.client.dsl.AppsAPIGroupDSL in project strimzi by strimzi.

the class MockKube method build.

public KubernetesClient build() {
    KubernetesClient mockClient = mock(KubernetesClient.class);
    MixedOperation<ConfigMap, ConfigMapList, DoneableConfigMap, Resource<ConfigMap, DoneableConfigMap>> mockCms = buildConfigMaps();
    MixedOperation<PersistentVolumeClaim, PersistentVolumeClaimList, DoneablePersistentVolumeClaim, Resource<PersistentVolumeClaim, DoneablePersistentVolumeClaim>> mockPvcs = buildPvcs();
    MixedOperation<Endpoints, EndpointsList, DoneableEndpoints, Resource<Endpoints, DoneableEndpoints>> mockEndpoints = buildEndpoints();
    MixedOperation<Service, ServiceList, DoneableService, Resource<Service, DoneableService>> mockSvc = buildServices();
    MixedOperation<Pod, PodList, DoneablePod, PodResource<Pod, DoneablePod>> mockPods = buildPods();
    MixedOperation<StatefulSet, StatefulSetList, DoneableStatefulSet, RollableScalableResource<StatefulSet, DoneableStatefulSet>> mockSs = buildStatefulSets(mockPods);
    MixedOperation<Deployment, DeploymentList, DoneableDeployment, ScalableResource<Deployment, DoneableDeployment>> mockDep = buildDeployments();
    when(mockClient.configMaps()).thenReturn(mockCms);
    when(mockClient.services()).thenReturn(mockSvc);
    AppsAPIGroupDSL api = mock(AppsAPIGroupDSL.class);
    when(api.statefulSets()).thenReturn(mockSs);
    when(mockClient.apps()).thenReturn(api);
    ExtensionsAPIGroupDSL ext = mock(ExtensionsAPIGroupDSL.class);
    when(mockClient.extensions()).thenReturn(ext);
    when(ext.deployments()).thenReturn(mockDep);
    when(mockClient.pods()).thenReturn(mockPods);
    when(mockClient.endpoints()).thenReturn(mockEndpoints);
    when(mockClient.persistentVolumeClaims()).thenReturn(mockPvcs);
    return mockClient;
}
Also used : ConfigMapList(io.fabric8.kubernetes.api.model.ConfigMapList) PodResource(io.fabric8.kubernetes.client.dsl.PodResource) PersistentVolumeClaimList(io.fabric8.kubernetes.api.model.PersistentVolumeClaimList) DoneableStatefulSet(io.fabric8.kubernetes.api.model.extensions.DoneableStatefulSet) DoneablePod(io.fabric8.kubernetes.api.model.DoneablePod) Deployment(io.fabric8.kubernetes.api.model.extensions.Deployment) DoneableDeployment(io.fabric8.kubernetes.api.model.extensions.DoneableDeployment) DoneableEndpoints(io.fabric8.kubernetes.api.model.DoneableEndpoints) Endpoints(io.fabric8.kubernetes.api.model.Endpoints) DoneableDeployment(io.fabric8.kubernetes.api.model.extensions.DoneableDeployment) DeploymentList(io.fabric8.kubernetes.api.model.extensions.DeploymentList) DoneableService(io.fabric8.kubernetes.api.model.DoneableService) ExtensionsAPIGroupDSL(io.fabric8.kubernetes.client.dsl.ExtensionsAPIGroupDSL) StatefulSetList(io.fabric8.kubernetes.api.model.extensions.StatefulSetList) DoneableConfigMap(io.fabric8.kubernetes.api.model.DoneableConfigMap) EndpointsList(io.fabric8.kubernetes.api.model.EndpointsList) KubernetesClient(io.fabric8.kubernetes.client.KubernetesClient) PodList(io.fabric8.kubernetes.api.model.PodList) DoneableConfigMap(io.fabric8.kubernetes.api.model.DoneableConfigMap) ConfigMap(io.fabric8.kubernetes.api.model.ConfigMap) DoneablePod(io.fabric8.kubernetes.api.model.DoneablePod) Pod(io.fabric8.kubernetes.api.model.Pod) ServiceList(io.fabric8.kubernetes.api.model.ServiceList) Resource(io.fabric8.kubernetes.client.dsl.Resource) ScalableResource(io.fabric8.kubernetes.client.dsl.ScalableResource) RollableScalableResource(io.fabric8.kubernetes.client.dsl.RollableScalableResource) PodResource(io.fabric8.kubernetes.client.dsl.PodResource) KubernetesResource(io.fabric8.kubernetes.api.model.KubernetesResource) DoneableService(io.fabric8.kubernetes.api.model.DoneableService) Service(io.fabric8.kubernetes.api.model.Service) AppsAPIGroupDSL(io.fabric8.kubernetes.client.dsl.AppsAPIGroupDSL) ScalableResource(io.fabric8.kubernetes.client.dsl.ScalableResource) RollableScalableResource(io.fabric8.kubernetes.client.dsl.RollableScalableResource) DoneableEndpoints(io.fabric8.kubernetes.api.model.DoneableEndpoints) RollableScalableResource(io.fabric8.kubernetes.client.dsl.RollableScalableResource) DoneablePersistentVolumeClaim(io.fabric8.kubernetes.api.model.DoneablePersistentVolumeClaim) PersistentVolumeClaim(io.fabric8.kubernetes.api.model.PersistentVolumeClaim) DoneablePersistentVolumeClaim(io.fabric8.kubernetes.api.model.DoneablePersistentVolumeClaim) DoneableStatefulSet(io.fabric8.kubernetes.api.model.extensions.DoneableStatefulSet) StatefulSet(io.fabric8.kubernetes.api.model.extensions.StatefulSet)

Example 2 with AppsAPIGroupDSL

use of io.fabric8.kubernetes.client.dsl.AppsAPIGroupDSL in project strimzi by strimzi.

the class StatefulSetOperatorTest method mocker.

@Override
protected void mocker(KubernetesClient mockClient, MixedOperation op) {
    AppsAPIGroupDSL mockExt = mock(AppsAPIGroupDSL.class);
    when(mockExt.statefulSets()).thenReturn(op);
    when(mockClient.apps()).thenReturn(mockExt);
}
Also used : AppsAPIGroupDSL(io.fabric8.kubernetes.client.dsl.AppsAPIGroupDSL)

Aggregations

AppsAPIGroupDSL (io.fabric8.kubernetes.client.dsl.AppsAPIGroupDSL)2 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)1 ConfigMapList (io.fabric8.kubernetes.api.model.ConfigMapList)1 DoneableConfigMap (io.fabric8.kubernetes.api.model.DoneableConfigMap)1 DoneableEndpoints (io.fabric8.kubernetes.api.model.DoneableEndpoints)1 DoneablePersistentVolumeClaim (io.fabric8.kubernetes.api.model.DoneablePersistentVolumeClaim)1 DoneablePod (io.fabric8.kubernetes.api.model.DoneablePod)1 DoneableService (io.fabric8.kubernetes.api.model.DoneableService)1 Endpoints (io.fabric8.kubernetes.api.model.Endpoints)1 EndpointsList (io.fabric8.kubernetes.api.model.EndpointsList)1 KubernetesResource (io.fabric8.kubernetes.api.model.KubernetesResource)1 PersistentVolumeClaim (io.fabric8.kubernetes.api.model.PersistentVolumeClaim)1 PersistentVolumeClaimList (io.fabric8.kubernetes.api.model.PersistentVolumeClaimList)1 Pod (io.fabric8.kubernetes.api.model.Pod)1 PodList (io.fabric8.kubernetes.api.model.PodList)1 Service (io.fabric8.kubernetes.api.model.Service)1 ServiceList (io.fabric8.kubernetes.api.model.ServiceList)1 Deployment (io.fabric8.kubernetes.api.model.extensions.Deployment)1 DeploymentList (io.fabric8.kubernetes.api.model.extensions.DeploymentList)1 DoneableDeployment (io.fabric8.kubernetes.api.model.extensions.DoneableDeployment)1