From 009974fe5fe634cbd6d1210780b99ff82e251f2d Mon Sep 17 00:00:00 2001 From: Steven Hawkins Date: Tue, 29 Nov 2022 11:32:32 -0500 Subject: [PATCH] Bulk formatting and removing unused imports (#4517) * fix #3984: bulk formatting the rest of the codebase * fix #3984: removing unused imports * fix #3984: correcting headers --- .../AbstractCustomResourceHandler.java | 32 +- .../crd/generator/CRDGenerationInfo.java | 3 +- .../fabric8/crd/generator/CRDGenerator.java | 37 +- .../io/fabric8/crd/generator/Resources.java | 21 +- .../crd/generator/decorator/Decorator.java | 2 +- .../decorator/NamedResourceDecorator.java | 7 +- .../decorator/ResourceProvidingDecorator.java | 1 - .../fabric8/crd/generator/utils/Generics.java | 5 +- .../fabric8/crd/generator/utils/Metadata.java | 12 +- .../io/fabric8/crd/generator/utils/Types.java | 3 - .../generator/v1/CustomResourceHandler.java | 1 - .../AddAdditionPrinterColumnDecorator.java | 123 +-- ...omResourceDefinitionResourceDecorator.java | 5 - ...tomResourceDefinitionVersionDecorator.java | 41 +- .../AddLabelSelectorPathDecorator.java | 31 +- ...tomResourceDefinitionVersionDecorator.java | 12 +- .../AddSpecReplicasPathDecorator.java | 32 +- .../AddStatusReplicasPathDecorator.java | 31 +- .../AddStatusSubresourceDecorator.java | 31 +- .../decorator/AddSubresourcesDecorator.java | 31 +- .../CustomResourceDefinitionDecorator.java | 12 +- ...tomResourceDefinitionVersionDecorator.java | 21 +- .../EnsureSingleStorageVersionDecorator.java | 40 +- .../decorator/SetServedVersionDecorator.java | 25 +- .../decorator/SetStorageVersionDecorator.java | 25 +- .../SortPrinterColumnsDecorator.java | 17 +- .../v1beta1/CustomResourceHandler.java | 1 - .../AddAdditionPrinterColumnDecorator.java | 123 +-- ...omResourceDefinitionResourceDecorator.java | 2 - ...tomResourceDefinitionVersionDecorator.java | 21 +- .../AddLabelSelectorPathDecorator.java | 6 +- ...tomResourceDefinitionVersionDecorator.java | 14 +- .../AddSpecReplicasPathDecorator.java | 6 +- .../AddStatusReplicasPathDecorator.java | 4 +- .../AddStatusSubresourceDecorator.java | 14 +- .../decorator/AddSubresourcesDecorator.java | 12 +- ...tomResourceDefinitionVersionDecorator.java | 25 +- .../EnsureSingleStorageVersionDecorator.java | 19 +- ...omoteSingleVersionAttributesDecorator.java | 1 - .../decorator/SetServedVersionDecorator.java | 2 +- .../decorator/SetStorageVersionDecorator.java | 2 +- .../SortPrinterColumnsDecorator.java | 7 +- .../AdditionalPrinterColumnDetector.java | 2 +- .../AnnotatedPropertyPathDetector.java | 1 - .../visitor/LabelSelectorPathDetector.java | 9 +- .../visitor/SpecReplicasPathDetector.java | 10 +- .../visitor/StatusReplicasPathDetector.java | 7 +- .../io/fabric8/crd/alt/LabelSelector.java | 2 +- .../java/io/fabric8/crd/alt/SpecReplicas.java | 2 +- .../io/fabric8/crd/alt/StatusReplicas.java | 2 +- .../crd/example/annotated/Annotated.java | 2 +- .../crd/example/extraction/Extraction.java | 2 +- .../extraction/IncorrectExtraction.java | 2 +- .../extraction/IncorrectExtraction2.java | 2 +- .../fabric8/crd/example/inherited/Base.java | 4 +- .../fabric8/crd/example/inherited/Child.java | 1 - .../crd/example/inherited/ChildSpec.java | 2 +- .../io/fabric8/crd/example/joke/Joke.java | 84 +- .../crd/example/joke/JokeRequestSpec.java | 4 +- .../crd/example/joke/JokeRequestStatus.java | 70 +- .../crd/example/json/ContainingJsonSpec.java | 8 +- .../crd/example/map/ContainingMaps.java | 2 +- .../io/fabric8/crd/example/nocyclic/Ref.java | 3 +- .../fabric8/crd/example/person/Address.java | 3 +- .../io/fabric8/crd/example/person/Person.java | 3 +- .../crd/example/simplest/Simplest.java | 2 +- .../example/webserver/WebServerWithSpec.java | 1 - .../WebServerWithStatusProperty.java | 5 +- .../crd/generator/CustomResourceInfoTest.java | 16 +- .../fabric8/crd/generator/ResourcesTest.java | 17 +- .../crd/generator/utils/TypesTest.java | 15 +- .../visitor/SpecReplicasPathDetectorTest.java | 9 +- .../schemaswaps/SchemaSwapCRDTest.java | 2 - .../camelk/client/GenericCamelKClient.java | 6 +- .../camelk/client/NamespacedCamelKClient.java | 3 +- .../camelk/client/dsl/V1APIGroupDSL.java | 25 +- .../camelk/client/util/ApiVersionUtil.java | 2 +- .../fabric8/camelk/v1/TraitConfiguration.java | 23 +- .../java/io/fabric8/camelk/ModelTest.java | 17 +- .../certmanager/client/CertManagerClient.java | 1 - .../client/GenericCertManagerClient.java | 6 +- .../certmanager/client/dsl/V1APIGroupDSL.java | 1 - .../client/dsl/V1alpha2APIGroupDSL.java | 5 + .../client/dsl/V1alpha3APIGroupDSL.java | 5 + .../client/dsl/V1beta1APIGroupDSL.java | 5 + .../examples/v1/CertificateCreate.java | 2 +- .../examples/v1alpha2/CertificateCreate.java | 2 +- .../examples/v1alpha3/CertificateCreate.java | 2 +- .../examples/v1beta1/CertificateCreate.java | 2 +- .../api/model/v1/CertificateRequestSpec.java | 34 +- .../model/v1beta1/CertificateRequestSpec.java | 200 ++--- .../client/GenericChaosMeshClient.java | 6 +- .../client/NamespacedChaosMeshClient.java | 2 +- .../chaosmesh/examples/ClientFactory.java | 4 +- .../chaosmesh/api/model/Constants.java | 3 +- .../istio/client/GenericIstioClient.java | 2 +- .../v1beta1/AuthorizationPolicyExample.java | 38 +- .../api/examples/v1beta1/ClientFactory.java | 60 +- .../v1beta1/DestinationRuleExample.java | 24 +- .../api/examples/v1beta1/GatewayExample.java | 28 +- .../v1beta1/PeerAuthenticationExample.java | 16 +- .../examples/v1beta1/ServiceEntryExample.java | 18 +- .../api/examples/v1beta1/SidecarExample.java | 16 +- .../v1beta1/VirtualServiceExample.java | 34 +- .../v1beta1/WorkloadEntryExample.java | 20 +- .../api/networking/v1alpha3/CorsPolicy.java | 43 +- .../CorsPolicy.java | 43 +- .../knative/client/GenericKnativeClient.java | 6 +- .../client/NamespacedKnativeClient.java | 3 +- .../serving/v1/GenericServingV1Client.java | 6 +- .../client/serving/v1/ServingV1Client.java | 6 +- .../knative/client/util/ApiVersionUtil.java | 35 +- .../fabric8/knative/api/model/Constants.java | 3 +- .../java/io/fabric8/knative/ModelTest.java | 26 +- .../GenericOpenClusterManagementClient.java | 7 +- ...NamespacedOpenClusterManagementClient.java | 3 +- .../client/OpenClusterManagementClient.java | 8 + .../OpenClusterManagementAppsAPIGroupDSL.java | 6 + ...nClusterManagementClustersAPIGroupDSL.java | 7 +- ...ClusterManagementDiscoveryAPIGroupDSL.java | 2 + ...terManagementObservabilityAPIGroupDSL.java | 2 + ...nClusterManagementOperatorAPIGroupDSL.java | 3 + ...penClusterManagementPolicyAPIGroupDSL.java | 3 + ...penClusterManagementSearchAPIGroupDSL.java | 2 + .../examples/apps/PlacementRuleCreate.java | 16 +- .../examples/cluster/ManagedClusterList.java | 8 +- .../cluster/ManagedClusterSetCreate.java | 8 +- .../agent/v1/KlusterletAddonConfigTest.java | 44 +- .../api/model/apps/ApplicationTest.java | 24 +- .../api/model/apps/ChannelTest.java | 28 +- .../api/model/apps/HelmReleaseTest.java | 36 +- .../api/model/apps/SubscriptionTest.java | 30 +- .../cluster/ManagedClusterSetBindingTest.java | 21 +- .../model/cluster/ManagedClusterSetTest.java | 14 +- .../api/model/cluster/ManagedClusterTest.java | 26 +- .../model/cluster/PlacementDecisionTest.java | 29 +- .../api/model/cluster/PlacementTest.java | 38 +- .../discovery/DiscoveredClusterTest.java | 22 +- .../model/discovery/DiscoveryConfigTest.java | 22 +- .../apps/MultiClusterObservabilityTest.java | 17 +- .../apps/ObservabilityAddonTest.java | 18 +- .../model/operator/ClusterManagerTest.java | 20 +- .../api/model/operator/KlusterletTest.java | 28 +- .../model/operator/MultiClusterHubTest.java | 18 +- .../apps/GitOpsClusterTest.java | 34 +- .../apps/PlacementRuleTest.java | 30 +- .../policy/PlacementBindingTest.java | 30 +- .../policy/PolicyAutomationTest.java | 34 +- .../policy/PolicyTest.java | 27 +- .../SearchCustomizationTest.java | 16 +- .../searchoperator/SearchOperatorTest.java | 42 +- .../client/GenericServiceCatalogClient.java | 6 +- .../NamespacedServiceCatalogClient.java | 2 +- .../client/ServiceCatalogClient.java | 1 - .../dsl/ClusterServiceBrokerResource.java | 43 +- .../dsl/ClusterServiceClassResource.java | 19 +- .../dsl/ClusterServicePlanResource.java | 27 +- .../client/dsl/ServiceBindingResource.java | 2 +- .../client/dsl/ServiceInstanceResource.java | 3 +- .../client/util/ApiVersionUtil.java | 33 +- .../examples/CreateBinding.java | 29 +- .../servicecatalog/examples/CreateBroker.java | 22 +- .../servicecatalog/examples/ListBrokers.java | 18 +- .../examples/ListServiceClasses.java | 17 +- .../examples/ListServiceClassesByBroker.java | 30 +- .../examples/ListServiceInstances.java | 15 +- .../examples/ListServicePlans.java | 18 +- .../examples/ListServicePlansByBroker.java | 30 +- .../examples/ProvisionService.java | 32 +- .../servicecatalog/api/model/Constants.java | 3 +- .../tekton/client/GenericTektonClient.java | 6 +- .../tekton/client/NamespacedTektonClient.java | 3 +- .../fabric8/tekton/client/TektonClient.java | 1 + .../client/dsl/V1alpha1APIGroupDSL.java | 4 +- .../tekton/client/util/ApiVersionUtil.java | 36 +- .../tekton/api/examples/ClientFactory.java | 64 +- .../tekton/api/examples/PipelineList.java | 2 +- .../api/examples/PipelineResourceCreate.java | 39 +- .../api/examples/PipelineResourceList.java | 4 +- .../tekton/api/examples/TaskCreate.java | 24 +- .../tekton/api/examples/TaskRunCancel.java | 12 +- .../api/examples/v1alpha1/TaskRunCreate.java | 42 +- .../api/examples/v1beta1/TaskRunCreate.java | 42 +- .../pipeline/v1alpha1/ArrayOrString.java | 7 +- .../pipeline/v1beta1/ArrayOrString.java | 10 +- .../java/io/fabric8/tekton/ModelTest.java | 30 +- .../GenericVerticalPodAutoscalerClient.java | 6 +- ...NamespacedVerticalPodAutoscalerClient.java | 3 +- .../client/dsl/V1APIGroupDSL.java | 2 - .../v1/VerticalPodAutoscalerCreate.java | 12 +- .../volcano/client/GenericVolcanoClient.java | 6 +- .../client/NamespacedVolcanoClient.java | 3 +- .../fabric8/volcano/client/VolcanoClient.java | 2 + .../client/dsl/V1beta1APIGroupDSL.java | 1 + .../volcano/examples/PodGroupCreate.java | 7 +- .../fabric8/volcano/examples/QueueCreate.java | 7 +- .../io/fabric8/volcano/examples/Utils.java | 40 +- .../examples/v1beta1/PodGroupCreate.java | 7 +- .../volcano/examples/v1beta1/QueueCreate.java | 7 +- .../client/GenericVolumeSnapshotClient.java | 6 +- .../NamespacedVolumeSnapshotClient.java | 3 +- .../client/VolumeSnapshotClient.java | 1 - .../client/VolumeSnapshotContentResource.java | 1 - .../client/VolumeSnapshotResource.java | 1 - .../examples/CreateVolumeSnapshot.java | 20 +- .../examples/CreateVolumeSnapshotClass.java | 18 +- .../examples/ListVolumeSnapshotContents.java | 7 +- .../examples/ListVolumeSnapshots.java | 4 +- .../volumesnapshot/api/model/Constants.java | 3 +- .../nodes/AbstractJSONSchema2Pojo.java | 1 - .../fabric8/java/generator/GeneratorTest.java | 3 - .../AdmissionRegistrationAPIGroupDSL.java | 1 + .../KubernetesClientTimeoutException.java | 14 +- .../client/NamespacedKubernetesClient.java | 1 + .../kubernetes/client/OperationInfo.java | 2 +- .../client/ResourceNotFoundException.java | 2 +- .../client/ServiceToURLProvider.java | 10 +- .../V1AdmissionRegistrationAPIGroupDSL.java | 3 +- .../client/V1AuthorizationAPIGroupDSL.java | 5 +- .../client/V1NetworkAPIGroupDSL.java | 2 + ...beta1AdmissionRegistrationAPIGroupDSL.java | 1 + .../V1beta1AuthorizationAPIGroupDSL.java | 3 + .../client/V1beta1NetworkAPIGroupDSL.java | 1 + .../kubernetes/client/VersionInfo.java | 11 +- .../client/dsl/ApiextensionsAPIGroupDSL.java | 1 + .../client/dsl/BatchAPIGroupDSL.java | 2 +- .../client/dsl/CertificatesAPIGroupDSL.java | 1 + .../kubernetes/client/dsl/Containerable.java | 3 +- .../client/dsl/DiscoveryAPIGroupDSL.java | 1 + .../client/dsl/EventingAPIGroupDSL.java | 1 + .../client/dsl/ExtensionsAPIGroupDSL.java | 8 +- .../kubernetes/client/dsl/FilterNested.java | 4 +- .../kubernetes/client/dsl/Filterable.java | 23 +- .../client/dsl/FunctionCallable.java | 1 - .../kubernetes/client/dsl/Listable.java | 9 +- .../client/dsl/MetricAPIGroupDSL.java | 1 + .../client/dsl/NetworkAPIGroupDSL.java | 2 + .../client/dsl/NodeMetricOperation.java | 20 +- ...ServerGetDeleteRecreateWaitApplicable.java | 3 +- .../client/dsl/PodMetricOperation.java | 42 +- .../client/dsl/RbacAPIGroupDSL.java | 4 +- .../client/dsl/SchedulingAPIGroupDSL.java | 2 + .../dsl/TimeoutImageEditReplacePatchable.java | 4 +- .../kubernetes/client/dsl/Timeoutable.java | 1 - .../kubernetes/client/dsl/V1APIGroupDSL.java | 5 +- .../client/dsl/V1BatchAPIGroupDSL.java | 2 + .../client/dsl/V1CertificatesAPIGroupDSL.java | 1 - .../client/dsl/V1PolicyAPIGroupDSL.java | 1 + .../client/dsl/V1beta1BatchAPIGroupDSL.java | 1 + .../dsl/V1beta1FlowControlAPIGroupDSL.java | 4 +- .../leaderelection/LeaderElectionConfig.java | 9 +- .../client/extended/run/RunConfig.java | 7 +- .../client/extended/run/RunConfigUtil.java | 16 +- .../kubernetes/client/http/BasicBuilder.java | 14 +- .../client/http/HttpStatusMessage.java | 141 +-- .../kubernetes/client/http/TlsVersion.java | 16 +- .../http/WebSocketHandshakeException.java | 11 +- .../client/internal/KubeConfigUtils.java | 23 +- .../kubernetes/client/internal/PKCS1Util.java | 8 +- .../kubernetes/client/lib/FileSystem.java | 53 +- .../kubernetes/client/lib/FilenameUtils.java | 60 +- .../client/utils/ApiVersionUtil.java | 33 +- .../utils/CachedSingleThreadScheduler.java | 20 +- .../kubernetes/client/utils/IOHelpers.java | 57 +- .../utils/KubernetesVersionFactory.java | 385 ++++---- .../utils/KubernetesVersionPriority.java | 51 +- .../client/utils/PodStatusUtil.java | 282 +++--- .../kubernetes/client/utils/ReflectUtils.java | 5 +- .../client/utils/ReplaceValueStream.java | 2 +- .../client/utils/ResourceCompare.java | 18 +- .../kubernetes/client/utils/URLUtils.java | 118 +-- .../io/fabric8/kubernetes/client/Custom.java | 3 +- .../kubernetes/client/CustomResourceTest.java | 30 +- .../io/fabric8/kubernetes/client/Good.java | 3 +- .../CustomResourceDefinitionContextTest.java | 61 +- .../extended/run/RunConfigUtilTest.java | 64 +- .../extended/run/RunOperationsTest.java | 20 +- .../kubernetes/client/http/WebSocketTest.java | 1 - .../client/internal/CertUtilsTest.java | 39 +- .../client/internal/KubeConfigUtilsTest.java | 102 +-- .../client/utils/ApiVersionUtilTest.java | 28 +- .../CachedSingleThreadSchedulerTest.java | 4 +- .../utils/KubernetesVersionFactoryTest.java | 819 +++++++++--------- .../utils/KubernetesVersionPriorityTest.java | 44 +- .../kubernetes/client/utils/PodMockUtils.java | 729 ++++++++-------- .../client/utils/PodStatusUtilTest.java | 590 ++++++------- .../client/utils/ReflectUtilsTest.java | 20 +- .../client/utils/ResourceCompareTest.java | 97 ++- .../client/utils/SerializationYamlTest.java | 18 +- .../kubernetes/client/utils/URLUtilsTest.java | 2 - .../dsl/internal/DefaultOperationInfo.java | 4 +- .../dsl/internal/MetricOperationsImpl.java | 6 +- .../client/dsl/internal/PortForwarder.java | 6 +- .../impl/SharedInformerFactoryImpl.java | 1 - .../utils/internal/CreateOrReplaceHelper.java | 7 +- .../internal/OptionalDependencyWrapper.java | 10 +- .../utils/internal/URLFromServiceUtil.java | 33 +- .../v1/AppsV1ControllerPodOperationTest.java | 48 +- .../batch/v1/JobOperationsImplTest.java | 14 +- .../kubernetes/client/impl/HandlersTest.java | 2 - .../impl/cache/ProcessorListenerTest.java | 35 +- .../impl/cache/SharedProcessorTest.java | 9 +- .../internal/CreateOrReplaceHelperTest.java | 47 +- .../OptionalDependencyWrapperTest.java | 10 +- .../kubernetes/examples/BindingExample.java | 44 +- .../kubernetes/examples/CRDLoadExample.java | 5 +- .../kubernetes/examples/ConfigMapExample.java | 9 +- .../examples/CredentialsExample.java | 44 +- .../kubernetes/examples/CronJobExample.java | 50 +- .../kubernetes/examples/DeleteExamples.java | 4 +- .../examples/DeploymentExamples.java | 51 +- .../kubernetes/examples/EndpointsExample.java | 19 +- .../kubernetes/examples/ExecLoopExample.java | 4 +- .../examples/ExecuteCommandOnPodExample.java | 14 +- .../GenericKubernetesResourceExample.java | 16 +- .../HorizontalPodAutoscalerV1Example.java | 24 +- ...HorizontalPodAutoscalerV2beta2Example.java | 70 +- .../examples/KubernetesVersionExample.java | 2 +- .../kubernetes/examples/ListExamples.java | 27 +- .../examples/ListStorageClassExample.java | 2 +- .../LoadMultipleDocumentsFromFileExample.java | 15 +- .../examples/NetworkPolicyExample.java | 37 +- .../PersistentVolumeClaimExample.java | 68 +- .../examples/PersistentVolumeExample.java | 45 +- .../examples/PodDisruptionBudgetExample.java | 18 +- .../kubernetes/examples/PodLogExample.java | 5 +- .../examples/PodPriorityExample.java | 24 +- .../examples/PodSecurityPolicyExample.java | 24 +- .../examples/PortForwardExample.java | 16 +- .../kubernetes/examples/ReplaceExamples.java | 30 +- .../kubernetes/examples/ServiceExample.java | 31 +- .../examples/SharedInformerExample.java | 59 +- .../examples/WaitUntilReadyExample.java | 31 +- .../kubernetes/examples/WatchExample.java | 12 +- .../kubernetes/examples/crds/DummySpec.java | 4 +- .../kubectl/equivalents/CanIEquivalent.java | 18 +- ...teSigningRequestApproveYamlEquivalent.java | 12 +- ...ateSigningRequestCreateYamlEquivalent.java | 3 +- ...icateSigningRequestDenyYamlEquivalent.java | 20 +- .../ConfigGetContextsEquivalent.java | 6 +- .../kubectl/equivalents/ConfigListUsers.java | 4 +- .../kubectl/equivalents/ConfigUseContext.java | 11 +- .../equivalents/ConfigViewEquivalent.java | 2 +- .../CreateOrReplaceResourceList.java | 4 +- .../CustomResourceCreateDemoTypeless.java | 17 +- .../DownloadFileFromMultiContainerPod.java | 10 +- .../equivalents/DownloadFileFromPod.java | 8 +- .../equivalents/EventsGetEquivalent.java | 8 +- ...LoadAndCreateCustomResourceDefinition.java | 6 +- .../equivalents/LoadAndCreateDeployment.java | 4 +- .../equivalents/LoadAndCreateService.java | 18 +- .../equivalents/NamespaceListEquivalent.java | 12 +- .../kubectl/equivalents/PodAddAnnotation.java | 6 +- .../kubectl/equivalents/PodAddLabel.java | 6 +- .../kubectl/equivalents/PodDelete.java | 8 +- .../kubectl/equivalents/PodDeleteViaYaml.java | 10 +- .../equivalents/PodExecEquivalent.java | 8 +- .../equivalents/PodListEquivalent.java | 22 +- .../equivalents/PodListFilterByLabel.java | 14 +- .../PodListFilterFieldSelector.java | 6 +- .../equivalents/PodListGlobalEquivalent.java | 8 +- .../equivalents/PodLogsFollowEquivalent.java | 2 +- .../PodLogsMultiContainerEquivalent.java | 4 +- .../kubectl/equivalents/PodRunEquivalent.java | 6 +- .../kubectl/equivalents/PodShowLabels.java | 12 +- .../PodSortByCreationTimestamp.java | 4 +- .../equivalents/PodWatchEquivalent.java | 72 +- .../equivalents/PortForwardEquivalent.java | 2 +- .../equivalents/RolloutPauseEquivalent.java | 4 +- .../equivalents/RolloutRestartEquivalent.java | 4 +- .../equivalents/RolloutResumeEquivalent.java | 4 +- .../RolloutSetImageEquivalent.java | 4 +- .../equivalents/RolloutUndoEquivalent.java | 4 +- .../kubectl/equivalents/TopEquivalent.java | 10 +- .../equivalents/UploadDirectoryToPod.java | 8 +- .../kubectl/equivalents/UploadFileToPod.java | 8 +- .../examples/BuildConfigExamples.java | 114 ++- .../examples/DeploymentConfigExamples.java | 51 +- .../examples/DeploymentConfigScale.java | 11 +- .../examples/ImageStreamExample.java | 52 +- .../openshift/examples/ListBuildConfigs.java | 2 +- .../examples/ListDeploymentConfigs.java | 2 +- .../openshift/examples/ListImageStreams.java | 2 +- .../openshift/examples/LoginExample.java | 9 +- .../examples/NewProjectExamples.java | 8 +- .../examples/OpenShiftVersionExample.java | 2 +- .../SecurityContextConstraintExample.java | 64 +- .../openshift/examples/WatchBuildConfigs.java | 2 +- .../src/test/java/io/fabric8/crd/pet/Pet.java | 3 +- .../test/java/io/fabric8/crd/pet/PetSpec.java | 3 +- .../DefaultSharedIndexInformerIT.java | 5 +- .../kubernetes/SelfSubjectAccessReviewIT.java | 16 +- .../java/io/fabric8/kubernetes/WatchIT.java | 20 +- .../model/admission/v1/AdmissionRequest.java | 35 +- .../admission/v1beta1/AdmissionRequest.java | 35 +- .../ValidatingWebhookConfigurationTest.java | 43 +- .../SubjectAccessReviewTest.java | 23 +- .../v1/JSONSchemaPropsOrArraySerDe.java | 18 +- .../v1/JSONSchemaPropsOrBoolSerDe.java | 13 +- .../v1/JSONSchemaPropsOrStringArraySerDe.java | 18 +- .../v1beta1/JSONSchemaPropsOrArraySerDe.java | 18 +- .../v1beta1/JSONSchemaPropsOrBoolSerDe.java | 13 +- .../JSONSchemaPropsOrStringArraySerDe.java | 18 +- .../v1/ConversionReviewTest.java | 2 +- .../v1/JSONSchemaPropsOrArrayTest.java | 56 +- .../v1/JSONSchemaPropsOrBoolTest.java | 56 +- .../v1/JSONSchemaPropsOrStringArrayTest.java | 78 +- .../v1beta1/CustomResourceDefinitionTest.java | 52 +- .../v1beta1/JSONSchemaPropsOrArrayTest.java | 67 +- .../v1beta1/JSONSchemaPropsOrBoolTest.java | 70 +- .../JSONSchemaPropsOrStringArrayTest.java | 89 +- .../HorizontalPodAutoscalerTest.java | 46 +- .../api/model/batch/v1/JobTest.java | 40 +- .../v1/CertificateSigningRequestTest.java | 12 +- .../io/fabric8/kubernetes/model/Scope.java | 3 +- .../model/annotation/Generated.java | 39 +- .../kubernetes/model/annotation/Kind.java | 2 +- .../model/annotation/LabelSelector.java | 2 +- .../kubernetes/model/annotation/Plural.java | 2 +- .../model/annotation/PrinterColumn.java | 4 +- .../model/annotation/ShortNames.java | 5 +- .../kubernetes/model/annotation/Singular.java | 2 +- .../model/annotation/SpecReplicas.java | 2 +- .../model/annotation/StatusReplicas.java | 2 +- .../jackson/JsonUnwrappedDeserializer.java | 50 +- .../jackson/UnwrappedTypeResolverBuilder.java | 6 +- .../fabric8/kubernetes/model/util/Helper.java | 22 +- .../api/model/coordination/v1/LeaseSpec.java | 19 +- .../api/model/DeletionPropagation.java | 7 +- .../kubernetes/api/model/Duration.java | 74 +- .../api/model/HasMetadataComparator.java | 129 ++- .../api/model/KubernetesResource.java | 1 + .../api/model/KubernetesResourceList.java | 4 +- .../kubernetes/api/model/MicroTimeSerDes.java | 3 +- .../fabric8/kubernetes/api/PluralizeTest.java | 1 - .../api/model/AdditionalPropertiesTest.java | 46 +- .../kubernetes/api/model/ConfigMapTest.java | 87 +- .../kubernetes/api/model/EventTest.java | 2 +- .../GenericKubernetesResourceListTest.java | 23 +- .../model/GenericKubernetesResourceTest.java | 160 ++-- .../kubernetes/api/model/HasMetadataTest.java | 42 +- .../api/model/KubernetesListTest.java | 143 ++- .../api/model/KubernetesResourceTest.java | 20 +- .../kubernetes/api/model/ListOptionsTest.java | 8 +- .../kubernetes/api/model/MicroTimeTest.java | 4 +- .../kubernetes/api/model/QuantityTest.java | 2 +- .../kubernetes/api/model/SecretTest.java | 94 +- .../kubernetes/api/model/ServiceTest.java | 211 +++-- .../kubernetes/api/model/StatusTest.java | 28 +- .../internal/KubernetesDeserializerTest.java | 1 - .../discovery/v1beta1/EndpointSliceTest.java | 43 +- .../metrics/v1beta1/NodeMetricsTest.java | 22 +- .../api/model/rbac/RoleBindingTest.java | 84 +- .../kubernetes/api/model/rbac/RoleTest.java | 75 +- .../api/model/hive/v1/ClusterClaimTest.java | 47 +- .../model/hive/v1/ClusterDeploymentTest.java | 108 +-- .../model/hive/v1/ClusterDeprovisionTest.java | 50 +- .../model/hive/v1/ClusterImageSetTest.java | 30 +- .../api/model/hive/v1/ClusterPoolTest.java | 88 +- .../model/hive/v1/ClusterRelocateTest.java | 52 +- .../api/model/hive/v1/DNSZoneTest.java | 44 +- .../api/model/hive/v1/HiveConfigTest.java | 57 +- .../api/model/hive/v1/MachinePoolTest.java | 88 +- .../model/hive/v1/SelectorSyncSetTest.java | 52 +- .../api/model/hive/v1/SyncSetTest.java | 56 +- .../model/installer/v1/InstallConfigTest.java | 178 ++-- .../apiserver/v1/APIRequestCountTest.java | 55 +- .../network/operator/v1/EgressRouterTest.java | 38 +- .../kubernetes/api/model/BuildConfigTest.java | 666 +++++++------- .../fabric8/kubernetes/api/model/Helper.java | 14 +- .../api/model/ImageStreamImportTest.java | 127 ++- .../api/model/ImageStreamTagTest.java | 173 ++-- .../kubernetes/api/model/RouteTest.java | 169 ++-- .../kubernetes/api/model/TemplateTest.java | 12 +- .../kubernetes/client/mock/BindingTest.java | 14 +- .../client/mock/ClusterRoleTest.java | 6 +- .../client/mock/ComponentStatusTest.java | 31 +- .../client/mock/DeploymentV1beta1Test.java | 61 +- .../client/mock/ErrorMessageTest.java | 39 +- .../client/mock/GenerationTest.java | 15 +- .../client/mock/HttpServerTest.java | 2 +- .../kubernetes/client/mock/KeyLoadTests.java | 6 +- .../kubernetes/client/mock/LabelTest.java | 102 ++- .../kubernetes/client/mock/MetricsTest.java | 68 +- .../kubernetes/client/mock/MixedCrudTest.java | 22 +- .../client/mock/NodeMetricsTest.java | 23 +- .../client/mock/PodMetricsTest.java | 36 +- .../client/mock/ReplicaSetV1beta1Test.java | 47 +- .../client/mock/TokenReviewTest.java | 36 +- .../client/mock/UntrustedCertTest.java | 18 +- .../mock/V1SubjectAccessReviewAuthTest.java | 170 ++-- .../V1beta1SubjectAccessReviewAuthTest.java | 169 ++-- .../client/mock/VersionInfoTest.java | 24 +- .../client/mock/crd/CronTabSpec.java | 72 +- .../client/mock/crd/CronTabStatus.java | 42 +- .../mock/crd/EntandoBundleReleaseSpec.java | 4 +- .../kubernetes/client/mock/crd/PodSet.java | 2 +- .../client/mock/crd/PodSetSpec.java | 22 +- .../client/mock/crd/PodSetStatus.java | 22 +- .../kubernetes/client/mock/crd/StarSpec.java | 6 +- .../client/mock/crd/StarStatus.java | 4 +- .../client/server/mock/AdaptTest.java | 60 +- .../server/mock/BuildConfigCrudTest.java | 8 +- .../client/server/mock/BuildTest.java | 6 +- .../mock/ClusterServiceVersionTest.java | 11 +- .../server/mock/ImageStreamImageTest.java | 9 +- .../server/mock/ImageStreamImportTest.java | 37 +- .../server/mock/ImageStreamMappingTest.java | 30 +- .../server/mock/LoadAsTemplateTest.java | 26 +- .../client/server/mock/OpenshiftRoleTest.java | 55 +- .../server/mock/PackageManifestTest.java | 1 - .../mock/PodSecurityPolicyReviewTest.java | 42 +- ...odSecurityPolicySelfSubjectReviewTest.java | 57 +- .../PodSecurityPolicySubjectReviewTest.java | 54 +- .../server/mock/SubjectAccessReviewTest.java | 176 ++-- .../server/mock/UserIdentityMappingTest.java | 20 +- .../client/NamespacedOpenShiftClient.java | 1 + .../openshift/client/OpenShiftAPIGroups.java | 1 + .../dsl/NameableCreateOrDeleteable.java | 3 +- ...penShiftClusterAutoscalingAPIGroupDSL.java | 1 + .../dsl/OpenShiftConsoleAPIGroupDSL.java | 4 + .../client/dsl/OpenShiftHiveAPIGroupDSL.java | 16 + .../dsl/OpenShiftMonitoringAPIGroupDSL.java | 5 + .../dsl/OpenShiftOperatorAPIGroupDSL.java | 16 + .../dsl/OpenShiftOperatorHubAPIGroupDSL.java | 4 + .../client/dsl/OpenShiftQuotaAPIGroupDSL.java | 1 + .../client/dsl/ProjectOperation.java | 3 +- .../client/dsl/TimeoutInputStreamable.java | 4 +- .../client/readiness/OpenShiftReadiness.java | 7 +- .../client/dsl/base/TestUnmarshal.java | 2 +- .../readiness/OpenShiftReadinessTest.java | 6 +- .../internal/BuildConfigOperationContext.java | 37 +- .../apps/DeploymentConfigOperationsImpl.java | 1 - .../internal/core/TemplateOperationsImpl.java | 1 - .../internal/OpenShiftOAuthInterceptor.java | 1 - .../client/dsl/base/TestUnmarshal.java | 2 +- ...ShiftDeploymentConfigPodOperationTest.java | 9 +- .../build/OpenShiftBuildPodOperationTest.java | 4 +- .../karaf/itests/FeatureInstallationTest.java | 48 +- .../karaf/itests/PropertiesOverrideTest.java | 67 +- .../kubernetes/karaf/itests/ServiceTest.java | 63 +- pom.xml | 2 +- 542 files changed, 8033 insertions(+), 7825 deletions(-) diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractCustomResourceHandler.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractCustomResourceHandler.java index 1c86e3492b2..1dfd3aeeb7e 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractCustomResourceHandler.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/AbstractCustomResourceHandler.java @@ -64,33 +64,33 @@ public void handle(CustomResourceInfo config) { } def = builder - .accept(labelSelectorPathDetector) - .accept(additionalPrinterColumnDetector) - .accept(traversedClassesVisitor) - .build(); + .accept(labelSelectorPathDetector) + .accept(additionalPrinterColumnDetector) + .accept(traversedClassesVisitor) + .build(); addDecorators(config, def, specReplicasPathDetector.getPath(), - statusReplicasPathDetector.getPath(), labelSelectorPathDetector.getPath()); + statusReplicasPathDetector.getPath(), labelSelectorPathDetector.getPath()); Map additionalPrinterColumns = new HashMap<>(additionalPrinterColumnDetector.getProperties()); additionalPrinterColumns.forEach((path, property) -> { Map parameters = property.getAnnotations().stream() - .filter(a -> a.getClassRef().getName().equals("PrinterColumn")).map(AnnotationRef::getParameters) - .findFirst().orElse(Collections.emptyMap()); + .filter(a -> a.getClassRef().getName().equals("PrinterColumn")).map(AnnotationRef::getParameters) + .findFirst().orElse(Collections.emptyMap()); String type = AbstractJsonSchema.getSchemaTypeFor(property.getTypeRef()); String column = (String) parameters.get("name"); if (Utils.isNullOrEmpty(column)) { column = property.getName().toUpperCase(); } String description = property.getComments().stream().filter(l -> !l.trim().startsWith("@")) - .collect(Collectors.joining(" ")).trim(); + .collect(Collectors.joining(" ")).trim(); String format = (String) parameters.get("format"); resources.decorate( - getPrinterColumnDecorator(name, version, path, type, column, description, format)); + getPrinterColumnDecorator(name, version, path, type, column, description, format)); }); } - + /** * Provides the decorator implementation associated with the CRD generation version. * @@ -104,19 +104,21 @@ public void handle(CustomResourceInfo config) { * @return the concrete decorator implementing the addition of a printer column to the currently built CRD */ protected abstract Decorator getPrinterColumnDecorator(String name, String version, String path, - String type, String column, String description, String format); + String type, String column, String description, String format); + /** * Adds all the necessary decorators to build the specific CRD version. For optional paths, see * https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#customresourcesubresourcescale-v1-apiextensions-k8s-io * These paths * * @param config the gathered {@link CustomResourceInfo} used as basis for the CRD generation - * @param def the {@link TypeDef} associated with the {@link io.fabric8.kubernetes.client.CustomResource} from which the CRD is generated + * @param def the {@link TypeDef} associated with the {@link io.fabric8.kubernetes.client.CustomResource} from which the CRD + * is generated * @param specReplicasPath an optionally detected path of field defining spec replicas * @param statusReplicasPath an optionally detected path of field defining status replicas - * @param labelSelectorPath an optionally detected path of field defining `status.selector` + * @param labelSelectorPath an optionally detected path of field defining `status.selector` */ protected abstract void addDecorators(CustomResourceInfo config, TypeDef def, - Optional specReplicasPath, Optional statusReplicasPath, - Optional labelSelectorPath); + Optional specReplicasPath, Optional statusReplicasPath, + Optional labelSelectorPath); } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/CRDGenerationInfo.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/CRDGenerationInfo.java index 08db83f90b3..b61d7ef47fa 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/CRDGenerationInfo.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/CRDGenerationInfo.java @@ -37,7 +37,8 @@ public Map> getCRDDetailsPerNameAndVersion() { void add(String crdName, String version, URI fileURI) { crdNameToVersionToCRDInfoMap.computeIfAbsent(crdName, k -> new HashMap<>()) - .put(version, new CRDInfo(crdName, version, new File(fileURI).getAbsolutePath(), ClassDependenciesVisitor.getDependentClassesFromCRDName(crdName))); + .put(version, new CRDInfo(crdName, version, new File(fileURI).getAbsolutePath(), + ClassDependenciesVisitor.getDependentClassesFromCRDName(crdName))); } public int numberOfGeneratedCRDs() { diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/CRDGenerator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/CRDGenerator.java index 77b85f881e7..2b05eb9a1c2 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/CRDGenerator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/CRDGenerator.java @@ -42,11 +42,10 @@ public class CRDGenerator { private Map infos; private static final ObjectMapper YAML_MAPPER = new ObjectMapper( - new YAMLFactory() - .enable(Feature.MINIMIZE_QUOTES) - .enable(Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS) - .disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER) - ); + new YAMLFactory() + .enable(Feature.MINIMIZE_QUOTES) + .enable(Feature.ALWAYS_QUOTE_NUMBERS_AS_STRINGS) + .disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER)); static { YAML_MAPPER.configure(SerializationFeature.INDENT_OUTPUT, true); @@ -71,7 +70,7 @@ public CRDGenerator withOutput(CRDOutput output) { public CRDGenerator forCRDVersions(List versions) { return versions != null && !versions.isEmpty() ? forCRDVersions(versions.toArray(new String[0])) - : this; + : this; } public CRDGenerator forCRDVersions(String... versions) { @@ -81,11 +80,11 @@ public CRDGenerator forCRDVersions(String... versions) { switch (version) { case CustomResourceHandler.VERSION: handlers.computeIfAbsent(CustomResourceHandler.VERSION, - s -> new CustomResourceHandler(resources)); + s -> new CustomResourceHandler(resources)); break; case io.fabric8.crd.generator.v1beta1.CustomResourceHandler.VERSION: handlers.computeIfAbsent(io.fabric8.crd.generator.v1beta1.CustomResourceHandler.VERSION, - s -> new io.fabric8.crd.generator.v1beta1.CustomResourceHandler(resources)); + s -> new io.fabric8.crd.generator.v1beta1.CustomResourceHandler(resources)); break; default: LOGGER.warn("Ignoring unsupported CRD version: {}", version); @@ -110,9 +109,9 @@ public CRDGenerator customResources(CustomResourceInfo... infos) { this.infos = new HashMap<>(infos.length); } Arrays.stream(infos) - .filter(Objects::nonNull) - // make sure we record all versions of the CR - .forEach(info -> this.infos.put(getOutputName(info.crdName(), info.version()), info)); + .filter(Objects::nonNull) + // make sure we record all versions of the CR + .forEach(info -> this.infos.put(getOutputName(info.crdName(), info.version()), info)); } return this; } @@ -133,23 +132,23 @@ public CRDGenerationInfo detailedGenerate() { if (output == null) { LOGGER.warn( - "No output option was selected either using 'inOutputDir' or 'withOutput' methods. Skipping generation."); + "No output option was selected either using 'inOutputDir' or 'withOutput' methods. Skipping generation."); return CRDGenerationInfo.EMPTY; } // if no CRD version is specified, generate for all supported versions if (handlers.isEmpty()) { forCRDVersions(CustomResourceHandler.VERSION, - io.fabric8.crd.generator.v1beta1.CustomResourceHandler.VERSION); + io.fabric8.crd.generator.v1beta1.CustomResourceHandler.VERSION); } for (CustomResourceInfo info : infos.values()) { if (info != null) { if (LOGGER.isInfoEnabled()) { LOGGER.info("Generating '{}' version '{}' with {} (spec: {} / status {})...", - info.crdName(), info.version(), info.crClassName(), - info.specClassName().orElse("undetermined"), - info.statusClassName().orElse("undetermined")); + info.crdName(), info.version(), info.crClassName(), + info.specClassName().orElse("undetermined"), + info.statusClassName().orElse("undetermined")); } handlers.values().forEach(h -> h.handle(info)); } @@ -163,8 +162,8 @@ public CRDGenerationInfo detailedGenerate() { final String outputName = getOutputName(crdName, version); try (final OutputStream outputStream = output.outputFor(outputName)) { outputStream.write( - "# Generated by Fabric8 CRDGenerator, manual edits might get overwritten!\n" - .getBytes()); + "# Generated by Fabric8 CRDGenerator, manual edits might get overwritten!\n" + .getBytes()); YAML_MAPPER.writeValue(outputStream, crd); final URI fileURI = output.crdURI(outputName); crdGenerationInfo.add(crdName, version, fileURI); @@ -175,7 +174,7 @@ public CRDGenerationInfo detailedGenerate() { } return crdGenerationInfo; } - + public static String getOutputName(String crdName, String crdSpecVersion) { return crdName + "-" + crdSpecVersion; } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/Resources.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/Resources.java index 080c0f83da3..c8a6f74240e 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/Resources.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/Resources.java @@ -15,16 +15,16 @@ */ package io.fabric8.crd.generator; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - import io.fabric8.crd.generator.decorator.Decorator; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.KubernetesList; import io.fabric8.kubernetes.api.model.KubernetesListBuilder; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + public class Resources { private final KubernetesListBuilder global = new KubernetesListBuilder(); private final Set globalDecorators = new TreeSet<>(); @@ -38,13 +38,13 @@ public KubernetesListBuilder global() { return this.global; } - /** * Get the Decorator Set. * The method is visible for testing purposes. + * * @return the Set of registed Decorators. */ - protected Set getDecorators() { + protected Set getDecorators() { return globalDecorators; } @@ -57,7 +57,6 @@ public void decorate(Decorator decorator) { globalDecorators.add(decorator); } - /** * Add a resource to all groups. * @@ -67,7 +66,6 @@ public void add(HasMetadata metadata) { global.addToItems(metadata); } - /** * Generate all resources. * @@ -90,8 +88,8 @@ public List applyConstraints(Set decorators) { // In other words we don't ANY sorting algorithm, we need bubble sort. // We also might need it more than once. So, we'll do it as many times as we have to, till there are not more transformations. // But hey, let's have an upper limit of 5 just to prevent infinite loops - for(int i=0; i<10 && bubbleSort(array); i++) { - System.out.println("Sorting again:" + (i+1)); + for (int i = 0; i < 10 && bubbleSort(array); i++) { + System.out.println("Sorting again:" + (i + 1)); } for (Decorator d : array) { @@ -102,6 +100,7 @@ public List applyConstraints(Set decorators) { /** * Bubble sort for decorators. + * * @param decorators the {@link Decorator} array to be sorted */ private boolean bubbleSort(Decorator[] decorators) { diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/Decorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/Decorator.java index c306793dec4..066a7d5bb1a 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/Decorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/Decorator.java @@ -56,7 +56,7 @@ public int compareTo(Decorator o) { return -1; } } - //Reproducible order every single time + //Reproducible order every single time int result = getClass().getName().compareTo(o.getClass().getName()); if (result == 0) { result = hashCode() - o.hashCode(); diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/NamedResourceDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/NamedResourceDecorator.java index c650761f53d..d4599df008a 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/NamedResourceDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/NamedResourceDecorator.java @@ -21,6 +21,7 @@ import io.fabric8.kubernetes.api.builder.VisitableBuilder; import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.client.utils.Utils; + import java.util.Optional; public abstract class NamedResourceDecorator extends Decorator { @@ -123,13 +124,13 @@ public ResourceVisitor withMetadata(ObjectMeta metadata) { public Class getType() { return (Class) Generics - .getTypeArguments(NamedResourceDecorator.class, NamedResourceDecorator.this.getClass()) - .get(0); + .getTypeArguments(NamedResourceDecorator.class, NamedResourceDecorator.this.getClass()) + .get(0); } } @Override public Class[] after() { - return new Class[]{ ResourceProvidingDecorator.class }; + return new Class[] { ResourceProvidingDecorator.class }; } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/ResourceProvidingDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/ResourceProvidingDecorator.java index a0691ed9311..f78bd1a834e 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/ResourceProvidingDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/decorator/ResourceProvidingDecorator.java @@ -15,7 +15,6 @@ */ package io.fabric8.crd.generator.decorator; -import java.util.Arrays; import java.util.HashMap; import java.util.Map; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Generics.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Generics.java index 2f18702c35a..a9e8abfa52e 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Generics.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Generics.java @@ -39,6 +39,7 @@ public class Generics { private Generics() { throw new IllegalStateException("Utility class"); } + public static Class getClass(Type type) { if (type instanceof Class) { return (Class) type; @@ -56,7 +57,7 @@ public static Class getClass(Type type) { return null; } } - + /** * Get the actual type arguments a child class has used to extend a generic base class. * @@ -66,7 +67,7 @@ public static Class getClass(Type type) { * @return a list of the raw classes for the actual type arguments */ public static List getTypeArguments(Class baseClass, - Class childClass) { + Class childClass) { Map resolvedTypes = new LinkedHashMap<>(); Type type = childClass; // start walking up the inheritance hierarchy until we hit baseClass diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Metadata.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Metadata.java index 652100bf9d5..feca3286aee 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Metadata.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Metadata.java @@ -20,6 +20,7 @@ import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.api.model.ObjectMetaFluent; + import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Optional; @@ -29,6 +30,7 @@ public class Metadata { private Metadata() { throw new IllegalStateException("Utility class"); } + public static Optional getKind(Builder builder) { try { Method method = builder.getClass().getMethod("getKind"); @@ -96,9 +98,9 @@ public static boolean removeFromLabels(Builder builder, String key) { * @return The predicate. */ public static Predicate> matching( - HasMetadata candidate) { + HasMetadata candidate) { return matching(candidate.getApiVersion(), candidate.getKind(), - candidate.getMetadata().getName()); + candidate.getMetadata().getName()); } /** @@ -110,13 +112,13 @@ public static boolean removeFromLabels(Builder builder, String key) { * @return The predicate. */ public static Predicate> matching(String apiVersion, - String kind, String name) { + String kind, String name) { return builder -> { HasMetadata item = builder.build(); ObjectMeta metadata = item.getMetadata(); return apiVersion.equals(item.getApiVersion()) && - kind != null && kind.equals(item.getKind()) && - name != null && name.equals(metadata.getName()); + kind != null && kind.equals(item.getKind()) && + name != null && name.equals(metadata.getName()); }; } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Types.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Types.java index 90909672be3..fda694ff626 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Types.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/utils/Types.java @@ -19,9 +19,6 @@ import io.fabric8.kubernetes.client.CustomResource; import io.sundr.adapter.api.AdapterContext; import io.sundr.adapter.api.Adapters; -import io.sundr.adapter.apt.AptAdapter; -import io.sundr.adapter.apt.AptContext; -import io.sundr.builder.TypedVisitor; import io.sundr.model.*; import io.sundr.model.functions.GetDefinition; import io.sundr.model.repo.DefinitionRepository; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/CustomResourceHandler.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/CustomResourceHandler.java index 0437e485b00..48d90ea5f85 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/CustomResourceHandler.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/CustomResourceHandler.java @@ -19,7 +19,6 @@ import io.fabric8.crd.generator.CustomResourceInfo; import io.fabric8.crd.generator.Resources; import io.fabric8.crd.generator.decorator.Decorator; -import io.fabric8.crd.generator.utils.Types; import io.fabric8.crd.generator.v1.decorator.AddAdditionPrinterColumnDecorator; import io.fabric8.crd.generator.v1.decorator.AddCustomResourceDefinitionResourceDecorator; import io.fabric8.crd.generator.v1.decorator.AddCustomResourceDefinitionVersionDecorator; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddAdditionPrinterColumnDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddAdditionPrinterColumnDecorator.java index a7dc89c7721..13043f755f4 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddAdditionPrinterColumnDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddAdditionPrinterColumnDecorator.java @@ -18,10 +18,11 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceColumnDefinitionBuilder; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersionFluent; import io.fabric8.kubernetes.client.utils.Utils; + import java.util.function.Predicate; public class AddAdditionPrinterColumnDecorator extends - CustomResourceDefinitionVersionDecorator> { + CustomResourceDefinitionVersionDecorator> { private final String type; private final String columnName; @@ -29,7 +30,8 @@ public class AddAdditionPrinterColumnDecorator extends private final String format; private final String description; - public AddAdditionPrinterColumnDecorator(String name, String version, String type, String columnName, String path, String format, String description) { + public AddAdditionPrinterColumnDecorator(String name, String version, String type, String columnName, String path, + String format, String description) { super(name, version); this.type = type; this.columnName = columnName; @@ -40,41 +42,42 @@ public AddAdditionPrinterColumnDecorator(String name, String version, String typ @Override public void andThenVisit(CustomResourceDefinitionVersionFluent spec) { - Predicate matchingColumn = col -> col.getName() != null && col.getName().equals(columnName); + Predicate matchingColumn = col -> col.getName() != null + && col.getName().equals(columnName); spec.removeMatchingFromAdditionalPrinterColumns(matchingColumn); spec.addNewAdditionalPrinterColumn() - .withType(type) - .withName(columnName) - .withJsonPath(path) - .withFormat(Utils.isNotNullOrEmpty(format) ? format : null) - .withDescription(Utils.isNotNullOrEmpty(description) ? description : null) - .endAdditionalPrinterColumn(); + .withType(type) + .withName(columnName) + .withJsonPath(path) + .withFormat(Utils.isNotNullOrEmpty(format) ? format : null) + .withDescription(Utils.isNotNullOrEmpty(description) ? description : null) + .endAdditionalPrinterColumn(); } - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode()); - result = prime * result + ((columnName == null) ? 0 : columnName.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((path == null) ? 0 : path.hashCode()); - result = prime * result + ((format == null) ? 0 : format.hashCode()); - result = prime * result + ((description == null) ? 0 : description.hashCode()); - return result; - } + result = prime * result + ((columnName == null) ? 0 : columnName.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((path == null) ? 0 : path.hashCode()); + result = prime * result + ((format == null) ? 0 : format.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + return result; + } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - AddAdditionPrinterColumnDecorator other = (AddAdditionPrinterColumnDecorator) obj; + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + AddAdditionPrinterColumnDecorator other = (AddAdditionPrinterColumnDecorator) obj; if (getName() == null) { if (other.getName() != null) return false; @@ -85,36 +88,36 @@ public boolean equals(Object obj) { return false; } else if (!getVersion().equals(other.getVersion())) return false; - if (description == null) { - if (other.description != null) - return false; - } else if (!description.equals(other.description)) - return false; - if (format == null) { - if (other.format != null) - return false; - } else if (!format.equals(other.format)) - return false; - if (columnName == null) { - if (other.columnName != null) - return false; - } else if (!columnName.equals(other.columnName)) - return false; - if (path == null) { - if (other.path != null) - return false; - } else if (!path.equals(other.path)) - return false; - if (type == null) { - if (other.type != null) - return false; - } else if (!type.equals(other.type)) - return false; - return true; - } + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (format == null) { + if (other.format != null) + return false; + } else if (!format.equals(other.format)) + return false; + if (columnName == null) { + if (other.columnName != null) + return false; + } else if (!columnName.equals(other.columnName)) + return false; + if (path == null) { + if (other.path != null) + return false; + } else if (!path.equals(other.path)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + return true; + } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() + "column:" + columnName +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + "column:" + columnName + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddCustomResourceDefinitionResourceDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddCustomResourceDefinitionResourceDecorator.java index 3fdf5e3da5c..44334a07dca 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddCustomResourceDefinitionResourceDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddCustomResourceDefinitionResourceDecorator.java @@ -21,11 +21,6 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionBuilder; import io.fabric8.kubernetes.client.utils.ApiVersionUtil; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Collectors; - public class AddCustomResourceDefinitionResourceDecorator extends ResourceProvidingDecorator { private String name; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddCustomResourceDefinitionVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddCustomResourceDefinitionVersionDecorator.java index 5d5b2469440..be65343ff4a 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddCustomResourceDefinitionVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddCustomResourceDefinitionVersionDecorator.java @@ -19,10 +19,11 @@ import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionSpecFluent; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersionBuilder; + import java.util.function.Predicate; public class AddCustomResourceDefinitionVersionDecorator extends - CustomResourceDefinitionDecorator> { + CustomResourceDefinitionDecorator> { private final String version; @@ -34,29 +35,29 @@ public AddCustomResourceDefinitionVersionDecorator(String name, String version) public String getName() { return this.name; } - + public String getVersion() { return this.version; } - + @Override public void andThenVisit(CustomResourceDefinitionSpecFluent spec, ObjectMeta resourceMeta) { Predicate predicate = candidate -> candidate.getName() - .equals(version); - - spec.removeMatchingFromVersions(predicate); - spec.addNewVersion() - .withName(version) - .endVersion(); - } - - @Override - public Class[] after() { - return new Class[] { AddCustomResourceDefinitionResourceDecorator.class }; - } - - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ version +"]"; - } + .equals(version); + + spec.removeMatchingFromVersions(predicate); + spec.addNewVersion() + .withName(version) + .endVersion(); + } + + @Override + public Class[] after() { + return new Class[] { AddCustomResourceDefinitionResourceDecorator.class }; + } + + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + version + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddLabelSelectorPathDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddLabelSelectorPathDecorator.java index 92f25aba0d4..fdda3cafa9c 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddLabelSelectorPathDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddLabelSelectorPathDecorator.java @@ -18,27 +18,28 @@ import io.fabric8.crd.generator.decorator.Decorator; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceSubresourcesFluent; -public class AddLabelSelectorPathDecorator extends CustomResourceDefinitionVersionDecorator> { +public class AddLabelSelectorPathDecorator + extends CustomResourceDefinitionVersionDecorator> { private final String path; - - public AddLabelSelectorPathDecorator(String name, String version, String path) { - super(name, version); - this.path = path; - } - - @Override - public void andThenVisit(CustomResourceSubresourcesFluent subresources) { - if (subresources.hasScale()) { + + public AddLabelSelectorPathDecorator(String name, String version, String path) { + super(name, version); + this.path = path; + } + + @Override + public void andThenVisit(CustomResourceSubresourcesFluent subresources) { + if (subresources.hasScale()) { subresources.editScale().withLabelSelectorPath(path).endScale(); } else { subresources.withNewScale().withLabelSelectorPath(path).endScale(); } - } + } - @Override - public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class, - AddSubresourcesDecorator.class}; + @Override + public Class[] after() { + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class, + AddSubresourcesDecorator.class }; } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSchemaToCustomResourceDefinitionVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSchemaToCustomResourceDefinitionVersionDecorator.java index df48ca43082..f0216e23d14 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSchemaToCustomResourceDefinitionVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSchemaToCustomResourceDefinitionVersionDecorator.java @@ -36,13 +36,11 @@ public void andThenVisit(CustomResourceDefinitionVersionFluent version) { @Override public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class}; + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class }; } - - - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSpecReplicasPathDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSpecReplicasPathDecorator.java index e3013c0000c..dbc5eb00375 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSpecReplicasPathDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSpecReplicasPathDecorator.java @@ -18,26 +18,28 @@ import io.fabric8.crd.generator.decorator.Decorator; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceSubresourcesFluent; -public class AddSpecReplicasPathDecorator extends CustomResourceDefinitionVersionDecorator> { +public class AddSpecReplicasPathDecorator + extends CustomResourceDefinitionVersionDecorator> { private final String path; - - public AddSpecReplicasPathDecorator(String name, String version, String path) { - super(name, version); - this.path = path; - } - - @Override - public void andThenVisit(CustomResourceSubresourcesFluent subresources) { - if (subresources.hasScale()) { + + public AddSpecReplicasPathDecorator(String name, String version, String path) { + super(name, version); + this.path = path; + } + + @Override + public void andThenVisit(CustomResourceSubresourcesFluent subresources) { + if (subresources.hasScale()) { subresources.editScale().withSpecReplicasPath(path).endScale(); } else { subresources.withNewScale().withSpecReplicasPath(path).endScale(); } - } - @Override - public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class, - AddSubresourcesDecorator.class}; + } + + @Override + public Class[] after() { + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class, + AddSubresourcesDecorator.class }; } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddStatusReplicasPathDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddStatusReplicasPathDecorator.java index 286591a267f..afeadbcffbe 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddStatusReplicasPathDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddStatusReplicasPathDecorator.java @@ -18,26 +18,27 @@ import io.fabric8.crd.generator.decorator.Decorator; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceSubresourcesFluent; -public class AddStatusReplicasPathDecorator extends CustomResourceDefinitionVersionDecorator> { +public class AddStatusReplicasPathDecorator + extends CustomResourceDefinitionVersionDecorator> { private final String path; - - public AddStatusReplicasPathDecorator(String name, String version, String path) { - super(name, version); - this.path = path; - } - - @Override - public void andThenVisit(CustomResourceSubresourcesFluent subresources) { - if (subresources.hasScale()) { + + public AddStatusReplicasPathDecorator(String name, String version, String path) { + super(name, version); + this.path = path; + } + + @Override + public void andThenVisit(CustomResourceSubresourcesFluent subresources) { + if (subresources.hasScale()) { subresources.editScale().withStatusReplicasPath(path).endScale(); } else { subresources.withNewScale().withStatusReplicasPath(path).endScale(); } - } + } - @Override - public Class[] after() { - return new Class[] { AddSubresourcesDecorator.class }; - } + @Override + public Class[] after() { + return new Class[] { AddSubresourcesDecorator.class }; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddStatusSubresourceDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddStatusSubresourceDecorator.java index 05ee071be1d..ac55aa30fb6 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddStatusSubresourceDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddStatusSubresourceDecorator.java @@ -18,25 +18,26 @@ import io.fabric8.crd.generator.decorator.Decorator; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceSubresourcesFluent; -public class AddStatusSubresourceDecorator extends CustomResourceDefinitionVersionDecorator> { +public class AddStatusSubresourceDecorator + extends CustomResourceDefinitionVersionDecorator> { - public AddStatusSubresourceDecorator(String name, String version) { - super(name, version); - } + public AddStatusSubresourceDecorator(String name, String version) { + super(name, version); + } - @Override - public void andThenVisit(CustomResourceSubresourcesFluent subresources) { + @Override + public void andThenVisit(CustomResourceSubresourcesFluent subresources) { subresources.withNewStatus().endStatus(); - } + } - @Override - public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class, - AddSubresourcesDecorator.class}; + @Override + public Class[] after() { + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class, + AddSubresourcesDecorator.class }; } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSubresourcesDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSubresourcesDecorator.java index 247e2da6b67..984a92b2b33 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSubresourcesDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/AddSubresourcesDecorator.java @@ -18,26 +18,27 @@ import io.fabric8.crd.generator.decorator.Decorator; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersionFluent; -public class AddSubresourcesDecorator extends CustomResourceDefinitionVersionDecorator> { +public class AddSubresourcesDecorator + extends CustomResourceDefinitionVersionDecorator> { - public AddSubresourcesDecorator(String name, String version) { - super(name, version); - } + public AddSubresourcesDecorator(String name, String version) { + super(name, version); + } - @Override - public void andThenVisit(CustomResourceDefinitionVersionFluent spec) { + @Override + public void andThenVisit(CustomResourceDefinitionVersionFluent spec) { if (!spec.hasSubresources()) { spec.withNewSubresources().endSubresources(); } - } + } - @Override - public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class}; - } + @Override + public Class[] after() { + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class }; + } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/CustomResourceDefinitionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/CustomResourceDefinitionDecorator.java index fc9d5b56902..e35a8d46a5e 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/CustomResourceDefinitionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/CustomResourceDefinitionDecorator.java @@ -20,11 +20,11 @@ public class CustomResourceDefinitionDecorator extends NamedResourceDecorator { - public CustomResourceDefinitionDecorator(String name) { - super("CustomResourceDefinition", name); - } + public CustomResourceDefinitionDecorator(String name) { + super("CustomResourceDefinition", name); + } - @Override - public void andThenVisit(T item, ObjectMeta resourceMeta) { - } + @Override + public void andThenVisit(T item, ObjectMeta resourceMeta) { + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/CustomResourceDefinitionVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/CustomResourceDefinitionVersionDecorator.java index 48ea2e9276e..a2b726c2150 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/CustomResourceDefinitionVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/CustomResourceDefinitionVersionDecorator.java @@ -15,8 +15,6 @@ */ package io.fabric8.crd.generator.v1.decorator; -import static io.fabric8.crd.generator.utils.Metadata.getMetadata; - import io.fabric8.crd.generator.decorator.Decorator; import io.fabric8.crd.generator.utils.Generics; import io.fabric8.kubernetes.api.builder.TypedVisitor; @@ -24,8 +22,11 @@ import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersionBuilder; import io.fabric8.kubernetes.client.utils.Utils; + import java.util.Optional; +import static io.fabric8.crd.generator.utils.Metadata.getMetadata; + public abstract class CustomResourceDefinitionVersionDecorator extends Decorator { protected static final String ANY = null; @@ -36,7 +37,6 @@ public abstract class CustomResourceDefinitionVersionDecorator extends Decora private final CustomResourceDefinitionVersionVisitor versionSelector = new CustomResourceDefinitionVersionVisitor(); private final VersionVisitor versionVisitor = new VersionVisitor(); - public CustomResourceDefinitionVersionDecorator(String name, String version) { this.name = name; this.version = version; @@ -45,11 +45,11 @@ public CustomResourceDefinitionVersionDecorator(String name, String version) { public String getName() { return this.name; } - + public String getVersion() { return this.version; } - + @Override public void visit(VisitableBuilder builder) { Optional objectMeta = getMetadata(builder); @@ -82,21 +82,22 @@ public void visit(T version) { public Class getType() { return (Class) Generics - .getTypeArguments(CustomResourceDefinitionVersionDecorator.class, CustomResourceDefinitionVersionDecorator.this.getClass()) + .getTypeArguments(CustomResourceDefinitionVersionDecorator.class, + CustomResourceDefinitionVersionDecorator.this.getClass()) .get(0); } } @Override public Class[] after() { - return new Class[]{ - AddCustomResourceDefinitionResourceDecorator.class, - AddCustomResourceDefinitionVersionDecorator.class}; + return new Class[] { + AddCustomResourceDefinitionResourceDecorator.class, + AddCustomResourceDefinitionVersionDecorator.class }; } @Override public Class[] before() { - return new Class[] { }; + return new Class[] {}; } @Override diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/EnsureSingleStorageVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/EnsureSingleStorageVersionDecorator.java index 93371a0c36a..1566ba6b255 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/EnsureSingleStorageVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/EnsureSingleStorageVersionDecorator.java @@ -20,47 +20,49 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionSpecFluent; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersion; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersionBuilder; + import java.util.concurrent.atomic.AtomicReference; import java.util.function.Predicate; -public class EnsureSingleStorageVersionDecorator extends CustomResourceDefinitionDecorator> { +public class EnsureSingleStorageVersionDecorator + extends CustomResourceDefinitionDecorator> { private final AtomicReference storageVersion = new AtomicReference<>(); - public EnsureSingleStorageVersionDecorator(String name) { - super(name); - } + public EnsureSingleStorageVersionDecorator(String name) { + super(name); + } - @Override - public void andThenVisit(CustomResourceDefinitionSpecFluent spec, ObjectMeta resourceMeta) { + @Override + public void andThenVisit(CustomResourceDefinitionSpecFluent spec, ObjectMeta resourceMeta) { Predicate hasStorageVersion = v -> v.getStorage() != null && v.getStorage(); if (spec.hasVersions() && !spec.hasMatchingVersion(hasStorageVersion)) { spec.editFirstVersion().withStorage(true).endVersion(); } - + for (CustomResourceDefinitionVersion version : spec.buildVersions()) { if (version.getStorage() != null && version.getStorage()) { String existing = storageVersion.get(); if (existing != null && !existing.equals(version.getName())) { throw new IllegalStateException(String.format( - "'%s' custom resource has versions %s and %s marked as storage. Only one version can be marked as storage per custom resource.", - resourceMeta.getName(), version.getName(), existing)); + "'%s' custom resource has versions %s and %s marked as storage. Only one version can be marked as storage per custom resource.", + resourceMeta.getName(), version.getName(), existing)); } else { storageVersion.set(version.getName()); } } } - } + } - @Override - public Class[] after() { - return new Class[]{AddCustomResourceDefinitionResourceDecorator.class, - AddCustomResourceDefinitionVersionDecorator.class, SetStorageVersionDecorator.class}; - } + @Override + public Class[] after() { + return new Class[] { AddCustomResourceDefinitionResourceDecorator.class, + AddCustomResourceDefinitionVersionDecorator.class, SetStorageVersionDecorator.class }; + } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + "]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SetServedVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SetServedVersionDecorator.java index 6b6c5a208b8..822b49df6f0 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SetServedVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SetServedVersionDecorator.java @@ -17,22 +17,23 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersionFluent; -public class SetServedVersionDecorator extends CustomResourceDefinitionVersionDecorator> { +public class SetServedVersionDecorator + extends CustomResourceDefinitionVersionDecorator> { private final boolean served; - public SetServedVersionDecorator(String name, String version, boolean served) { - super(name, version); - this.served = served; - } + public SetServedVersionDecorator(String name, String version, boolean served) { + super(name, version); + this.served = served; + } - @Override - public void andThenVisit(CustomResourceDefinitionVersionFluent version) { + @Override + public void andThenVisit(CustomResourceDefinitionVersionFluent version) { version.withServed(served); - } + } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() + ", served:" + served + "]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + ", served:" + served + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SetStorageVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SetStorageVersionDecorator.java index 5f6b3e2c708..0adf187739f 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SetStorageVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SetStorageVersionDecorator.java @@ -17,22 +17,23 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersionFluent; -public class SetStorageVersionDecorator extends CustomResourceDefinitionVersionDecorator> { +public class SetStorageVersionDecorator + extends CustomResourceDefinitionVersionDecorator> { private final boolean storage; - public SetStorageVersionDecorator(String name, String version, boolean storage) { - super(name, version); - this.storage = storage; - } + public SetStorageVersionDecorator(String name, String version, boolean storage) { + super(name, version); + this.storage = storage; + } - @Override - public void andThenVisit(CustomResourceDefinitionVersionFluent version) { + @Override + public void andThenVisit(CustomResourceDefinitionVersionFluent version) { version.withStorage(storage); - } + } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() + ", storage:"+ storage+"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + ", storage:" + storage + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SortPrinterColumnsDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SortPrinterColumnsDecorator.java index 2ddfa5ddd71..baf62975bc6 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SortPrinterColumnsDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1/decorator/SortPrinterColumnsDecorator.java @@ -15,13 +15,14 @@ */ package io.fabric8.crd.generator.v1.decorator; -import java.util.List; - import io.fabric8.crd.generator.decorator.Decorator; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceColumnDefinition; import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersionFluent; -public class SortPrinterColumnsDecorator extends CustomResourceDefinitionVersionDecorator> { +import java.util.List; + +public class SortPrinterColumnsDecorator + extends CustomResourceDefinitionVersionDecorator> { public SortPrinterColumnsDecorator(String name, String version) { super(name, version); @@ -30,7 +31,7 @@ public SortPrinterColumnsDecorator(String name, String version) { @Override public void andThenVisit(CustomResourceDefinitionVersionFluent version) { List columns = version.buildAdditionalPrinterColumns(); - if(columns != null && !columns.isEmpty()) { + if (columns != null && !columns.isEmpty()) { columns.sort((o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getJsonPath(), o2.getJsonPath())); } version.withAdditionalPrinterColumns(columns); @@ -72,9 +73,9 @@ public boolean equals(Object obj) { return true; } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() + "]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/CustomResourceHandler.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/CustomResourceHandler.java index c4abc0b031d..acc260b60bf 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/CustomResourceHandler.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/CustomResourceHandler.java @@ -19,7 +19,6 @@ import io.fabric8.crd.generator.CustomResourceInfo; import io.fabric8.crd.generator.Resources; import io.fabric8.crd.generator.decorator.Decorator; -import io.fabric8.crd.generator.utils.Types; import io.fabric8.crd.generator.v1beta1.decorator.AddAdditionPrinterColumnDecorator; import io.fabric8.crd.generator.v1beta1.decorator.AddCustomResourceDefinitionResourceDecorator; import io.fabric8.crd.generator.v1beta1.decorator.AddCustomResourceDefinitionVersionDecorator; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddAdditionPrinterColumnDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddAdditionPrinterColumnDecorator.java index 55d44d5c43e..15203705f9a 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddAdditionPrinterColumnDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddAdditionPrinterColumnDecorator.java @@ -18,10 +18,11 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceColumnDefinitionBuilder; import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionFluent; import io.fabric8.kubernetes.client.utils.Utils; + import java.util.function.Predicate; public class AddAdditionPrinterColumnDecorator extends - CustomResourceDefinitionVersionDecorator> { + CustomResourceDefinitionVersionDecorator> { private final String type; private final String columnName; @@ -30,7 +31,7 @@ public class AddAdditionPrinterColumnDecorator extends private final String description; public AddAdditionPrinterColumnDecorator(String resourceName, String resourceVersion, String type, - String columnName, String path, String format, String description) { + String columnName, String path, String format, String description) { super(resourceName, resourceVersion); this.type = type; this.columnName = columnName; @@ -41,42 +42,42 @@ public AddAdditionPrinterColumnDecorator(String resourceName, String resourceVer @Override public void andThenVisit(CustomResourceDefinitionVersionFluent spec) { - Predicate matchingColumn = col -> col.getName() != null && col.getName().equals(columnName); + Predicate matchingColumn = col -> col.getName() != null + && col.getName().equals(columnName); spec.removeMatchingFromAdditionalPrinterColumns(matchingColumn); spec.addNewAdditionalPrinterColumn() - .withType(type) - .withName(columnName) - .withJSONPath(path) - .withFormat(Utils.isNotNullOrEmpty(format) ? format : null) - .withDescription(Utils.isNotNullOrEmpty(description) ? description : null) - .endAdditionalPrinterColumn(); + .withType(type) + .withName(columnName) + .withJSONPath(path) + .withFormat(Utils.isNotNullOrEmpty(format) ? format : null) + .withDescription(Utils.isNotNullOrEmpty(description) ? description : null) + .endAdditionalPrinterColumn(); } - - @Override - public int hashCode() { - final int prime = 31; - int result = super.hashCode(); + @Override + public int hashCode() { + final int prime = 31; + int result = super.hashCode(); result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); result = prime * result + ((getVersion() == null) ? 0 : getVersion().hashCode()); - result = prime * result + ((columnName == null) ? 0 : columnName.hashCode()); - result = prime * result + ((type == null) ? 0 : type.hashCode()); - result = prime * result + ((path == null) ? 0 : path.hashCode()); - result = prime * result + ((format == null) ? 0 : format.hashCode()); - result = prime * result + ((description == null) ? 0 : description.hashCode()); - return result; - } + result = prime * result + ((columnName == null) ? 0 : columnName.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((path == null) ? 0 : path.hashCode()); + result = prime * result + ((format == null) ? 0 : format.hashCode()); + result = prime * result + ((description == null) ? 0 : description.hashCode()); + return result; + } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (!super.equals(obj)) - return false; - if (getClass() != obj.getClass()) - return false; - AddAdditionPrinterColumnDecorator other = (AddAdditionPrinterColumnDecorator) obj; + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (!super.equals(obj)) + return false; + if (getClass() != obj.getClass()) + return false; + AddAdditionPrinterColumnDecorator other = (AddAdditionPrinterColumnDecorator) obj; if (getName() == null) { if (other.getName() != null) return false; @@ -87,36 +88,36 @@ public boolean equals(Object obj) { return false; } else if (!getVersion().equals(other.getVersion())) return false; - if (description == null) { - if (other.description != null) - return false; - } else if (!description.equals(other.description)) - return false; - if (format == null) { - if (other.format != null) - return false; - } else if (!format.equals(other.format)) - return false; - if (columnName == null) { - if (other.columnName != null) - return false; - } else if (!columnName.equals(other.columnName)) - return false; - if (path == null) { - if (other.path != null) - return false; - } else if (!path.equals(other.path)) - return false; - if (type == null) { - if (other.type != null) - return false; - } else if (!type.equals(other.type)) - return false; - return true; - } + if (description == null) { + if (other.description != null) + return false; + } else if (!description.equals(other.description)) + return false; + if (format == null) { + if (other.format != null) + return false; + } else if (!format.equals(other.format)) + return false; + if (columnName == null) { + if (other.columnName != null) + return false; + } else if (!columnName.equals(other.columnName)) + return false; + if (path == null) { + if (other.path != null) + return false; + } else if (!path.equals(other.path)) + return false; + if (type == null) { + if (other.type != null) + return false; + } else if (!type.equals(other.type)) + return false; + return true; + } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() + "column:" + columnName +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + "column:" + columnName + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddCustomResourceDefinitionResourceDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddCustomResourceDefinitionResourceDecorator.java index 5b812b66ce6..d6dec8bba14 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddCustomResourceDefinitionResourceDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddCustomResourceDefinitionResourceDecorator.java @@ -21,8 +21,6 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder; import io.fabric8.kubernetes.client.utils.ApiVersionUtil; -import java.util.Arrays; - public class AddCustomResourceDefinitionResourceDecorator extends ResourceProvidingDecorator { private String name; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddCustomResourceDefinitionVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddCustomResourceDefinitionVersionDecorator.java index 10d1fd62659..2699ecfb79e 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddCustomResourceDefinitionVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddCustomResourceDefinitionVersionDecorator.java @@ -19,10 +19,11 @@ import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionSpecFluent; import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionBuilder; + import java.util.function.Predicate; public class AddCustomResourceDefinitionVersionDecorator extends - CustomResourceDefinitionDecorator> { + CustomResourceDefinitionDecorator> { private String version; @@ -34,20 +35,20 @@ public AddCustomResourceDefinitionVersionDecorator(String name, String version) public String getName() { return this.name; } - + public String getVersion() { return this.version; } - + @Override public void andThenVisit(CustomResourceDefinitionSpecFluent spec, ObjectMeta resourceMeta) { Predicate predicate = candidate -> candidate.getName() - .equals(version); + .equals(version); spec.removeMatchingFromVersions(predicate); spec.addNewVersion() - .withName(version) - .endVersion(); + .withName(version) + .endVersion(); } @Override @@ -55,8 +56,8 @@ public Class[] after() { return new Class[] { AddCustomResourceDefinitionResourceDecorator.class }; } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ version +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + version + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddLabelSelectorPathDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddLabelSelectorPathDecorator.java index 0e210346b61..7215d939768 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddLabelSelectorPathDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddLabelSelectorPathDecorator.java @@ -19,7 +19,7 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceSubresourcesFluent; public class AddLabelSelectorPathDecorator extends - CustomResourceDefinitionVersionDecorator> { + CustomResourceDefinitionVersionDecorator> { private final String path; @@ -39,7 +39,7 @@ public void andThenVisit(CustomResourceSubresourcesFluent subresources) { @Override public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class, - AddSubresourcesDecorator.class}; + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class, + AddSubresourcesDecorator.class }; } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSchemaToCustomResourceDefinitionVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSchemaToCustomResourceDefinitionVersionDecorator.java index 93a4ac49b32..9d05d040871 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSchemaToCustomResourceDefinitionVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSchemaToCustomResourceDefinitionVersionDecorator.java @@ -20,12 +20,12 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.JSONSchemaProps; public class AddSchemaToCustomResourceDefinitionVersionDecorator - extends CustomResourceDefinitionVersionDecorator> { + extends CustomResourceDefinitionVersionDecorator> { private JSONSchemaProps schema; public AddSchemaToCustomResourceDefinitionVersionDecorator(String name, String version, - JSONSchemaProps schema) { + JSONSchemaProps schema) { super(name, version); this.schema = schema; } @@ -37,11 +37,11 @@ public void andThenVisit(CustomResourceDefinitionVersionFluent version) { @Override public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class}; + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class }; } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSpecReplicasPathDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSpecReplicasPathDecorator.java index 0357281256b..d4302ad070f 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSpecReplicasPathDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSpecReplicasPathDecorator.java @@ -19,7 +19,7 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceSubresourcesFluent; public class AddSpecReplicasPathDecorator extends - CustomResourceDefinitionVersionDecorator> { + CustomResourceDefinitionVersionDecorator> { private final String path; @@ -39,7 +39,7 @@ public void andThenVisit(CustomResourceSubresourcesFluent subresources) { @Override public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class, - AddSubresourcesDecorator.class}; + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class, + AddSubresourcesDecorator.class }; } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddStatusReplicasPathDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddStatusReplicasPathDecorator.java index 8f5e312344b..bc2e73836db 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddStatusReplicasPathDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddStatusReplicasPathDecorator.java @@ -19,7 +19,7 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceSubresourcesFluent; public class AddStatusReplicasPathDecorator extends - CustomResourceDefinitionVersionDecorator> { + CustomResourceDefinitionVersionDecorator> { private final String path; @@ -39,6 +39,6 @@ public void andThenVisit(CustomResourceSubresourcesFluent subresources) { @Override public Class[] after() { - return new Class[]{AddSubresourcesDecorator.class}; + return new Class[] { AddSubresourcesDecorator.class }; } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddStatusSubresourceDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddStatusSubresourceDecorator.java index 0e56ac20ba5..3a75e8e0ea2 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddStatusSubresourceDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddStatusSubresourceDecorator.java @@ -19,7 +19,7 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceSubresourcesFluent; public class AddStatusSubresourceDecorator extends - CustomResourceDefinitionVersionDecorator> { + CustomResourceDefinitionVersionDecorator> { public AddStatusSubresourceDecorator(String name, String version) { super(name, version); @@ -32,12 +32,12 @@ public void andThenVisit(CustomResourceSubresourcesFluent subresources) { @Override public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class, - AddSubresourcesDecorator.class}; + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class, + AddSubresourcesDecorator.class }; } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSubresourcesDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSubresourcesDecorator.java index 74a2b61bc71..64f43b86637 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSubresourcesDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/AddSubresourcesDecorator.java @@ -19,7 +19,7 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionFluent; public class AddSubresourcesDecorator extends - CustomResourceDefinitionVersionDecorator> { + CustomResourceDefinitionVersionDecorator> { public AddSubresourcesDecorator(String name, String version) { super(name, version); @@ -34,11 +34,11 @@ public void andThenVisit(CustomResourceDefinitionVersionFluent spec) { @Override public Class[] after() { - return new Class[]{AddCustomResourceDefinitionVersionDecorator.class}; + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class }; } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() + ", version:"+ getVersion() +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + ", version:" + getVersion() + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/CustomResourceDefinitionVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/CustomResourceDefinitionVersionDecorator.java index ac8b9e36158..7205fff44c7 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/CustomResourceDefinitionVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/CustomResourceDefinitionVersionDecorator.java @@ -15,8 +15,6 @@ */ package io.fabric8.crd.generator.v1beta1.decorator; -import static io.fabric8.crd.generator.utils.Metadata.getMetadata; - import io.fabric8.crd.generator.decorator.Decorator; import io.fabric8.crd.generator.utils.Generics; import io.fabric8.kubernetes.api.builder.TypedVisitor; @@ -24,10 +22,13 @@ import io.fabric8.kubernetes.api.model.ObjectMeta; import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionBuilder; import io.fabric8.kubernetes.client.utils.Utils; + import java.util.Optional; +import static io.fabric8.crd.generator.utils.Metadata.getMetadata; + public abstract class CustomResourceDefinitionVersionDecorator extends - Decorator { + Decorator { protected static final String ANY = null; @@ -57,7 +58,7 @@ public void visit(VisitableBuilder builder) { return; } if (Utils.isNullOrEmpty(name) || objectMeta.map(ObjectMeta::getName).filter(s -> s.equals(name)) - .isPresent()) { + .isPresent()) { builder.accept(versionSelector); } } @@ -65,7 +66,7 @@ public void visit(VisitableBuilder builder) { public abstract void andThenVisit(T version); private class CustomResourceDefinitionVersionVisitor extends - TypedVisitor { + TypedVisitor { @Override public void visit(CustomResourceDefinitionVersionBuilder builder) { @@ -84,22 +85,22 @@ public void visit(T version) { public Class getType() { return (Class) Generics - .getTypeArguments(CustomResourceDefinitionVersionDecorator.class, - CustomResourceDefinitionVersionDecorator.this.getClass()) - .get(0); + .getTypeArguments(CustomResourceDefinitionVersionDecorator.class, + CustomResourceDefinitionVersionDecorator.this.getClass()) + .get(0); } } @Override public Class[] after() { - return new Class[]{ - AddCustomResourceDefinitionResourceDecorator.class, - AddCustomResourceDefinitionVersionDecorator.class}; + return new Class[] { + AddCustomResourceDefinitionResourceDecorator.class, + AddCustomResourceDefinitionVersionDecorator.class }; } @Override public Class[] before() { - return new Class[]{}; + return new Class[] {}; } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/EnsureSingleStorageVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/EnsureSingleStorageVersionDecorator.java index e00d106332e..474eb9063c3 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/EnsureSingleStorageVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/EnsureSingleStorageVersionDecorator.java @@ -20,11 +20,12 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionSpecFluent; import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersion; import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionBuilder; + import java.util.concurrent.atomic.AtomicReference; import java.util.function.Predicate; public class EnsureSingleStorageVersionDecorator extends - CustomResourceDefinitionDecorator> { + CustomResourceDefinitionDecorator> { private final AtomicReference storageVersion = new AtomicReference<>(); @@ -45,8 +46,8 @@ public void andThenVisit(CustomResourceDefinitionSpecFluent spec, ObjectMeta String existing = storageVersion.get(); if (existing != null && !existing.equals(version.getName())) { throw new IllegalStateException(String.format( - "'%s' custom resource has versions %s and %s marked as storage. Only one version can be marked as storage per custom resource.", - resourceMeta.getName(), version.getName(), existing)); + "'%s' custom resource has versions %s and %s marked as storage. Only one version can be marked as storage per custom resource.", + resourceMeta.getName(), version.getName(), existing)); } else { storageVersion.set(version.getName()); } @@ -56,12 +57,12 @@ public void andThenVisit(CustomResourceDefinitionSpecFluent spec, ObjectMeta @Override public Class[] after() { - return new Class[]{AddCustomResourceDefinitionResourceDecorator.class, - AddCustomResourceDefinitionVersionDecorator.class, SetStorageVersionDecorator.class}; + return new Class[] { AddCustomResourceDefinitionResourceDecorator.class, + AddCustomResourceDefinitionVersionDecorator.class, SetStorageVersionDecorator.class }; } - @Override - public String toString() { - return getClass().getName() + " [name:"+ getName() +"]"; - } + @Override + public String toString() { + return getClass().getName() + " [name:" + getName() + "]"; + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/PromoteSingleVersionAttributesDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/PromoteSingleVersionAttributesDecorator.java index 91b6b96b20c..9a41ccecfd7 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/PromoteSingleVersionAttributesDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/PromoteSingleVersionAttributesDecorator.java @@ -26,7 +26,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SetServedVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SetServedVersionDecorator.java index 781ea409b2c..c57b4f31634 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SetServedVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SetServedVersionDecorator.java @@ -18,7 +18,7 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionFluent; public class SetServedVersionDecorator extends - CustomResourceDefinitionVersionDecorator> { + CustomResourceDefinitionVersionDecorator> { private final boolean served; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SetStorageVersionDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SetStorageVersionDecorator.java index 3ed58ff491f..b6f14453c75 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SetStorageVersionDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SetStorageVersionDecorator.java @@ -18,7 +18,7 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionFluent; public class SetStorageVersionDecorator extends - CustomResourceDefinitionVersionDecorator> { + CustomResourceDefinitionVersionDecorator> { private final boolean storage; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SortPrinterColumnsDecorator.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SortPrinterColumnsDecorator.java index 33fc4d9ecac..46bfe3ff1eb 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SortPrinterColumnsDecorator.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/v1beta1/decorator/SortPrinterColumnsDecorator.java @@ -21,7 +21,8 @@ import java.util.List; -public class SortPrinterColumnsDecorator extends CustomResourceDefinitionVersionDecorator> { +public class SortPrinterColumnsDecorator + extends CustomResourceDefinitionVersionDecorator> { public SortPrinterColumnsDecorator(String name, String version) { super(name, version); @@ -30,7 +31,7 @@ public SortPrinterColumnsDecorator(String name, String version) { @Override public void andThenVisit(CustomResourceDefinitionVersionFluent version) { List columns = version.buildAdditionalPrinterColumns(); - if(columns != null && !columns.isEmpty()) { + if (columns != null && !columns.isEmpty()) { columns.sort((o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getJSONPath(), o2.getJSONPath())); } version.withAdditionalPrinterColumns(columns); @@ -38,6 +39,6 @@ public void andThenVisit(CustomResourceDefinitionVersionFluent version) { @Override public Class[] after() { - return new Class[] {AddCustomResourceDefinitionVersionDecorator.class, AddAdditionPrinterColumnDecorator.class}; + return new Class[] { AddCustomResourceDefinitionVersionDecorator.class, AddAdditionPrinterColumnDecorator.class }; } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/AdditionalPrinterColumnDetector.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/AdditionalPrinterColumnDetector.java index 6f87a176bc6..b99a78f0ff4 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/AdditionalPrinterColumnDetector.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/AdditionalPrinterColumnDetector.java @@ -16,6 +16,7 @@ package io.fabric8.crd.generator.visitor; import io.fabric8.kubernetes.model.annotation.PrinterColumn; + import java.util.ArrayList; public class AdditionalPrinterColumnDetector extends AnnotatedMultiPropertyPathDetector { @@ -28,4 +29,3 @@ public AdditionalPrinterColumnDetector(String prefix) { super(prefix, PrinterColumn.class.getSimpleName(), new ArrayList<>()); } } - diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/AnnotatedPropertyPathDetector.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/AnnotatedPropertyPathDetector.java index 9273cf413de..5e802ded0fc 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/AnnotatedPropertyPathDetector.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/AnnotatedPropertyPathDetector.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/LabelSelectorPathDetector.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/LabelSelectorPathDetector.java index 216854795c2..dda802865e9 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/LabelSelectorPathDetector.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/LabelSelectorPathDetector.java @@ -16,15 +16,16 @@ package io.fabric8.crd.generator.visitor; import io.fabric8.kubernetes.model.annotation.LabelSelector; + import java.util.ArrayList; public class LabelSelectorPathDetector extends AnnotatedPropertyPathDetector { - public LabelSelectorPathDetector() { + public LabelSelectorPathDetector() { this(DOT); } - public LabelSelectorPathDetector(String prefix) { - super(prefix, LabelSelector.class.getSimpleName(), new ArrayList<>()); - } + public LabelSelectorPathDetector(String prefix) { + super(prefix, LabelSelector.class.getSimpleName(), new ArrayList<>()); + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/SpecReplicasPathDetector.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/SpecReplicasPathDetector.java index 162d944fe6e..74d2ac3b758 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/SpecReplicasPathDetector.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/SpecReplicasPathDetector.java @@ -16,14 +16,16 @@ package io.fabric8.crd.generator.visitor; import io.fabric8.kubernetes.model.annotation.SpecReplicas; + import java.util.ArrayList; public class SpecReplicasPathDetector extends AnnotatedPropertyPathDetector { - public SpecReplicasPathDetector() { + public SpecReplicasPathDetector() { this(DOT); } - public SpecReplicasPathDetector(String prefix) { - super(prefix, SpecReplicas.class.getSimpleName(), new ArrayList<>()); - } + + public SpecReplicasPathDetector(String prefix) { + super(prefix, SpecReplicas.class.getSimpleName(), new ArrayList<>()); + } } diff --git a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/StatusReplicasPathDetector.java b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/StatusReplicasPathDetector.java index c23ee4d0708..f982bdf1166 100644 --- a/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/StatusReplicasPathDetector.java +++ b/crd-generator/api/src/main/java/io/fabric8/crd/generator/visitor/StatusReplicasPathDetector.java @@ -16,16 +16,17 @@ package io.fabric8.crd.generator.visitor; import io.fabric8.kubernetes.model.annotation.StatusReplicas; + import java.util.ArrayList; public class StatusReplicasPathDetector extends AnnotatedPropertyPathDetector { - public StatusReplicasPathDetector(String prefix) { + public StatusReplicasPathDetector(String prefix) { super(prefix, StatusReplicas.class.getSimpleName(), new ArrayList<>()); } - public StatusReplicasPathDetector() { + public StatusReplicasPathDetector() { this(DOT); - } + } } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/alt/LabelSelector.java b/crd-generator/api/src/test/java/io/fabric8/crd/alt/LabelSelector.java index 46802bea385..3d2ac4e2b1e 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/alt/LabelSelector.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/alt/LabelSelector.java @@ -23,5 +23,5 @@ @Target({ ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface LabelSelector { - + } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/alt/SpecReplicas.java b/crd-generator/api/src/test/java/io/fabric8/crd/alt/SpecReplicas.java index 92a6da5e29f..d5121c99dcf 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/alt/SpecReplicas.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/alt/SpecReplicas.java @@ -23,5 +23,5 @@ @Target({ ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface SpecReplicas { - + } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/alt/StatusReplicas.java b/crd-generator/api/src/test/java/io/fabric8/crd/alt/StatusReplicas.java index 0660329e195..b7c54a6e35e 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/alt/StatusReplicas.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/alt/StatusReplicas.java @@ -23,5 +23,5 @@ @Target({ ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface StatusReplicas { - + } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/annotated/Annotated.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/annotated/Annotated.java index 36866fa83a1..fc6a8123038 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/annotated/Annotated.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/annotated/Annotated.java @@ -17,6 +17,6 @@ import io.fabric8.kubernetes.client.CustomResource; -public class Annotated extends CustomResource { +public class Annotated extends CustomResource { } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/Extraction.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/Extraction.java index 2652b142be2..420393c90ab 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/Extraction.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/Extraction.java @@ -19,6 +19,6 @@ import io.fabric8.kubernetes.client.CustomResource; @SchemaSwap(originalType = ExtractionSpec.class, fieldName = "bar", targetType = FooExtractor.class) -public class Extraction extends CustomResource { +public class Extraction extends CustomResource { } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/IncorrectExtraction.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/IncorrectExtraction.java index ced6b044515..aba0a7cefc2 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/IncorrectExtraction.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/IncorrectExtraction.java @@ -19,6 +19,6 @@ import io.fabric8.kubernetes.client.CustomResource; @SchemaSwap(originalType = ExtractionSpec.class, fieldName = "FOO", targetType = FooExtractor.class) -public class IncorrectExtraction extends CustomResource { +public class IncorrectExtraction extends CustomResource { } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/IncorrectExtraction2.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/IncorrectExtraction2.java index bb74053bdbe..8a27bc63eda 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/IncorrectExtraction2.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/extraction/IncorrectExtraction2.java @@ -20,6 +20,6 @@ import io.fabric8.kubernetes.client.CustomResource; @SchemaSwap(originalType = BasicSpec.class, fieldName = "bar", targetType = FooExtractor.class) -public class IncorrectExtraction2 extends CustomResource { +public class IncorrectExtraction2 extends CustomResource { } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/Base.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/Base.java index 201da810f25..280cc0280fa 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/Base.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/Base.java @@ -19,7 +19,7 @@ import io.fabric8.kubernetes.client.CustomResource; public abstract class Base - extends CustomResource - implements Namespaced { + extends CustomResource + implements Namespaced { } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/Child.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/Child.java index 75ca24ab086..98279a76450 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/Child.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/Child.java @@ -23,5 +23,4 @@ @Group("acme.com") public class Child extends Base implements Namespaced { - } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/ChildSpec.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/ChildSpec.java index 8a30ff5799c..d09724c26c0 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/ChildSpec.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/inherited/ChildSpec.java @@ -19,6 +19,6 @@ public class ChildSpec extends BaseSpec { private Map unsupported; - private Map supported; + private Map supported; private Map unsupported2; } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/Joke.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/Joke.java index 7b0ba8d1812..792a6c4cf25 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/Joke.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/Joke.java @@ -26,57 +26,57 @@ @Version("v1alpha1") @JsonInclude(Include.NON_NULL) public class Joke extends CustomResource implements Namespaced { - private String joke; - private String category; - private boolean safe; - private String lang; - private int id; + private String joke; + private String category; + private boolean safe; + private String lang; + private int id; - public Joke() { - } + public Joke() { + } - public Joke(int id, String joke, String category, boolean safe, String lang) { - this.id = id; - getMetadata().setName("" + id); - this.joke = joke; - this.category = category; - this.safe = safe; - this.lang = lang; - } + public Joke(int id, String joke, String category, boolean safe, String lang) { + this.id = id; + getMetadata().setName("" + id); + this.joke = joke; + this.category = category; + this.safe = safe; + this.lang = lang; + } - public int getId() { - return id; - } + public int getId() { + return id; + } - public String getJoke() { - return joke; - } + public String getJoke() { + return joke; + } - public void setJoke(String joke) { - this.joke = joke; - } + public void setJoke(String joke) { + this.joke = joke; + } - public String getCategory() { - return category; - } + public String getCategory() { + return category; + } - public void setCategory(String category) { - this.category = category; - } + public void setCategory(String category) { + this.category = category; + } - public boolean isSafe() { - return safe; - } + public boolean isSafe() { + return safe; + } - public void setSafe(boolean safe) { - this.safe = safe; - } + public void setSafe(boolean safe) { + this.safe = safe; + } - public String getLang() { - return lang; - } + public String getLang() { + return lang; + } - public void setLang(String lang) { - this.lang = lang; - } + public void setLang(String lang) { + this.lang = lang; + } } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/JokeRequestSpec.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/JokeRequestSpec.java index 93237a0a931..bf4baa7dbd4 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/JokeRequestSpec.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/JokeRequestSpec.java @@ -43,8 +43,8 @@ public enum ExcludedTopic { @JsonPropertyDescription("category-description") private Category category = Category.Any; @PrinterColumn(name = "excludedTopics") - private ExcludedTopic[] excluded = new ExcludedTopic[]{ExcludedTopic.nsfw, ExcludedTopic.racist, - ExcludedTopic.sexist}; + private ExcludedTopic[] excluded = new ExcludedTopic[] { ExcludedTopic.nsfw, ExcludedTopic.racist, + ExcludedTopic.sexist }; private boolean safe; public Category getCategory() { diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/JokeRequestStatus.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/JokeRequestStatus.java index f59ee9bd550..ad68c2be12a 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/JokeRequestStatus.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/joke/JokeRequestStatus.java @@ -16,39 +16,39 @@ package io.fabric8.crd.example.joke; public class JokeRequestStatus { - public enum State { - CREATED, - ALREADY_PRESENT, - PROCESSING, - ERROR, - UNKNOWN - } - - private State state = State.UNKNOWN; - private boolean error; - private String message; - - public State getState() { - return state; - } - - public void setState(State state) { - this.state = state; - } - - public boolean isError() { - return error; - } - - public void setError(boolean error) { - this.error = error; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } + public enum State { + CREATED, + ALREADY_PRESENT, + PROCESSING, + ERROR, + UNKNOWN + } + + private State state = State.UNKNOWN; + private boolean error; + private String message; + + public State getState() { + return state; + } + + public void setState(State state) { + this.state = state; + } + + public boolean isError() { + return error; + } + + public void setError(boolean error) { + this.error = error; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/json/ContainingJsonSpec.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/json/ContainingJsonSpec.java index 253118c7ec0..01d6d1435b4 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/json/ContainingJsonSpec.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/json/ContainingJsonSpec.java @@ -21,7 +21,9 @@ public class ContainingJsonSpec { private int field; - public int getField() { return field; } + public int getField() { + return field; + } private JsonNode free; @@ -31,6 +33,8 @@ public JsonNode getFree() { private Foo foo; - public Foo getFoo() { return foo; } + public Foo getFoo() { + return foo; + } } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/map/ContainingMaps.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/map/ContainingMaps.java index dc3f0b08bee..0bc432d06fe 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/map/ContainingMaps.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/map/ContainingMaps.java @@ -21,6 +21,6 @@ @Group("map.fabric8.io") @Version("v1alpha1") -public class ContainingMaps extends CustomResource { +public class ContainingMaps extends CustomResource { } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/nocyclic/Ref.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/nocyclic/Ref.java index 76d80b25d95..82f42353eb0 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/nocyclic/Ref.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/nocyclic/Ref.java @@ -21,6 +21,7 @@ public class Ref { protected Inner inner; - public static class Inner { } + public static class Inner { + } } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/person/Address.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/person/Address.java index 3f66e0027b0..273afeb3670 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/person/Address.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/person/Address.java @@ -23,6 +23,7 @@ public class Address { private Type type; public enum Type { - home, work + home, + work } } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/person/Person.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/person/Person.java index 4b8f4510806..5aac9e21229 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/person/Person.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/person/Person.java @@ -29,6 +29,7 @@ public class Person { private Type type; public enum Type { - crazy, crazier + crazy, + crazier } } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/simplest/Simplest.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/simplest/Simplest.java index 367049759d1..4dc3f2b9716 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/simplest/Simplest.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/simplest/Simplest.java @@ -21,6 +21,6 @@ @Group("samples.fabric8.io") @Version("v1alpha1") -public class Simplest extends CustomResource { +public class Simplest extends CustomResource { } diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/webserver/WebServerWithSpec.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/webserver/WebServerWithSpec.java index 18016c005ae..176b2f24147 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/webserver/WebServerWithSpec.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/webserver/WebServerWithSpec.java @@ -23,4 +23,3 @@ public class WebServerWithSpec { private WebServerStatus status; } - diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/example/webserver/WebServerWithStatusProperty.java b/crd-generator/api/src/test/java/io/fabric8/crd/example/webserver/WebServerWithStatusProperty.java index 4fdea0fe5aa..2f2eb46d57a 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/example/webserver/WebServerWithStatusProperty.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/example/webserver/WebServerWithStatusProperty.java @@ -22,9 +22,8 @@ public class WebServerWithStatusProperty { private String name; private int port; - @SpecReplicas - private int replicas; + @SpecReplicas + private int replicas; private WebServerStatus status; } - diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/generator/CustomResourceInfoTest.java b/crd-generator/api/src/test/java/io/fabric8/crd/generator/CustomResourceInfoTest.java index 750d015b923..e10119984cd 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/generator/CustomResourceInfoTest.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/generator/CustomResourceInfoTest.java @@ -15,10 +15,6 @@ */ package io.fabric8.crd.generator; -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.Namespaced; import io.fabric8.kubernetes.client.CustomResource; @@ -28,6 +24,10 @@ import io.fabric8.kubernetes.model.annotation.Version; import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + public class CustomResourceInfoTest { public static class Spec { @@ -77,9 +77,11 @@ void shouldProperlyCreateCustomResourceInfo() throws Exception { String specClassName = info.specClassName().get(); assertEquals(Spec.class.getCanonicalName(), specClassName); // todo: check that we can load and instantiate class from the returned class name - /*Class specClass = Class.forName(specClassName); - Object o = specClass.getDeclaredConstructor().newInstance(); - assertNotNull(o);*/ + /* + * Class specClass = Class.forName(specClassName); + * Object o = specClass.getDeclaredConstructor().newInstance(); + * assertNotNull(o); + */ assertEquals(Status.class.getCanonicalName(), info.statusClassName().get()); assertEquals(HasMetadata.getSingular(ClusteredCR.class), info.singular()); assertEquals(HasMetadata.getPlural(ClusteredCR.class), info.plural()); diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/generator/ResourcesTest.java b/crd-generator/api/src/test/java/io/fabric8/crd/generator/ResourcesTest.java index bc01950b194..cf2bc72962c 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/generator/ResourcesTest.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/generator/ResourcesTest.java @@ -15,23 +15,23 @@ */ package io.fabric8.crd.generator; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - -import org.junit.jupiter.api.Test; - import io.fabric8.crd.generator.v1.decorator.AddAdditionPrinterColumnDecorator; import io.fabric8.crd.generator.v1.decorator.SortPrinterColumnsDecorator; +import org.junit.jupiter.api.Test; -public class ResourcesTest { +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +public class ResourcesTest { @Test public void shouldSupportMultiplePrinterColumns() { Resources r = new Resources(); - AddAdditionPrinterColumnDecorator dec1 = new AddAdditionPrinterColumnDecorator("resource", "v1", "string", "replicas", ".replicas", null, null); - AddAdditionPrinterColumnDecorator dec2 = new AddAdditionPrinterColumnDecorator("resource", "v1", "boolean", "enabled", ".replicas", null, null); + AddAdditionPrinterColumnDecorator dec1 = new AddAdditionPrinterColumnDecorator("resource", "v1", "string", "replicas", + ".replicas", null, null); + AddAdditionPrinterColumnDecorator dec2 = new AddAdditionPrinterColumnDecorator("resource", "v1", "boolean", "enabled", + ".replicas", null, null); r.decorate(dec1); r.decorate(dec2); @@ -41,7 +41,6 @@ public void shouldSupportMultiplePrinterColumns() { assertTrue(r.getDecorators().contains(dec2)); } - @Test public void shouldSupportMultipleSortPrinterColums() { Resources r = new Resources(); diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/generator/utils/TypesTest.java b/crd-generator/api/src/test/java/io/fabric8/crd/generator/utils/TypesTest.java index ca4e11ff284..14fa18ce6a2 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/generator/utils/TypesTest.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/generator/utils/TypesTest.java @@ -15,10 +15,6 @@ */ package io.fabric8.crd.generator.utils; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - import io.fabric8.crd.example.basic.Basic; import io.fabric8.crd.example.basic.BasicSpec; import io.fabric8.crd.example.basic.BasicStatus; @@ -31,9 +27,14 @@ import io.sundr.model.Property; import io.sundr.model.TypeDef; import io.sundr.model.TypeRef; +import org.junit.jupiter.api.Test; + import java.util.List; import java.util.Optional; -import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class TypesTest { @@ -67,7 +68,7 @@ void shouldHaveAllTheExpectedProperties() { final List properties = def.getProperties(); assertEquals(7, properties.size()); } - + @Test void findingSuperClassesShouldWork() { List superClasses = Types.typeDefFrom(Basic.class).getExtendsList(); @@ -79,7 +80,7 @@ void projectSuperClassesShouldProduceProperlyTypedClasses() { List superClasses = Types.typeDefFrom(Basic.class).getExtendsList(); assertEquals(2, superClasses.size()); Optional crOpt = superClasses.stream() - .filter(c -> c.getName().contains("CustomResource")).findFirst(); + .filter(c -> c.getName().contains("CustomResource")).findFirst(); assertTrue(crOpt.isPresent()); ClassRef crDef = crOpt.get(); List arguments = crDef.getArguments(); diff --git a/crd-generator/api/src/test/java/io/fabric8/crd/generator/visitor/SpecReplicasPathDetectorTest.java b/crd-generator/api/src/test/java/io/fabric8/crd/generator/visitor/SpecReplicasPathDetectorTest.java index a7d37b54e3e..993234d09ec 100644 --- a/crd-generator/api/src/test/java/io/fabric8/crd/generator/visitor/SpecReplicasPathDetectorTest.java +++ b/crd-generator/api/src/test/java/io/fabric8/crd/generator/visitor/SpecReplicasPathDetectorTest.java @@ -15,9 +15,6 @@ */ package io.fabric8.crd.generator.visitor; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; - import io.fabric8.crd.example.webserver.WebServerWithSpec; import io.fabric8.crd.example.webserver.WebServerWithStatusProperty; import io.sundr.adapter.api.AdapterContext; @@ -25,9 +22,11 @@ import io.sundr.model.TypeDef; import io.sundr.model.TypeDefBuilder; import io.sundr.model.repo.DefinitionRepository; - import org.junit.jupiter.api.Test; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + class SpecReplicasPathDetectorTest { public static final AdapterContext CONTEXT = AdapterContext.create(DefinitionRepository.getRepository()); @@ -41,7 +40,6 @@ public void shoudDetectSpecReplicasPath() throws Exception { assertEquals(".replicas", detector.getPath().get()); } - @Test public void shoudDetectNestedSpecReplicasPath() throws Exception { TypeDef def = Adapters.adaptType(WebServerWithSpec.class, CONTEXT); @@ -51,4 +49,3 @@ public void shoudDetectNestedSpecReplicasPath() throws Exception { assertEquals(".spec.replicas", detector.getPath().get()); } } - diff --git a/crd-generator/test/src/test/java/io/fabric8/crd/generator/schemaswaps/SchemaSwapCRDTest.java b/crd-generator/test/src/test/java/io/fabric8/crd/generator/schemaswaps/SchemaSwapCRDTest.java index 11db80a98b9..8d83706c038 100644 --- a/crd-generator/test/src/test/java/io/fabric8/crd/generator/schemaswaps/SchemaSwapCRDTest.java +++ b/crd-generator/test/src/test/java/io/fabric8/crd/generator/schemaswaps/SchemaSwapCRDTest.java @@ -21,9 +21,7 @@ import io.fabric8.kubernetes.client.utils.Serialization; import org.junit.jupiter.api.Test; -import java.util.List; import java.util.Map; -import java.util.Optional; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; diff --git a/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/GenericCamelKClient.java b/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/GenericCamelKClient.java index 8bef71f93f9..68ce6186669 100644 --- a/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/GenericCamelKClient.java +++ b/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/GenericCamelKClient.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericCamelKClient extends Client, CamelKClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/NamespacedCamelKClient.java b/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/NamespacedCamelKClient.java index f3b1cda90ad..d6223636526 100644 --- a/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/NamespacedCamelKClient.java +++ b/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/NamespacedCamelKClient.java @@ -15,7 +15,6 @@ */ package io.fabric8.camelk.client; - public interface NamespacedCamelKClient extends CamelKClient, - GenericCamelKClient { + GenericCamelKClient { } diff --git a/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/dsl/V1APIGroupDSL.java b/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/dsl/V1APIGroupDSL.java index fd928426158..4c08bef75c8 100644 --- a/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/dsl/V1APIGroupDSL.java +++ b/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/dsl/V1APIGroupDSL.java @@ -45,19 +45,19 @@ public interface V1APIGroupDSL extends Client { */ MixedOperation> camelCatalogs(); - /** - * API entrypoint for Integration(camel.apache.org/v1) - * - * @return MixedOperation for Integration class - */ - MixedOperation> integrations(); + /** + * API entrypoint for Integration(camel.apache.org/v1) + * + * @return MixedOperation for Integration class + */ + MixedOperation> integrations(); - /** - * API entrypoint for IntegrationKit(camel.apache.org/v1) - * - * @return MixedOperation for IntegrationKit class - */ - MixedOperation> integrationKits(); + /** + * API entrypoint for IntegrationKit(camel.apache.org/v1) + * + * @return MixedOperation for IntegrationKit class + */ + MixedOperation> integrationKits(); /** * API entrypoint for IntegrationPlatform(camel.apache.org/v1) @@ -66,4 +66,3 @@ public interface V1APIGroupDSL extends Client { */ MixedOperation> integrationPlatforms(); } - diff --git a/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/util/ApiVersionUtil.java b/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/util/ApiVersionUtil.java index 1eb1a7dee14..27295b34019 100644 --- a/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/util/ApiVersionUtil.java +++ b/extensions/camel-k/client/src/main/java/io/fabric8/camelk/client/util/ApiVersionUtil.java @@ -86,7 +86,7 @@ private static String trimVersion(String apiVersion) { * * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. * @return Just the apiGroupName part without the apiGroupName, or apiVersion if no separator is - * found. + * found. */ private static String trimGroup(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { diff --git a/extensions/camel-k/model-v1/src/main/java/io/fabric8/camelk/v1/TraitConfiguration.java b/extensions/camel-k/model-v1/src/main/java/io/fabric8/camelk/v1/TraitConfiguration.java index b7d73b026e8..b24dd164b1f 100644 --- a/extensions/camel-k/model-v1/src/main/java/io/fabric8/camelk/v1/TraitConfiguration.java +++ b/extensions/camel-k/model-v1/src/main/java/io/fabric8/camelk/v1/TraitConfiguration.java @@ -60,20 +60,19 @@ @BuildableReference(Volume.class), @BuildableReference(VolumeMount.class) }) -public class TraitConfiguration implements KubernetesResource -{ +public class TraitConfiguration implements KubernetesResource { - @JsonIgnore - private Map additionalProperties = new HashMap<>(); + @JsonIgnore + private Map additionalProperties = new HashMap<>(); - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } } diff --git a/extensions/camel-k/model-v1/src/test/java/io/fabric8/camelk/ModelTest.java b/extensions/camel-k/model-v1/src/test/java/io/fabric8/camelk/ModelTest.java index e599b0afa12..a6ce0b0da20 100644 --- a/extensions/camel-k/model-v1/src/test/java/io/fabric8/camelk/ModelTest.java +++ b/extensions/camel-k/model-v1/src/test/java/io/fabric8/camelk/ModelTest.java @@ -22,15 +22,14 @@ class ModelTest { @Test - void shouldCreateIntegration() { + void shouldCreateIntegration() { Integration integration = new IntegrationBuilder() - .withNewMetadata() - .withName("my-integration") - .endMetadata() - .withNewSpec() - //.addToFlows("form this to that") - .endSpec() - .build(); + .withNewMetadata() + .withName("my-integration") + .endMetadata() + .withNewSpec() + //.addToFlows("form this to that") + .endSpec() + .build(); } } - diff --git a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/CertManagerClient.java b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/CertManagerClient.java index 0b3d98a0cf0..9c582f0dec3 100644 --- a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/CertManagerClient.java +++ b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/CertManagerClient.java @@ -15,7 +15,6 @@ */ package io.fabric8.certmanager.client; - import io.fabric8.certmanager.client.dsl.V1APIGroupDSL; import io.fabric8.certmanager.client.dsl.V1alpha2APIGroupDSL; import io.fabric8.certmanager.client.dsl.V1alpha3APIGroupDSL; diff --git a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/GenericCertManagerClient.java b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/GenericCertManagerClient.java index c6a9b87af39..2f83cf743cc 100644 --- a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/GenericCertManagerClient.java +++ b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/GenericCertManagerClient.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericCertManagerClient extends Client, CertManagerClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1APIGroupDSL.java b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1APIGroupDSL.java index ad1fce9f4d8..4a3c014b2c4 100644 --- a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1APIGroupDSL.java +++ b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1APIGroupDSL.java @@ -15,7 +15,6 @@ */ package io.fabric8.certmanager.client.dsl; - import io.fabric8.certmanager.api.model.acme.v1.Challenge; import io.fabric8.certmanager.api.model.acme.v1.ChallengeList; import io.fabric8.certmanager.api.model.acme.v1.Order; diff --git a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1alpha2APIGroupDSL.java b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1alpha2APIGroupDSL.java index d9ceee1ae8f..0e9dc944be0 100644 --- a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1alpha2APIGroupDSL.java +++ b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1alpha2APIGroupDSL.java @@ -27,9 +27,14 @@ public interface V1alpha2APIGroupDSL extends Client { MixedOperation> certificates(); + MixedOperation> certificateRequests(); + MixedOperation> issuers(); + NonNamespaceOperation> clusterIssuers(); + MixedOperation> challenges(); + MixedOperation> orders(); } diff --git a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1alpha3APIGroupDSL.java b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1alpha3APIGroupDSL.java index e8dddeacdfe..2aaad06a56a 100644 --- a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1alpha3APIGroupDSL.java +++ b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1alpha3APIGroupDSL.java @@ -27,9 +27,14 @@ public interface V1alpha3APIGroupDSL extends Client { MixedOperation> certificates(); + MixedOperation> certificateRequests(); + MixedOperation> issuers(); + NonNamespaceOperation> clusterIssuers(); + MixedOperation> challenges(); + MixedOperation> orders(); } diff --git a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1beta1APIGroupDSL.java b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1beta1APIGroupDSL.java index 0528ddb62e3..d83c4bc52a3 100644 --- a/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1beta1APIGroupDSL.java +++ b/extensions/certmanager/client/src/main/java/io/fabric8/certmanager/client/dsl/V1beta1APIGroupDSL.java @@ -27,9 +27,14 @@ public interface V1beta1APIGroupDSL extends Client { MixedOperation> certificates(); + MixedOperation> certificateRequests(); + MixedOperation> issuers(); + NonNamespaceOperation> clusterIssuers(); + MixedOperation> challenges(); + MixedOperation> orders(); } diff --git a/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1/CertificateCreate.java b/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1/CertificateCreate.java index 7943c65fc72..c24e37e330b 100644 --- a/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1/CertificateCreate.java +++ b/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1/CertificateCreate.java @@ -27,7 +27,7 @@ public static void main(String[] args) { String namespace = "default"; Certificate certificate = new CertificateBuilder() - .build(); + .build(); // Create Certificate certManagerClient.v1().certificates().inNamespace(namespace).create(certificate); diff --git a/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1alpha2/CertificateCreate.java b/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1alpha2/CertificateCreate.java index ac5fde8565d..cd2ab6f33ea 100644 --- a/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1alpha2/CertificateCreate.java +++ b/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1alpha2/CertificateCreate.java @@ -27,7 +27,7 @@ public static void main(String[] args) { String namespace = "default"; Certificate certificate = new CertificateBuilder() - .build(); + .build(); // Create Certificate certManagerClient.v1alpha2().certificates().inNamespace(namespace).create(certificate); diff --git a/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1alpha3/CertificateCreate.java b/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1alpha3/CertificateCreate.java index 199b9bdf0f7..ed6be6ce6b5 100644 --- a/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1alpha3/CertificateCreate.java +++ b/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1alpha3/CertificateCreate.java @@ -27,7 +27,7 @@ public static void main(String[] args) { String namespace = "default"; Certificate certificate = new CertificateBuilder() - .build(); + .build(); // Create Certificate certManagerClient.v1alpha3().certificates().inNamespace(namespace).create(certificate); diff --git a/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1beta1/CertificateCreate.java b/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1beta1/CertificateCreate.java index d4f999c479a..a4c2f964381 100644 --- a/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1beta1/CertificateCreate.java +++ b/extensions/certmanager/examples/src/main/java/io/fabric8/certmanager/examples/v1beta1/CertificateCreate.java @@ -27,7 +27,7 @@ public static void main(String[] args) { String namespace = "default"; Certificate certificate = new CertificateBuilder() - .build(); + .build(); // Create Certificate certManagerClient.v1beta1().certificates().inNamespace(namespace).create(certificate); diff --git a/extensions/certmanager/model-v1/src/main/java/io/fabric8/certmanager/api/model/v1/CertificateRequestSpec.java b/extensions/certmanager/model-v1/src/main/java/io/fabric8/certmanager/api/model/v1/CertificateRequestSpec.java index b4b894838f2..ec10e2e54f7 100644 --- a/extensions/certmanager/model-v1/src/main/java/io/fabric8/certmanager/api/model/v1/CertificateRequestSpec.java +++ b/extensions/certmanager/model-v1/src/main/java/io/fabric8/certmanager/api/model/v1/CertificateRequestSpec.java @@ -15,7 +15,6 @@ */ package io.fabric8.certmanager.api.model.v1; - import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -46,11 +45,11 @@ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ - "duration", - "isCA", - "issuerRef", - "request", - "usages" + "duration", + "isCA", + "issuerRef", + "request", + "usages" }) @JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class) @ToString @@ -61,17 +60,16 @@ "" }) @Buildable(editableEnabled = true, validationEnabled = false, generateBuilderPackage = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = { - @BuildableReference(ObjectMeta.class), - @BuildableReference(io.fabric8.kubernetes.api.model.ObjectReference.class), - @BuildableReference(LabelSelector.class), - @BuildableReference(Container.class), - @BuildableReference(EnvVar.class), - @BuildableReference(ContainerPort.class), - @BuildableReference(Volume.class), - @BuildableReference(VolumeMount.class) + @BuildableReference(ObjectMeta.class), + @BuildableReference(io.fabric8.kubernetes.api.model.ObjectReference.class), + @BuildableReference(LabelSelector.class), + @BuildableReference(Container.class), + @BuildableReference(EnvVar.class), + @BuildableReference(ContainerPort.class), + @BuildableReference(Volume.class), + @BuildableReference(VolumeMount.class) }) -public class CertificateRequestSpec implements KubernetesResource -{ +public class CertificateRequestSpec implements KubernetesResource { @JsonProperty("duration") private Duration duration; @@ -102,7 +100,8 @@ public CertificateRequestSpec() { * @param issuerRef * @param usages */ - public CertificateRequestSpec(Duration duration, Boolean isCA, io.fabric8.certmanager.api.model.meta.v1.ObjectReference issuerRef, String request, List usages) { + public CertificateRequestSpec(Duration duration, Boolean isCA, + io.fabric8.certmanager.api.model.meta.v1.ObjectReference issuerRef, String request, List usages) { super(); this.duration = duration; this.isCA = isCA; @@ -172,4 +171,3 @@ public void setAdditionalProperty(String name, Object value) { } } - diff --git a/extensions/certmanager/model-v1beta1/src/main/java/io/fabric8/certmanager/api/model/v1beta1/CertificateRequestSpec.java b/extensions/certmanager/model-v1beta1/src/main/java/io/fabric8/certmanager/api/model/v1beta1/CertificateRequestSpec.java index 706c592ae98..5aa0173e567 100644 --- a/extensions/certmanager/model-v1beta1/src/main/java/io/fabric8/certmanager/api/model/v1beta1/CertificateRequestSpec.java +++ b/extensions/certmanager/model-v1beta1/src/main/java/io/fabric8/certmanager/api/model/v1beta1/CertificateRequestSpec.java @@ -70,105 +70,105 @@ @BuildableReference(Volume.class), @BuildableReference(VolumeMount.class) }) -public class CertificateRequestSpec implements KubernetesResource -{ - - @JsonProperty("duration") - private Duration duration; - @JsonProperty("isCA") - private Boolean isCA; - @JsonProperty("issuerRef") - private io.fabric8.certmanager.api.model.meta.v1.ObjectReference issuerRef; - @JsonProperty("request") - private String request; - @JsonProperty("usages") - @JsonInclude(JsonInclude.Include.NON_EMPTY) - private List usages = new ArrayList<>(); - @JsonIgnore - private Map additionalProperties = new HashMap<>(); - - /** - * No args constructor for use in serialization - * - */ - public CertificateRequestSpec() { - } - - /** - * - * @param duration - * @param request - * @param isCA - * @param issuerRef - * @param usages - */ - public CertificateRequestSpec(Duration duration, Boolean isCA, io.fabric8.certmanager.api.model.meta.v1.ObjectReference issuerRef, String request, List usages) { - super(); - this.duration = duration; - this.isCA = isCA; - this.issuerRef = issuerRef; - this.request = request; - this.usages = usages; - } - - @JsonProperty("duration") - public Duration getDuration() { - return duration; - } - - @JsonProperty("duration") - public void setDuration(Duration duration) { - this.duration = duration; - } - - @JsonProperty("isCA") - public Boolean getIsCA() { - return isCA; - } - - @JsonProperty("isCA") - public void setIsCA(Boolean isCA) { - this.isCA = isCA; - } - - @JsonProperty("issuerRef") - public io.fabric8.certmanager.api.model.meta.v1.ObjectReference getIssuerRef() { - return issuerRef; - } - - @JsonProperty("issuerRef") - public void setIssuerRef(io.fabric8.certmanager.api.model.meta.v1.ObjectReference issuerRef) { - this.issuerRef = issuerRef; - } - - @JsonProperty("request") - public String getRequest() { - return request; - } - - @JsonProperty("request") - public void setRequest(String request) { - this.request = request; - } - - @JsonProperty("usages") - public List getUsages() { - return usages; - } - - @JsonProperty("usages") - public void setUsages(List usages) { - this.usages = usages; - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - @JsonAnySetter - public void setAdditionalProperty(String name, Object value) { - this.additionalProperties.put(name, value); - } +public class CertificateRequestSpec implements KubernetesResource { + + @JsonProperty("duration") + private Duration duration; + @JsonProperty("isCA") + private Boolean isCA; + @JsonProperty("issuerRef") + private io.fabric8.certmanager.api.model.meta.v1.ObjectReference issuerRef; + @JsonProperty("request") + private String request; + @JsonProperty("usages") + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private List usages = new ArrayList<>(); + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + /** + * No args constructor for use in serialization + * + */ + public CertificateRequestSpec() { + } + + /** + * + * @param duration + * @param request + * @param isCA + * @param issuerRef + * @param usages + */ + public CertificateRequestSpec(Duration duration, Boolean isCA, + io.fabric8.certmanager.api.model.meta.v1.ObjectReference issuerRef, String request, List usages) { + super(); + this.duration = duration; + this.isCA = isCA; + this.issuerRef = issuerRef; + this.request = request; + this.usages = usages; + } + + @JsonProperty("duration") + public Duration getDuration() { + return duration; + } + + @JsonProperty("duration") + public void setDuration(Duration duration) { + this.duration = duration; + } + + @JsonProperty("isCA") + public Boolean getIsCA() { + return isCA; + } + + @JsonProperty("isCA") + public void setIsCA(Boolean isCA) { + this.isCA = isCA; + } + + @JsonProperty("issuerRef") + public io.fabric8.certmanager.api.model.meta.v1.ObjectReference getIssuerRef() { + return issuerRef; + } + + @JsonProperty("issuerRef") + public void setIssuerRef(io.fabric8.certmanager.api.model.meta.v1.ObjectReference issuerRef) { + this.issuerRef = issuerRef; + } + + @JsonProperty("request") + public String getRequest() { + return request; + } + + @JsonProperty("request") + public void setRequest(String request) { + this.request = request; + } + + @JsonProperty("usages") + public List getUsages() { + return usages; + } + + @JsonProperty("usages") + public void setUsages(List usages) { + this.usages = usages; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } } diff --git a/extensions/chaosmesh/client/src/main/java/io/fabric8/chaosmesh/client/GenericChaosMeshClient.java b/extensions/chaosmesh/client/src/main/java/io/fabric8/chaosmesh/client/GenericChaosMeshClient.java index bbb2a2b16c6..2b9f7cf7f56 100644 --- a/extensions/chaosmesh/client/src/main/java/io/fabric8/chaosmesh/client/GenericChaosMeshClient.java +++ b/extensions/chaosmesh/client/src/main/java/io/fabric8/chaosmesh/client/GenericChaosMeshClient.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericChaosMeshClient extends Client, ChaosMeshClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/chaosmesh/client/src/main/java/io/fabric8/chaosmesh/client/NamespacedChaosMeshClient.java b/extensions/chaosmesh/client/src/main/java/io/fabric8/chaosmesh/client/NamespacedChaosMeshClient.java index 59fd0f06046..660b0f89130 100644 --- a/extensions/chaosmesh/client/src/main/java/io/fabric8/chaosmesh/client/NamespacedChaosMeshClient.java +++ b/extensions/chaosmesh/client/src/main/java/io/fabric8/chaosmesh/client/NamespacedChaosMeshClient.java @@ -16,5 +16,5 @@ package io.fabric8.chaosmesh.client; public interface NamespacedChaosMeshClient extends ChaosMeshClient, - GenericChaosMeshClient { + GenericChaosMeshClient { } diff --git a/extensions/chaosmesh/examples/src/main/java/io/fabric8/chaosmesh/examples/ClientFactory.java b/extensions/chaosmesh/examples/src/main/java/io/fabric8/chaosmesh/examples/ClientFactory.java index 02f58a3e715..ea2766f7e5e 100644 --- a/extensions/chaosmesh/examples/src/main/java/io/fabric8/chaosmesh/examples/ClientFactory.java +++ b/extensions/chaosmesh/examples/src/main/java/io/fabric8/chaosmesh/examples/ClientFactory.java @@ -20,7 +20,8 @@ import io.fabric8.kubernetes.client.ConfigBuilder; public class ClientFactory { - private ClientFactory() {} + private ClientFactory() { + } public static ChaosMeshClient newClient(String[] args) { ConfigBuilder config = new ConfigBuilder(); @@ -62,4 +63,3 @@ public static String getOptions(String[] args, String name, String defaultValue) return defaultValue; } } - diff --git a/extensions/chaosmesh/model/src/main/java/io/fabric8/chaosmesh/api/model/Constants.java b/extensions/chaosmesh/model/src/main/java/io/fabric8/chaosmesh/api/model/Constants.java index 35e69b5269e..12fb772b403 100755 --- a/extensions/chaosmesh/model/src/main/java/io/fabric8/chaosmesh/api/model/Constants.java +++ b/extensions/chaosmesh/model/src/main/java/io/fabric8/chaosmesh/api/model/Constants.java @@ -17,7 +17,8 @@ public class Constants { - private Constants() {} + private Constants() { + } public static final String BUILDER_PACKAGE = "io.fabric8.kubernetes.api.builder"; } diff --git a/extensions/istio/client/src/main/java/io/fabric8/istio/client/GenericIstioClient.java b/extensions/istio/client/src/main/java/io/fabric8/istio/client/GenericIstioClient.java index f56e72a6dd3..2ec5d9f3dd7 100644 --- a/extensions/istio/client/src/main/java/io/fabric8/istio/client/GenericIstioClient.java +++ b/extensions/istio/client/src/main/java/io/fabric8/istio/client/GenericIstioClient.java @@ -21,5 +21,5 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericIstioClient - extends Client, IstioClient, Namespaceable, AnyNamespaceable, RequestConfigurable { + extends Client, IstioClient, Namespaceable, AnyNamespaceable, RequestConfigurable { } diff --git a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/AuthorizationPolicyExample.java b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/AuthorizationPolicyExample.java index b04fcf9e758..baf02dac114 100644 --- a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/AuthorizationPolicyExample.java +++ b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/AuthorizationPolicyExample.java @@ -15,8 +15,6 @@ */ package io.fabric8.istio.api.examples.v1beta1; -import java.util.Collections; - import io.fabric8.istio.api.security.v1beta1.AuthorizationPolicyAction; import io.fabric8.istio.api.security.v1beta1.AuthorizationPolicyBuilder; import io.fabric8.istio.api.security.v1beta1.AuthorizationPolicyList; @@ -30,6 +28,8 @@ import io.fabric8.istio.client.IstioClient; import io.fabric8.kubernetes.client.KubernetesClientException; +import java.util.Collections; + public class AuthorizationPolicyExample { private static final String NAMESPACE = "test"; @@ -47,22 +47,24 @@ public static void main(String[] args) { public static void createResource(IstioClient client) { System.out.println("Creating a AuthorizationPolicy entry"); client.v1beta1().authorizationPolicies().inNamespace(NAMESPACE).create(new AuthorizationPolicyBuilder() - .withNewMetadata() - .withName("httpbin") - .endMetadata() - .withNewSpec() - .withSelector(new WorkloadSelectorBuilder().withMatchLabels(Collections.singletonMap("app", "httpbin")).build()) - .withAction(AuthorizationPolicyAction.DENY) - .withRules(new RuleBuilder() - .withFrom( - new RuleFromBuilder().withSource(new SourceBuilder().withPrincipals("cluster.local/ns/default/sa/sleep").build()) - .build(), - new RuleFromBuilder().withSource(new SourceBuilder().withNamespaces("dev").build()).build()) - .withTo(new RuleToBuilder().withOperation(new OperationBuilder().withMethods("GET").build()).build()) - .withWhen(new ConditionBuilder().withKey("request.auth.claims[iss]").withValues("https://accounts.google.com").build()) - .build()) - .endSpec() - .build()); + .withNewMetadata() + .withName("httpbin") + .endMetadata() + .withNewSpec() + .withSelector(new WorkloadSelectorBuilder().withMatchLabels(Collections.singletonMap("app", "httpbin")).build()) + .withAction(AuthorizationPolicyAction.DENY) + .withRules(new RuleBuilder() + .withFrom( + new RuleFromBuilder() + .withSource(new SourceBuilder().withPrincipals("cluster.local/ns/default/sa/sleep").build()) + .build(), + new RuleFromBuilder().withSource(new SourceBuilder().withNamespaces("dev").build()).build()) + .withTo(new RuleToBuilder().withOperation(new OperationBuilder().withMethods("GET").build()).build()) + .withWhen( + new ConditionBuilder().withKey("request.auth.claims[iss]").withValues("https://accounts.google.com").build()) + .build()) + .endSpec() + .build()); System.out.println("Listing AuthorizationPolicy instances:"); AuthorizationPolicyList list = client.v1beta1().authorizationPolicies().inNamespace(NAMESPACE).list(); diff --git a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/ClientFactory.java b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/ClientFactory.java index f952b0301b1..dcda718e75d 100644 --- a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/ClientFactory.java +++ b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/ClientFactory.java @@ -23,44 +23,44 @@ public class ClientFactory { private ClientFactory() { throw new IllegalStateException("Utility class"); } + public static IstioClient newClient(String[] args) { - ConfigBuilder config = new ConfigBuilder(); - for (int i = 0; i < args.length - 1; i++) { + ConfigBuilder config = new ConfigBuilder(); + for (int i = 0; i < args.length - 1; i++) { - String key = args[i]; - String value = args[i + 1]; + String key = args[i]; + String value = args[i + 1]; - if (key.equals("--api-server")) { - config = config.withMasterUrl(value); - } + if (key.equals("--api-server")) { + config = config.withMasterUrl(value); + } - if (key.equals("--token")) { - config = config.withOauthToken(value); - } + if (key.equals("--token")) { + config = config.withOauthToken(value); + } - if (key.equals("--username")) { - config = config.withUsername(value); - } + if (key.equals("--username")) { + config = config.withUsername(value); + } - if (key.equals("--password")) { - config = config.withPassword(value); - } - if (key.equals("--namespace")) { - config = config.withNamespace(value); - } + if (key.equals("--password")) { + config = config.withPassword(value); + } + if (key.equals("--namespace")) { + config = config.withNamespace(value); } - return new DefaultIstioClient(config.build()); + } + return new DefaultIstioClient(config.build()); } - public static String getOptions(String[] args, String name, String defaultValue) { - for (int i = 0; i < args.length - 1; i++) { - String key = args[i]; - String value = args[i + 1]; - if (key.equals(name)) { - return value; - } - } - return defaultValue; + public static String getOptions(String[] args, String name, String defaultValue) { + for (int i = 0; i < args.length - 1; i++) { + String key = args[i]; + String value = args[i + 1]; + if (key.equals(name)) { + return value; + } } + return defaultValue; + } } - diff --git a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/DestinationRuleExample.java b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/DestinationRuleExample.java index 50418b23820..a49f5710889 100644 --- a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/DestinationRuleExample.java +++ b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/DestinationRuleExample.java @@ -41,18 +41,18 @@ public static void createResource(IstioClient client) { System.out.println("Creating a destination rule"); // Example from: https://istio.io/latest/docs/reference/config/networking/destination-rule/ client.v1beta1().destinationRules().inNamespace(NAMESPACE).create(new DestinationRuleBuilder() - .withNewMetadata() - .withName("reviews-route") - .endMetadata() - .withNewSpec() - .withHost("ratings.prod.svc.cluster.local") - .withNewTrafficPolicy() - .withLoadBalancer( - new LoadBalancerSettingsBuilder().withLbPolicy(new LoadBalancerSettingsSimple(LoadBalancerSettingsSimpleLB.RANDOM)) - .build()) - .endTrafficPolicy() - .endSpec() - .build()); + .withNewMetadata() + .withName("reviews-route") + .endMetadata() + .withNewSpec() + .withHost("ratings.prod.svc.cluster.local") + .withNewTrafficPolicy() + .withLoadBalancer( + new LoadBalancerSettingsBuilder().withLbPolicy(new LoadBalancerSettingsSimple(LoadBalancerSettingsSimpleLB.RANDOM)) + .build()) + .endTrafficPolicy() + .endSpec() + .build()); System.out.println("Listing destination rules instances:"); DestinationRuleList list = client.v1beta1().destinationRules().inNamespace(NAMESPACE).list(); diff --git a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/GatewayExample.java b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/GatewayExample.java index 6475a622346..dbb19b20bd4 100644 --- a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/GatewayExample.java +++ b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/GatewayExample.java @@ -15,8 +15,6 @@ */ package io.fabric8.istio.api.examples.v1beta1; -import java.util.Collections; - import io.fabric8.istio.api.networking.v1beta1.GatewayBuilder; import io.fabric8.istio.api.networking.v1beta1.GatewayList; import io.fabric8.istio.api.networking.v1beta1.PortBuilder; @@ -25,6 +23,8 @@ import io.fabric8.istio.client.IstioClient; import io.fabric8.kubernetes.client.KubernetesClientException; +import java.util.Collections; + public class GatewayExample { private static final String NAMESPACE = "test"; @@ -43,18 +43,18 @@ public static void createResource(IstioClient client) { System.out.println("Creating a gateway"); // Example from: https://istio.io/latest/docs/reference/config/networking/gateway/ client.v1beta1().gateways().inNamespace(NAMESPACE).create(new GatewayBuilder() - .withNewMetadata() - .withName("my-gateway") - .endMetadata() - .withNewSpec() - .withSelector(Collections.singletonMap("app", "my-gateway-controller")) - .withServers(new ServerBuilder() - .withPort(new PortBuilder().withNumber(80).withProtocol("HTTP").withName("http").build()) - .withHosts("uk.bookinfo.com", "eu.bookinfo.com") - .withTls(new ServerTLSSettingsBuilder().withHttpsRedirect(true).build()) - .build()) - .endSpec() - .build()); + .withNewMetadata() + .withName("my-gateway") + .endMetadata() + .withNewSpec() + .withSelector(Collections.singletonMap("app", "my-gateway-controller")) + .withServers(new ServerBuilder() + .withPort(new PortBuilder().withNumber(80).withProtocol("HTTP").withName("http").build()) + .withHosts("uk.bookinfo.com", "eu.bookinfo.com") + .withTls(new ServerTLSSettingsBuilder().withHttpsRedirect(true).build()) + .build()) + .endSpec() + .build()); System.out.println("Listing gateway instances:"); GatewayList list = client.v1beta1().gateways().inNamespace(NAMESPACE).list(); diff --git a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/PeerAuthenticationExample.java b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/PeerAuthenticationExample.java index 30a5ffa3cf6..b00f49fec3b 100644 --- a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/PeerAuthenticationExample.java +++ b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/PeerAuthenticationExample.java @@ -40,14 +40,14 @@ public static void main(String[] args) { public static void createResource(IstioClient client) { System.out.println("Creating a PeerAuthentication entry"); client.v1beta1().peerAuthentications().inNamespace(NAMESPACE).create(new PeerAuthenticationBuilder() - .withNewMetadata() - .withName("details-svc") - .endMetadata() - .withNewSpec() - .withSelector(new WorkloadSelectorBuilder().addToMatchLabels("app", "reviews").build()) - .withMtls(new PeerAuthenticationMutualTLS(PeerAuthenticationMutualTLSMode.DISABLE)) - .endSpec() - .build()); + .withNewMetadata() + .withName("details-svc") + .endMetadata() + .withNewSpec() + .withSelector(new WorkloadSelectorBuilder().addToMatchLabels("app", "reviews").build()) + .withMtls(new PeerAuthenticationMutualTLS(PeerAuthenticationMutualTLSMode.DISABLE)) + .endSpec() + .build()); System.out.println("Listing workload entry instances:"); PeerAuthenticationList list = client.v1beta1().peerAuthentications().inNamespace(NAMESPACE).list(); diff --git a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/ServiceEntryExample.java b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/ServiceEntryExample.java index 018a2192b87..86307d55106 100644 --- a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/ServiceEntryExample.java +++ b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/ServiceEntryExample.java @@ -40,15 +40,15 @@ public static void createResource(IstioClient client) { System.out.println("Creating a service entry"); // Example from: https://istio.io/latest/docs/reference/config/networking/service-entry/ client.v1beta1().serviceEntries().inNamespace(NAMESPACE).create(new ServiceEntryBuilder() - .withNewMetadata() - .withName("external-svc-https") - .endMetadata() - .withNewSpec() - .withHosts("api.dropboxapi.com", "www.googleapis.com") - .withLocation(ServiceEntryLocation.MESH_INTERNAL) - .withPorts(new PortBuilder().withName("https").withProtocol("TLS").withNumber(443).build()) - .endSpec() - .build()); + .withNewMetadata() + .withName("external-svc-https") + .endMetadata() + .withNewSpec() + .withHosts("api.dropboxapi.com", "www.googleapis.com") + .withLocation(ServiceEntryLocation.MESH_INTERNAL) + .withPorts(new PortBuilder().withName("https").withProtocol("TLS").withNumber(443).build()) + .endSpec() + .build()); System.out.println("Listing Virtual Service Instances:"); ServiceEntryList list = client.v1beta1().serviceEntries().inNamespace(NAMESPACE).list(); diff --git a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/SidecarExample.java b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/SidecarExample.java index c60436aa2a5..5dede777f9e 100644 --- a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/SidecarExample.java +++ b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/SidecarExample.java @@ -39,14 +39,14 @@ public static void createResource(IstioClient client) { System.out.println("Creating a sidecar"); // Example from: https://istio.io/latest/docs/reference/config/networking/sidecar/ client.v1beta1().sidecars().inNamespace(NAMESPACE).create(new SidecarBuilder() - .withNewMetadata() - .withName("default") - .endMetadata() - .withNewSpec() - .withEgress(new IstioEgressListenerBuilder() - .withHosts("./*", "istio-system/*").build()) - .endSpec() - .build()); + .withNewMetadata() + .withName("default") + .endMetadata() + .withNewSpec() + .withEgress(new IstioEgressListenerBuilder() + .withHosts("./*", "istio-system/*").build()) + .endSpec() + .build()); System.out.println("Listing sidecar instances:"); SidecarList list = client.v1beta1().sidecars().inNamespace(NAMESPACE).list(); diff --git a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/VirtualServiceExample.java b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/VirtualServiceExample.java index c285b215c4d..d7fd9674d04 100644 --- a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/VirtualServiceExample.java +++ b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/VirtualServiceExample.java @@ -40,28 +40,28 @@ public static void createResource(IstioClient client) { // Example from: https://istio.io/latest/docs/reference/config/networking/virtual-service/ final String reviewsHost = "reviews.prod.svc.cluster.local"; client.v1beta1().virtualServices().inNamespace(NAMESPACE).create(new VirtualServiceBuilder() - .withNewMetadata() - .withName("reviews-route") - .endMetadata() - .withNewSpec() + .withNewMetadata() + .withName("reviews-route") + .endMetadata() + .withNewSpec() .addToHosts(reviewsHost) .addNewHttp() - .withName("reviews-v2-routes") - .addNewMatch().withNewUri().withNewStringMatchPrefixType("/wpcatalog").endUri().endMatch() - .addNewMatch().withNewUri().withNewStringMatchPrefixType("/consumercatalog").endUri().endMatch() - .withNewRewrite().withUri("/newcatalog").endRewrite() - .addNewRoute() - .withNewDestination().withHost(reviewsHost).withSubset("v2").endDestination() - .endRoute() + .withName("reviews-v2-routes") + .addNewMatch().withNewUri().withNewStringMatchPrefixType("/wpcatalog").endUri().endMatch() + .addNewMatch().withNewUri().withNewStringMatchPrefixType("/consumercatalog").endUri().endMatch() + .withNewRewrite().withUri("/newcatalog").endRewrite() + .addNewRoute() + .withNewDestination().withHost(reviewsHost).withSubset("v2").endDestination() + .endRoute() .endHttp() .addNewHttp() - .withName("reviews-v2-routes") - .addNewRoute() - .withNewDestination().withHost(reviewsHost).withSubset("v1").endDestination() - .endRoute() + .withName("reviews-v2-routes") + .addNewRoute() + .withNewDestination().withHost(reviewsHost).withSubset("v1").endDestination() + .endRoute() .endHttp() - .endSpec() - .build()); + .endSpec() + .build()); System.out.println("Listing Virtual Service Instances:"); VirtualServiceList list = client.v1beta1().virtualServices().inNamespace(NAMESPACE).list(); diff --git a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/WorkloadEntryExample.java b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/WorkloadEntryExample.java index 971af248c70..f4047de1974 100644 --- a/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/WorkloadEntryExample.java +++ b/extensions/istio/examples/src/main/java/io/fabric8/istio/api/examples/v1beta1/WorkloadEntryExample.java @@ -15,13 +15,13 @@ */ package io.fabric8.istio.api.examples.v1beta1; -import java.util.Collections; - import io.fabric8.istio.api.networking.v1beta1.WorkloadEntryBuilder; import io.fabric8.istio.api.networking.v1beta1.WorkloadEntryList; import io.fabric8.istio.client.IstioClient; import io.fabric8.kubernetes.client.KubernetesClientException; +import java.util.Collections; + public class WorkloadEntryExample { private static final String NAMESPACE = "test"; @@ -40,14 +40,14 @@ public static void createResource(IstioClient client) { System.out.println("Creating a workload entry"); // Example from: https://istio.io/latest/docs/reference/config/networking/workload-entry/ client.v1beta1().workloadEntries().inNamespace(NAMESPACE).create(new WorkloadEntryBuilder() - .withNewMetadata() - .withName("details-svc") - .endMetadata() - .withNewSpec() - .withServiceAccount("details-legacy") - .withLabels(Collections.singletonMap("app", "details-legacy")) - .endSpec() - .build()); + .withNewMetadata() + .withName("details-svc") + .endMetadata() + .withNewSpec() + .withServiceAccount("details-legacy") + .withLabels(Collections.singletonMap("app", "details-legacy")) + .endSpec() + .build()); System.out.println("Listing workload entry instances:"); WorkloadEntryList list = client.v1beta1().workloadEntries().inNamespace(NAMESPACE).list(); diff --git a/extensions/istio/model-v1alpha3/src/main/java/io/fabric8/istio/api/networking/v1alpha3/CorsPolicy.java b/extensions/istio/model-v1alpha3/src/main/java/io/fabric8/istio/api/networking/v1alpha3/CorsPolicy.java index 7f65cd9a1db..6059cc8cf79 100644 --- a/extensions/istio/model-v1alpha3/src/main/java/io/fabric8/istio/api/networking/v1alpha3/CorsPolicy.java +++ b/extensions/istio/model-v1alpha3/src/main/java/io/fabric8/istio/api/networking/v1alpha3/CorsPolicy.java @@ -15,11 +15,6 @@ */ package io.fabric8.istio.api.networking.v1alpha3; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -27,7 +22,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - import io.fabric8.kubernetes.api.model.Container; import io.fabric8.kubernetes.api.model.ContainerPort; import io.fabric8.kubernetes.api.model.EnvVar; @@ -42,28 +36,33 @@ import lombok.EqualsAndHashCode; import lombok.ToString; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ - "allowCredentials", - "allowHeaders", - "allowMethods", - "allowOrigin", - "allowOrigins", - "exposeHeaders", - "maxAge" + "allowCredentials", + "allowHeaders", + "allowMethods", + "allowOrigin", + "allowOrigins", + "exposeHeaders", + "maxAge" }) @JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class) @ToString @EqualsAndHashCode @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = { - @BuildableReference(ObjectMeta.class), - @BuildableReference(ObjectReference.class), - @BuildableReference(LabelSelector.class), - @BuildableReference(Container.class), - @BuildableReference(EnvVar.class), - @BuildableReference(ContainerPort.class), - @BuildableReference(Volume.class), - @BuildableReference(VolumeMount.class) + @BuildableReference(ObjectMeta.class), + @BuildableReference(ObjectReference.class), + @BuildableReference(LabelSelector.class), + @BuildableReference(Container.class), + @BuildableReference(EnvVar.class), + @BuildableReference(ContainerPort.class), + @BuildableReference(Volume.class), + @BuildableReference(VolumeMount.class) }) public class CorsPolicy implements KubernetesResource { @@ -105,7 +104,7 @@ public CorsPolicy() { * @param allowOrigins */ public CorsPolicy(Boolean allowCredentials, List allowHeaders, List allowMethods, - List deprecatedAllowOrigin, List allowOrigins, List exposeHeaders, String maxAge) { + List deprecatedAllowOrigin, List allowOrigins, List exposeHeaders, String maxAge) { super(); this.allowCredentials = allowCredentials; this.allowHeaders = allowHeaders; diff --git a/extensions/istio/model-v1beta1/src/main/java/io.fabric8.istio.api.networking.v1beta1/CorsPolicy.java b/extensions/istio/model-v1beta1/src/main/java/io.fabric8.istio.api.networking.v1beta1/CorsPolicy.java index 7f70f0c4291..2ea2949c8ef 100644 --- a/extensions/istio/model-v1beta1/src/main/java/io.fabric8.istio.api.networking.v1beta1/CorsPolicy.java +++ b/extensions/istio/model-v1beta1/src/main/java/io.fabric8.istio.api.networking.v1beta1/CorsPolicy.java @@ -15,11 +15,6 @@ */ package io.fabric8.istio.api.networking.v1beta1; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -27,7 +22,6 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; - import io.fabric8.kubernetes.api.model.Container; import io.fabric8.kubernetes.api.model.ContainerPort; import io.fabric8.kubernetes.api.model.EnvVar; @@ -42,28 +36,33 @@ import lombok.EqualsAndHashCode; import lombok.ToString; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ - "allowCredentials", - "allowHeaders", - "allowMethods", - "allowOrigin", - "allowOrigins", - "exposeHeaders", - "maxAge" + "allowCredentials", + "allowHeaders", + "allowMethods", + "allowOrigin", + "allowOrigins", + "exposeHeaders", + "maxAge" }) @JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class) @ToString @EqualsAndHashCode @Buildable(editableEnabled = false, validationEnabled = false, generateBuilderPackage = false, builderPackage = "io.fabric8.kubernetes.api.builder", refs = { - @BuildableReference(ObjectMeta.class), - @BuildableReference(ObjectReference.class), - @BuildableReference(LabelSelector.class), - @BuildableReference(Container.class), - @BuildableReference(EnvVar.class), - @BuildableReference(ContainerPort.class), - @BuildableReference(Volume.class), - @BuildableReference(VolumeMount.class) + @BuildableReference(ObjectMeta.class), + @BuildableReference(ObjectReference.class), + @BuildableReference(LabelSelector.class), + @BuildableReference(Container.class), + @BuildableReference(EnvVar.class), + @BuildableReference(ContainerPort.class), + @BuildableReference(Volume.class), + @BuildableReference(VolumeMount.class) }) public class CorsPolicy implements KubernetesResource { @@ -105,7 +104,7 @@ public CorsPolicy() { * @param allowOrigins */ public CorsPolicy(Boolean allowCredentials, List allowHeaders, List allowMethods, - List deprecatedAllowOrigin, List allowOrigins, List exposeHeaders, String maxAge) { + List deprecatedAllowOrigin, List allowOrigins, List exposeHeaders, String maxAge) { super(); this.allowCredentials = allowCredentials; this.allowHeaders = allowHeaders; diff --git a/extensions/knative/client/src/main/java/io/fabric8/knative/client/GenericKnativeClient.java b/extensions/knative/client/src/main/java/io/fabric8/knative/client/GenericKnativeClient.java index 0fd79f59146..4102d1b2293 100644 --- a/extensions/knative/client/src/main/java/io/fabric8/knative/client/GenericKnativeClient.java +++ b/extensions/knative/client/src/main/java/io/fabric8/knative/client/GenericKnativeClient.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericKnativeClient extends Client, KnativeClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/knative/client/src/main/java/io/fabric8/knative/client/NamespacedKnativeClient.java b/extensions/knative/client/src/main/java/io/fabric8/knative/client/NamespacedKnativeClient.java index 2a0105e760e..ee607b560eb 100644 --- a/extensions/knative/client/src/main/java/io/fabric8/knative/client/NamespacedKnativeClient.java +++ b/extensions/knative/client/src/main/java/io/fabric8/knative/client/NamespacedKnativeClient.java @@ -15,7 +15,6 @@ */ package io.fabric8.knative.client; - public interface NamespacedKnativeClient extends KnativeClient, - GenericKnativeClient { + GenericKnativeClient { } diff --git a/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/GenericServingV1Client.java b/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/GenericServingV1Client.java index 792bc8bded3..b279a8bd18e 100644 --- a/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/GenericServingV1Client.java +++ b/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/GenericServingV1Client.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericServingV1Client extends Client, ServingV1Client, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/ServingV1Client.java b/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/ServingV1Client.java index d535be95bc9..c35fe85373a 100644 --- a/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/ServingV1Client.java +++ b/extensions/knative/client/src/main/java/io/fabric8/knative/client/serving/v1/ServingV1Client.java @@ -15,18 +15,20 @@ */ package io.fabric8.knative.client.serving.v1; - +import io.fabric8.knative.serving.v1.*; import io.fabric8.kubernetes.client.Client; import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.Resource; -import io.fabric8.knative.serving.v1.*; public interface ServingV1Client extends Client { // Serving MixedOperation> services(); + MixedOperation> routes(); + MixedOperation> revisions(); + MixedOperation> configurations(); } diff --git a/extensions/knative/client/src/main/java/io/fabric8/knative/client/util/ApiVersionUtil.java b/extensions/knative/client/src/main/java/io/fabric8/knative/client/util/ApiVersionUtil.java index f021ae1f660..587412331c4 100644 --- a/extensions/knative/client/src/main/java/io/fabric8/knative/client/util/ApiVersionUtil.java +++ b/extensions/knative/client/src/main/java/io/fabric8/knative/client/util/ApiVersionUtil.java @@ -25,19 +25,20 @@ @Deprecated public class ApiVersionUtil { - private ApiVersionUtil() { + private ApiVersionUtil() { throw new IllegalStateException("Utility class"); } - /** + /** * Extracts apiGroupName from apiGroupVersion when in resource for apiGroupName/apiGroupVersion combination - * @param item resource which is being used - * @param apiGroup apiGroupName present if any - * @return Just the apiGroupName part without apiGroupVersion + * + * @param item resource which is being used + * @param apiGroup apiGroupName present if any + * @return Just the apiGroupName part without apiGroupVersion */ public static String apiGroup(T item, String apiGroup) { - if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) { + if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) { return trimGroupOrNull(((HasMetadata) item).getApiVersion()); } else if (apiGroup != null && !apiGroup.isEmpty()) { return trimGroup(apiGroup); @@ -47,6 +48,7 @@ public static String apiGroup(T item, String apiGroup) { /** * Returns the api version falling back to the items apiGroupVersion if not null. + * * @param * @param item * @param apiVersion @@ -63,8 +65,9 @@ public static String apiVersion(T item, String apiVersion) { /** * Separates apiGroupVersion for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupVersion part without the apiGroupName. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupVersion part without the apiGroupName. */ private static String trimVersion(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { @@ -74,10 +77,11 @@ private static String trimVersion(String apiVersion) { return apiVersion; } - /** + /** * Separates apiGroupName for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupName part without the apiGroupName, or apiVersion if no separator is found. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupName part without the apiGroupName, or apiVersion if no separator is found. */ private static String trimGroup(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { @@ -87,12 +91,11 @@ private static String trimGroup(String apiVersion) { return apiVersion; } - - - /** + /** * Separates apiGroupName for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupName part without the apiGroupName, or null if no separator is found. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupName part without the apiGroupName, or null if no separator is found. */ private static String trimGroupOrNull(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { diff --git a/extensions/knative/model/src/main/java/io/fabric8/knative/api/model/Constants.java b/extensions/knative/model/src/main/java/io/fabric8/knative/api/model/Constants.java index 5fd41368f8f..14eac78237c 100755 --- a/extensions/knative/model/src/main/java/io/fabric8/knative/api/model/Constants.java +++ b/extensions/knative/model/src/main/java/io/fabric8/knative/api/model/Constants.java @@ -19,5 +19,6 @@ public class Constants { private Constants() { throw new IllegalStateException("Utility class"); } - public static final String BUILDER_PACKAGE = "io.fabric8.kubernetes.api.builder"; + + public static final String BUILDER_PACKAGE = "io.fabric8.kubernetes.api.builder"; } diff --git a/extensions/knative/model/src/test/java/io/fabric8/knative/ModelTest.java b/extensions/knative/model/src/test/java/io/fabric8/knative/ModelTest.java index 7f416935404..70f8127b211 100644 --- a/extensions/knative/model/src/test/java/io/fabric8/knative/ModelTest.java +++ b/extensions/knative/model/src/test/java/io/fabric8/knative/ModelTest.java @@ -15,28 +15,26 @@ */ package io.fabric8.knative; -import org.junit.jupiter.api.Test; - import io.fabric8.knative.serving.v1.*; +import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotNull; class ModelTest { @Test - void shouldHaveBuildableContainer() { + void shouldHaveBuildableContainer() { Service service = new ServiceBuilder() - .withNewSpec() - .withNewTemplate() - .withNewSpec() - .addNewContainer() - .withImage("my-image") - .endContainer() - .endSpec() - .endTemplate() - .endSpec() - .build(); + .withNewSpec() + .withNewTemplate() + .withNewSpec() + .addNewContainer() + .withImage("my-image") + .endContainer() + .endSpec() + .endTemplate() + .endSpec() + .build(); assertNotNull(service); } } - diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/GenericOpenClusterManagementClient.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/GenericOpenClusterManagementClient.java index d1f6b42573f..acb56964a7f 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/GenericOpenClusterManagementClient.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/GenericOpenClusterManagementClient.java @@ -21,8 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericOpenClusterManagementClient extends Client, OpenClusterManagementClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } - diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/NamespacedOpenClusterManagementClient.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/NamespacedOpenClusterManagementClient.java index b3d0beb83aa..a48cdfd4b94 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/NamespacedOpenClusterManagementClient.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/NamespacedOpenClusterManagementClient.java @@ -15,7 +15,6 @@ */ package io.fabric8.openclustermanagement.client; - public interface NamespacedOpenClusterManagementClient extends OpenClusterManagementClient, - GenericOpenClusterManagementClient { + GenericOpenClusterManagementClient { } diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/OpenClusterManagementClient.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/OpenClusterManagementClient.java index 667f557b794..b5f6ef5c763 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/OpenClusterManagementClient.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/OpenClusterManagementClient.java @@ -27,48 +27,56 @@ public interface OpenClusterManagementClient extends Client { /** * API entrypoint for resources in apps.open-cluster-management.io apiGroup + * * @return {@link OpenClusterManagementAppsAPIGroupDSL} */ OpenClusterManagementAppsAPIGroupDSL apps(); /** * API entrypoint for resources in agent.open-cluster-management.io apiGroup + * * @return {@link OpenClusterManagementAgentAPIGroupDSL} */ OpenClusterManagementAgentAPIGroupDSL agents(); /** * API entrypoint for resources in clusters.open-cluster-management.io apiGroup + * * @return {@link OpenClusterManagementClustersAPIGroupDSL} */ OpenClusterManagementClustersAPIGroupDSL clusters(); /** * API entrypoint for resources in discovery.open-cluster-management.io apiGroup + * * @return {@link OpenClusterManagementDiscoveryAPIGroupDSL} */ OpenClusterManagementDiscoveryAPIGroupDSL discovery(); /** * API entrypoint for resources in observability.open-cluster-management.io apiGroup + * * @return {@link OpenClusterManagementObservabilityAPIGroupClient} */ OpenClusterManagementObservabilityAPIGroupClient observability(); /** * API entrypoint for resources in operator.open-cluster-management.io apiGroup + * * @return {@link OpenClusterManagementOperatorAPIGroupDSL} */ OpenClusterManagementOperatorAPIGroupDSL operator(); /** * API entrypoint for resources in policy.open-cluster-management.io apiGroup + * * @return {@link OpenClusterManagementPolicyAPIGroupDSL} */ OpenClusterManagementPolicyAPIGroupDSL policy(); /** * API entrypoint for resources in search.open-cluster-management.io apiGroup + * * @return {@link OpenClusterManagementSearchAPIGroupDSL} */ OpenClusterManagementSearchAPIGroupDSL search(); diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementAppsAPIGroupDSL.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementAppsAPIGroupDSL.java index 99a77d5145b..7486436da49 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementAppsAPIGroupDSL.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementAppsAPIGroupDSL.java @@ -34,36 +34,42 @@ public interface OpenClusterManagementAppsAPIGroupDSL extends Client { /** * API entrypoint for Channel (apps.open-cluster-management.io/v1) + * * @return {@link MixedOperation} for Channel */ MixedOperation> channels(); /** * API entrypoint for Subscription (apps.open-cluster-management.io/v1) + * * @return {@link MixedOperation} for Subscription */ MixedOperation> subscriptions(); /** * API entrypoint for HelmRelease (apps.open-cluster-management.io/v1) + * * @return {@link MixedOperation} for HelmRelease */ MixedOperation> helmReleases(); /** * API entrypoint for Application (app.k8s.io/v1beta1) + * * @return {@link MixedOperation} for Application */ MixedOperation> applications(); /** * API entrypoint for PlacementRule (apps.open-cluster-management.io/v1) + * * @return {@link MixedOperation} for PlacementRule */ MixedOperation> placementRules(); /** * API entrypoint for GitOpsCluster (apps.open-cluster-management.io/v1beta1) + * * @return {@link MixedOperation} for GitOpsCluster */ MixedOperation> gitOpsClusters(); diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementClustersAPIGroupDSL.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementClustersAPIGroupDSL.java index a2a31c9dc74..56a8f45ebd5 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementClustersAPIGroupDSL.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementClustersAPIGroupDSL.java @@ -30,33 +30,38 @@ import io.fabric8.openclustermanagement.api.model.cluster.v1beta1.ManagedClusterSetBindingList; import io.fabric8.openclustermanagement.api.model.cluster.v1beta1.ManagedClusterSetList; -public interface OpenClusterManagementClustersAPIGroupDSL extends Client { +public interface OpenClusterManagementClustersAPIGroupDSL extends Client { /** * API entrypoint for ManagedCluster (cluster.open-cluster-management.io/v1) + * * @return {@link NonNamespaceOperation} for ManagedCluster */ NonNamespaceOperation> managedClusters(); /** * API entrypoint for ManagedClusterSet (cluster.open-cluster-management.io/v1beta1) + * * @return {@link NonNamespaceOperation} for ManagedClusterSet */ NonNamespaceOperation> managedClusterSets(); /** * API entrypoint for ManagedClusterSetBinding (cluster.open-cluster-management.io/v1beta1) + * * @return {@link MixedOperation} for ManagedClusterSetBinding */ MixedOperation> managedClusterSetBindings(); /** * API entrypoint for Placement (cluster.open-cluster-management.io/v1alpha1) + * * @return {@link MixedOperation} for Placement */ MixedOperation> placements(); /** * API entrypoint for PlacementDecision (cluster.open-cluster-management.io/v1alpha1) + * * @return {@link MixedOperation} for PlacementDecision */ MixedOperation> placementDecisions(); diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementDiscoveryAPIGroupDSL.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementDiscoveryAPIGroupDSL.java index 4ad182598bd..e7c2b3be32d 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementDiscoveryAPIGroupDSL.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementDiscoveryAPIGroupDSL.java @@ -26,12 +26,14 @@ public interface OpenClusterManagementDiscoveryAPIGroupDSL extends Client { /** * API entrypoint for DiscoveredCluster (discovery.open-cluster-management.io/v1alpha1) + * * @return {@link MixedOperation} for DiscoveredCluster */ MixedOperation> discoveredClusters(); /** * API entrypoint for DiscoveryConfig (discovery.open-cluster-management.io/v1alpha1) + * * @return {@link MixedOperation} for DiscoveryConfig */ MixedOperation> discoveryConfigs(); diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementObservabilityAPIGroupDSL.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementObservabilityAPIGroupDSL.java index 806eb201107..e495b19ef66 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementObservabilityAPIGroupDSL.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementObservabilityAPIGroupDSL.java @@ -27,12 +27,14 @@ public interface OpenClusterManagementObservabilityAPIGroupDSL extends Client { /** * API entrypoint for MultiClusterObservability (observability.open-cluster-management.io/v1beta2) + * * @return {@link NonNamespaceOperation} for MultiClusterObservability */ NonNamespaceOperation> multiClusterObservailities(); /** * API entrypoint for ObservabilityAddon (observability.open-cluster-management.io/v1beta1) + * * @return {@link MixedOperation} for ObservabilityAddon */ MixedOperation> observabilityAddons(); diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementOperatorAPIGroupDSL.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementOperatorAPIGroupDSL.java index eae67773b04..28125e3176b 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementOperatorAPIGroupDSL.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementOperatorAPIGroupDSL.java @@ -29,18 +29,21 @@ public interface OpenClusterManagementOperatorAPIGroupDSL extends Client { /** * API entrypoint for MultiClusterHub (operator.open-cluster-management.io/v1) + * * @return {@link MixedOperation} for MultiClusterHub */ MixedOperation> multiClusterHubs(); /** * API entrypoint for Klusterlet (operator.open-cluster-management.io/v1) + * * @return {@link NonNamespaceOperation} for Klusterlet */ NonNamespaceOperation> klusterlets(); /** * API entrypoint for ClusterManager (operator.open-cluster-management.io/v1) + * * @return {@link NonNamespaceOperation} for ClusterManager */ NonNamespaceOperation> clusterManagers(); diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementPolicyAPIGroupDSL.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementPolicyAPIGroupDSL.java index ac47c0a704e..8656f4a0d1c 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementPolicyAPIGroupDSL.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementPolicyAPIGroupDSL.java @@ -28,18 +28,21 @@ public interface OpenClusterManagementPolicyAPIGroupDSL extends Client { /** * API entrypoint for Policy (policy.open-cluster-management.io/v1) + * * @return {@link MixedOperation} for Policy */ MixedOperation> policies(); /** * API entrypoint for PlacementBinding (policy.open-cluster-management.io/v1) + * * @return {@link MixedOperation} for PlacementBinding */ MixedOperation> placementBindings(); /** * API entrypoint for PolicyAutomation (policy.open-cluster-management.io/v1beta1) + * * @return {@link MixedOperation} for PolicyAutomation */ MixedOperation> policyAutomations(); diff --git a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementSearchAPIGroupDSL.java b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementSearchAPIGroupDSL.java index b56a448c4a0..2f87f77e908 100644 --- a/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementSearchAPIGroupDSL.java +++ b/extensions/open-cluster-management/client/src/main/java/io/fabric8/openclustermanagement/client/dsl/OpenClusterManagementSearchAPIGroupDSL.java @@ -26,12 +26,14 @@ public interface OpenClusterManagementSearchAPIGroupDSL extends Client { /** * API entrypoint for SearchCustomization (search.open-cluster-management.io/v1alpha1) + * * @return {@link MixedOperation} for SearchCustomization */ MixedOperation> searchCustomizations(); /** * API entrypoint for SearchOperator (search.open-cluster-management.io/v1alpha1 + * * @return {@link MixedOperation} for SearchOperator */ MixedOperation> searchOperators(); diff --git a/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/apps/PlacementRuleCreate.java b/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/apps/PlacementRuleCreate.java index 8b8d78d11ff..97369ac92c5 100644 --- a/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/apps/PlacementRuleCreate.java +++ b/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/apps/PlacementRuleCreate.java @@ -29,14 +29,14 @@ public static void main(String[] args) { try (OpenClusterManagementClient ocmClient = new DefaultOpenClusterManagementClient()) { PlacementRule placementRule = new PlacementRuleBuilder() - .withNewMetadata().withName("towhichcluster").endMetadata() - .withNewSpec() - .addNewClusterCondition() - .withType("ManagedClusterConditionAvailable") - .withStatus("True") - .endClusterCondition() - .endSpec() - .build(); + .withNewMetadata().withName("towhichcluster").endMetadata() + .withNewSpec() + .addNewClusterCondition() + .withType("ManagedClusterConditionAvailable") + .withStatus("True") + .endClusterCondition() + .endSpec() + .build(); logger.info("Creating PlacementRule {}", placementRule.getMetadata().getName()); ocmClient.apps().placementRules().inNamespace("default").create(placementRule); logger.info("Success."); diff --git a/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/cluster/ManagedClusterList.java b/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/cluster/ManagedClusterList.java index c484275b423..97c11250fc6 100644 --- a/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/cluster/ManagedClusterList.java +++ b/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/cluster/ManagedClusterList.java @@ -29,10 +29,10 @@ public static void main(String[] args) { try (OpenClusterManagementClient ocmClient = new DefaultOpenClusterManagementClient()) { logger.info("Listing all ManagedClusters: "); ocmClient.clusters().managedClusters() - .list().getItems().stream() - .map(ManagedCluster::getMetadata) - .map(ObjectMeta::getName) - .forEach(logger::info); + .list().getItems().stream() + .map(ManagedCluster::getMetadata) + .map(ObjectMeta::getName) + .forEach(logger::info); } } } diff --git a/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/cluster/ManagedClusterSetCreate.java b/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/cluster/ManagedClusterSetCreate.java index 91d8a71b69c..418b062112a 100644 --- a/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/cluster/ManagedClusterSetCreate.java +++ b/extensions/open-cluster-management/examples/src/main/java/io/fabric8/openclustermanagement/examples/cluster/ManagedClusterSetCreate.java @@ -28,10 +28,10 @@ public class ManagedClusterSetCreate { public static void main(String[] args) { try (OpenClusterManagementClient ocmClient = new DefaultOpenClusterManagementClient()) { ManagedClusterSet managedClusterSet = new ManagedClusterSetBuilder() - .withNewMetadata().withName("managedclusterset1").endMetadata() - .withNewSpec() - .endSpec() - .build(); + .withNewMetadata().withName("managedclusterset1").endMetadata() + .withNewSpec() + .endSpec() + .build(); logger.info("Creating ManagedClusterSet {}", managedClusterSet.getMetadata().getName()); ocmClient.clusters().managedClusterSets().create(managedClusterSet); diff --git a/extensions/open-cluster-management/model-agent/src/test/java/io/fabric8/openclustermanagement/api/model/agent/v1/KlusterletAddonConfigTest.java b/extensions/open-cluster-management/model-agent/src/test/java/io/fabric8/openclustermanagement/api/model/agent/v1/KlusterletAddonConfigTest.java index 658d39a42df..685cb4786a1 100644 --- a/extensions/open-cluster-management/model-agent/src/test/java/io/fabric8/openclustermanagement/api/model/agent/v1/KlusterletAddonConfigTest.java +++ b/extensions/open-cluster-management/model-agent/src/test/java/io/fabric8/openclustermanagement/api/model/agent/v1/KlusterletAddonConfigTest.java @@ -32,8 +32,8 @@ class KlusterletAddonConfigTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-klusterletaddonconfig.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final KlusterletAddonConfig kac = mapper.readValue(originalJson, KlusterletAddonConfig.class); @@ -56,26 +56,26 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given io.fabric8.openclustermanagement.api.model.agent.v1.KlusterletAddonConfigBuilder klusterletAddonConfigBuilder = new io.fabric8.openclustermanagement.api.model.agent.v1.KlusterletAddonConfigBuilder() - .withNewMetadata() - .withName("test-kac") - .endMetadata() - .withNewSpec() - .withNewApplicationManager() - .withEnabled(true) - .endApplicationManager() - .withNewPolicyController() - .withEnabled(true) - .endPolicyController() - .withNewSearchCollector() - .withEnabled(true) - .endSearchCollector() - .withNewCertPolicyController() - .withEnabled(true) - .endCertPolicyController() - .withNewIamPolicyController() - .withEnabled(true) - .endIamPolicyController() - .endSpec(); + .withNewMetadata() + .withName("test-kac") + .endMetadata() + .withNewSpec() + .withNewApplicationManager() + .withEnabled(true) + .endApplicationManager() + .withNewPolicyController() + .withEnabled(true) + .endPolicyController() + .withNewSearchCollector() + .withEnabled(true) + .endSearchCollector() + .withNewCertPolicyController() + .withEnabled(true) + .endCertPolicyController() + .withNewIamPolicyController() + .withEnabled(true) + .endIamPolicyController() + .endSpec(); // When KlusterletAddonConfig kac = klusterletAddonConfigBuilder.build(); diff --git a/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/ApplicationTest.java b/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/ApplicationTest.java index d00fbd57894..368d2af08af 100644 --- a/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/ApplicationTest.java +++ b/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/ApplicationTest.java @@ -34,8 +34,8 @@ class ApplicationTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-application.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final Application application = mapper.readValue(originalJson, Application.class); @@ -57,16 +57,16 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given ApplicationBuilder applicationBuilder = new ApplicationBuilder() - .withNewMetadata() - .addToLabels("app", "nginx-app-details") - .withName("nginx-app-3") - .endMetadata() - .withNewSpec() - .addNewComponentKind("apps.open-cluster-management.io", "Subscription") - .withNewSelector() - .addToMatchLabels("app", "nginx-app-details") - .endSelector() - .endSpec(); + .withNewMetadata() + .addToLabels("app", "nginx-app-details") + .withName("nginx-app-3") + .endMetadata() + .withNewSpec() + .addNewComponentKind("apps.open-cluster-management.io", "Subscription") + .withNewSelector() + .addToMatchLabels("app", "nginx-app-details") + .endSelector() + .endSpec(); // When Application application = applicationBuilder.build(); diff --git a/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/ChannelTest.java b/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/ChannelTest.java index 075887ff755..b26f571a92a 100644 --- a/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/ChannelTest.java +++ b/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/ChannelTest.java @@ -33,8 +33,8 @@ class ChannelTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-channel.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final Channel channel = mapper.readValue(originalJson, Channel.class); @@ -56,18 +56,18 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given ChannelBuilder channelBuilder = new ChannelBuilder() - .withNewMetadata() - .addToLabels("vendor", "OpenShift") - .withName("sample-channel") - .endMetadata() - .withNewSpec() - .withType("HelmRepo") - .withPathname("https://charts.helm.sh/stable") - .withNewConfigMapRef() - .withKind("ConfigMap") - .withName("test-configmap") - .endConfigMapRef() - .endSpec(); + .withNewMetadata() + .addToLabels("vendor", "OpenShift") + .withName("sample-channel") + .endMetadata() + .withNewSpec() + .withType("HelmRepo") + .withPathname("https://charts.helm.sh/stable") + .withNewConfigMapRef() + .withKind("ConfigMap") + .withName("test-configmap") + .endConfigMapRef() + .endSpec(); // When Channel channel = channelBuilder.build(); diff --git a/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/HelmReleaseTest.java b/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/HelmReleaseTest.java index 85fbfcc68ce..3b636313d51 100644 --- a/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/HelmReleaseTest.java +++ b/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/HelmReleaseTest.java @@ -34,8 +34,8 @@ class HelmReleaseTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-helmrelease.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final HelmRelease helmRelease = mapper.readValue(originalJson, HelmRelease.class); @@ -59,22 +59,22 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given HelmReleaseBuilder helmReleaseBuilder = new HelmReleaseBuilder() - .withNewMetadata() - .addToLabels("vendor", "OpenShift") - .withName("sample_subscription") - .addToAnnotations("apps.open-cluster-management.io/git-path", "apps/sample/") - .addToAnnotations("apps.open-cluster-management.io/git-branch", "sample_branch") - .endMetadata() - .withNewRepo() - .withChartName("nginx-ingress") - .withNewSource() - .withNewHelmRepo() - .withUrls("https://kubernetes-charts.storage.googleapis.com/nginx-ingress-1.26.0.tgz") - .endHelmRepo() - .withType("HelmRepo") - .endSource() - .withVersion("1.26.0") - .endRepo(); + .withNewMetadata() + .addToLabels("vendor", "OpenShift") + .withName("sample_subscription") + .addToAnnotations("apps.open-cluster-management.io/git-path", "apps/sample/") + .addToAnnotations("apps.open-cluster-management.io/git-branch", "sample_branch") + .endMetadata() + .withNewRepo() + .withChartName("nginx-ingress") + .withNewSource() + .withNewHelmRepo() + .withUrls("https://kubernetes-charts.storage.googleapis.com/nginx-ingress-1.26.0.tgz") + .endHelmRepo() + .withType("HelmRepo") + .endSource() + .withVersion("1.26.0") + .endRepo(); // When HelmRelease helmRelease = helmReleaseBuilder.build(); diff --git a/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/SubscriptionTest.java b/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/SubscriptionTest.java index cedbe8cc0c2..eef6ee65df1 100644 --- a/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/SubscriptionTest.java +++ b/extensions/open-cluster-management/model-apps/src/test/java/io/fabric8/openclustermanagement/api/model/apps/SubscriptionTest.java @@ -33,8 +33,8 @@ class SubscriptionTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-subscription.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final Subscription subscription = mapper.readValue(originalJson, Subscription.class); @@ -57,19 +57,19 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given SubscriptionBuilder subscriptionBuilder = new SubscriptionBuilder() - .withNewMetadata() - .addToLabels("vendor", "OpenShift") - .withName("sample_subscription") - .addToAnnotations("apps.open-cluster-management.io/git-path", "apps/sample/") - .addToAnnotations("apps.open-cluster-management.io/git-branch", "sample_branch") - .endMetadata() - .withNewSpec() - .withChannel("channel_namespace/sample_channel") - .addNewPackageOverride() - .withPackageName("my-sample-application") - .withPackageAlias("the-sample-app") - .endPackageOverride() - .endSpec(); + .withNewMetadata() + .addToLabels("vendor", "OpenShift") + .withName("sample_subscription") + .addToAnnotations("apps.open-cluster-management.io/git-path", "apps/sample/") + .addToAnnotations("apps.open-cluster-management.io/git-branch", "sample_branch") + .endMetadata() + .withNewSpec() + .withChannel("channel_namespace/sample_channel") + .addNewPackageOverride() + .withPackageName("my-sample-application") + .withPackageAlias("the-sample-app") + .endPackageOverride() + .endSpec(); // When Subscription subscription = subscriptionBuilder.build(); diff --git a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterSetBindingTest.java b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterSetBindingTest.java index d5164cdbe08..96c432144f7 100644 --- a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterSetBindingTest.java +++ b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterSetBindingTest.java @@ -33,13 +33,14 @@ class ManagedClusterSetBindingTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-managedclustersetbinding.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final ManagedClusterSetBinding managedClusterSetBinding = mapper.readValue(originalJson, ManagedClusterSetBinding.class); final String serializedJson = mapper.writeValueAsString(managedClusterSetBinding); - final ManagedClusterSetBinding managedClusterSetFromSerializedJson = mapper.readValue(serializedJson, ManagedClusterSetBinding.class); + final ManagedClusterSetBinding managedClusterSetFromSerializedJson = mapper.readValue(serializedJson, + ManagedClusterSetBinding.class); // Then assertNotNull(managedClusterSetBinding); @@ -52,13 +53,13 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given ManagedClusterSetBindingBuilder managedClusterBuilder = new ManagedClusterSetBindingBuilder() - .withNewMetadata() - .withName("clusterset1") - .withNamespace("ns1") - .endMetadata() - .withNewSpec() - .withClusterSet("clusterset1") - .endSpec(); + .withNewMetadata() + .withName("clusterset1") + .withNamespace("ns1") + .endMetadata() + .withNewSpec() + .withClusterSet("clusterset1") + .endSpec(); // When ManagedClusterSetBinding managedClusterSetBinding = managedClusterBuilder.build(); diff --git a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterSetTest.java b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterSetTest.java index e699554d715..2ad04ab4f17 100644 --- a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterSetTest.java +++ b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterSetTest.java @@ -33,8 +33,8 @@ class ManagedClusterSetTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-managedclusterset.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final ManagedClusterSet managedClusterSet = mapper.readValue(originalJson, ManagedClusterSet.class); @@ -52,11 +52,11 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given ManagedClusterSetBuilder managedClusterBuilder = new ManagedClusterSetBuilder() - .withNewMetadata() - .withName("cluster1") - .endMetadata() - .withNewSpec() - .endSpec(); + .withNewMetadata() + .withName("cluster1") + .endMetadata() + .withNewSpec() + .endSpec(); // When ManagedClusterSet managedClusterSet = managedClusterBuilder.build(); diff --git a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterTest.java b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterTest.java index ba1ca49d494..7fd8b94c688 100644 --- a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterTest.java +++ b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/ManagedClusterTest.java @@ -34,8 +34,8 @@ class ManagedClusterTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-managedcluster.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final ManagedCluster managedCluster = mapper.readValue(originalJson, ManagedCluster.class); @@ -55,17 +55,17 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given ManagedClusterBuilder managedClusterBuilder = new ManagedClusterBuilder() - .withNewMetadata() - .addToLabels("vendor", "OpenShift") - .withName("cluster1") - .endMetadata() - .withNewSpec() - .withHubAcceptsClient(true) - .addNewManagedClusterClientConfig() - .withCaBundle("test") - .withUrl("https://test.com") - .endManagedClusterClientConfig() - .endSpec(); + .withNewMetadata() + .addToLabels("vendor", "OpenShift") + .withName("cluster1") + .endMetadata() + .withNewSpec() + .withHubAcceptsClient(true) + .addNewManagedClusterClientConfig() + .withCaBundle("test") + .withUrl("https://test.com") + .endManagedClusterClientConfig() + .endSpec(); // When ManagedCluster managedCluster = managedClusterBuilder.build(); diff --git a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/PlacementDecisionTest.java b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/PlacementDecisionTest.java index 2460400524c..83b822ee180 100644 --- a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/PlacementDecisionTest.java +++ b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/PlacementDecisionTest.java @@ -25,7 +25,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; class PlacementDecisionTest { private final ObjectMapper mapper = new ObjectMapper(); @@ -34,8 +33,8 @@ class PlacementDecisionTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-placementdecision.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final PlacementDecision placementDecision = mapper.readValue(originalJson, PlacementDecision.class); @@ -45,24 +44,24 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Then assertNotNull(placementDecision); assertNotNull(serializedJson); - assertNotNull( placementDecisionFromSerializedJson); - assertEquals(placementDecision.getMetadata().getName(), placementDecisionFromSerializedJson.getMetadata().getName()); + assertNotNull(placementDecisionFromSerializedJson); + assertEquals(placementDecision.getMetadata().getName(), placementDecisionFromSerializedJson.getMetadata().getName()); } @Test void builderShouldCreateObject() { // Given PlacementDecisionBuilder placementDecisionBuilder = new PlacementDecisionBuilder() - .withNewMetadata() - .addToLabels("vendor", "OpenShift") - .withName("placement1-decision1") - .endMetadata() - .withNewStatus() - .addNewDecision() - .withClusterName("cluster1") - .withReason("somereason") - .endDecision() - .endStatus(); + .withNewMetadata() + .addToLabels("vendor", "OpenShift") + .withName("placement1-decision1") + .endMetadata() + .withNewStatus() + .addNewDecision() + .withClusterName("cluster1") + .withReason("somereason") + .endDecision() + .endStatus(); // When PlacementDecision placementDecision = placementDecisionBuilder.build(); diff --git a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/PlacementTest.java b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/PlacementTest.java index 954c1e331c5..c1d3461c50c 100644 --- a/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/PlacementTest.java +++ b/extensions/open-cluster-management/model-cluster/src/test/java/io/fabric8/openclustermanagement/api/model/cluster/PlacementTest.java @@ -33,8 +33,8 @@ class PlacementTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-placement.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final Placement placement = mapper.readValue(originalJson, Placement.class); @@ -52,19 +52,19 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given PlacementBuilder placementBuilder = new PlacementBuilder() - .withNewMetadata() - .withName("placement1") - .withNamespace("ns1") - .endMetadata() - .withNewSpec() - .addNewPredicate() - .withNewRequiredClusterSelector() - .withNewLabelSelector() - .addToMatchLabels("vendor", "OpenShift") - .endLabelSelector() - .endRequiredClusterSelector() - .endPredicate() - .endSpec(); + .withNewMetadata() + .withName("placement1") + .withNamespace("ns1") + .endMetadata() + .withNewSpec() + .addNewPredicate() + .withNewRequiredClusterSelector() + .withNewLabelSelector() + .addToMatchLabels("vendor", "OpenShift") + .endLabelSelector() + .endRequiredClusterSelector() + .endPredicate() + .endSpec(); // When Placement placement = placementBuilder.build(); @@ -74,9 +74,9 @@ void builderShouldCreateObject() { assertEquals("placement1", placement.getMetadata().getName()); assertEquals(1, placement.getSpec().getPredicates().size()); assertEquals("OpenShift", placement.getSpec().getPredicates().get(0) - .getRequiredClusterSelector() - .getLabelSelector() - .getMatchLabels() - .get("vendor")); + .getRequiredClusterSelector() + .getLabelSelector() + .getMatchLabels() + .get("vendor")); } } diff --git a/extensions/open-cluster-management/model-discovery/src/test/java/io/fabric8/openclustermanagement/api/model/discovery/DiscoveredClusterTest.java b/extensions/open-cluster-management/model-discovery/src/test/java/io/fabric8/openclustermanagement/api/model/discovery/DiscoveredClusterTest.java index 87eaf70641c..d3d093a8fd3 100644 --- a/extensions/open-cluster-management/model-discovery/src/test/java/io/fabric8/openclustermanagement/api/model/discovery/DiscoveredClusterTest.java +++ b/extensions/open-cluster-management/model-discovery/src/test/java/io/fabric8/openclustermanagement/api/model/discovery/DiscoveredClusterTest.java @@ -33,8 +33,8 @@ class DiscoveredClusterTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-discoveredcluster.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final DiscoveredCluster discoveredCluster = mapper.readValue(originalJson, DiscoveredCluster.class); @@ -53,15 +53,15 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given DiscoveredClusterBuilder subscriptionBuilder = new DiscoveredClusterBuilder() - .withNewMetadata() - .withName("sample_discoveredcluster") - .endMetadata() - .withNewSpec() - .withName("crc-cluster") - .withApiUrl("https://api.crc.testing:6443") - .withCloudProvider("RedHat") - .withDisplayName("Crc") - .endSpec(); + .withNewMetadata() + .withName("sample_discoveredcluster") + .endMetadata() + .withNewSpec() + .withName("crc-cluster") + .withApiUrl("https://api.crc.testing:6443") + .withCloudProvider("RedHat") + .withDisplayName("Crc") + .endSpec(); // When DiscoveredCluster subscription = subscriptionBuilder.build(); diff --git a/extensions/open-cluster-management/model-discovery/src/test/java/io/fabric8/openclustermanagement/api/model/discovery/DiscoveryConfigTest.java b/extensions/open-cluster-management/model-discovery/src/test/java/io/fabric8/openclustermanagement/api/model/discovery/DiscoveryConfigTest.java index 34023e8fb88..3d8a84909eb 100644 --- a/extensions/open-cluster-management/model-discovery/src/test/java/io/fabric8/openclustermanagement/api/model/discovery/DiscoveryConfigTest.java +++ b/extensions/open-cluster-management/model-discovery/src/test/java/io/fabric8/openclustermanagement/api/model/discovery/DiscoveryConfigTest.java @@ -33,8 +33,8 @@ class DiscoveryConfigTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-discoveryconfig.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final DiscoveryConfig discoveryConfig = mapper.readValue(originalJson, DiscoveryConfig.class); @@ -54,15 +54,15 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given DiscoveryConfigBuilder subscriptionBuilder = new DiscoveryConfigBuilder() - .withNewMetadata() - .withName("sample_discovery") - .endMetadata() - .withNewSpec() - .withCredential("ocm-api-token") - .withNewFilters() - .withLastActive(7) - .endFilters() - .endSpec(); + .withNewMetadata() + .withName("sample_discovery") + .endMetadata() + .withNewSpec() + .withCredential("ocm-api-token") + .withNewFilters() + .withLastActive(7) + .endFilters() + .endSpec(); // When DiscoveryConfig subscription = subscriptionBuilder.build(); diff --git a/extensions/open-cluster-management/model-observability/src/test/java/io/fabric8/openclustermanagement/api/model/multiclusterobservabilityoperator/apps/MultiClusterObservabilityTest.java b/extensions/open-cluster-management/model-observability/src/test/java/io/fabric8/openclustermanagement/api/model/multiclusterobservabilityoperator/apps/MultiClusterObservabilityTest.java index 946ebed5f91..14bbb9b75ec 100644 --- a/extensions/open-cluster-management/model-observability/src/test/java/io/fabric8/openclustermanagement/api/model/multiclusterobservabilityoperator/apps/MultiClusterObservabilityTest.java +++ b/extensions/open-cluster-management/model-observability/src/test/java/io/fabric8/openclustermanagement/api/model/multiclusterobservabilityoperator/apps/MultiClusterObservabilityTest.java @@ -34,8 +34,8 @@ class MultiClusterObservabilityTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-multiclusterobservability.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final MultiClusterObservability multiClusterObservability = mapper.readValue(originalJson, MultiClusterObservability.class); @@ -52,7 +52,8 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { assertEquals(10, multiClusterObservability.getSpec().getObservabilityAddonSpec().getInterval()); assertEquals(1, multiClusterObservability.getSpec().getObservabilityAddonSpec().getResources().getLimits().size()); assertEquals(1, multiClusterObservability.getSpec().getObservabilityAddonSpec().getResources().getRequests().size()); - assertEquals("thanos-object-storage", multiClusterObservability.getSpec().getStorageConfig().getMetricObjectStorage().getName()); + assertEquals("thanos-object-storage", + multiClusterObservability.getSpec().getStorageConfig().getMetricObjectStorage().getName()); assertEquals("thanos.yaml", multiClusterObservability.getSpec().getStorageConfig().getMetricObjectStorage().getKey()); } @@ -60,11 +61,11 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given MultiClusterObservabilityBuilder multiClusterObservabilityBuilder = new MultiClusterObservabilityBuilder() - .withNewMetadata() - .withName("sample_mch") - .endMetadata() - .withNewSpec() - .endSpec(); + .withNewMetadata() + .withName("sample_mch") + .endMetadata() + .withNewSpec() + .endSpec(); // When MultiClusterObservability mch = multiClusterObservabilityBuilder.build(); diff --git a/extensions/open-cluster-management/model-observability/src/test/java/io/fabric8/openclustermanagement/api/model/multiclusterobservabilityoperator/apps/ObservabilityAddonTest.java b/extensions/open-cluster-management/model-observability/src/test/java/io/fabric8/openclustermanagement/api/model/multiclusterobservabilityoperator/apps/ObservabilityAddonTest.java index 6c0f9a5344f..3d499ce0bf8 100644 --- a/extensions/open-cluster-management/model-observability/src/test/java/io/fabric8/openclustermanagement/api/model/multiclusterobservabilityoperator/apps/ObservabilityAddonTest.java +++ b/extensions/open-cluster-management/model-observability/src/test/java/io/fabric8/openclustermanagement/api/model/multiclusterobservabilityoperator/apps/ObservabilityAddonTest.java @@ -34,8 +34,8 @@ class ObservabilityAddonTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-observabilityaddon.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final ObservabilityAddon observabilityAddon = mapper.readValue(originalJson, ObservabilityAddon.class); @@ -55,13 +55,13 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given ObservabilityAddonBuilder observabilityAddonBuilder = new ObservabilityAddonBuilder() - .withNewMetadata() - .withName("observability-addon") - .endMetadata() - .withNewSpec() - .withEnableMetrics(true) - .withInterval(10) - .endSpec(); + .withNewMetadata() + .withName("observability-addon") + .endMetadata() + .withNewSpec() + .withEnableMetrics(true) + .withInterval(10) + .endSpec(); // When ObservabilityAddon observabilityAddon = observabilityAddonBuilder.build(); diff --git a/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/ClusterManagerTest.java b/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/ClusterManagerTest.java index 6fab340d021..24a316d4310 100644 --- a/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/ClusterManagerTest.java +++ b/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/ClusterManagerTest.java @@ -33,8 +33,8 @@ class ClusterManagerTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-clustermanager.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final ClusterManager clusterManager = mapper.readValue(originalJson, ClusterManager.class); @@ -55,14 +55,14 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given ClusterManagerBuilder clusterManagerBuilder = new ClusterManagerBuilder() - .withNewMetadata() - .withName("cluster-manager") - .endMetadata() - .withNewSpec() - .withRegistrationImagePullSpec("quay.io/open-cluster-management/registration") - .withWorkImagePullSpec("quay.io/open-cluster-management/work") - .withPlacementImagePullSpec("quay.io/open-cluster-management/placement") - .endSpec(); + .withNewMetadata() + .withName("cluster-manager") + .endMetadata() + .withNewSpec() + .withRegistrationImagePullSpec("quay.io/open-cluster-management/registration") + .withWorkImagePullSpec("quay.io/open-cluster-management/work") + .withPlacementImagePullSpec("quay.io/open-cluster-management/placement") + .endSpec(); // When ClusterManager clusterManager = clusterManagerBuilder.build(); diff --git a/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/KlusterletTest.java b/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/KlusterletTest.java index 5b7fa389706..bb7d6325592 100644 --- a/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/KlusterletTest.java +++ b/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/KlusterletTest.java @@ -33,8 +33,8 @@ class KlusterletTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-klusterlet.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final Klusterlet klusterlet = mapper.readValue(originalJson, Klusterlet.class); @@ -57,18 +57,18 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given KlusterletBuilder klusterletBuilder = new KlusterletBuilder() - .withNewMetadata() - .withName("klusterlet") - .endMetadata() - .withNewSpec() - .withRegistrationImagePullSpec("quay.io/open-cluster-management/registration") - .withWorkImagePullSpec("quay.io/open-cluster-management/work") - .withClusterName("cluster1") - .withNamespace("open-cluster-management-agent") - .addNewExternalServerURL() - .withUrl("https://localhost") - .endExternalServerURL() - .endSpec(); + .withNewMetadata() + .withName("klusterlet") + .endMetadata() + .withNewSpec() + .withRegistrationImagePullSpec("quay.io/open-cluster-management/registration") + .withWorkImagePullSpec("quay.io/open-cluster-management/work") + .withClusterName("cluster1") + .withNamespace("open-cluster-management-agent") + .addNewExternalServerURL() + .withUrl("https://localhost") + .endExternalServerURL() + .endSpec(); // When Klusterlet klusterlet = klusterletBuilder.build(); diff --git a/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/MultiClusterHubTest.java b/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/MultiClusterHubTest.java index dd39f40e66b..a8fc88f59e7 100644 --- a/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/MultiClusterHubTest.java +++ b/extensions/open-cluster-management/model-operator/src/test/java/io/fabric8/openclustermanagement/api/model/operator/MultiClusterHubTest.java @@ -34,8 +34,8 @@ class MultiClusterHubTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-multiclusterhub.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final MultiClusterHub multiClusterHub = mapper.readValue(originalJson, MultiClusterHub.class); @@ -55,13 +55,13 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given MultiClusterHubBuilder multiClusterHubBuilder = new MultiClusterHubBuilder() - .withNewMetadata() - .withName("sample_mch") - .endMetadata() - .withNewSpec() - .withImagePullSecret("redhat-registry") - .withDisableHubSelfManagement(false) - .endSpec(); + .withNewMetadata() + .withName("sample_mch") + .endMetadata() + .withNewSpec() + .withImagePullSecret("redhat-registry") + .withDisableHubSelfManagement(false) + .endSpec(); // When MultiClusterHub multiClusterHub = multiClusterHubBuilder.build(); diff --git a/extensions/open-cluster-management/model-placementruleapps/src/test/java/io/fabric8/openclustermanagement/api/model/multicloudoperatorsplacementrule/apps/GitOpsClusterTest.java b/extensions/open-cluster-management/model-placementruleapps/src/test/java/io/fabric8/openclustermanagement/api/model/multicloudoperatorsplacementrule/apps/GitOpsClusterTest.java index 7e38ebf4a73..6736fb80d21 100644 --- a/extensions/open-cluster-management/model-placementruleapps/src/test/java/io/fabric8/openclustermanagement/api/model/multicloudoperatorsplacementrule/apps/GitOpsClusterTest.java +++ b/extensions/open-cluster-management/model-placementruleapps/src/test/java/io/fabric8/openclustermanagement/api/model/multicloudoperatorsplacementrule/apps/GitOpsClusterTest.java @@ -33,8 +33,8 @@ class GitOpsClusterTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-gitopscluster.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final GitOpsCluster gitOpsCluster = mapper.readValue(originalJson, GitOpsCluster.class); @@ -58,21 +58,21 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given GitOpsClusterBuilder gitOpsClusterBuilder = new GitOpsClusterBuilder() - .withNewMetadata() - .withName("argo-acm-importer") - .endMetadata() - .withNewSpec() - .withNewArgoServer() - .withCluster("notused") - .withArgoNamespace("openshift-gitops") - .endArgoServer() - .withNewPlacementRef() - .withApiVersion("cluster.open-cluster-management.io/v1alpha1") - .withKind("Placement") - .withName("all-openshift-clusters") - .withNamespace("openshift-gitops") - .endPlacementRef() - .endSpec(); + .withNewMetadata() + .withName("argo-acm-importer") + .endMetadata() + .withNewSpec() + .withNewArgoServer() + .withCluster("notused") + .withArgoNamespace("openshift-gitops") + .endArgoServer() + .withNewPlacementRef() + .withApiVersion("cluster.open-cluster-management.io/v1alpha1") + .withKind("Placement") + .withName("all-openshift-clusters") + .withNamespace("openshift-gitops") + .endPlacementRef() + .endSpec(); // When GitOpsCluster gitOpsCluster = gitOpsClusterBuilder.build(); diff --git a/extensions/open-cluster-management/model-placementruleapps/src/test/java/io/fabric8/openclustermanagement/api/model/multicloudoperatorsplacementrule/apps/PlacementRuleTest.java b/extensions/open-cluster-management/model-placementruleapps/src/test/java/io/fabric8/openclustermanagement/api/model/multicloudoperatorsplacementrule/apps/PlacementRuleTest.java index c09af741e7a..2ded1f69e49 100644 --- a/extensions/open-cluster-management/model-placementruleapps/src/test/java/io/fabric8/openclustermanagement/api/model/multicloudoperatorsplacementrule/apps/PlacementRuleTest.java +++ b/extensions/open-cluster-management/model-placementruleapps/src/test/java/io/fabric8/openclustermanagement/api/model/multicloudoperatorsplacementrule/apps/PlacementRuleTest.java @@ -33,8 +33,8 @@ class PlacementRuleTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-placementrule.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final PlacementRule placementRule = mapper.readValue(originalJson, PlacementRule.class); @@ -57,19 +57,19 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given PlacementRuleBuilder placementRuleBuilder = new PlacementRuleBuilder() - .withNewMetadata() - .withName("all-ready-clusters") - .endMetadata() - .withNewSpec() - .withClusterReplicas(1) - .addNewClusterCondition() - .withStatus("True") - .withType("ManagedClusterConditionAvailable") - .endClusterCondition() - .addNewCluster().withName("cluster1").endCluster() - .addNewCluster().withName("cluster2").endCluster() - .addNewCluster().withName("cluster3").endCluster() - .endSpec(); + .withNewMetadata() + .withName("all-ready-clusters") + .endMetadata() + .withNewSpec() + .withClusterReplicas(1) + .addNewClusterCondition() + .withStatus("True") + .withType("ManagedClusterConditionAvailable") + .endClusterCondition() + .addNewCluster().withName("cluster1").endCluster() + .addNewCluster().withName("cluster2").endCluster() + .addNewCluster().withName("cluster3").endCluster() + .endSpec(); // When PlacementRule placementRule = placementRuleBuilder.build(); diff --git a/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PlacementBindingTest.java b/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PlacementBindingTest.java index e365e57865c..6a3b0a7f95e 100644 --- a/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PlacementBindingTest.java +++ b/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PlacementBindingTest.java @@ -33,8 +33,8 @@ class PlacementBindingTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-placementbinding.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final PlacementBinding placementBinding = mapper.readValue(originalJson, PlacementBinding.class); @@ -56,19 +56,19 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given PlacementBindingBuilder placementBindingBuilder = new PlacementBindingBuilder() - .withNewMetadata() - .withName("test-policy-pb") - .endMetadata() - .withNewPlacementRef() - .withName("test-policy-plr") - .withApiGroup("apps.open-cluster-management.io") - .withKind("PlacementRule") - .endPlacementRef() - .addNewSubject() - .withName("test-policy") - .withApiGroup("policy.open-cluster-management.io") - .withKind("Policy") - .endSubject(); + .withNewMetadata() + .withName("test-policy-pb") + .endMetadata() + .withNewPlacementRef() + .withName("test-policy-plr") + .withApiGroup("apps.open-cluster-management.io") + .withKind("PlacementRule") + .endPlacementRef() + .addNewSubject() + .withName("test-policy") + .withApiGroup("policy.open-cluster-management.io") + .withKind("Policy") + .endSubject(); // When PlacementBinding placementBinding = placementBindingBuilder.build(); diff --git a/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PolicyAutomationTest.java b/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PolicyAutomationTest.java index 0aae882aaf7..36398e5232e 100644 --- a/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PolicyAutomationTest.java +++ b/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PolicyAutomationTest.java @@ -34,8 +34,8 @@ class PolicyAutomationTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-policyautomation.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final PolicyAutomation policyAutomation = mapper.readValue(originalJson, PolicyAutomation.class); @@ -59,21 +59,21 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given PolicyAutomationBuilder policyAutomationBuilder = new PolicyAutomationBuilder() - .withNewMetadata() - .withName("create-service-now-ticket") - .endMetadata() - .withNewSpec() - .withEventHook("noncompliant") - .withPolicyRef("case5-test-policy") - .withMode("disabled") - .withNewAutomationDef() - .withName("Demo Job Template") - .withSecret("toweraccess") - .addToExtraVars("sn_severity", 1) - .addToExtraVars("sn_priority", 1) - .addToExtraVars("target_clusters", Collections.singletonList("cluster1")) - .endAutomationDef() - .endSpec(); + .withNewMetadata() + .withName("create-service-now-ticket") + .endMetadata() + .withNewSpec() + .withEventHook("noncompliant") + .withPolicyRef("case5-test-policy") + .withMode("disabled") + .withNewAutomationDef() + .withName("Demo Job Template") + .withSecret("toweraccess") + .addToExtraVars("sn_severity", 1) + .addToExtraVars("sn_priority", 1) + .addToExtraVars("target_clusters", Collections.singletonList("cluster1")) + .endAutomationDef() + .endSpec(); // When PolicyAutomation policyAutomation = policyAutomationBuilder.build(); diff --git a/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PolicyTest.java b/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PolicyTest.java index 649f94eb340..6d054076ade 100644 --- a/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PolicyTest.java +++ b/extensions/open-cluster-management/model-policy/src/test/java/io/fabric8/openclustermanagement/api/model/governancepolicypropagator/policy/PolicyTest.java @@ -35,8 +35,8 @@ class PolicyTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-policy.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final Policy policy = mapper.readValue(originalJson, Policy.class); @@ -57,16 +57,16 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given PolicyBuilder policyBuilder = new PolicyBuilder() - .withNewMetadata() - .withName("test-policy-swagger") - .endMetadata() - .withNewSpec() - .withDisabled(false) - .withRemediationAction("enforce") - .addNewPolicyTemplate() - .withObjectDefinition(Collections.singletonMap("kind", "ConfigurationPolicy")) - .endPolicyTemplate() - .endSpec(); + .withNewMetadata() + .withName("test-policy-swagger") + .endMetadata() + .withNewSpec() + .withDisabled(false) + .withRemediationAction("enforce") + .addNewPolicyTemplate() + .withObjectDefinition(Collections.singletonMap("kind", "ConfigurationPolicy")) + .endPolicyTemplate() + .endSpec(); // When Policy policy = policyBuilder.build(); @@ -76,6 +76,7 @@ void builderShouldCreateObject() { assertEquals("test-policy-swagger", policy.getMetadata().getName()); assertEquals("enforce", policy.getSpec().getRemediationAction()); assertFalse(policy.getSpec().getDisabled()); - assertEquals(Collections.singletonMap("kind", "ConfigurationPolicy"), policy.getSpec().getPolicyTemplates().get(0).getObjectDefinition()); + assertEquals(Collections.singletonMap("kind", "ConfigurationPolicy"), + policy.getSpec().getPolicyTemplates().get(0).getObjectDefinition()); } } diff --git a/extensions/open-cluster-management/model-search/src/test/java/io/fabric8/openclustermanagement/api/model/searchoperator/SearchCustomizationTest.java b/extensions/open-cluster-management/model-search/src/test/java/io/fabric8/openclustermanagement/api/model/searchoperator/SearchCustomizationTest.java index 296d0f0605a..09f407b0f0b 100644 --- a/extensions/open-cluster-management/model-search/src/test/java/io/fabric8/openclustermanagement/api/model/searchoperator/SearchCustomizationTest.java +++ b/extensions/open-cluster-management/model-search/src/test/java/io/fabric8/openclustermanagement/api/model/searchoperator/SearchCustomizationTest.java @@ -34,8 +34,8 @@ class SearchCustomizationTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-searchcustomization.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final SearchCustomization searchCustomization = mapper.readValue(originalJson, SearchCustomization.class); @@ -54,12 +54,12 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { void builderShouldCreateObject() { // Given SearchCustomizationBuilder searchCustomizationBuilder = new SearchCustomizationBuilder() - .withNewMetadata() - .withName("searchcustomization") - .endMetadata() - .withNewSpec() - .withPersistence(true) - .endSpec(); + .withNewMetadata() + .withName("searchcustomization") + .endMetadata() + .withNewSpec() + .withPersistence(true) + .endSpec(); // When SearchCustomization searchCustomization = searchCustomizationBuilder.build(); diff --git a/extensions/open-cluster-management/model-search/src/test/java/io/fabric8/openclustermanagement/api/model/searchoperator/SearchOperatorTest.java b/extensions/open-cluster-management/model-search/src/test/java/io/fabric8/openclustermanagement/api/model/searchoperator/SearchOperatorTest.java index 9316dd8e4a8..9052e174903 100644 --- a/extensions/open-cluster-management/model-search/src/test/java/io/fabric8/openclustermanagement/api/model/searchoperator/SearchOperatorTest.java +++ b/extensions/open-cluster-management/model-search/src/test/java/io/fabric8/openclustermanagement/api/model/searchoperator/SearchOperatorTest.java @@ -33,8 +33,8 @@ class SearchOperatorTest { void deserializationAndSerializationShouldWorkAsExpected() throws IOException { // Given String originalJson = new Scanner(getClass().getResourceAsStream("/valid-searchoperator.json")) - .useDelimiter("\\A") - .next(); + .useDelimiter("\\A") + .next(); // When final SearchOperator searchOperator = mapper.readValue(originalJson, SearchOperator.class); @@ -51,29 +51,30 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException { assertEquals("1Gi", searchOperator.getSpec().getRedisgraphResource().getLimitMemory()); assertEquals("64Mi", searchOperator.getSpec().getRedisgraphResource().getRequestMemory()); assertEquals("25m", searchOperator.getSpec().getRedisgraphResource().getRequestCpu()); - assertEquals("quay.io/open-cluster-management/redisgraph-tls:2.4.0-e2ec66da43abff85a7fcf56f22ed5849e0589069", searchOperator.getSpec().getSearchimageoverrides().getRedisgraphTls()); + assertEquals("quay.io/open-cluster-management/redisgraph-tls:2.4.0-e2ec66da43abff85a7fcf56f22ed5849e0589069", + searchOperator.getSpec().getSearchimageoverrides().getRedisgraphTls()); } @Test void builderShouldCreateObject() { // Given SearchOperatorBuilder searchOperatorBuilder = new SearchOperatorBuilder() - .withNewMetadata() - .withName("searchoperator") - .endMetadata() - .withNewSpec() - .withPullpolicy("Always") - .withNewRedisgraphResource() - .withLimitMemory("1Gi") - .withRequestCpu("25m") - .withRequestMemory("64Mi") - .endRedisgraphResource() - .withPullpolicy("Always") - .withPullsecret("multiclusterhub-operator-pull-secret") - .withNewSearchimageoverrides() - .withRedisgraphTls("quay.io/open-cluster-management/redisgraph-tls:2.4.0-e2ec66da43abff85a7fcf56f22ed5849e0589069") - .endSearchimageoverrides() - .endSpec(); + .withNewMetadata() + .withName("searchoperator") + .endMetadata() + .withNewSpec() + .withPullpolicy("Always") + .withNewRedisgraphResource() + .withLimitMemory("1Gi") + .withRequestCpu("25m") + .withRequestMemory("64Mi") + .endRedisgraphResource() + .withPullpolicy("Always") + .withPullsecret("multiclusterhub-operator-pull-secret") + .withNewSearchimageoverrides() + .withRedisgraphTls("quay.io/open-cluster-management/redisgraph-tls:2.4.0-e2ec66da43abff85a7fcf56f22ed5849e0589069") + .endSearchimageoverrides() + .endSpec(); // When SearchOperator searchOperator = searchOperatorBuilder.build(); @@ -86,6 +87,7 @@ void builderShouldCreateObject() { assertEquals("1Gi", searchOperator.getSpec().getRedisgraphResource().getLimitMemory()); assertEquals("64Mi", searchOperator.getSpec().getRedisgraphResource().getRequestMemory()); assertEquals("25m", searchOperator.getSpec().getRedisgraphResource().getRequestCpu()); - assertEquals("quay.io/open-cluster-management/redisgraph-tls:2.4.0-e2ec66da43abff85a7fcf56f22ed5849e0589069", searchOperator.getSpec().getSearchimageoverrides().getRedisgraphTls()); + assertEquals("quay.io/open-cluster-management/redisgraph-tls:2.4.0-e2ec66da43abff85a7fcf56f22ed5849e0589069", + searchOperator.getSpec().getSearchimageoverrides().getRedisgraphTls()); } } diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/GenericServiceCatalogClient.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/GenericServiceCatalogClient.java index 36f87c45919..b59f2c99e08 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/GenericServiceCatalogClient.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/GenericServiceCatalogClient.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericServiceCatalogClient extends Client, ServiceCatalogClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/NamespacedServiceCatalogClient.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/NamespacedServiceCatalogClient.java index c3efe7e69f3..4ec45e0f1d6 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/NamespacedServiceCatalogClient.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/NamespacedServiceCatalogClient.java @@ -16,5 +16,5 @@ package io.fabric8.servicecatalog.client; public interface NamespacedServiceCatalogClient extends ServiceCatalogClient, - GenericServiceCatalogClient { + GenericServiceCatalogClient { } diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/ServiceCatalogClient.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/ServiceCatalogClient.java index 94c3e934320..937c34d1778 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/ServiceCatalogClient.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/ServiceCatalogClient.java @@ -15,7 +15,6 @@ */ package io.fabric8.servicecatalog.client; - import io.fabric8.kubernetes.client.Client; import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServiceBrokerResource.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServiceBrokerResource.java index 3a7f675f7d6..017a7ff52a0 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServiceBrokerResource.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServiceBrokerResource.java @@ -22,27 +22,28 @@ public interface ClusterServiceBrokerResource extends Resource { + /** + * List all {@link io.fabric8.servicecatalog.api.model.ClusterServicePlan}s available to the current broker. + * It's an alternative of listing all plans and filtering by field. + * + * @return The list of plans. + */ + ClusterServicePlanList listPlans(); - /** - * List all {@link io.fabric8.servicecatalog.api.model.ClusterServicePlan}s available to the current broker. - * It's an alternative of listing all plans and filtering by field. - * @return The list of plans. - */ - ClusterServicePlanList listPlans(); + /** + * List all {@link io.fabric8.servicecatalog.api.model.ClusterServiceClass}es available to the current broker. + * It's an alternative of listing all classes and filtering by field. + * + * @return The list of plans. + */ + ClusterServiceClassList listClasses(); - /** - * List all {@link io.fabric8.servicecatalog.api.model.ClusterServiceClass}es available to the current broker. - * It's an alternative of listing all classes and filtering by field. - * @return The list of plans. - */ - ClusterServiceClassList listClasses(); - - - /** - * Switch to the {@link ClusterServiceClassResource} with the specified external name. - * @param externalName - * @return the resource. - * @throws IllegalArgumentException if no unique resource with externalName is found. - */ - ClusterServiceClassResource useServiceClass(String externalName); + /** + * Switch to the {@link ClusterServiceClassResource} with the specified external name. + * + * @param externalName + * @return the resource. + * @throws IllegalArgumentException if no unique resource with externalName is found. + */ + ClusterServiceClassResource useServiceClass(String externalName); } diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServiceClassResource.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServiceClassResource.java index cfe0064f7b1..55337039e94 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServiceClassResource.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServiceClassResource.java @@ -20,15 +20,16 @@ public interface ClusterServiceClassResource extends Resource { - ClusterServicePlanList listPlans(); + ClusterServicePlanList listPlans(); - /** - * Switch to the {@link ClusterServicePlanResource} with the specified external name. - * @param externalName - * @return the resource. - * @throws IllegalArgumentException if no unique resource with externalName is found. - */ - ClusterServicePlanResource usePlan(String externalName); + /** + * Switch to the {@link ClusterServicePlanResource} with the specified external name. + * + * @param externalName + * @return the resource. + * @throws IllegalArgumentException if no unique resource with externalName is found. + */ + ClusterServicePlanResource usePlan(String externalName); - ServiceInstance instantiate(String instanceName, String plan); + ServiceInstance instantiate(String instanceName, String plan); } diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServicePlanResource.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServicePlanResource.java index 3bde3190697..d3f8302fbad 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServicePlanResource.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ClusterServicePlanResource.java @@ -18,20 +18,21 @@ import io.fabric8.kubernetes.client.dsl.Resource; import io.fabric8.servicecatalog.api.model.*; - public interface ClusterServicePlanResource extends Resource { - /** - * Instantiate the {@link ClusterServicePlan}. - * @param args The instance name, or the namespace and instance name (var-arg). - * @return The {@link ServiceInstance}. - */ - ServiceInstance instantiate(String... args); + /** + * Instantiate the {@link ClusterServicePlan}. + * + * @param args The instance name, or the namespace and instance name (var-arg). + * @return The {@link ServiceInstance}. + */ + ServiceInstance instantiate(String... args); - /** - * Instantiate the {@link ClusterServicePlan} and returns the {@link ServiceInstanceResource}. - * @param args The instance name, or the namespace and instance name (var-arg). - * @return The {@link ServiceInstanceResource}. - */ - ServiceInstanceResource instantiateAnd(String... args); + /** + * Instantiate the {@link ClusterServicePlan} and returns the {@link ServiceInstanceResource}. + * + * @param args The instance name, or the namespace and instance name (var-arg). + * @return The {@link ServiceInstanceResource}. + */ + ServiceInstanceResource instantiateAnd(String... args); } diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ServiceBindingResource.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ServiceBindingResource.java index 986329fea42..0cd342a55ba 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ServiceBindingResource.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ServiceBindingResource.java @@ -21,5 +21,5 @@ public interface ServiceBindingResource extends Resource { - Secret getSecret(); + Secret getSecret(); } diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ServiceInstanceResource.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ServiceInstanceResource.java index 75a2f266898..1b07eeabc0a 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ServiceInstanceResource.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/dsl/ServiceInstanceResource.java @@ -18,8 +18,7 @@ import io.fabric8.kubernetes.client.dsl.Resource; import io.fabric8.servicecatalog.api.model.*; - public interface ServiceInstanceResource extends Resource { - ServiceBinding bind(String secretName); + ServiceBinding bind(String secretName); } diff --git a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/util/ApiVersionUtil.java b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/util/ApiVersionUtil.java index e06b2bba8e0..03321ed5b3c 100644 --- a/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/util/ApiVersionUtil.java +++ b/extensions/service-catalog/client/src/main/java/io/fabric8/servicecatalog/client/util/ApiVersionUtil.java @@ -29,15 +29,16 @@ private ApiVersionUtil() { throw new IllegalStateException("Utility class"); } - /** + /** * Extracts apiGroupName from apiGroupVersion when in resource for apiGroupName/apiGroupVersion combination - * @param item resource which is being used - * @param apiGroup apiGroupName present if any - * @return Just the apiGroupName part without apiGroupVersion + * + * @param item resource which is being used + * @param apiGroup apiGroupName present if any + * @return Just the apiGroupName part without apiGroupVersion */ public static String apiGroup(T item, String apiGroup) { - if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) { + if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) { return trimGroupOrNull(((HasMetadata) item).getApiVersion()); } else if (apiGroup != null && !apiGroup.isEmpty()) { return trimGroup(apiGroup); @@ -47,6 +48,7 @@ public static String apiGroup(T item, String apiGroup) { /** * Returns the api version falling back to the items apiGroupVersion if not null. + * * @param * @param item * @param apiVersion @@ -63,8 +65,9 @@ public static String apiVersion(T item, String apiVersion) { /** * Separates apiGroupVersion for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupVersion part without the apiGroupName. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupVersion part without the apiGroupName. */ private static String trimVersion(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { @@ -74,10 +77,11 @@ private static String trimVersion(String apiVersion) { return apiVersion; } - /** + /** * Separates apiGroupName for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupName part without the apiGroupName, or apiVersion if no separator is found. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupName part without the apiGroupName, or apiVersion if no separator is found. */ private static String trimGroup(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { @@ -87,12 +91,11 @@ private static String trimGroup(String apiVersion) { return apiVersion; } - - - /** + /** * Separates apiGroupName for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupName part without the apiGroupName, or null if no separator is found. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupName part without the apiGroupName, or null if no separator is found. */ private static String trimGroupOrNull(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { diff --git a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/CreateBinding.java b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/CreateBinding.java index 6001dc21271..be72d892bc4 100644 --- a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/CreateBinding.java +++ b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/CreateBinding.java @@ -1,4 +1,4 @@ -package io.fabric8.servicecatalog.examples; /** +/** * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,23 +14,24 @@ * limitations under the License. */ +package io.fabric8.servicecatalog.examples; + import io.fabric8.servicecatalog.api.model.ServiceBindingBuilder; import io.fabric8.servicecatalog.client.ServiceCatalogClient; - public class CreateBinding { - public static void main(String[] args) { - ServiceCatalogClient client = ClientFactory.newClient(args); - System.out.println("Creating a service binding"); - client.serviceBindings().inNamespace("iocanel").create(new ServiceBindingBuilder() - .withNewMetadata() - .withName("mybinding") - .endMetadata() - .withNewSpec() - .withNewInstanceRef("myservice") - .withSecretName("mysercret") - .endSpec().build()); + public static void main(String[] args) { + ServiceCatalogClient client = ClientFactory.newClient(args); + System.out.println("Creating a service binding"); + client.serviceBindings().inNamespace("iocanel").create(new ServiceBindingBuilder() + .withNewMetadata() + .withName("mybinding") + .endMetadata() + .withNewSpec() + .withNewInstanceRef("myservice") + .withSecretName("mysercret") + .endSpec().build()); - } + } } diff --git a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/CreateBroker.java b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/CreateBroker.java index 71c339e2176..091e252aed9 100644 --- a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/CreateBroker.java +++ b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/CreateBroker.java @@ -1,4 +1,4 @@ -package io.fabric8.servicecatalog.examples; /** +/** * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +14,8 @@ * limitations under the License. */ +package io.fabric8.servicecatalog.examples; + import io.fabric8.servicecatalog.api.model.ClusterServiceBroker; import io.fabric8.servicecatalog.api.model.ClusterServiceBrokerBuilder; import io.fabric8.servicecatalog.client.ServiceCatalogClient; @@ -21,14 +23,14 @@ public class CreateBroker { public static void main(String[] args) { - ServiceCatalogClient client = ClientFactory.newClient(args); - ClusterServiceBroker broker = client.clusterServiceBrokers().create(new ClusterServiceBrokerBuilder() - .withNewMetadata() - .withName("mybroker") - .endMetadata() - .withNewSpec() - .withUrl("http://url.to.service.broker") - .endSpec() - .build()); + ServiceCatalogClient client = ClientFactory.newClient(args); + ClusterServiceBroker broker = client.clusterServiceBrokers().create(new ClusterServiceBrokerBuilder() + .withNewMetadata() + .withName("mybroker") + .endMetadata() + .withNewSpec() + .withUrl("http://url.to.service.broker") + .endSpec() + .build()); } } diff --git a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListBrokers.java b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListBrokers.java index 877933d4e10..424c2b15d9b 100644 --- a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListBrokers.java +++ b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListBrokers.java @@ -1,4 +1,4 @@ -package io.fabric8.servicecatalog.examples; /** +/** * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,18 +14,20 @@ * limitations under the License. */ +package io.fabric8.servicecatalog.examples; + import io.fabric8.servicecatalog.api.model.ClusterServiceBrokerList; import io.fabric8.servicecatalog.client.ServiceCatalogClient; public class ListBrokers { public static void main(String[] args) { - ServiceCatalogClient client = ClientFactory.newClient(args); - ClusterServiceBrokerList list = client.clusterServiceBrokers().list(); - System.out.println("Listing Cluster Service Brokers:"); - list.getItems().stream() - .map(b->b.getMetadata().getName()) - .forEach(System.out::println); - System.out.println("Done"); + ServiceCatalogClient client = ClientFactory.newClient(args); + ClusterServiceBrokerList list = client.clusterServiceBrokers().list(); + System.out.println("Listing Cluster Service Brokers:"); + list.getItems().stream() + .map(b -> b.getMetadata().getName()) + .forEach(System.out::println); + System.out.println("Done"); } } diff --git a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceClasses.java b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceClasses.java index 9deb91328ee..7536f9edeb7 100644 --- a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceClasses.java +++ b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceClasses.java @@ -1,4 +1,4 @@ -package io.fabric8.servicecatalog.examples; /** +/** * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +14,8 @@ * limitations under the License. */ +package io.fabric8.servicecatalog.examples; + import io.fabric8.servicecatalog.api.model.ClusterServiceClassList; import io.fabric8.servicecatalog.client.ServiceCatalogClient; import org.slf4j.Logger; @@ -23,11 +25,12 @@ public class ListServiceClasses { private static final Logger logger = LoggerFactory.getLogger(ListServiceClasses.class.getSimpleName()); public static void main(String[] args) { - ServiceCatalogClient client = ClientFactory.newClient(args); - logger.info("Listing Cluster Service Classes:"); - ClusterServiceClassList list = client.clusterServiceClasses().list(); - list.getItems() - .forEach(b -> logger.info(b.getSpec().getClusterServiceBrokerName() + "\t\t" + b.getSpec().getExternalName() + "\t\t\t\t" + b.getMetadata().getName())); - logger.info("Done"); + ServiceCatalogClient client = ClientFactory.newClient(args); + logger.info("Listing Cluster Service Classes:"); + ClusterServiceClassList list = client.clusterServiceClasses().list(); + list.getItems() + .forEach(b -> logger.info(b.getSpec().getClusterServiceBrokerName() + "\t\t" + b.getSpec().getExternalName() + + "\t\t\t\t" + b.getMetadata().getName())); + logger.info("Done"); } } diff --git a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceClassesByBroker.java b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceClassesByBroker.java index a8d0fe442f7..fa661a5260c 100644 --- a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceClassesByBroker.java +++ b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceClassesByBroker.java @@ -1,4 +1,4 @@ -package io.fabric8.servicecatalog.examples; /** +/** * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,25 +14,27 @@ * limitations under the License. */ +package io.fabric8.servicecatalog.examples; + import io.fabric8.servicecatalog.api.model.ClusterServiceClassList; import io.fabric8.servicecatalog.client.ServiceCatalogClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ListServiceClassesByBroker { - private static final Logger logger = LoggerFactory.getLogger(ListServiceClassesByBroker.class.getSimpleName()); + private static final Logger logger = LoggerFactory.getLogger(ListServiceClassesByBroker.class.getSimpleName()); - public static void main(String[] args) { - ServiceCatalogClient client = ClientFactory.newClient(args); - String broker = ClientFactory.getOptions(args, "--broker", null); - if (broker == null || broker.isEmpty()) { - logger.info("Missing --broker option!"); - System.exit(1); - } - logger.info("Listing Cluster Service Classes {} :", broker); - ClusterServiceClassList list = client.clusterServiceBrokers().withName(broker).listClasses(); - list.getItems() - .forEach(b -> logger.info(b.getSpec().getExternalName() + "\t\t\t\t" + b.getMetadata().getName())); - logger.info("Done"); + public static void main(String[] args) { + ServiceCatalogClient client = ClientFactory.newClient(args); + String broker = ClientFactory.getOptions(args, "--broker", null); + if (broker == null || broker.isEmpty()) { + logger.info("Missing --broker option!"); + System.exit(1); } + logger.info("Listing Cluster Service Classes {} :", broker); + ClusterServiceClassList list = client.clusterServiceBrokers().withName(broker).listClasses(); + list.getItems() + .forEach(b -> logger.info(b.getSpec().getExternalName() + "\t\t\t\t" + b.getMetadata().getName())); + logger.info("Done"); + } } diff --git a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceInstances.java b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceInstances.java index 92ddd9d46b6..d74f4f0cd77 100644 --- a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceInstances.java +++ b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServiceInstances.java @@ -1,4 +1,4 @@ -package io.fabric8.servicecatalog.examples; /** +/** * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +14,7 @@ * limitations under the License. */ +package io.fabric8.servicecatalog.examples; import io.fabric8.servicecatalog.api.model.ServiceInstanceList; import io.fabric8.servicecatalog.client.ServiceCatalogClient; @@ -24,13 +25,13 @@ public class ListServiceInstances { private static final Logger logger = LoggerFactory.getLogger(ListServiceInstances.class.getSimpleName()); public static void main(String[] args) { - ServiceCatalogClient client = ClientFactory.newClient(args); - ServiceInstanceList list = client.serviceInstances().inNamespace("iocanel").list(); + ServiceCatalogClient client = ClientFactory.newClient(args); + ServiceInstanceList list = client.serviceInstances().inNamespace("iocanel").list(); - logger.info("Listing Service Instances:"); - list.getItems() - .forEach(b -> logger.info(b.getMetadata().getName())); + logger.info("Listing Service Instances:"); + list.getItems() + .forEach(b -> logger.info(b.getMetadata().getName())); - logger.info("Done"); + logger.info("Done"); } } diff --git a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServicePlans.java b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServicePlans.java index 8471487434d..c4d34f50289 100644 --- a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServicePlans.java +++ b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServicePlans.java @@ -1,4 +1,4 @@ -package io.fabric8.servicecatalog.examples; /** +/** * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +14,7 @@ * limitations under the License. */ +package io.fabric8.servicecatalog.examples; import io.fabric8.servicecatalog.api.model.ClusterServicePlan; import io.fabric8.servicecatalog.api.model.ClusterServicePlanList; @@ -25,12 +26,13 @@ public class ListServicePlans { private static final Logger logger = LoggerFactory.getLogger(ListServicePlans.class.getSimpleName()); public static void main(String[] args) { - ServiceCatalogClient client = ClientFactory.newClient(args); - ClusterServicePlanList list = client.clusterServicePlans().list(); - ClusterServicePlan c; - logger.info("Listing Cluster Service Plans:"); - list.getItems() - .forEach(b -> logger.info(b.getSpec().getClusterServiceBrokerName() + "\t\t\t" + b.getSpec().getClusterServiceClassRef() + "\t\t\t" + b.getSpec().getExternalName())); - logger.info("Done"); + ServiceCatalogClient client = ClientFactory.newClient(args); + ClusterServicePlanList list = client.clusterServicePlans().list(); + ClusterServicePlan c; + logger.info("Listing Cluster Service Plans:"); + list.getItems() + .forEach(b -> logger.info(b.getSpec().getClusterServiceBrokerName() + "\t\t\t" + b.getSpec().getClusterServiceClassRef() + + "\t\t\t" + b.getSpec().getExternalName())); + logger.info("Done"); } } diff --git a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServicePlansByBroker.java b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServicePlansByBroker.java index b33cdadf34a..5e8aee684f1 100644 --- a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServicePlansByBroker.java +++ b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ListServicePlansByBroker.java @@ -1,4 +1,4 @@ -package io.fabric8.servicecatalog.examples; /** +/** * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,6 +14,7 @@ * limitations under the License. */ +package io.fabric8.servicecatalog.examples; import io.fabric8.servicecatalog.api.model.ClusterServicePlanList; import io.fabric8.servicecatalog.client.ServiceCatalogClient; @@ -21,19 +22,20 @@ import org.slf4j.LoggerFactory; public class ListServicePlansByBroker { - private static final Logger logger = LoggerFactory.getLogger(ListServicePlansByBroker.class.getSimpleName()); + private static final Logger logger = LoggerFactory.getLogger(ListServicePlansByBroker.class.getSimpleName()); - public static void main(String[] args) { - ServiceCatalogClient client = ClientFactory.newClient(args); - String broker = ClientFactory.getOptions(args, "--broker", null); - if (broker == null || broker.isEmpty()) { - logger.info("Missing --broker option!"); - System.exit(1); - } - logger.info("Listing Cluster Service Plans {} :", broker); - ClusterServicePlanList list = client.clusterServiceBrokers().withName(broker).listPlans(); - list.getItems() - .forEach(b -> logger.info(b.getSpec().getClusterServiceClassRef()+ "\t\t\t" + b.getSpec().getExternalName() + "\t\t\t\t" + b.getMetadata().getName())); - logger.info("Done"); + public static void main(String[] args) { + ServiceCatalogClient client = ClientFactory.newClient(args); + String broker = ClientFactory.getOptions(args, "--broker", null); + if (broker == null || broker.isEmpty()) { + logger.info("Missing --broker option!"); + System.exit(1); } + logger.info("Listing Cluster Service Plans {} :", broker); + ClusterServicePlanList list = client.clusterServiceBrokers().withName(broker).listPlans(); + list.getItems() + .forEach(b -> logger.info(b.getSpec().getClusterServiceClassRef() + "\t\t\t" + b.getSpec().getExternalName() + + "\t\t\t\t" + b.getMetadata().getName())); + logger.info("Done"); + } } diff --git a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ProvisionService.java b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ProvisionService.java index c709baadcc8..4d86a73baad 100644 --- a/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ProvisionService.java +++ b/extensions/service-catalog/examples/src/main/java/io/fabric8/servicecatalog/examples/ProvisionService.java @@ -1,4 +1,4 @@ -package io.fabric8.servicecatalog.examples; /** +/** * Copyright (C) 2015 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,24 +14,26 @@ * limitations under the License. */ +package io.fabric8.servicecatalog.examples; + import io.fabric8.servicecatalog.api.model.ServiceInstance; import io.fabric8.servicecatalog.api.model.ServiceInstanceBuilder; import io.fabric8.servicecatalog.client.ServiceCatalogClient; public class ProvisionService { - public static void main(String[] args) { - ServiceCatalogClient client = ClientFactory.newClient(args); - System.out.println("Provisioning a service"); - ServiceInstance instance = client.serviceInstances().inNamespace("iocanel").create(new ServiceInstanceBuilder() - .withNewMetadata() - .withName("myserivce") - .endMetadata() - .withNewSpec() - .withClusterServiceClassExternalName("jenkins-ephemeral") - .withClusterServicePlanExternalName("default") - .endSpec() - .build()); - System.out.println("Done"); - } + public static void main(String[] args) { + ServiceCatalogClient client = ClientFactory.newClient(args); + System.out.println("Provisioning a service"); + ServiceInstance instance = client.serviceInstances().inNamespace("iocanel").create(new ServiceInstanceBuilder() + .withNewMetadata() + .withName("myserivce") + .endMetadata() + .withNewSpec() + .withClusterServiceClassExternalName("jenkins-ephemeral") + .withClusterServicePlanExternalName("default") + .endSpec() + .build()); + System.out.println("Done"); + } } diff --git a/extensions/service-catalog/model/src/main/java/io/fabric8/servicecatalog/api/model/Constants.java b/extensions/service-catalog/model/src/main/java/io/fabric8/servicecatalog/api/model/Constants.java index 2fbb0c6f357..75110144262 100755 --- a/extensions/service-catalog/model/src/main/java/io/fabric8/servicecatalog/api/model/Constants.java +++ b/extensions/service-catalog/model/src/main/java/io/fabric8/servicecatalog/api/model/Constants.java @@ -19,5 +19,6 @@ public class Constants { private Constants() { throw new IllegalStateException("Utility class"); } - public static final String BUILDER_PACKAGE = "io.fabric8.kubernetes.api.builder"; + + public static final String BUILDER_PACKAGE = "io.fabric8.kubernetes.api.builder"; } diff --git a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/GenericTektonClient.java b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/GenericTektonClient.java index aed0d9051fa..e248fea13e3 100644 --- a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/GenericTektonClient.java +++ b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/GenericTektonClient.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericTektonClient extends Client, TektonClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/NamespacedTektonClient.java b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/NamespacedTektonClient.java index a1c29817504..485dcd4cc80 100644 --- a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/NamespacedTektonClient.java +++ b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/NamespacedTektonClient.java @@ -15,7 +15,6 @@ */ package io.fabric8.tekton.client; - public interface NamespacedTektonClient extends TektonClient, - GenericTektonClient { + GenericTektonClient { } diff --git a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/TektonClient.java b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/TektonClient.java index 4d2c2ab3340..5e81e589c11 100644 --- a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/TektonClient.java +++ b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/TektonClient.java @@ -32,6 +32,7 @@ public interface TektonClient extends Client { /** * API entrypoint for tekton.dev/v1alpha1 API group resources + * * @return {@link V1alpha1APIGroupDSL} for Tekton resource operations in this API group. */ V1alpha1APIGroupDSL v1alpha1(); diff --git a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/dsl/V1alpha1APIGroupDSL.java b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/dsl/V1alpha1APIGroupDSL.java index 0d8504af569..36a8523f5df 100644 --- a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/dsl/V1alpha1APIGroupDSL.java +++ b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/dsl/V1alpha1APIGroupDSL.java @@ -19,10 +19,10 @@ import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; import io.fabric8.kubernetes.client.dsl.Resource; -import io.fabric8.tekton.pipeline.v1alpha1.Condition; -import io.fabric8.tekton.pipeline.v1alpha1.ConditionList; import io.fabric8.tekton.pipeline.v1alpha1.ClusterTask; import io.fabric8.tekton.pipeline.v1alpha1.ClusterTaskList; +import io.fabric8.tekton.pipeline.v1alpha1.Condition; +import io.fabric8.tekton.pipeline.v1alpha1.ConditionList; import io.fabric8.tekton.pipeline.v1alpha1.Pipeline; import io.fabric8.tekton.pipeline.v1alpha1.PipelineList; import io.fabric8.tekton.pipeline.v1alpha1.PipelineRun; diff --git a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/util/ApiVersionUtil.java b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/util/ApiVersionUtil.java index fed9b3527ab..990e3a123b8 100644 --- a/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/util/ApiVersionUtil.java +++ b/extensions/tekton/client/src/main/java/io/fabric8/tekton/client/util/ApiVersionUtil.java @@ -26,17 +26,19 @@ public class ApiVersionUtil { private ApiVersionUtil() { - throw new IllegalStateException("Utility class"); + throw new IllegalStateException("Utility class"); } - /** + + /** * Extracts apiGroupName from apiGroupVersion when in resource for apiGroupName/apiGroupVersion combination - * @param item resource which is being used - * @param apiGroup apiGroupName present if any - * @return Just the apiGroupName part without apiGroupVersion + * + * @param item resource which is being used + * @param apiGroup apiGroupName present if any + * @return Just the apiGroupName part without apiGroupVersion */ public static String apiGroup(T item, String apiGroup) { - if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) { + if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) { return trimGroupOrNull(((HasMetadata) item).getApiVersion()); } else if (apiGroup != null && !apiGroup.isEmpty()) { return trimGroup(apiGroup); @@ -46,6 +48,7 @@ public static String apiGroup(T item, String apiGroup) { /** * Returns the api version falling back to the items apiGroupVersion if not null. + * * @param * @param item * @param apiVersion @@ -62,8 +65,9 @@ public static String apiVersion(T item, String apiVersion) { /** * Separates apiGroupVersion for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupVersion part without the apiGroupName. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupVersion part without the apiGroupName. */ private static String trimVersion(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { @@ -73,10 +77,11 @@ private static String trimVersion(String apiVersion) { return apiVersion; } - /** + /** * Separates apiGroupName for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupName part without the apiGroupName, or apiVersion if no separator is found. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupName part without the apiGroupName, or apiVersion if no separator is found. */ private static String trimGroup(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { @@ -86,12 +91,11 @@ private static String trimGroup(String apiVersion) { return apiVersion; } - - - /** + /** * Separates apiGroupName for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupName part without the apiGroupName, or null if no separator is found. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupName part without the apiGroupName, or null if no separator is found. */ private static String trimGroupOrNull(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/ClientFactory.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/ClientFactory.java index b08e479182e..77fde37423b 100644 --- a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/ClientFactory.java +++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/ClientFactory.java @@ -15,52 +15,52 @@ */ package io.fabric8.tekton.api.examples; -import io.fabric8.tekton.client.TektonClient; -import io.fabric8.tekton.client.DefaultTektonClient; import io.fabric8.kubernetes.client.ConfigBuilder; +import io.fabric8.tekton.client.DefaultTektonClient; +import io.fabric8.tekton.client.TektonClient; public class ClientFactory { private ClientFactory() { throw new IllegalStateException("Utility class"); } + public static TektonClient newClient(String[] args) { - ConfigBuilder config = new ConfigBuilder(); - for (int i = 0; i < args.length - 1; i++) { + ConfigBuilder config = new ConfigBuilder(); + for (int i = 0; i < args.length - 1; i++) { - String key = args[i]; - String value = args[i + 1]; + String key = args[i]; + String value = args[i + 1]; - if (key.equals("--api-server")) { - config = config.withMasterUrl(value); - } + if (key.equals("--api-server")) { + config = config.withMasterUrl(value); + } - if (key.equals("--token")) { - config = config.withOauthToken(value); - } + if (key.equals("--token")) { + config = config.withOauthToken(value); + } - if (key.equals("--username")) { - config = config.withUsername(value); - } + if (key.equals("--username")) { + config = config.withUsername(value); + } - if (key.equals("--password")) { - config = config.withPassword(value); - } - if (key.equals("--namespace")) { - config = config.withNamespace(value); - } + if (key.equals("--password")) { + config = config.withPassword(value); + } + if (key.equals("--namespace")) { + config = config.withNamespace(value); } - return new DefaultTektonClient(config.build()); + } + return new DefaultTektonClient(config.build()); } - public static String getOptions(String[] args, String name, String defaultValue) { - for (int i = 0; i < args.length - 1; i++) { - String key = args[i]; - String value = args[i + 1]; - if (key.equals(name)) { - return value; - } - } - return defaultValue; + public static String getOptions(String[] args, String name, String defaultValue) { + for (int i = 0; i < args.length - 1; i++) { + String key = args[i]; + String value = args[i + 1]; + if (key.equals(name)) { + return value; + } } + return defaultValue; + } } - diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineList.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineList.java index 86065a749ff..56a9937b3ab 100644 --- a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineList.java +++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineList.java @@ -20,7 +20,7 @@ public class PipelineList { public static void main(String[] args) { - try ( TektonClient client = ClientFactory.newClient(args)) { + try (TektonClient client = ClientFactory.newClient(args)) { System.out.println("Pipelines:"); client.v1beta1().pipelines().list().getItems().forEach(System.out::println); System.out.println("done."); diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceCreate.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceCreate.java index eb26612f8f9..a41f9fa8e82 100644 --- a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceCreate.java +++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceCreate.java @@ -20,28 +20,29 @@ import io.fabric8.tekton.resource.v1alpha1.PipelineResourceBuilder; public class PipelineResourceCreate { - + public static void main(String[] args) { - try ( TektonClient client = ClientFactory.newClient(args)) { + try (TektonClient client = ClientFactory.newClient(args)) { String namespace = "default"; PipelineResource resource = new PipelineResourceBuilder() - .withNewMetadata() - .withName("client-repo") - .endMetadata() - .withNewSpec() - .withType("git") - .addNewParam() - .withName("revision") - .withValue("v4.2.2") - .endParam() - .addNewParam() - .withName("url") - .withValue("https://github.com/fabric8io/kubernetes-client") - .endParam() - .endSpec() - .build(); - - System.out.println("Created:" + client.v1alpha1().pipelineResources().inNamespace(namespace).create(resource).getMetadata().getName()); + .withNewMetadata() + .withName("client-repo") + .endMetadata() + .withNewSpec() + .withType("git") + .addNewParam() + .withName("revision") + .withValue("v4.2.2") + .endParam() + .addNewParam() + .withName("url") + .withValue("https://github.com/fabric8io/kubernetes-client") + .endParam() + .endSpec() + .build(); + + System.out.println( + "Created:" + client.v1alpha1().pipelineResources().inNamespace(namespace).create(resource).getMetadata().getName()); } System.exit(0); } diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceList.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceList.java index 3888b72c509..9130a2b6c7f 100644 --- a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceList.java +++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/PipelineResourceList.java @@ -18,9 +18,9 @@ import io.fabric8.tekton.client.*; public class PipelineResourceList { - + public static void main(String[] args) { - try ( TektonClient client = ClientFactory.newClient(args)) { + try (TektonClient client = ClientFactory.newClient(args)) { System.out.println("Pipeline resources:"); client.v1alpha1().pipelineResources().list().getItems().forEach(System.out::println); System.out.println("done."); diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskCreate.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskCreate.java index a3534f6520b..8d918c7fcbb 100644 --- a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskCreate.java +++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskCreate.java @@ -26,18 +26,18 @@ public static void main(String[] args) { try (TektonClient tektonClient = new DefaultTektonClient()) { String namespace = "default"; Task task = new TaskBuilder() - .withNewMetadata().withName("read-task").endMetadata() - .withNewSpec() - .withNewResources() - .addNewInput() - .withName("workspace").withType("git") - .endInput() - .endResources() - .addNewStep() - .withName("readme").withImage("ubuntu").withScript("cat workspace/README.md") - .endStep() - .endSpec() - .build(); + .withNewMetadata().withName("read-task").endMetadata() + .withNewSpec() + .withNewResources() + .addNewInput() + .withName("workspace").withType("git") + .endInput() + .endResources() + .addNewStep() + .withName("readme").withImage("ubuntu").withScript("cat workspace/README.md") + .endStep() + .endSpec() + .build(); // Create Task task = tektonClient.v1beta1().tasks().inNamespace(namespace).create(task); diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskRunCancel.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskRunCancel.java index be0903d62cf..d740cf23403 100644 --- a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskRunCancel.java +++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/TaskRunCancel.java @@ -15,13 +15,14 @@ */ package io.fabric8.tekton.api.examples; -import java.util.ArrayList; -import java.util.List; import io.fabric8.knative.internal.pkg.apis.Condition; import io.fabric8.tekton.client.DefaultTektonClient; import io.fabric8.tekton.client.TektonClient; import io.fabric8.tekton.pipeline.v1beta1.TaskRun; +import java.util.ArrayList; +import java.util.List; + public class TaskRunCancel { public static void main(String[] args) { @@ -29,7 +30,7 @@ public static void main(String[] args) { String namespace = "default"; TaskRun taskRun = tektonClient.v1beta1().taskRuns().inNamespace(namespace).list().getItems().get(0); - + List taskRunConditions = new ArrayList<>(); Condition taskRunCancelCondition = new Condition(); taskRunCancelCondition.setType("Succeeded"); @@ -37,8 +38,9 @@ public static void main(String[] args) { taskRunCancelCondition.setReason("TaskRunCancelled"); taskRunCancelCondition.setMessage("The TaskRun was cancelled successfully."); taskRunConditions.add(taskRunCancelCondition); - - /* The implementation needs to replace old conditions with the single status condition to be added. + + /* + * The implementation needs to replace old conditions with the single status condition to be added. * Without this, you will receive back a "Not all Steps in the Task have finished executing" message */ taskRun.getStatus().setConditions(taskRunConditions); diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/v1alpha1/TaskRunCreate.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/v1alpha1/TaskRunCreate.java index ed407301aba..e345046e375 100644 --- a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/v1alpha1/TaskRunCreate.java +++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/v1alpha1/TaskRunCreate.java @@ -27,27 +27,27 @@ public static void main(String[] args) { String namespace = "default"; TaskRun taskRun = new TaskRunBuilder() - .withNewMetadata().withGenerateName("build-gcs-targz-").endMetadata() - .withNewSpec() - .withNewTaskSpec() - .withNewInputs() - .addNewResource().withName("source").withType("storage").endResource() - .endInputs() - .addNewStep().withImage("ubuntu").withScript("cat source/file.txt").endStep() - .endTaskSpec() - .withNewInputs() - .addNewResource() - .withName("source") - .withNewResourceSpec() - .withType("storage") - .addNewParam().withName("location").withValue("gs://build-crd-tests/archive.tar.gz").endParam() - .addNewParam().withName("artifactType").withValue("TarGzArchive").endParam() - .addNewParam().withName("type").withValue("build-gcs").endParam() - .endResourceSpec() - .endResource() - .endInputs() - .endSpec() - .build(); + .withNewMetadata().withGenerateName("build-gcs-targz-").endMetadata() + .withNewSpec() + .withNewTaskSpec() + .withNewInputs() + .addNewResource().withName("source").withType("storage").endResource() + .endInputs() + .addNewStep().withImage("ubuntu").withScript("cat source/file.txt").endStep() + .endTaskSpec() + .withNewInputs() + .addNewResource() + .withName("source") + .withNewResourceSpec() + .withType("storage") + .addNewParam().withName("location").withValue("gs://build-crd-tests/archive.tar.gz").endParam() + .addNewParam().withName("artifactType").withValue("TarGzArchive").endParam() + .addNewParam().withName("type").withValue("build-gcs").endParam() + .endResourceSpec() + .endResource() + .endInputs() + .endSpec() + .build(); // Create TaskRun taskRun = tektonClient.v1alpha1().taskRuns().inNamespace(namespace).create(taskRun); diff --git a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/v1beta1/TaskRunCreate.java b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/v1beta1/TaskRunCreate.java index 7e08764672d..a9349b5cc1f 100644 --- a/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/v1beta1/TaskRunCreate.java +++ b/extensions/tekton/examples/src/main/java/io/fabric8/tekton/api/examples/v1beta1/TaskRunCreate.java @@ -26,27 +26,27 @@ public static void main(String[] args) { try (TektonClient tektonClient = new DefaultTektonClient()) { String namespace = "default"; TaskRun taskRun = new TaskRunBuilder() - .withNewMetadata().withGenerateName("build-gcs-targz-").endMetadata() - .withNewSpec() - .withNewTaskSpec() - .withNewResources() - .addNewInput().withName("source").withType("storage").endInput() - .endResources() - .addNewStep().withImage("ubuntu").withScript("cat source/file.txt").endStep() - .endTaskSpec() - .withNewResources() - .addNewInput() - .withName("source") - .withNewResourceSpec() - .withType("storage") - .addNewParam().withName("location").withValue("gs://build-crd-tests/archive.tar.gz").endParam() - .addNewParam().withName("artifactType").withValue("TarGzArchive").endParam() - .addNewParam().withName("type").withValue("build-gcs").endParam() - .endResourceSpec() - .endInput() - .endResources() - .endSpec() - .build(); + .withNewMetadata().withGenerateName("build-gcs-targz-").endMetadata() + .withNewSpec() + .withNewTaskSpec() + .withNewResources() + .addNewInput().withName("source").withType("storage").endInput() + .endResources() + .addNewStep().withImage("ubuntu").withScript("cat source/file.txt").endStep() + .endTaskSpec() + .withNewResources() + .addNewInput() + .withName("source") + .withNewResourceSpec() + .withType("storage") + .addNewParam().withName("location").withValue("gs://build-crd-tests/archive.tar.gz").endParam() + .addNewParam().withName("artifactType").withValue("TarGzArchive").endParam() + .addNewParam().withName("type").withValue("build-gcs").endParam() + .endResourceSpec() + .endInput() + .endResources() + .endSpec() + .build(); // Create TaskRun taskRun = tektonClient.v1beta1().taskRuns().inNamespace(namespace).create(taskRun); diff --git a/extensions/tekton/model-v1alpha1/src/main/java/io/fabric8/tekton/pipeline/v1alpha1/ArrayOrString.java b/extensions/tekton/model-v1alpha1/src/main/java/io/fabric8/tekton/pipeline/v1alpha1/ArrayOrString.java index 43046c5ad2f..5293f0914c2 100644 --- a/extensions/tekton/model-v1alpha1/src/main/java/io/fabric8/tekton/pipeline/v1alpha1/ArrayOrString.java +++ b/extensions/tekton/model-v1alpha1/src/main/java/io/fabric8/tekton/pipeline/v1alpha1/ArrayOrString.java @@ -15,7 +15,6 @@ */ package io.fabric8.tekton.pipeline.v1alpha1; - import com.fasterxml.jackson.annotation.JsonAnyGetter; import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -48,9 +47,9 @@ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ - "arrayVal", - "stringVal", - "type" + "arrayVal", + "stringVal", + "type" }) @JsonDeserialize(using = ArrayOrString.Deserializer.class) @JsonSerialize(using = ArrayOrString.Serializer.class) diff --git a/extensions/tekton/model-v1beta1/src/main/java/io/fabric8/tekton/pipeline/v1beta1/ArrayOrString.java b/extensions/tekton/model-v1beta1/src/main/java/io/fabric8/tekton/pipeline/v1beta1/ArrayOrString.java index c0e2ebccfdf..e2a4686fe18 100644 --- a/extensions/tekton/model-v1beta1/src/main/java/io/fabric8/tekton/pipeline/v1beta1/ArrayOrString.java +++ b/extensions/tekton/model-v1beta1/src/main/java/io/fabric8/tekton/pipeline/v1beta1/ArrayOrString.java @@ -15,7 +15,6 @@ */ package io.fabric8.tekton.pipeline.v1beta1; - import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; @@ -36,9 +35,9 @@ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ - "arrayVal", - "stringVal", - "type" + "arrayVal", + "stringVal", + "type" }) @JsonDeserialize(using = ArrayOrString.Deserializer.class) @JsonSerialize(using = ArrayOrString.Serializer.class) @@ -132,7 +131,8 @@ public void setAdditionalProperty(String name, Object value) { public static class Serializer extends JsonSerializer { @Override - public void serialize(ArrayOrString value, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + public void serialize(ArrayOrString value, JsonGenerator jgen, SerializerProvider provider) + throws IOException, JsonProcessingException { if (value != null) { if (value.getType() == null) { String stringVal = value.getStringVal(); diff --git a/extensions/tekton/model-v1beta1/src/test/java/io/fabric8/tekton/ModelTest.java b/extensions/tekton/model-v1beta1/src/test/java/io/fabric8/tekton/ModelTest.java index a107cf32023..23aa39f3292 100644 --- a/extensions/tekton/model-v1beta1/src/test/java/io/fabric8/tekton/ModelTest.java +++ b/extensions/tekton/model-v1beta1/src/test/java/io/fabric8/tekton/ModelTest.java @@ -15,41 +15,39 @@ */ package io.fabric8.tekton; -import org.junit.jupiter.api.Test; - import io.fabric8.tekton.pipeline.v1beta1.*; +import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNotNull; class ModelTest { @Test - void shouldHaveBuildableContainer() { + void shouldHaveBuildableContainer() { Task service = new TaskBuilder() - .withNewSpec() - .addNewVolume() + .withNewSpec() + .addNewVolume() .withName("m2-cache") .withNewNfs() - .withPath("my.nfs-server.com/m2") + .withPath("my.nfs-server.com/m2") .endNfs() - .endVolume() - .addNewStep() + .endVolume() + .addNewStep() .withName("maven-build") .withCommand("mvn") .withArgs("clean", "install") .withImage("maven:3.6.3-jdk11") .addNewVolumeMount() - .withName("m2-cache") - .withMountPath("/m2-cache") + .withName("m2-cache") + .withMountPath("/m2-cache") .endVolumeMount() .addNewEnv() - .withName("FOO") - .withValue("BAR") + .withName("FOO") + .withValue("BAR") .endEnv() - .endStep() - .endSpec() - .build(); + .endStep() + .endSpec() + .build(); assertNotNull(service); } } - diff --git a/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/GenericVerticalPodAutoscalerClient.java b/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/GenericVerticalPodAutoscalerClient.java index 45927fd51bf..4d3a074512f 100644 --- a/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/GenericVerticalPodAutoscalerClient.java +++ b/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/GenericVerticalPodAutoscalerClient.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericVerticalPodAutoscalerClient extends Client, VerticalPodAutoscalerClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/NamespacedVerticalPodAutoscalerClient.java b/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/NamespacedVerticalPodAutoscalerClient.java index 700c5e5fe70..bff8f53a171 100644 --- a/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/NamespacedVerticalPodAutoscalerClient.java +++ b/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/NamespacedVerticalPodAutoscalerClient.java @@ -15,5 +15,6 @@ */ package io.fabric8.verticalpodautoscaler.client; -public interface NamespacedVerticalPodAutoscalerClient extends VerticalPodAutoscalerClient, GenericVerticalPodAutoscalerClient { +public interface NamespacedVerticalPodAutoscalerClient + extends VerticalPodAutoscalerClient, GenericVerticalPodAutoscalerClient { } diff --git a/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/dsl/V1APIGroupDSL.java b/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/dsl/V1APIGroupDSL.java index df09bfd3d69..2f90fbdebc5 100644 --- a/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/dsl/V1APIGroupDSL.java +++ b/extensions/verticalpodautoscaler/client/src/main/java/io/fabric8/verticalpodautoscaler/client/dsl/V1APIGroupDSL.java @@ -15,8 +15,6 @@ */ package io.fabric8.verticalpodautoscaler.client.dsl; - - import io.fabric8.kubernetes.client.Client; import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.Resource; diff --git a/extensions/verticalpodautoscaler/examples/src/main/java/io/fabric8/verticalpodautoscaler/examples/v1/VerticalPodAutoscalerCreate.java b/extensions/verticalpodautoscaler/examples/src/main/java/io/fabric8/verticalpodautoscaler/examples/v1/VerticalPodAutoscalerCreate.java index 27270f2bd0a..b7a19778e69 100644 --- a/extensions/verticalpodautoscaler/examples/src/main/java/io/fabric8/verticalpodautoscaler/examples/v1/VerticalPodAutoscalerCreate.java +++ b/extensions/verticalpodautoscaler/examples/src/main/java/io/fabric8/verticalpodautoscaler/examples/v1/VerticalPodAutoscalerCreate.java @@ -15,11 +15,11 @@ */ package io.fabric8.verticalpodautoscaler.examples.v1; -import io.fabric8.verticalpodautoscaler.client.DefaultVerticalPodAutoscalerClient; import io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscaler; import io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerBuilder; -import io.fabric8.verticalpodautoscaler.client.NamespacedVerticalPodAutoscalerClient; import io.fabric8.verticalpodautoscaler.api.model.v1.VerticalPodAutoscalerList; +import io.fabric8.verticalpodautoscaler.client.DefaultVerticalPodAutoscalerClient; +import io.fabric8.verticalpodautoscaler.client.NamespacedVerticalPodAutoscalerClient; public class VerticalPodAutoscalerCreate { public static void main(String[] args) { @@ -27,15 +27,17 @@ public static void main(String[] args) { String namespace = "default"; VerticalPodAutoscaler verticalPodAutoscaler = new VerticalPodAutoscalerBuilder() - .build(); + .build(); // Create VerticalPodAutoscaler verticalPodAutoscalerClient.v1().verticalpodautoscalers().inNamespace(namespace).create(verticalPodAutoscaler); System.out.println("Created: " + verticalPodAutoscaler.getMetadata().getName()); // List VerticalPodAutoscaler - VerticalPodAutoscalerList verticalPodAutoscalerList = verticalPodAutoscalerClient.v1().verticalpodautoscalers().inNamespace(namespace).list(); - System.out.println("There are " + verticalPodAutoscalerList.getItems().size() + " VerticalPodAutoscaler objects in " + namespace); + VerticalPodAutoscalerList verticalPodAutoscalerList = verticalPodAutoscalerClient.v1().verticalpodautoscalers() + .inNamespace(namespace).list(); + System.out.println( + "There are " + verticalPodAutoscalerList.getItems().size() + " VerticalPodAutoscaler objects in " + namespace); } } } diff --git a/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/GenericVolcanoClient.java b/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/GenericVolcanoClient.java index 84ac8935317..b4fb292126c 100644 --- a/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/GenericVolcanoClient.java +++ b/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/GenericVolcanoClient.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericVolcanoClient extends Client, VolcanoClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/NamespacedVolcanoClient.java b/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/NamespacedVolcanoClient.java index 7fa48d9de18..52315f1bc86 100644 --- a/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/NamespacedVolcanoClient.java +++ b/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/NamespacedVolcanoClient.java @@ -15,7 +15,6 @@ */ package io.fabric8.volcano.client; - public interface NamespacedVolcanoClient extends VolcanoClient, - GenericVolcanoClient { + GenericVolcanoClient { } diff --git a/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/VolcanoClient.java b/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/VolcanoClient.java index 999da71d807..841752c102d 100644 --- a/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/VolcanoClient.java +++ b/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/VolcanoClient.java @@ -29,6 +29,8 @@ */ public interface VolcanoClient extends Client { MixedOperation> podGroups(); + MixedOperation> queues(); + V1beta1APIGroupDSL v1beta1(); } diff --git a/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/dsl/V1beta1APIGroupDSL.java b/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/dsl/V1beta1APIGroupDSL.java index f5a178f1ae0..de7160029a5 100644 --- a/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/dsl/V1beta1APIGroupDSL.java +++ b/extensions/volcano/client/src/main/java/io/fabric8/volcano/client/dsl/V1beta1APIGroupDSL.java @@ -25,5 +25,6 @@ public interface V1beta1APIGroupDSL extends Client { MixedOperation> podGroups(); + MixedOperation> queues(); } diff --git a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/PodGroupCreate.java b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/PodGroupCreate.java index f058f483552..7b5dfbf73d7 100644 --- a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/PodGroupCreate.java +++ b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/PodGroupCreate.java @@ -36,10 +36,9 @@ public static void main(String[] args) { // Wait for status or 5s timeout volcanoClient.podGroups().inNamespace(namespace).withName(groupName).waitUntilCondition( - group -> Objects.nonNull(group.getStatus()) && group.getStatus().getPhase().equals("Running"), - 5, - TimeUnit.SECONDS - ); + group -> Objects.nonNull(group.getStatus()) && group.getStatus().getPhase().equals("Running"), + 5, + TimeUnit.SECONDS); System.out.println("Created: " + podGroup.getMetadata().getName()); // List PodGroup diff --git a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/QueueCreate.java b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/QueueCreate.java index b8a14bfb23a..e3885079946 100644 --- a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/QueueCreate.java +++ b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/QueueCreate.java @@ -34,10 +34,9 @@ public static void main(String[] args) { // Wait for status or 5s timeout volcanoClient.queues().withName(queueName).waitUntilCondition( - q -> Objects.nonNull(q.getStatus()) && q.getStatus().getState().equals("Open"), - 5, - TimeUnit.SECONDS - ); + q -> Objects.nonNull(q.getStatus()) && q.getStatus().getState().equals("Open"), + 5, + TimeUnit.SECONDS); System.out.println("Created: " + queue.getMetadata().getName()); // List queue diff --git a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/Utils.java b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/Utils.java index b2c280e5184..817311f2a98 100644 --- a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/Utils.java +++ b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/Utils.java @@ -32,11 +32,11 @@ private Utils() { public static Map buildDefaultResourceMap() { Quantity cpu = new QuantityBuilder(false) - .withAmount("1") - .build(); + .withAmount("1") + .build(); Quantity memory = new QuantityBuilder(false) - .withAmount("1024") - .build(); + .withAmount("1024") + .build(); Map resourceMap = new HashMap<>(); resourceMap.put("cpu", cpu); resourceMap.put("memory", memory); @@ -46,26 +46,26 @@ public static Map buildDefaultResourceMap() { public static PodGroup buildDefaultPodGroups(String namespace, String groupName) { // Build PodGroup with metadata and spec return new PodGroupBuilder() - .editOrNewMetadata() - .withName(groupName) - .withNamespace(namespace) - .endMetadata() - .editOrNewSpec() - .withMinResources(buildDefaultResourceMap()) - .endSpec() - .build(); + .editOrNewMetadata() + .withName(groupName) + .withNamespace(namespace) + .endMetadata() + .editOrNewSpec() + .withMinResources(buildDefaultResourceMap()) + .endSpec() + .build(); } public static Queue buildDefaultQueues(String queueName) { // Build Queue with metadata and spec return new QueueBuilder() - .editOrNewMetadata() - .withName(queueName) - .endMetadata() - .editOrNewSpec() - .withCapability(buildDefaultResourceMap()) - .withWeight(1) - .endSpec() - .build(); + .editOrNewMetadata() + .withName(queueName) + .endMetadata() + .editOrNewSpec() + .withCapability(buildDefaultResourceMap()) + .withWeight(1) + .endSpec() + .build(); } } diff --git a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/v1beta1/PodGroupCreate.java b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/v1beta1/PodGroupCreate.java index 9ae6f6a6749..cc41f42bd43 100644 --- a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/v1beta1/PodGroupCreate.java +++ b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/v1beta1/PodGroupCreate.java @@ -37,10 +37,9 @@ public static void main(String[] args) { // Wait for status or 5s timeout volcanoClient.v1beta1().podGroups().inNamespace(namespace).withName(groupName).waitUntilCondition( - group -> Objects.nonNull(group.getStatus()) && group.getStatus().getPhase().equals("Running"), - 5, - TimeUnit.SECONDS - ); + group -> Objects.nonNull(group.getStatus()) && group.getStatus().getPhase().equals("Running"), + 5, + TimeUnit.SECONDS); System.out.println("Created: " + podGroup.getMetadata().getName()); // List PodGroup diff --git a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/v1beta1/QueueCreate.java b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/v1beta1/QueueCreate.java index 3f45c5875f9..08afc5ff34a 100644 --- a/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/v1beta1/QueueCreate.java +++ b/extensions/volcano/examples/src/main/java/io/fabric8/volcano/examples/v1beta1/QueueCreate.java @@ -35,10 +35,9 @@ public static void main(String[] args) { // Wait for status or 5s timeout volcanoClient.v1beta1().queues().withName(queueName).waitUntilCondition( - q -> Objects.nonNull(q.getStatus()) && q.getStatus().getState().equals("Open"), - 5, - TimeUnit.SECONDS - ); + q -> Objects.nonNull(q.getStatus()) && q.getStatus().getState().equals("Open"), + 5, + TimeUnit.SECONDS); System.out.println("Created: " + queue.getMetadata().getName()); // List queue diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/GenericVolumeSnapshotClient.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/GenericVolumeSnapshotClient.java index 2287980c248..78c380c6596 100644 --- a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/GenericVolumeSnapshotClient.java +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/GenericVolumeSnapshotClient.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.client.dsl.RequestConfigurable; public interface GenericVolumeSnapshotClient extends Client, VolumeSnapshotClient, - Namespaceable, - AnyNamespaceable, - RequestConfigurable { + Namespaceable, + AnyNamespaceable, + RequestConfigurable { } diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/NamespacedVolumeSnapshotClient.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/NamespacedVolumeSnapshotClient.java index 257da1b1e11..0cf528efc71 100644 --- a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/NamespacedVolumeSnapshotClient.java +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/NamespacedVolumeSnapshotClient.java @@ -15,5 +15,6 @@ */ package io.fabric8.volumesnapshot.client; -public interface NamespacedVolumeSnapshotClient extends VolumeSnapshotClient, GenericVolumeSnapshotClient { +public interface NamespacedVolumeSnapshotClient + extends VolumeSnapshotClient, GenericVolumeSnapshotClient { } diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotClient.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotClient.java index b2414f8a090..b0047f086af 100644 --- a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotClient.java +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotClient.java @@ -15,7 +15,6 @@ */ package io.fabric8.volumesnapshot.client; - import io.fabric8.kubernetes.client.Client; import io.fabric8.kubernetes.client.dsl.MixedOperation; import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotContentResource.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotContentResource.java index 1e4e6998157..78028f72154 100644 --- a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotContentResource.java +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotContentResource.java @@ -18,6 +18,5 @@ import io.fabric8.kubernetes.client.dsl.Resource; import io.fabric8.volumesnapshot.api.model.VolumeSnapshotContent; - public interface VolumeSnapshotContentResource extends Resource { } diff --git a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotResource.java b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotResource.java index 7244e93d3e6..cb2a4b3e5be 100644 --- a/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotResource.java +++ b/extensions/volumesnapshot/client/src/main/java/io/fabric8/volumesnapshot/client/VolumeSnapshotResource.java @@ -18,6 +18,5 @@ import io.fabric8.kubernetes.client.dsl.Resource; import io.fabric8.volumesnapshot.api.model.VolumeSnapshot; - public interface VolumeSnapshotResource extends Resource { } diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshot.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshot.java index 5b785851eab..fa977d7e4ee 100644 --- a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshot.java +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshot.java @@ -15,8 +15,8 @@ */ package io.fabric8.volumesnapshot.examples; -import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; import io.fabric8.volumesnapshot.api.model.VolumeSnapshotBuilder; +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; @SuppressWarnings("java:S106") public class CreateVolumeSnapshot { @@ -25,15 +25,15 @@ public static void main(String[] args) { try (VolumeSnapshotClient client = ClientFactory.newClient(args)) { System.out.println("Creating a volume snapshot"); client.volumeSnapshots().inNamespace("default").create(new VolumeSnapshotBuilder() - .withNewMetadata() - .withName("my-snapshot") - .endMetadata() - .withNewSpec() - .withNewSource() - .withPersistentVolumeClaimName("my-pvc") - .endSource() - .endSpec() - .build()); + .withNewMetadata() + .withName("my-snapshot") + .endMetadata() + .withNewSpec() + .withNewSource() + .withPersistentVolumeClaimName("my-pvc") + .endSource() + .endSpec() + .build()); } } } diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshotClass.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshotClass.java index 880f9784807..9de247d40a3 100644 --- a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshotClass.java +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/CreateVolumeSnapshotClass.java @@ -15,20 +15,20 @@ */ package io.fabric8.volumesnapshot.examples; -import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; import io.fabric8.volumesnapshot.api.model.VolumeSnapshotClassBuilder; - +import io.fabric8.volumesnapshot.client.VolumeSnapshotClient; + public class CreateVolumeSnapshotClass { public static void main(String[] args) { try (VolumeSnapshotClient client = ClientFactory.newClient(args)) { - client.volumeSnapshotClasses().create(new VolumeSnapshotClassBuilder() - .withNewMetadata() - .withName("my-snapshot-class") - .endMetadata() - .withDriver("my-csi-driver") - .withDeletionPolicy("Delete") - .build()); + client.volumeSnapshotClasses().create(new VolumeSnapshotClassBuilder() + .withNewMetadata() + .withName("my-snapshot-class") + .endMetadata() + .withDriver("my-csi-driver") + .withDeletionPolicy("Delete") + .build()); } } } diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotContents.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotContents.java index 69e64e7d1b8..50d73674450 100644 --- a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotContents.java +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshotContents.java @@ -26,10 +26,9 @@ public static void main(String[] args) { System.out.println("Listing Volume Snapshot Classes:"); VolumeSnapshotContentList list = client.volumeSnapshotContents().list(); list.getItems().forEach(b -> System.out.println( - b.getSpec().getVolumeSnapshotRef().getNamespace() + "/" + b.getSpec().getVolumeSnapshotRef().getName() - + "\t\t\t\t" + b.getSpec().getVolumeSnapshotClassName() - + "\t\t\t\t" + b.getMetadata().getName()) - ); + b.getSpec().getVolumeSnapshotRef().getNamespace() + "/" + b.getSpec().getVolumeSnapshotRef().getName() + + "\t\t\t\t" + b.getSpec().getVolumeSnapshotClassName() + + "\t\t\t\t" + b.getMetadata().getName())); System.out.println("Done"); } } diff --git a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshots.java b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshots.java index 7ddb5ac0992..3a2e19d1ed8 100644 --- a/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshots.java +++ b/extensions/volumesnapshot/examples/src/main/java/io/fabric8/volumesnapshot/examples/ListVolumeSnapshots.java @@ -26,8 +26,8 @@ public static void main(String[] args) { VolumeSnapshotList list = client.volumeSnapshots().list(); System.out.println("Listing Volume Snapshots:"); list.getItems().stream() - .map(b -> b.getMetadata().getName()) - .forEach(System.out::println); + .map(b -> b.getMetadata().getName()) + .forEach(System.out::println); System.out.println("Done"); } } diff --git a/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/Constants.java b/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/Constants.java index f14744f1707..3b306fd46ea 100755 --- a/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/Constants.java +++ b/extensions/volumesnapshot/model/src/main/java/io/fabric8/volumesnapshot/api/model/Constants.java @@ -17,7 +17,8 @@ public class Constants { - private Constants() {} + private Constants() { + } public static final String BUILDER_PACKAGE = "io.fabric8.kubernetes.api.builder"; } diff --git a/java-generator/core/src/main/java/io/fabric8/java/generator/nodes/AbstractJSONSchema2Pojo.java b/java-generator/core/src/main/java/io/fabric8/java/generator/nodes/AbstractJSONSchema2Pojo.java index 19831bfa40c..abef1c4733c 100644 --- a/java-generator/core/src/main/java/io/fabric8/java/generator/nodes/AbstractJSONSchema2Pojo.java +++ b/java-generator/core/src/main/java/io/fabric8/java/generator/nodes/AbstractJSONSchema2Pojo.java @@ -25,7 +25,6 @@ import io.fabric8.kubernetes.api.model.apiextensions.v1.JSONSchemaProps; import java.util.Locale; -import java.util.Optional; import java.util.function.Function; import static io.fabric8.java.generator.nodes.Keywords.JAVA_KEYWORDS; diff --git a/java-generator/core/src/test/java/io/fabric8/java/generator/GeneratorTest.java b/java-generator/core/src/test/java/io/fabric8/java/generator/GeneratorTest.java index 9c3d09ed7d3..aba33116e53 100644 --- a/java-generator/core/src/test/java/io/fabric8/java/generator/GeneratorTest.java +++ b/java-generator/core/src/test/java/io/fabric8/java/generator/GeneratorTest.java @@ -21,13 +21,10 @@ import com.github.javaparser.ast.body.ClassOrInterfaceDeclaration; import com.github.javaparser.ast.body.EnumDeclaration; import com.github.javaparser.ast.body.FieldDeclaration; -import com.github.javaparser.ast.body.MethodDeclaration; import com.github.javaparser.ast.body.VariableDeclarator; import com.github.javaparser.ast.expr.AnnotationExpr; import com.github.javaparser.ast.expr.Expression; -import com.github.javaparser.ast.expr.MethodCallExpr; import com.github.javaparser.ast.expr.SingleMemberAnnotationExpr; -import com.github.javaparser.ast.stmt.BlockStmt; import io.fabric8.java.generator.nodes.*; import io.fabric8.kubernetes.api.model.apiextensions.v1.JSONSchemaProps; import io.fabric8.kubernetes.client.utils.Serialization; diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/AdmissionRegistrationAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/AdmissionRegistrationAPIGroupDSL.java index b32586e316f..07eed719c2b 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/AdmissionRegistrationAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/AdmissionRegistrationAPIGroupDSL.java @@ -17,5 +17,6 @@ public interface AdmissionRegistrationAPIGroupDSL extends Client { V1AdmissionRegistrationAPIGroupDSL v1(); + V1beta1AdmissionRegistrationAPIGroupDSL v1beta1(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/KubernetesClientTimeoutException.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/KubernetesClientTimeoutException.java index ad1eb9c63f9..3b37e71c738 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/KubernetesClientTimeoutException.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/KubernetesClientTimeoutException.java @@ -30,14 +30,15 @@ public class KubernetesClientTimeoutException extends KubernetesClientException private static final String KNOWS_RESOURCES_FORMAT = "Timed out waiting for [%d] milliseconds for multiple resources. %s"; private final List resourcesNotReady; - + public KubernetesClientTimeoutException(String kind, String name, String namespace, long amount, TimeUnit timeUnit) { super(String.format(RESOURCE_FORMAT, timeUnit.toMillis(amount), kind, name, namespace)); this.resourcesNotReady = Collections.emptyList(); } public KubernetesClientTimeoutException(HasMetadata resource, long amount, TimeUnit timeUnit) { - super(String.format(RESOURCE_FORMAT, timeUnit.toMillis(amount), resource.getKind(), resource.getMetadata().getName(), resource.getMetadata().getNamespace())); + super(String.format(RESOURCE_FORMAT, timeUnit.toMillis(amount), resource.getKind(), resource.getMetadata().getName(), + resource.getMetadata().getNamespace())); this.resourcesNotReady = Collections.unmodifiableList(Arrays.asList(resource)); } @@ -52,9 +53,10 @@ public List getResourcesNotReady() { /** * Creates a string listing all the resources that are not ready. + * * @param resources The resources that are not ready. * @return - */ + */ private static String notReadyToString(Iterable resources) { StringBuilder sb = new StringBuilder(); sb.append("Resources that are not ready: "); @@ -66,9 +68,9 @@ private static String notReadyToString(Iterable resources) { sb.append(", "); } sb.append("[Kind:").append(r.getKind()) - .append(" Name:").append(r.getMetadata().getName()) - .append(" Namespace:").append(r.getMetadata().getNamespace()) - .append("]"); + .append(" Name:").append(r.getMetadata().getName()) + .append(" Namespace:").append(r.getMetadata().getNamespace()) + .append("]"); } return sb.toString(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/NamespacedKubernetesClient.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/NamespacedKubernetesClient.java index abcbdf29e94..48b26543b49 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/NamespacedKubernetesClient.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/NamespacedKubernetesClient.java @@ -20,6 +20,7 @@ public interface NamespacedKubernetesClient extends KubernetesClient { NamespacedKubernetesClient inAnyNamespace(); + NamespacedKubernetesClient inNamespace(String namespace); FunctionCallable withRequestConfig(RequestConfig requestConfig); diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/OperationInfo.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/OperationInfo.java index 304d248fa53..76f6168684b 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/OperationInfo.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/OperationInfo.java @@ -36,7 +36,7 @@ default String getGroup() { default String getPlural() { return null; } - + default String getVersion() { return null; } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/ResourceNotFoundException.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/ResourceNotFoundException.java index 16707b2bdf0..0d6d0f10c58 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/ResourceNotFoundException.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/ResourceNotFoundException.java @@ -20,7 +20,7 @@ public class ResourceNotFoundException extends RuntimeException { public ResourceNotFoundException(String s) { super(s); } - + public ResourceNotFoundException(String s, Throwable cause) { super(s, cause); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/ServiceToURLProvider.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/ServiceToURLProvider.java index ed69caf4290..98d96a56207 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/ServiceToURLProvider.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/ServiceToURLProvider.java @@ -20,7 +20,11 @@ public interface ServiceToURLProvider { enum ServiceToUrlImplPriority { - FIRST(0), SECOND(1), THIRD(2), FOURTH(3), FIFTH(4); + FIRST(0), + SECOND(1), + THIRD(2), + FOURTH(3), + FIFTH(4); private final int value; @@ -28,7 +32,9 @@ enum ServiceToUrlImplPriority { value = newVal; } - public int getValue() { return value; } + public int getValue() { + return value; + } } int getPriority(); diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1AdmissionRegistrationAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1AdmissionRegistrationAPIGroupDSL.java index 4b568fce52c..af127829934 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1AdmissionRegistrationAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1AdmissionRegistrationAPIGroupDSL.java @@ -22,7 +22,8 @@ import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; import io.fabric8.kubernetes.client.dsl.Resource; -public interface V1AdmissionRegistrationAPIGroupDSL extends Client { +public interface V1AdmissionRegistrationAPIGroupDSL extends Client { NonNamespaceOperation> validatingWebhookConfigurations(); + NonNamespaceOperation> mutatingWebhookConfigurations(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1AuthorizationAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1AuthorizationAPIGroupDSL.java index b8e6db81a98..b7540b99f5a 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1AuthorizationAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1AuthorizationAPIGroupDSL.java @@ -22,9 +22,12 @@ import io.fabric8.kubernetes.client.dsl.InOutCreateable; import io.fabric8.kubernetes.client.dsl.NamespacedInOutCreateable; -public interface V1AuthorizationAPIGroupDSL extends Client{ +public interface V1AuthorizationAPIGroupDSL extends Client { InOutCreateable selfSubjectAccessReview(); + InOutCreateable subjectAccessReview(); + NamespacedInOutCreateable localSubjectAccessReview(); + InOutCreateable selfSubjectRulesReview(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1NetworkAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1NetworkAPIGroupDSL.java index c32ffc1c3d9..a8b54016bef 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1NetworkAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1NetworkAPIGroupDSL.java @@ -27,6 +27,8 @@ public interface V1NetworkAPIGroupDSL extends Client { MixedOperation> networkPolicies(); + MixedOperation> ingresses(); + NonNamespaceOperation> ingressClasses(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1AdmissionRegistrationAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1AdmissionRegistrationAPIGroupDSL.java index c180fcacf1d..e35f5d04534 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1AdmissionRegistrationAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1AdmissionRegistrationAPIGroupDSL.java @@ -25,5 +25,6 @@ public interface V1beta1AdmissionRegistrationAPIGroupDSL extends Client { MixedOperation> validatingWebhookConfigurations(); + NonNamespaceOperation> mutatingWebhookConfigurations(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1AuthorizationAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1AuthorizationAPIGroupDSL.java index 2f29882876b..e7d474769f5 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1AuthorizationAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1AuthorizationAPIGroupDSL.java @@ -24,7 +24,10 @@ public interface V1beta1AuthorizationAPIGroupDSL extends Client { InOutCreateable selfSubjectAccessReview(); + InOutCreateable subjectAccessReview(); + NamespacedInOutCreateable localSubjectAccessReview(); + InOutCreateable selfSubjectRulesReview(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1NetworkAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1NetworkAPIGroupDSL.java index 26c12c7ca95..dc2db26a119 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1NetworkAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/V1beta1NetworkAPIGroupDSL.java @@ -25,5 +25,6 @@ public interface V1beta1NetworkAPIGroupDSL extends Client { MixedOperation> ingresses(); + NonNamespaceOperation> ingressClasses(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/VersionInfo.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/VersionInfo.java index 06817265ddd..f1f0c23bc6c 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/VersionInfo.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/VersionInfo.java @@ -22,7 +22,9 @@ public class VersionInfo { public static final class VersionKeys { - private VersionKeys() {} + private VersionKeys() { + } + public static final String BUILD_DATE = "buildDate"; public static final String GIT_COMMIT = "gitCommit"; public static final String GIT_VERSION = "gitVersion"; @@ -34,6 +36,7 @@ private VersionKeys() {} public static final String COMPILER = "compiler"; public static final String BUILD_DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ssX"; } + private Date buildDate; private String gitCommit; private String gitVersion; @@ -80,12 +83,14 @@ public String getCompiler() { return compiler; } - private VersionInfo() { } + private VersionInfo() { + } public static class Builder { private VersionInfo versionInfo = new VersionInfo(); - public Builder() { } + public Builder() { + } public Builder(VersionInfo versionInfo) { if (versionInfo != null) { diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ApiextensionsAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ApiextensionsAPIGroupDSL.java index 3b6e0be77dc..ebccb1769a5 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ApiextensionsAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ApiextensionsAPIGroupDSL.java @@ -21,5 +21,6 @@ public interface ApiextensionsAPIGroupDSL extends Client { V1ApiextensionAPIGroupDSL v1(); + V1beta1ApiextensionAPIGroupDSL v1beta1(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/BatchAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/BatchAPIGroupDSL.java index 54cc6b14ba8..ccc51b199a1 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/BatchAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/BatchAPIGroupDSL.java @@ -21,7 +21,7 @@ import io.fabric8.kubernetes.api.model.batch.v1beta1.CronJobList; import io.fabric8.kubernetes.client.Client; -public interface BatchAPIGroupDSL extends Client{ +public interface BatchAPIGroupDSL extends Client { /** * DSL entrypoint for batch/v1 Jobs diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/CertificatesAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/CertificatesAPIGroupDSL.java index 7c86443d750..dd1932f838c 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/CertificatesAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/CertificatesAPIGroupDSL.java @@ -19,5 +19,6 @@ public interface CertificatesAPIGroupDSL extends Client { V1CertificatesAPIGroupDSL v1(); + V1beta1CertificatesAPIGroupDSL v1beta1(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Containerable.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Containerable.java index 96eda541ad7..c1a74bda23c 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Containerable.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Containerable.java @@ -19,8 +19,9 @@ public interface Containerable { /** * Get logs of a specific container + * * @param id container for which we want logs * @return returns pod log operation with specified PodLogOption configured */ - T inContainer(I id); + T inContainer(I id); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/DiscoveryAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/DiscoveryAPIGroupDSL.java index cdf467bf505..b561ed3ded4 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/DiscoveryAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/DiscoveryAPIGroupDSL.java @@ -19,5 +19,6 @@ public interface DiscoveryAPIGroupDSL extends Client { V1DiscoveryAPIGroupDSL v1(); + V1beta1DiscoveryAPIGroupDSL v1beta1(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/EventingAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/EventingAPIGroupDSL.java index cc5877744ca..6fa6cf4e532 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/EventingAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/EventingAPIGroupDSL.java @@ -19,5 +19,6 @@ public interface EventingAPIGroupDSL extends Client { V1EventingAPIGroupDSL v1(); + V1beta1EventingAPIGroupDSL v1beta1(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ExtensionsAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ExtensionsAPIGroupDSL.java index a52953a95cd..46402e9c653 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ExtensionsAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ExtensionsAPIGroupDSL.java @@ -16,18 +16,18 @@ package io.fabric8.kubernetes.client.dsl; +import io.fabric8.kubernetes.api.model.batch.v1.Job; +import io.fabric8.kubernetes.api.model.batch.v1.JobList; import io.fabric8.kubernetes.api.model.extensions.DaemonSet; import io.fabric8.kubernetes.api.model.extensions.DaemonSetList; import io.fabric8.kubernetes.api.model.extensions.Deployment; import io.fabric8.kubernetes.api.model.extensions.DeploymentList; -import io.fabric8.kubernetes.api.model.extensions.ReplicaSet; -import io.fabric8.kubernetes.api.model.extensions.ReplicaSetList; -import io.fabric8.kubernetes.api.model.batch.v1.Job; -import io.fabric8.kubernetes.api.model.batch.v1.JobList; import io.fabric8.kubernetes.api.model.extensions.Ingress; import io.fabric8.kubernetes.api.model.extensions.IngressList; import io.fabric8.kubernetes.api.model.extensions.NetworkPolicy; import io.fabric8.kubernetes.api.model.extensions.NetworkPolicyList; +import io.fabric8.kubernetes.api.model.extensions.ReplicaSet; +import io.fabric8.kubernetes.api.model.extensions.ReplicaSetList; import io.fabric8.kubernetes.api.model.policy.v1beta1.PodSecurityPolicy; import io.fabric8.kubernetes.api.model.policy.v1beta1.PodSecurityPolicyList; import io.fabric8.kubernetes.client.Client; diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FilterNested.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FilterNested.java index 4fc65530a94..d23b4dd0a73 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FilterNested.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FilterNested.java @@ -19,9 +19,9 @@ import io.fabric8.kubernetes.api.builder.Nested; public interface FilterNested extends Filterable>, Nested { - + default T endFilter() { return and(); } - + } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Filterable.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Filterable.java index aa7fdeb53ed..c932ced4f65 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Filterable.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Filterable.java @@ -22,6 +22,7 @@ /** * Each filter method applies in an additive way to the previous filter state. + * * @param */ public interface Filterable { @@ -30,16 +31,16 @@ public interface Filterable { /** * @deprecated as the underlying implementation does not align with the arguments anymore. - * It is possible to negate multiple values with the same key, e.g.: - * foo != bar , foo != baz - * To support this a multi-value map is needed, as a regular map would override the key with the new value. + * It is possible to negate multiple values with the same key, e.g.: + * foo != bar , foo != baz + * To support this a multi-value map is needed, as a regular map would override the key with the new value. */ @Deprecated T withoutLabels(Map labels); - T withLabelIn(String key, String ... values); + T withLabelIn(String key, String... values); - T withLabelNotIn(String key, String ... values); + T withLabelNotIn(String key, String... values); T withLabel(String key, String value); @@ -59,11 +60,11 @@ default T withoutLabel(String key) { /** * @deprecated as the underlying implementation does not align with the arguments fully. - * Method is created to have a similar API as `withoutLabels`, but should eventually be replaced - * with something better for the same reasons. - * It is possible to negate multiple values with the same key, e.g.: - * foo != bar , foo != baz - * To support this a multi-value map is needed, as a regular map would override the key with the new value. + * Method is created to have a similar API as `withoutLabels`, but should eventually be replaced + * with something better for the same reasons. + * It is possible to negate multiple values with the same key, e.g.: + * foo != bar , foo != baz + * To support this a multi-value map is needed, as a regular map would override the key with the new value. */ @Deprecated T withoutFields(Map fields); @@ -76,9 +77,9 @@ default T withoutLabel(String key) { /** * Filter with the object that this event is about. + * * @param objectReference {@link ObjectReference} for providing information of referred object * @return filtered resource */ T withInvolvedObject(ObjectReference objectReference); } - diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FunctionCallable.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FunctionCallable.java index 74906352f9f..772a7f792f9 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FunctionCallable.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/FunctionCallable.java @@ -15,7 +15,6 @@ */ package io.fabric8.kubernetes.client.dsl; - import java.util.function.Function; public interface FunctionCallable { diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Listable.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Listable.java index f1198a9f5fd..212ff567b52 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Listable.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Listable.java @@ -22,6 +22,7 @@ public interface Listable { /** * List resources from APIServer. + * * @deprecated : Please use {@link #list(ListOptions)} instead * * @param limitVal number of resources to list @@ -33,9 +34,11 @@ public interface Listable { /** * List resource from Kubernetes API server. - *

The passed in options may be modified as a side-effect of this call. - *
Values that already exist at this context, such as the labels and fields will be overridden - * on the passed in options regardless of initial values. + *

+ * The passed in options may be modified as a side-effect of this call. + *
+ * Values that already exist at this context, such as the labels and fields will be overridden + * on the passed in options regardless of initial values. * * @param listOptions ListOptions is the query options to a standard REST list call. * @return list of resource type diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/MetricAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/MetricAPIGroupDSL.java index bdfc83c8088..0908245ebbb 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/MetricAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/MetricAPIGroupDSL.java @@ -19,5 +19,6 @@ public interface MetricAPIGroupDSL extends Client { PodMetricOperation pods(); + NodeMetricOperation nodes(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/NetworkAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/NetworkAPIGroupDSL.java index 98f90aad461..560af527bdc 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/NetworkAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/NetworkAPIGroupDSL.java @@ -25,9 +25,11 @@ public interface NetworkAPIGroupDSL extends Client { V1NetworkAPIGroupDSL v1(); + V1beta1NetworkAPIGroupDSL v1beta1(); MixedOperation> networkPolicies(); + MixedOperation> ingress(); MixedOperation> ingresses(); diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/NodeMetricOperation.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/NodeMetricOperation.java index d991ae394ab..7e8a7b298e2 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/NodeMetricOperation.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/NodeMetricOperation.java @@ -22,17 +22,17 @@ import java.util.Map; public interface NodeMetricOperation - extends MetricOperation, Nameable { + extends MetricOperation, Nameable { - @Override - NodeMetricOperation withLabels(Map labels); + @Override + NodeMetricOperation withLabels(Map labels); - /** - * Get NodeMetric with specified name - * - * @param nodeName name of the node - * @return NodeMetric fetched from ApiServer - */ - NodeMetrics metrics(String nodeName); + /** + * Get NodeMetric with specified name + * + * @param nodeName name of the node + * @return NodeMetric fetched from ApiServer + */ + NodeMetrics metrics(String nodeName); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable.java index 4f654c2a6f1..f8c39a58fbc 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable.java @@ -17,6 +17,7 @@ package io.fabric8.kubernetes.client.dsl; public interface ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable - extends NamespaceListVisitFromServerGetDeleteRecreateWaitApplicable, Parameterizable> { + extends NamespaceListVisitFromServerGetDeleteRecreateWaitApplicable, + Parameterizable> { } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/PodMetricOperation.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/PodMetricOperation.java index 18f0118a2bb..a33b0dfdd39 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/PodMetricOperation.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/PodMetricOperation.java @@ -22,26 +22,26 @@ import java.util.Map; public interface PodMetricOperation extends MetricOperation, Nameable, - Namespaceable { - - @Override - PodMetricOperation withLabels(Map labels); - - /** - * Get PodMetricsList for a namespace. - * - * @param namespace namespace for which PodMetrics are queries - * @return PodMetricsList for all pods in specified namespace - */ - PodMetricsList metrics(String namespace); - - /** - * Get PodMetrics in a namespace with a name. - * - * @param namespace namespace of pod - * @param podName name of pod - * @return PodMetric corresponding to specified Pod - */ - PodMetrics metrics(String namespace, String podName); + Namespaceable { + + @Override + PodMetricOperation withLabels(Map labels); + + /** + * Get PodMetricsList for a namespace. + * + * @param namespace namespace for which PodMetrics are queries + * @return PodMetricsList for all pods in specified namespace + */ + PodMetricsList metrics(String namespace); + + /** + * Get PodMetrics in a namespace with a name. + * + * @param namespace namespace of pod + * @param podName name of pod + * @return PodMetric corresponding to specified Pod + */ + PodMetrics metrics(String namespace, String podName); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/RbacAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/RbacAPIGroupDSL.java index 25fd6beb885..29fbb854a16 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/RbacAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/RbacAPIGroupDSL.java @@ -20,12 +20,12 @@ import io.fabric8.kubernetes.api.model.rbac.ClusterRoleBindingList; import io.fabric8.kubernetes.api.model.rbac.ClusterRoleList; import io.fabric8.kubernetes.api.model.rbac.Role; -import io.fabric8.kubernetes.api.model.rbac.RoleList; import io.fabric8.kubernetes.api.model.rbac.RoleBinding; import io.fabric8.kubernetes.api.model.rbac.RoleBindingList; +import io.fabric8.kubernetes.api.model.rbac.RoleList; import io.fabric8.kubernetes.client.Client; -public interface RbacAPIGroupDSL extends Client{ +public interface RbacAPIGroupDSL extends Client { MixedOperation> roles(); diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/SchedulingAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/SchedulingAPIGroupDSL.java index fdd556aad6a..af9b54c429a 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/SchedulingAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/SchedulingAPIGroupDSL.java @@ -22,6 +22,8 @@ public interface SchedulingAPIGroupDSL extends Client { @Deprecated MixedOperation> priorityClass(); + V1SchedulingAPIGroupDSL v1(); + V1beta1SchedulingAPIGroupDSL v1beta1(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/TimeoutImageEditReplacePatchable.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/TimeoutImageEditReplacePatchable.java index 91be0adff86..4e6a5dcff93 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/TimeoutImageEditReplacePatchable.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/TimeoutImageEditReplacePatchable.java @@ -17,6 +17,6 @@ package io.fabric8.kubernetes.client.dsl; public interface TimeoutImageEditReplacePatchable extends - Timeoutable>, - ImageEditReplacePatchable { + Timeoutable>, + ImageEditReplacePatchable { } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Timeoutable.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Timeoutable.java index 04a1afed2d1..c41e70e7db4 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Timeoutable.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/Timeoutable.java @@ -22,6 +22,5 @@ public interface Timeoutable { T withTimeout(long timeout, TimeUnit unit); - T withTimeoutInMillis(long timeoutInMillis); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1APIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1APIGroupDSL.java index f0ed5f5a6d9..9df4d335340 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1APIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1APIGroupDSL.java @@ -15,13 +15,14 @@ */ package io.fabric8.kubernetes.client.dsl; -import io.fabric8.kubernetes.api.model.PodTemplate; -import io.fabric8.kubernetes.api.model.PodTemplateList; import io.fabric8.kubernetes.api.model.Event; import io.fabric8.kubernetes.api.model.EventList; +import io.fabric8.kubernetes.api.model.PodTemplate; +import io.fabric8.kubernetes.api.model.PodTemplateList; import io.fabric8.kubernetes.client.Client; public interface V1APIGroupDSL extends Client { MixedOperation> podTemplates(); + MixedOperation> events(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1BatchAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1BatchAPIGroupDSL.java index 67ce73a6680..bb193f05bd2 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1BatchAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1BatchAPIGroupDSL.java @@ -24,12 +24,14 @@ public interface V1BatchAPIGroupDSL extends Client { /** * DSL entrypoint for batch/v1 Job + * * @return {@link MixedOperation} for Job resource */ MixedOperation> jobs(); /** * DSL entrypoint for batch/v1 CronJob + * * @return {@link MixedOperation} for CronJob resource */ MixedOperation> cronjobs(); diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1CertificatesAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1CertificatesAPIGroupDSL.java index 46816225a7b..f88c451bbb5 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1CertificatesAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1CertificatesAPIGroupDSL.java @@ -15,7 +15,6 @@ */ package io.fabric8.kubernetes.client.dsl; - import io.fabric8.kubernetes.api.model.certificates.v1.CertificateSigningRequest; import io.fabric8.kubernetes.api.model.certificates.v1.CertificateSigningRequestList; import io.fabric8.kubernetes.client.Client; diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1PolicyAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1PolicyAPIGroupDSL.java index 4df5d4ebe15..c4e6eaa5f55 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1PolicyAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1PolicyAPIGroupDSL.java @@ -22,6 +22,7 @@ public interface V1PolicyAPIGroupDSL extends Client { /** * DSL entrypoint for policy/v1 PodDisruptionBudget + * * @return {@link MixedOperation} for PodDisruptionBudget */ MixedOperation> podDisruptionBudget(); diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1beta1BatchAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1beta1BatchAPIGroupDSL.java index 12b1a1f7c1c..9eed67dfc46 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1beta1BatchAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1beta1BatchAPIGroupDSL.java @@ -22,6 +22,7 @@ public interface V1beta1BatchAPIGroupDSL extends Client { /** * DSL entrypoint for batch/v1beta1 CronJob resource + * * @return {@link MixedOperation} for CronJob resource */ MixedOperation> cronjobs(); diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1beta1FlowControlAPIGroupDSL.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1beta1FlowControlAPIGroupDSL.java index 0a6d17f3255..b1d33e5fa75 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1beta1FlowControlAPIGroupDSL.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/dsl/V1beta1FlowControlAPIGroupDSL.java @@ -15,11 +15,11 @@ */ package io.fabric8.kubernetes.client.dsl; +import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchema; +import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaList; import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfiguration; import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.PriorityLevelConfigurationList; import io.fabric8.kubernetes.client.Client; -import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchema; -import io.fabric8.kubernetes.api.model.flowcontrol.v1beta1.FlowSchemaList; public interface V1beta1FlowControlAPIGroupDSL extends Client { /** diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/leaderelection/LeaderElectionConfig.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/leaderelection/LeaderElectionConfig.java index 7d5da458354..47e64f88ac9 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/leaderelection/LeaderElectionConfig.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/leaderelection/LeaderElectionConfig.java @@ -20,11 +20,7 @@ import java.time.Duration; -@Buildable( - editableEnabled = false, - lazyCollectionInitEnabled = false, - builderPackage = "io.fabric8.kubernetes.api.builder" -) +@Buildable(editableEnabled = false, lazyCollectionInitEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder") public class LeaderElectionConfig { private final Lock lock; @@ -35,7 +31,8 @@ public class LeaderElectionConfig { private final boolean releaseOnCancel; private final String name; - public LeaderElectionConfig(Lock lock, Duration leaseDuration, Duration renewDeadline, Duration retryPeriod, LeaderCallbacks leaderCallbacks, boolean releaseOnCancel, String name) { + public LeaderElectionConfig(Lock lock, Duration leaseDuration, Duration renewDeadline, Duration retryPeriod, + LeaderCallbacks leaderCallbacks, boolean releaseOnCancel, String name) { this.lock = lock; this.leaseDuration = leaseDuration; this.renewDeadline = renewDeadline; diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/run/RunConfig.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/run/RunConfig.java index 07cebc322b1..e122854bef1 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/run/RunConfig.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/run/RunConfig.java @@ -44,7 +44,8 @@ public class RunConfig { /** * Arguments for the default or provided command. * - *

If command is present, these will be used as extra arguments for the command. If not, + *

+ * If command is present, these will be used as extra arguments for the command. If not, * these will be set in the args container configuration. */ private List args; @@ -79,7 +80,9 @@ public class RunConfig { @SuppressWarnings("java:S107") @Buildable(builderPackage = "io.fabric8.kubernetes.api.builder") - public RunConfig(String name, String image, String imagePullPolicy, String command, List args, String restartPolicy, String serviceAccount, Map labels, Map env, Map limits, Map requests, int port) { + public RunConfig(String name, String image, String imagePullPolicy, String command, List args, String restartPolicy, + String serviceAccount, Map labels, Map env, Map limits, + Map requests, int port) { this.name = name; this.image = image; this.imagePullPolicy = imagePullPolicy; diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/run/RunConfigUtil.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/run/RunConfigUtil.java index 02d77baed41..d6c70d678dd 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/run/RunConfigUtil.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/extended/run/RunConfigUtil.java @@ -33,7 +33,9 @@ public class RunConfigUtil { private static final String DEFAULT_RESTART_POLICY = "Always"; - private RunConfigUtil() { } + + private RunConfigUtil() { + } public static ObjectMeta getObjectMetadataFromRunConfig(RunConfig generatorRunConfig) { ObjectMetaBuilder objectMetaBuilder = new ObjectMetaBuilder(); @@ -80,20 +82,20 @@ static Container containerFromConfig(RunConfig runConfig) { if (runConfig.getPort() > 0) { containerBuilder.withPorts(new ContainerPortBuilder() - .withContainerPort(runConfig.getPort()) - .build()); + .withContainerPort(runConfig.getPort()) + .build()); } if (runConfig.getLimits() != null) { containerBuilder.editOrNewResources() - .addToLimits(runConfig.getLimits()) - .endResources(); + .addToLimits(runConfig.getLimits()) + .endResources(); } if (runConfig.getRequests() != null) { containerBuilder.editOrNewResources() - .addToRequests(runConfig.getRequests()) - .endResources(); + .addToRequests(runConfig.getRequests()) + .endResources(); } return containerBuilder.build(); } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/BasicBuilder.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/BasicBuilder.java index 6576b172a48..d7f34e486e1 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/BasicBuilder.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/BasicBuilder.java @@ -19,23 +19,25 @@ import java.net.URI; public interface BasicBuilder { - + BasicBuilder uri(URI uri); - + /** - * Add the key value pair. Will append to an existing key. + * Add the key value pair. Will append to an existing key. + * * @param k key * @param v value * @return the builder */ BasicBuilder header(String k, String v); - + /** - * Set the key value pair. Will overwrite an existing key. + * Set the key value pair. Will overwrite an existing key. + * * @param k key * @param v value * @return the builder */ BasicBuilder setHeader(String k, String v); - + } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/HttpStatusMessage.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/HttpStatusMessage.java index e25739c88d2..3c956ef4261 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/HttpStatusMessage.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/HttpStatusMessage.java @@ -20,85 +20,86 @@ import java.util.Map; /** - * Adapted from https://stackoverflow.com/questions/67345954/how-do-i-get-the-http-status-message-from-responses-on-java-net-httpclient-reque + * Adapted from + * https://stackoverflow.com/questions/67345954/how-do-i-get-the-http-status-message-from-responses-on-java-net-httpclient-reque */ public class HttpStatusMessage { private static final String UNKNOWN_STATUS = "Unknown Status"; - private static final Map REASONS = new HashMap<>(); + private static final Map REASONS = new HashMap<>(); static { - // informational - entry(100, "Continue"); - entry(101, "Switching Protocol"); - entry(102, "Processing"); - entry(103, "Early Hints"); + // informational + entry(100, "Continue"); + entry(101, "Switching Protocol"); + entry(102, "Processing"); + entry(103, "Early Hints"); - // successful - entry(200, "OK"); - entry(201, "Created"); - entry(202, "Accepted"); - entry(203, "Non-Authoritative Information"); - entry(204, "No Content"); - entry(205, "Reset Content"); - entry(206, "Partial Content"); - entry(207, "Multi Status"); - entry(208, "Already Reported"); - entry(226, "IM Used"); + // successful + entry(200, "OK"); + entry(201, "Created"); + entry(202, "Accepted"); + entry(203, "Non-Authoritative Information"); + entry(204, "No Content"); + entry(205, "Reset Content"); + entry(206, "Partial Content"); + entry(207, "Multi Status"); + entry(208, "Already Reported"); + entry(226, "IM Used"); - // redirection - entry(300, "Multiple Choice"); - entry(301, "Moved Permanently"); - entry(302, "Found"); - entry(303, "See Other"); - entry(304, "Not Modified"); - entry(305, "Use Proxy"); // deprecated - entry(307, "Temporary Redirect"); - entry(308, "Permanent Redirect"); + // redirection + entry(300, "Multiple Choice"); + entry(301, "Moved Permanently"); + entry(302, "Found"); + entry(303, "See Other"); + entry(304, "Not Modified"); + entry(305, "Use Proxy"); // deprecated + entry(307, "Temporary Redirect"); + entry(308, "Permanent Redirect"); - // client error - entry(400, "Bad Request"); - entry(401, "Unauthorized"); - entry(402, "Payment Required"); - entry(403, "Forbidden"); - entry(404, "Not Found"); - entry(405, "Method Not Allowed"); - entry(406, "Not Acceptable"); - entry(407, "Proxy Authentication Required"); - entry(408, "Request Timeout"); - entry(409, "Conflict"); - entry(410, "Gone"); - entry(411, "Length Required"); - entry(412, "Precondition Failed"); - entry(413, "Payload Too Long"); - entry(414, "URI Too Long"); - entry(415, "Unsupported Media Type"); - entry(416, "Range Not Satisfiable"); - entry(417, "Expectation Failed"); - entry(418, "I'm a Teapot"); - entry(421, "Misdirected Request"); - entry(422, "Unprocessable Entity"); - entry(423, "Locked"); - entry(424, "Failed Dependency"); - entry(425, "Too Early"); - entry(426, "Upgrade Required"); - entry(428, "Precondition Required"); - entry(429, "Too Many Requests"); - entry(431, "Request Header Fields Too Large"); - entry(451, "Unavailable for Legal Reasons"); + // client error + entry(400, "Bad Request"); + entry(401, "Unauthorized"); + entry(402, "Payment Required"); + entry(403, "Forbidden"); + entry(404, "Not Found"); + entry(405, "Method Not Allowed"); + entry(406, "Not Acceptable"); + entry(407, "Proxy Authentication Required"); + entry(408, "Request Timeout"); + entry(409, "Conflict"); + entry(410, "Gone"); + entry(411, "Length Required"); + entry(412, "Precondition Failed"); + entry(413, "Payload Too Long"); + entry(414, "URI Too Long"); + entry(415, "Unsupported Media Type"); + entry(416, "Range Not Satisfiable"); + entry(417, "Expectation Failed"); + entry(418, "I'm a Teapot"); + entry(421, "Misdirected Request"); + entry(422, "Unprocessable Entity"); + entry(423, "Locked"); + entry(424, "Failed Dependency"); + entry(425, "Too Early"); + entry(426, "Upgrade Required"); + entry(428, "Precondition Required"); + entry(429, "Too Many Requests"); + entry(431, "Request Header Fields Too Large"); + entry(451, "Unavailable for Legal Reasons"); - // server error - entry(500, "Internal Server Error"); - entry(501, "Not Implemented"); - entry(502, "Bad Gateway"); - entry(503, "Service Unavailable"); - entry(504, "Gateway Timeout"); - entry(505, "HTTP Version Not Supported"); - entry(506, "Variant Also Negotiates"); - entry(507, "Insufficient Storage"); - entry(508, "Loop Detected"); - entry(510, "Not Extended"); - entry(511, "Network Authentication Required"); + // server error + entry(500, "Internal Server Error"); + entry(501, "Not Implemented"); + entry(502, "Bad Gateway"); + entry(503, "Service Unavailable"); + entry(504, "Gateway Timeout"); + entry(505, "HTTP Version Not Supported"); + entry(506, "Variant Also Negotiates"); + entry(507, "Insufficient Storage"); + entry(508, "Loop Detected"); + entry(510, "Not Extended"); + entry(511, "Network Authentication Required"); } private static void entry(int i, String string) { @@ -108,7 +109,7 @@ private static void entry(int i, String string) { public static String getMessageForStatus(int status) { return REASONS.getOrDefault(status, UNKNOWN_STATUS); } - + private HttpStatusMessage() { // utility } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/TlsVersion.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/TlsVersion.java index 6df3309c543..4e02fdf5e96 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/TlsVersion.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/TlsVersion.java @@ -22,12 +22,12 @@ * Replacement for okhttp3.TlsVersion */ public enum TlsVersion { - - TLS_1_3("TLSv1.3"), - TLS_1_2("TLSv1.2"), - TLS_1_1("TLSv1.1"), - TLS_1_0("TLSv1"), - SSL_3_0("SSLv3"), + + TLS_1_3("TLSv1.3"), + TLS_1_2("TLSv1.2"), + TLS_1_1("TLSv1.1"), + TLS_1_0("TLSv1"), + SSL_3_0("SSLv3"), ; final String javaName; @@ -45,9 +45,9 @@ public static TlsVersion forJavaName(String string) { } return TlsVersion.valueOf(string.replaceAll("[v.]", "_")); } - + public String javaName() { return javaName; } - + } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/WebSocketHandshakeException.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/WebSocketHandshakeException.java index e6478f3aa46..f9f31728889 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/WebSocketHandshakeException.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/http/WebSocketHandshakeException.java @@ -19,24 +19,25 @@ import java.io.IOException; public final class WebSocketHandshakeException extends IOException { - + private final transient HttpResponse response; - + public WebSocketHandshakeException(HttpResponse response) { this.response = response; } - + /** * Get the response, which includes the code of failure. + * * @return the response, never null */ public HttpResponse getResponse() { return response; } - + @Override public synchronized WebSocketHandshakeException initCause(Throwable cause) { - return (WebSocketHandshakeException) super.initCause(cause); + return (WebSocketHandshakeException) super.initCause(cause); } } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/KubeConfigUtils.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/KubeConfigUtils.java index 6710da6d87b..7d5a53383f9 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/KubeConfigUtils.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/KubeConfigUtils.java @@ -35,7 +35,8 @@ * like osc login and osc project myproject */ public class KubeConfigUtils { - private KubeConfigUtils() {} + private KubeConfigUtils() { + } public static Config parseConfig(File file) throws IOException { ObjectMapper mapper = Serialization.yamlMapper(); @@ -98,10 +99,10 @@ public static AuthInfo getUserAuthInfo(Config config, Context context) { List users = config.getUsers(); if (users != null) { authInfo = users.stream() - .filter(u -> u.getName().equals(user)) - .findAny() - .map(NamedAuthInfo::getUser) - .orElse(null); + .filter(u -> u.getName().equals(user)) + .findAny() + .map(NamedAuthInfo::getUser) + .orElse(null); } } } @@ -111,8 +112,8 @@ public static AuthInfo getUserAuthInfo(Config config, Context context) { /** * Returns the current {@link Cluster} for the current context * - * @param config {@link Config} config object - * @param context {@link Context} context object + * @param config {@link Config} config object + * @param context {@link Context} context object * @return current {@link Cluster} for current context */ public static Cluster getCluster(Config config, Context context) { @@ -123,10 +124,10 @@ public static Cluster getCluster(Config config, Context context) { List clusters = config.getClusters(); if (clusters != null) { cluster = clusters.stream() - .filter(c -> c.getName().equals(clusterName)) - .findAny() - .map(NamedCluster::getCluster) - .orElse(null); + .filter(c -> c.getName().equals(clusterName)) + .findAny() + .map(NamedCluster::getCluster) + .orElse(null); } } } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/PKCS1Util.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/PKCS1Util.java index 39e2671dfaf..d8ddeebdc84 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/PKCS1Util.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/internal/PKCS1Util.java @@ -44,9 +44,9 @@ public static RSAPrivateCrtKeySpec decodePKCS1(byte[] keyBytes) throws IOExcepti parser.read(); return new RSAPrivateCrtKeySpec(next(parser), next(parser), - next(parser), next(parser), - next(parser), next(parser), - next(parser), next(parser)); + next(parser), next(parser), + next(parser), next(parser), + next(parser), next(parser)); } // ========================================================================================== @@ -92,7 +92,7 @@ private int getLength() throws IOException { int num = i & 0x7F; if (i >= 0xFF || num > 4) { throw new IOException("Invalid DER: length field too big (" - + i + ")"); + + i + ")"); } byte[] bytes = new byte[num]; diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/lib/FileSystem.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/lib/FileSystem.java index 4ce6dea7adb..b18c39c96c5 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/lib/FileSystem.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/lib/FileSystem.java @@ -43,8 +43,8 @@ public enum FileSystem { * Linux file system. */ LINUX(true, true, 255, 4096, new char[] { - // KEEP THIS ARRAY SORTED! - // @formatter:off + // KEEP THIS ARRAY SORTED! + // @formatter:off // ASCII NUL 0, '/' @@ -55,8 +55,8 @@ public enum FileSystem { * MacOS file system. */ MAC_OSX(true, true, 255, 1024, new char[] { - // KEEP THIS ARRAY SORTED! - // @formatter:off + // KEEP THIS ARRAY SORTED! + // @formatter:off // ASCII NUL 0, '/', @@ -68,9 +68,9 @@ public enum FileSystem { * Windows file system. */ WINDOWS(false, true, 255, - 32000, new char[] { - // KEEP THIS ARRAY SORTED! - // @formatter:off + 32000, new char[] { + // KEEP THIS ARRAY SORTED! + // @formatter:off // ASCII NUL 0, // 1-31 may be allowed in file streams @@ -78,9 +78,10 @@ public enum FileSystem { 29, 30, 31, '"', '*', '/', ':', '<', '>', '?', '\\', '|' // @formatter:on - }, // KEEP THIS ARRAY SORTED! - new String[] { "AUX", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "CON", "LPT1", - "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", "NUL", "PRN" }, true); + }, // KEEP THIS ARRAY SORTED! + new String[] { "AUX", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "CON", "LPT1", + "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9", "NUL", "PRN" }, + true); /** *

@@ -139,7 +140,7 @@ public static FileSystem getCurrent() { * Decides if the operating system matches. * * @param osNamePrefix - * the prefix for the os name + * the prefix for the os name * @return true if matches, or false if not or can't determine */ private static boolean getOsMatchesName(final String osNamePrefix) { @@ -156,7 +157,7 @@ private static boolean getOsMatchesName(final String osNamePrefix) { *

* * @param property - * the system property name + * the system property name * @return the system property value or {@code null} if a security problem occurs */ private static String getSystemProperty(final String property) { @@ -165,7 +166,7 @@ private static String getSystemProperty(final String property) { } catch (final SecurityException ex) { // we are not allowed to look at this property System.err.println("Caught a SecurityException reading the system property '" + property - + "'; the SystemUtils property value will default to null."); + + "'; the SystemUtils property value will default to null."); return null; } } @@ -177,9 +178,9 @@ private static String getSystemProperty(final String property) { *

* * @param osName - * the actual OS name + * the actual OS name * @param osNamePrefix - * the prefix for the expected OS name + * the prefix for the expected OS name * @return true if matches, or false if not or can't determine */ private static boolean isOsNameMatch(final String osName, final String osNamePrefix) { @@ -209,8 +210,8 @@ private static boolean isOsNameMatch(final String osName, final String osNamePre * @param supportsDriveLetter Whether this file system support driver letters. */ FileSystem(final boolean caseSensitive, final boolean casePreserving, final int maxFileLength, - final int maxPathLength, final char[] illegalFileNameChars, final String[] reservedFileNames, - final boolean supportsDriveLetter) { + final int maxPathLength, final char[] illegalFileNameChars, final String[] reservedFileNames, + final boolean supportsDriveLetter) { this.maxFileNameLength = maxFileLength; this.maxPathLength = maxPathLength; this.illegalFileNameChars = Objects.requireNonNull(illegalFileNameChars, "illegalFileNameChars"); @@ -278,7 +279,7 @@ public boolean isCaseSensitive() { * Returns {@code true} if the given character is illegal in a file name, {@code false} otherwise. * * @param c - * the character to test + * the character to test * @return {@code true} if the given character is illegal in a file name, {@code false} otherwise. */ private boolean isIllegalFileNameChar(final char c) { @@ -291,7 +292,7 @@ private boolean isIllegalFileNameChar(final char c) { * an illegal character then the check fails. * * @param candidate - * a candidate file name (without a path) like {@code "filename.ext"} or {@code "filename"} + * a candidate file name (without a path) like {@code "filename.ext"} or {@code "filename"} * @return {@code true} if the candidate name is legal */ public boolean isLegalFileName(final CharSequence candidate) { @@ -313,7 +314,7 @@ public boolean isLegalFileName(final CharSequence candidate) { * Returns whether the given string is a reserved file name. * * @param candidate - * the string to test + * the string to test * @return {@code true} if the given string is a reserved file name. */ public boolean isReservedFileName(final CharSequence candidate) { @@ -343,20 +344,20 @@ public boolean supportsDriveLetter() { * {@link #getMaxFileNameLength()}. * * @param candidate - * a candidate file name (without a path) like {@code "filename.ext"} or {@code "filename"} + * a candidate file name (without a path) like {@code "filename.ext"} or {@code "filename"} * @param replacement - * Illegal characters in the candidate name are replaced by this character + * Illegal characters in the candidate name are replaced by this character * @return a String without illegal characters */ public String toLegalFileName(final String candidate, final char replacement) { if (isIllegalFileNameChar(replacement)) { throw new IllegalArgumentException( - String.format("The replacement character '%s' cannot be one of the %s illegal characters: %s", - // %s does not work properly with NUL - replacement == '\0' ? "\\0" : replacement, name(), Arrays.toString(illegalFileNameChars))); + String.format("The replacement character '%s' cannot be one of the %s illegal characters: %s", + // %s does not work properly with NUL + replacement == '\0' ? "\\0" : replacement, name(), Arrays.toString(illegalFileNameChars))); } final String truncated = candidate.length() > maxFileNameLength ? candidate.substring(0, maxFileNameLength) - : candidate; + : candidate; boolean changed = false; final char[] charArray = truncated.toCharArray(); for (int i = 0; i < charArray.length; i++) { diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/lib/FilenameUtils.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/lib/FilenameUtils.java index 4926fb7d2a5..9a420406191 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/lib/FilenameUtils.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/lib/FilenameUtils.java @@ -136,7 +136,7 @@ static boolean isSystemWindows() { /** * Checks if the character is a separator. * - * @param ch the character to check + * @param ch the character to check * @return true if it is a separator character */ private static boolean isSeparator(final char ch) { @@ -181,7 +181,7 @@ private static boolean isSeparator(final char ch) { * * (Note the file separator returned will be correct for Windows/Unix) * - * @param fileName the fileName to normalize, null returns null + * @param fileName the fileName to normalize, null returns null * @return the normalized fileName, or null if invalid. Null bytes inside string will be removed */ public static String normalize(final String fileName) { @@ -225,9 +225,9 @@ public static String normalize(final String fileName) { * ~/../bar --> null * * - * @param fileName the fileName to normalize, null returns null + * @param fileName the fileName to normalize, null returns null * @param unixSeparator {@code true} if a unix separator should - * be used or {@code false} if a windows separator should be used. + * be used or {@code false} if a windows separator should be used. * @return the normalized fileName, or null if invalid. Null bytes inside string will be removed * @since 2.0 */ @@ -239,9 +239,9 @@ public static String normalizeNoEndSeparator(final String fileName, final boolea /** * Internal method to perform the normalization. * - * @param fileName the fileName + * @param fileName the fileName * @param separator The separator character to use - * @param keepSeparator true to keep the final separator + * @param keepSeparator true to keep the final separator * @return the normalized fileName. Null bytes inside string will be removed. */ private static String doNormalize(final String fileName, final char separator, final boolean keepSeparator) { @@ -260,7 +260,7 @@ private static String doNormalize(final String fileName, final char separator, f return null; } - final char[] array = new char[size + 2]; // +1 for possible extra slash, +2 for arraycopy + final char[] array = new char[size + 2]; // +1 for possible extra slash, +2 for arraycopy fileName.getChars(0, fileName.length(), array, 0); // fix separators throughout @@ -290,21 +290,20 @@ private static String doNormalize(final String fileName, final char separator, f // dot slash for (int i = prefix + 1; i < size; i++) { if (array[i] == separator && array[i - 1] == '.' && - (i == prefix + 1 || array[i - 2] == separator)) { + (i == prefix + 1 || array[i - 2] == separator)) { if (i == size - 1) { lastIsDirectory = true; } System.arraycopy(array, i + 1, array, i - 1, size - i); - size -=2; + size -= 2; i--; } } // double dot slash - outer: - for (int i = prefix + 2; i < size; i++) { + outer: for (int i = prefix + 2; i < size; i++) { if (array[i] == separator && array[i - 1] == '.' && array[i - 2] == '.' && - (i == prefix + 2 || array[i - 3] == separator)) { + (i == prefix + 2 || array[i - 3] == separator)) { if (i == prefix + 2) { return null; } @@ -312,7 +311,7 @@ private static String doNormalize(final String fileName, final char separator, f lastIsDirectory = true; } int j; - for (j = i - 4 ; j >= prefix; j--) { + for (j = i - 4; j >= prefix; j--) { if (array[j] == separator) { // remove b/../ from a/b/../c System.arraycopy(array, i + 1, array, j + 1, size - i); @@ -328,23 +327,22 @@ private static String doNormalize(final String fileName, final char separator, f } } - if (size <= 0) { // should never be less than 0 + if (size <= 0) { // should never be less than 0 return EMPTY_STRING; } - if (size <= prefix) { // should never be less than prefix + if (size <= prefix) { // should never be less than prefix return new String(array, 0, size); } if (lastIsDirectory && keepSeparator) { - return new String(array, 0, size); // keep trailing separator + return new String(array, 0, size); // keep trailing separator } - return new String(array, 0, size - 1); // lose trailing separator + return new String(array, 0, size - 1); // lose trailing separator } - /** * Converts all separators to the Unix separator of forward slash. * - * @param path the path to be changed, null ignored + * @param path the path to be changed, null ignored * @return the updated path */ public static String separatorsToUnix(final String path) { @@ -357,7 +355,7 @@ public static String separatorsToUnix(final String path) { /** * Converts all separators to the Windows separator of backslash. * - * @param path the path to be changed, null ignored + * @param path the path to be changed, null ignored * @return the updated path */ public static String separatorsToWindows(final String path) { @@ -370,7 +368,7 @@ public static String separatorsToWindows(final String path) { /** * Converts all separators to the system separator. * - * @param path the path to be changed, null ignored + * @param path the path to be changed, null ignored * @return the updated path */ public static String separatorsToSystem(final String path) { @@ -416,7 +414,7 @@ public static String separatorsToSystem(final String path) { * These must be followed by a server name, so double-slashes are not collapsed * to a single slash at the start of the fileName. * - * @param fileName the fileName to find the prefix in, null returns -1 + * @param fileName the fileName to find the prefix in, null returns -1 * @return the length of the prefix, -1 if invalid or null */ public static int getPrefixLength(final String fileName) { @@ -433,7 +431,7 @@ public static int getPrefixLength(final String fileName) { } if (len == 1) { if (ch0 == '~') { - return 2; // return a length greater than the input + return 2; // return a length greater than the input } return isSeparator(ch0) ? 1 : 0; } @@ -441,7 +439,7 @@ public static int getPrefixLength(final String fileName) { int posUnix = fileName.indexOf(UNIX_SEPARATOR, 1); int posWin = fileName.indexOf(WINDOWS_SEPARATOR, 1); if (posUnix == NOT_FOUND && posWin == NOT_FOUND) { - return len + 1; // return a length greater than the input + return len + 1; // return a length greater than the input } posUnix = posUnix == NOT_FOUND ? posWin : posUnix; posWin = posWin == NOT_FOUND ? posUnix : posWin; @@ -489,7 +487,7 @@ public static int getPrefixLength(final String fileName) { private static void requireNonNullChars(final String path) { if (path.indexOf(0) >= 0) { throw new IllegalArgumentException("Null byte present in file/path name. There are no " - + "known legitimate use cases for such data, but several injection attacks may use it"); + + "known legitimate use cases for such data, but several injection attacks may use it"); } } @@ -497,9 +495,11 @@ private static void requireNonNullChars(final String path) { * Checks whether a given string is a valid host name according to * RFC 3986. * - *

Accepted are IP addresses (v4 and v6) as well as what the + *

+ * Accepted are IP addresses (v4 and v6) as well as what the * RFC calls a "reg-name". Percent encoded names don't seem to be - * valid names in UNC paths.

+ * valid names in UNC paths. + *

* * @see "https://tools.ietf.org/html/rfc3986#section-3.2.2" * @param name the hostname to validate @@ -509,8 +509,7 @@ private static boolean isValidHostName(final String name) { return isIPv6Address(name) || isRFC3986HostName(name); } - private static final Pattern IPV4_PATTERN = - Pattern.compile("^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$"); + private static final Pattern IPV4_PATTERN = Pattern.compile("^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$"); private static final int IPV4_MAX_OCTET_VALUE = 255; /** @@ -561,7 +560,7 @@ private static boolean isIPv6Address(final String inet6Address) { return false; } if ((inet6Address.startsWith(":") && !inet6Address.startsWith("::")) - || (inet6Address.endsWith(":") && !inet6Address.endsWith("::"))) { + || (inet6Address.endsWith(":") && !inet6Address.endsWith("::"))) { return false; } String[] octets = inet6Address.split(":"); @@ -614,6 +613,7 @@ private static boolean isIPv6Address(final String inet6Address) { } return validOctets <= IPV6_MAX_HEX_GROUPS && (validOctets >= IPV6_MAX_HEX_GROUPS || containsCompressedZeroes); } + private static final Pattern REG_NAME_PART_PATTERN = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9-]*$"); /** diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ApiVersionUtil.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ApiVersionUtil.java index 703388dcf99..7a6b54d3b7c 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ApiVersionUtil.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ApiVersionUtil.java @@ -25,10 +25,11 @@ private ApiVersionUtil() { /** * Extracts apiGroupName from apiGroupVersion when in resource for apiGroupName/apiGroupVersion combination - * @param Template argument provided - * @param item resource which is being used - * @param apiGroup apiGroupName present if any - * @return Just the apiGroupName part without apiGroupVersion + * + * @param Template argument provided + * @param item resource which is being used + * @param apiGroup apiGroupName present if any + * @return Just the apiGroupName part without apiGroupVersion */ public static String apiGroup(T item, String apiGroup) { if (item instanceof HasMetadata && Utils.isNotNullOrEmpty(((HasMetadata) item).getApiVersion())) { @@ -41,6 +42,7 @@ public static String apiGroup(T item, String apiGroup) { /** * Returns the api version falling back to the items apiGroupVersion if not null. + * * @param type of parameter * @param item item to be processed * @param apiVersion apiVersion string @@ -57,23 +59,25 @@ public static String apiVersion(T item, String apiVersion) { /** * Separates apiGroupVersion for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupVersion part without the apiGroupName. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupVersion part without the apiGroupName. */ public static String trimVersion(String apiVersion) { if (apiVersion != null) { final int slash = apiVersion.indexOf('/'); - if(slash > 0) { + if (slash > 0) { return apiVersion.substring(slash + 1); } } return apiVersion; } - /** + /** * Separates apiGroupName for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupName part without the apiGroupName, or apiVersion if no separator is found. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupName part without the apiGroupName, or apiVersion if no separator is found. */ public static String trimGroup(String apiVersion) { if (apiVersion != null) { @@ -85,12 +89,11 @@ public static String trimGroup(String apiVersion) { return apiVersion; } - - - /** + /** * Separates apiGroupName for apiGroupName/apiGroupVersion combination. - * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. - * @return Just the apiGroupName part without the apiGroupName, or null if no separator is found. + * + * @param apiVersion The apiGroupVersion or apiGroupName/apiGroupVersion combo. + * @return Just the apiGroupName part without the apiGroupName, or null if no separator is found. */ public static String trimGroupOrNull(String apiVersion) { if (apiVersion != null && apiVersion.contains("/")) { diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/CachedSingleThreadScheduler.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/CachedSingleThreadScheduler.java index c813f76fef2..5f873979b3b 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/CachedSingleThreadScheduler.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/CachedSingleThreadScheduler.java @@ -24,26 +24,28 @@ * Maintains a single thread daemon scheduler, which will terminate the thread * when not in use. * - *
It is not intended for long-running tasks, + *
+ * It is not intended for long-running tasks, * but it does not assume the task can be handed off to the common pool * - *
This is very similar to the CompletableFuture.Delayer, but provides a scheduler method + *
+ * This is very similar to the CompletableFuture.Delayer, but provides a scheduler method */ public class CachedSingleThreadScheduler { - + public static final long DEFAULT_TTL_MILLIS = TimeUnit.SECONDS.toMillis(10); - + private final long ttlMillis; private ScheduledThreadPoolExecutor executor; public CachedSingleThreadScheduler() { this(DEFAULT_TTL_MILLIS); } - + public CachedSingleThreadScheduler(long ttlMillis) { this.ttlMillis = ttlMillis; } - + public synchronized ScheduledFuture scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, @@ -51,7 +53,7 @@ public synchronized ScheduledFuture scheduleWithFixedDelay(Runnable command, startExecutor(); return executor.scheduleWithFixedDelay(command, initialDelay, delay, unit); } - + public synchronized ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) { @@ -79,9 +81,9 @@ private synchronized void shutdownCheck() { executor = null; } } - + synchronized boolean hasExecutor() { return executor != null; } - + } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/IOHelpers.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/IOHelpers.java index 39a81bb5158..e51978245ad 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/IOHelpers.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/IOHelpers.java @@ -33,43 +33,42 @@ public class IOHelpers { private IOHelpers() { throw new IllegalStateException("Utility class"); } - + public static String readFully(InputStream in, Charset charset) throws IOException { Reader r = new BufferedReader(new InputStreamReader(in, charset)); return readFully(r); } - - public static String readFully(InputStream in) throws IOException { - return readFully(in, Charset.defaultCharset()); - } - public static String readFully(Reader r) throws IOException { - try (StringWriter w = new StringWriter()) { - copy(r, w); - return w.toString(); - } - } + public static String readFully(InputStream in) throws IOException { + return readFully(in, Charset.defaultCharset()); + } + public static String readFully(Reader r) throws IOException { + try (StringWriter w = new StringWriter()) { + copy(r, w); + return w.toString(); + } + } - private static void copy(Reader reader, Writer writer) throws IOException { - char[] buffer = new char[8192]; - int len; - for (; ; ) { - len = reader.read(buffer); - if (len > 0) { - writer.write(buffer, 0, len); - } else { - writer.flush(); - break; - } - } + private static void copy(Reader reader, Writer writer) throws IOException { + char[] buffer = new char[8192]; + int len; + for (;;) { + len = reader.read(buffer); + if (len > 0) { + writer.write(buffer, 0, len); + } else { + writer.flush(); + break; + } } + } public static boolean isJSONValid(String json) { - try{ + try { ObjectMapper objectMapper = Serialization.jsonMapper(); objectMapper.readTree(json); - } catch(JsonProcessingException e){ + } catch (JsonProcessingException e) { return false; } return true; @@ -84,10 +83,10 @@ public static String convertYamlToJson(String yaml) throws IOException { } public static String convertToJson(String jsonOrYaml) throws IOException { - if (isJSONValid(jsonOrYaml)) { - return jsonOrYaml; - } - return convertYamlToJson(jsonOrYaml); + if (isJSONValid(jsonOrYaml)) { + return jsonOrYaml; + } + return convertYamlToJson(jsonOrYaml); } } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionFactory.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionFactory.java index 8716f418199..22d18fa3cde 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionFactory.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionFactory.java @@ -26,223 +26,230 @@ */ public class KubernetesVersionFactory { - private KubernetesVersionFactory() {} + private KubernetesVersionFactory() { + } - public static Version create(String versionValue) { - Version version = KubernetesVersion.FACTORY.create(versionValue); - if (version == null) { - version = NonKubernetesVersion.FACTORY.create(versionValue); - } - return version; + public static Version create(String versionValue) { + Version version = KubernetesVersion.FACTORY.create(versionValue); + if (version == null) { + version = NonKubernetesVersion.FACTORY.create(versionValue); } + return version; + } - public interface VersionFactory { - T create(String version); - } + public interface VersionFactory { + T create(String version); + } - /** - * A kubernetes version. This represents a version that starts with a 'v' followed by a numerical major version. - * Optionally this may be followed by an 'alpha' or 'beta' qualifier and an also optional numeric minor version. - */ - public static class KubernetesVersion extends Version { - - public static final VersionFactory FACTORY = new VersionFactory() { - - private final Pattern versionPattern = Pattern.compile("v([0-9]+)((alpha|beta)([0-9]+)?)*"); - - @Override - public KubernetesVersion create(String version) { - if (version == null) { - return null; - } - Matcher matcher = versionPattern.matcher(version); - if (!matcher.matches()) { - return null; - } - Integer majorValue = getInt(matcher.group(1)); - String qualifierValue = matcher.group(3); - Integer minorValue = getInt(matcher.group(4)); - return new KubernetesVersion(majorValue, qualifierValue, minorValue, version); - } - - private Integer getInt(String value) { - if (value == null) { - return null; - } - try { - return Integer.parseInt(value); - } catch(NumberFormatException e) { - return null; - } - } - }; - - private final Integer major; - private final Optional qualifier; - private final Optional minor; - - private KubernetesVersion(Integer major, String qualifier, Integer minor, String version) { - super(version); - this.major = major; - this.qualifier = Optional.ofNullable(qualifier); - this.minor = Optional.ofNullable(minor); - } + /** + * A kubernetes version. This represents a version that starts with a 'v' followed by a numerical major version. + * Optionally this may be followed by an 'alpha' or 'beta' qualifier and an also optional numeric minor version. + */ + public static class KubernetesVersion extends Version { - public Integer getMajor() { - return major; - } + public static final VersionFactory FACTORY = new VersionFactory() { - public Optional getQualifier() { - return qualifier; - } + private final Pattern versionPattern = Pattern.compile("v([0-9]+)((alpha|beta)([0-9]+)?)*"); - public Optional getMinor() { - return minor; - } + @Override + public KubernetesVersion create(String version) { + if (version == null) { + return null; + } + Matcher matcher = versionPattern.matcher(version); + if (!matcher.matches()) { + return null; + } + Integer majorValue = getInt(matcher.group(1)); + String qualifierValue = matcher.group(3); + Integer minorValue = getInt(matcher.group(4)); + return new KubernetesVersion(majorValue, qualifierValue, minorValue, version); + } + + private Integer getInt(String value) { + if (value == null) { + return null; + } + try { + return Integer.parseInt(value); + } catch (NumberFormatException e) { + return null; + } + } + }; + + private final Integer major; + private final Optional qualifier; + private final Optional minor; + + private KubernetesVersion(Integer major, String qualifier, Integer minor, String version) { + super(version); + this.major = major; + this.qualifier = Optional.ofNullable(qualifier); + this.minor = Optional.ofNullable(minor); + } - public boolean isStable() { - return qualifier.orElse(null) == null; - } + public Integer getMajor() { + return major; + } - @Override - public boolean isKubernetes() { - return true; - } + public Optional getQualifier() { + return qualifier; + } - /** - * Compares this version to another version and returns whether this version has a - * higher, equal or lower priority than the version that it is being compared to. - * - * The kubernetes specs v1.17 at Version Priority - * state the following: - * - *
    - *
  • Entries that follow Kubernetes version patterns are sorted before those that do not.
  • - *
  • For entries that follow Kubernetes version patterns, the numeric portions of the version string is sorted largest to smallest.
  • - *
  • If the strings beta or alpha follow the first numeric portion, they sorted in that order, after the equivalent string without the beta - * or alpha suffix (which is presumed to be the GA version).
  • - *
  • If another number follows the beta, or alpha, those numbers are also sorted from largest to smallest.
  • - *
  • Strings that don’t fit the above format are sorted alphabetically and the numeric portions are not treated specially. Notice that in the example below, foo1 is sorted above foo10. - * This is different from the sorting of the numeric portion of entries that do follow the Kubernetes version patterns.
  • - *
- * - * @param other the version to compare this version to - * @return -1 if this version has a lower, 1 if it has a higher or 0 if the priorities are equal - * - */ - @Override - public int compareTo(Version other) { - if (other == this) { - return 0; - } - if (other instanceof NonKubernetesVersion) { - return 1; - } - if (!(other instanceof KubernetesVersion)) { - return 1; - } - KubernetesVersion otherKube = (KubernetesVersion) other; - if (qualifier.isPresent()) { - if (!otherKube.qualifier.isPresent()) { - return -1; - } - int qualifierComparison = qualifier.get().compareTo(otherKube.qualifier.orElse(null)); - if (qualifierComparison != 0) { - return qualifierComparison; - } - int majorComparison = compareMajor(otherKube); - if (majorComparison != 0) { - return majorComparison; - } - return compareMinor(otherKube); - } else { - if (!otherKube.qualifier.isPresent()) { - return compareMajor(otherKube); - } else { - return 1; - } - } - } + public Optional getMinor() { + return minor; + } - private int compareMajor(KubernetesVersion other) { - return major.compareTo(other.major); - } + public boolean isStable() { + return qualifier.orElse(null) == null; + } - private int compareMinor(KubernetesVersion other) { - if (minor.isPresent()) { - if (!other.minor.isPresent()) { - return 1; - } - return minor.get().compareTo(other.minor.orElse(null)); - } else { - if (!other.minor.isPresent()) { - return 0; - } - return -1; - } - } + @Override + public boolean isKubernetes() { + return true; } /** - * A non kubernetes version which is any version string that does not start with a 'v'. + * Compares this version to another version and returns whether this version has a + * higher, equal or lower priority than the version that it is being compared to. + * + * The kubernetes specs v1.17 at Version + * Priority + * state the following: + * + *
    + *
  • Entries that follow Kubernetes version patterns are sorted before those that do not.
  • + *
  • For entries that follow Kubernetes version patterns, the numeric portions of the version string is sorted largest to + * smallest.
  • + *
  • If the strings beta or alpha follow the first numeric portion, they sorted in that order, after the equivalent string + * without the beta + * or alpha suffix (which is presumed to be the GA version).
  • + *
  • If another number follows the beta, or alpha, those numbers are also sorted from largest to smallest.
  • + *
  • Strings that don’t fit the above format are sorted alphabetically and the numeric portions are not treated specially. + * Notice that in the example below, foo1 is sorted above foo10. + * This is different from the sorting of the numeric portion of entries that do follow the Kubernetes version patterns.
  • + *
+ * + * @param other the version to compare this version to + * @return -1 if this version has a lower, 1 if it has a higher or 0 if the priorities are equal + * */ - public static class NonKubernetesVersion extends Version { + @Override + public int compareTo(Version other) { + if (other == this) { + return 0; + } + if (other instanceof NonKubernetesVersion) { + return 1; + } + if (!(other instanceof KubernetesVersion)) { + return 1; + } + KubernetesVersion otherKube = (KubernetesVersion) other; + if (qualifier.isPresent()) { + if (!otherKube.qualifier.isPresent()) { + return -1; + } + int qualifierComparison = qualifier.get().compareTo(otherKube.qualifier.orElse(null)); + if (qualifierComparison != 0) { + return qualifierComparison; + } + int majorComparison = compareMajor(otherKube); + if (majorComparison != 0) { + return majorComparison; + } + return compareMinor(otherKube); + } else { + if (!otherKube.qualifier.isPresent()) { + return compareMajor(otherKube); + } else { + return 1; + } + } + } - public static final VersionFactory FACTORY = version -> { - if (version == null) { - return null; - } - return new NonKubernetesVersion(version); - }; + private int compareMajor(KubernetesVersion other) { + return major.compareTo(other.major); + } - private NonKubernetesVersion(String version) { - super(version); + private int compareMinor(KubernetesVersion other) { + if (minor.isPresent()) { + if (!other.minor.isPresent()) { + return 1; } - - @Override - public boolean isKubernetes() { - return false; + return minor.get().compareTo(other.minor.orElse(null)); + } else { + if (!other.minor.isPresent()) { + return 0; } + return -1; + } + } + } + + /** + * A non kubernetes version which is any version string that does not start with a 'v'. + */ + public static class NonKubernetesVersion extends Version { + + public static final VersionFactory FACTORY = version -> { + if (version == null) { + return null; + } + return new NonKubernetesVersion(version); + }; + + private NonKubernetesVersion(String version) { + super(version); + } - /** - * Non-Kubernetes versions have lower priority than kubernetes versions. Among them they're inverse-lexicographically sorted. - * - * @param other the other version to compare to - * @return -1 if this has a lower, 0 if equal or 1 if higher priority - */ - @Override - public int compareTo(Version other) { - if (other == this) { - return 0; - } - if (other instanceof KubernetesVersion) { - return -1; - } else if (other instanceof NonKubernetesVersion) { - return full.compareTo(other.full) * -1; // inverse lexicographical order - } else { - return -1; - } - } + @Override + public boolean isKubernetes() { + return false; } - protected abstract static class Version implements Comparable { + /** + * Non-Kubernetes versions have lower priority than kubernetes versions. Among them they're inverse-lexicographically + * sorted. + * + * @param other the other version to compare to + * @return -1 if this has a lower, 0 if equal or 1 if higher priority + */ + @Override + public int compareTo(Version other) { + if (other == this) { + return 0; + } + if (other instanceof KubernetesVersion) { + return -1; + } else if (other instanceof NonKubernetesVersion) { + return full.compareTo(other.full) * -1; // inverse lexicographical order + } else { + return -1; + } + } + } - protected final String full; + protected abstract static class Version implements Comparable { - protected Version(String full) { - this.full = full; - } + protected final String full; + + protected Version(String full) { + this.full = full; + } - public abstract boolean isKubernetes(); + public abstract boolean isKubernetes(); - public String getFull() { - return full; - } + public String getFull() { + return full; + } - @Override - public String toString() { - return full; - } + @Override + public String toString() { + return full; } + } } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriority.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriority.java index 6297c616a61..afadad62456 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriority.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriority.java @@ -29,33 +29,34 @@ */ public class KubernetesVersionPriority { - private KubernetesVersionPriority() {} + private KubernetesVersionPriority() { + } - /** - * Returns the version with the highest priority for the given list of versions. - * - * @param versions the versions to pick the version with the highest priority from - * @return the version with the highest priority - * - * @see CustomResourceDefinitionVersion#getName() - * @see CustomResourceDefinitionSpec#getVersions() - */ - public static String highestPriority(List versions) { - List byPriority = getByPriority(versions); - if (byPriority.isEmpty()) { - return null; - } - return byPriority.get(0).getFull(); + /** + * Returns the version with the highest priority for the given list of versions. + * + * @param versions the versions to pick the version with the highest priority from + * @return the version with the highest priority + * + * @see CustomResourceDefinitionVersion#getName() + * @see CustomResourceDefinitionSpec#getVersions() + */ + public static String highestPriority(List versions) { + List byPriority = getByPriority(versions); + if (byPriority.isEmpty()) { + return null; } + return byPriority.get(0).getFull(); + } - private static List getByPriority(List versions) { - if (versions == null - || versions.isEmpty()) { - return Collections.emptyList(); - } - return versions.stream() - .map(KubernetesVersionFactory::create) - .sorted(Collections.reverseOrder()) - .collect(Collectors.toList()); + private static List getByPriority(List versions) { + if (versions == null + || versions.isEmpty()) { + return Collections.emptyList(); } + return versions.stream() + .map(KubernetesVersionFactory::create) + .sorted(Collections.reverseOrder()) + .collect(Collectors.toList()); + } } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/PodStatusUtil.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/PodStatusUtil.java index 59c1305e3c7..96396f00569 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/PodStatusUtil.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/PodStatusUtil.java @@ -27,156 +27,162 @@ public class PodStatusUtil { - private static final String POD_RUNNING = "Running"; - private static final String POD_INITIALIZING = "PodInitializing"; - private static final String CONTAINER_COMPLETED = "Completed"; - - private PodStatusUtil() {} - - /** - * Returns {@code true} if the given pod is running. Returns {@code false} otherwise. - * - * The definition when a pod is considered running can be found at - * k8s.io/api/core/v1/types.go#L3564 - * It states: - * "PodRunning means the pod has been bound to a node and all of the containers have been started. - * At least one container is still running or is in the process of being restarted." - * - * The logic is taken from (kubernetes/printers.go) printPod() - * and (openshift-web-console/resources.js) podStatus() - * - * @param pod the pod to return the running status for - * @return returns true if the pod is running - */ - public static boolean isRunning(Pod pod) { - if (isInStatus(POD_RUNNING, pod)) { - return true; - } - if (hasDeletionTimestamp(pod) - || isInitializing(pod)) { - return false; - } - if (hasRunningContainer(pod)) { - return !hasCompletedContainer(pod) - || Readiness.isPodReady(pod); - } - return false; + private static final String POD_RUNNING = "Running"; + private static final String POD_INITIALIZING = "PodInitializing"; + private static final String CONTAINER_COMPLETED = "Completed"; + + private PodStatusUtil() { + } + + /** + * Returns {@code true} if the given pod is running. Returns {@code false} otherwise. + * + * The definition when a pod is considered running can be found at + * k8s.io/api/core/v1/types.go#L3564 + * It states: + * "PodRunning means the pod has been bound to a node and all of the containers have been started. + * At least one container is still running or is in the process of being restarted." + * + * The logic is taken from (kubernetes/printers.go) + * printPod() + * and (openshift-web-console/resources.js) + * podStatus() + * + * @param pod the pod to return the running status for + * @return returns true if the pod is running + */ + public static boolean isRunning(Pod pod) { + if (isInStatus(POD_RUNNING, pod)) { + return true; } - - private static boolean isInStatus(String expected, Pod pod) { - if (pod == null - || pod.getStatus() == null - || expected == null) { - return false; - } - - return expected.equals(pod.getStatus().getPhase()) - || expected.equals(pod.getStatus().getReason()); + if (hasDeletionTimestamp(pod) + || isInitializing(pod)) { + return false; } - - private static boolean hasDeletionTimestamp(Pod pod) { - if (pod == null) { - return false; - } - return pod.getMetadata() != null - && pod.getMetadata().getDeletionTimestamp() != null; + if (hasRunningContainer(pod)) { + return !hasCompletedContainer(pod) + || Readiness.isPodReady(pod); } - - /** - * Returns {@code true} if the given pod has at least 1 container that's initializing. - * - * @param pod the pod to return the initializing status for - * @return returns true if the pod is initializing - */ - public static boolean isInitializing(Pod pod) { - if (pod == null) { - return false; - } - return pod.getStatus().getInitContainerStatuses().stream() - .anyMatch(PodStatusUtil::isInitializing); + return false; + } + + private static boolean isInStatus(String expected, Pod pod) { + if (pod == null + || pod.getStatus() == null + || expected == null) { + return false; } - /** - * Returns {@code true} if the given container status is terminated with an non-0 exit code or is waiting. - * Returns {@code false} otherwise. - */ - private static boolean isInitializing(ContainerStatus status) { - if (status == null) { - return true; - } - - ContainerState state = status.getState(); - if (state == null) { - return true; - } - if (isTerminated(state)) { - return hasNonNullExitCode(state); - } else if (isWaiting(state)) { - return !isWaitingInitializing(state); - } else { - return true; - } - } + return expected.equals(pod.getStatus().getPhase()) + || expected.equals(pod.getStatus().getReason()); + } - private static boolean isTerminated(ContainerState state) { - return state == null - || state.getTerminated() != null; + private static boolean hasDeletionTimestamp(Pod pod) { + if (pod == null) { + return false; } - - private static boolean hasNonNullExitCode(ContainerState state) { - return state.getTerminated() != null - && state.getTerminated().getExitCode() != 0; + return pod.getMetadata() != null + && pod.getMetadata().getDeletionTimestamp() != null; + } + + /** + * Returns {@code true} if the given pod has at least 1 container that's initializing. + * + * @param pod the pod to return the initializing status for + * @return returns true if the pod is initializing + */ + public static boolean isInitializing(Pod pod) { + if (pod == null) { + return false; } - - private static boolean isWaiting(ContainerState state) { - return state == null - || state.getWaiting() != null; + return pod.getStatus().getInitContainerStatuses().stream() + .anyMatch(PodStatusUtil::isInitializing); + } + + /** + * Returns {@code true} if the given container status is terminated with an non-0 exit code or is waiting. + * Returns {@code false} otherwise. + */ + private static boolean isInitializing(ContainerStatus status) { + if (status == null) { + return true; } - private static boolean isWaitingInitializing(ContainerState state) { - return state != null - && state.getWaiting() != null - && POD_INITIALIZING.equals(state.getWaiting().getReason()); + ContainerState state = status.getState(); + if (state == null) { + return true; } - - private static boolean hasRunningContainer(Pod pod) { - return getContainerStatus(pod).stream() - .anyMatch(PodStatusUtil::isRunning); + if (isTerminated(state)) { + return hasNonNullExitCode(state); + } else if (isWaiting(state)) { + return !isWaitingInitializing(state); + } else { + return true; } - - private static boolean isRunning(ContainerStatus status) { - return status.getReady() != null - && status.getState() != null - && status.getState().getRunning() != null; - } - - private static boolean hasCompletedContainer(Pod pod) { - return getContainerStatus(pod).stream() - .anyMatch(PodStatusUtil::isCompleted); - } - - private static boolean isCompleted(ContainerStatus status) { - return status.getState() != null - && status.getState().getTerminated() != null - && CONTAINER_COMPLETED.equals(status.getState().getTerminated().getReason()); - } - - /** - * Returns the container status for all containers of the given pod. Returns an empty list - * if the pod has no status - * - * @param pod the pod to return the container status for - * @return list of container status - * - * @see Pod#getStatus() - * @see PodStatus#getContainerStatuses() - */ - public static List getContainerStatus(Pod pod) { - if (pod == null - || pod.getStatus() == null) { - return Collections.emptyList(); - } - return pod.getStatus().getContainerStatuses(); + } + + private static boolean isTerminated(ContainerState state) { + return state == null + || state.getTerminated() != null; + } + + private static boolean hasNonNullExitCode(ContainerState state) { + return state.getTerminated() != null + && state.getTerminated().getExitCode() != 0; + } + + private static boolean isWaiting(ContainerState state) { + return state == null + || state.getWaiting() != null; + } + + private static boolean isWaitingInitializing(ContainerState state) { + return state != null + && state.getWaiting() != null + && POD_INITIALIZING.equals(state.getWaiting().getReason()); + } + + private static boolean hasRunningContainer(Pod pod) { + return getContainerStatus(pod).stream() + .anyMatch(PodStatusUtil::isRunning); + } + + private static boolean isRunning(ContainerStatus status) { + return status.getReady() != null + && status.getState() != null + && status.getState().getRunning() != null; + } + + private static boolean hasCompletedContainer(Pod pod) { + return getContainerStatus(pod).stream() + .anyMatch(PodStatusUtil::isCompleted); + } + + private static boolean isCompleted(ContainerStatus status) { + return status.getState() != null + && status.getState().getTerminated() != null + && CONTAINER_COMPLETED.equals(status.getState().getTerminated().getReason()); + } + + /** + * Returns the container status for all containers of the given pod. Returns an empty list + * if the pod has no status + * + * @param pod the pod to return the container status for + * @return list of container status + * + * @see Pod#getStatus() + * @see PodStatus#getContainerStatuses() + */ + public static List getContainerStatus(Pod pod) { + if (pod == null + || pod.getStatus() == null) { + return Collections.emptyList(); } + return pod.getStatus().getContainerStatuses(); + } } \ No newline at end of file diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReflectUtils.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReflectUtils.java index 03279e06c57..90df0e01ba8 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReflectUtils.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReflectUtils.java @@ -28,8 +28,9 @@ public class ReflectUtils { private ReflectUtils() { throw new IllegalStateException("Utility class"); } + public static ObjectMeta objectMetadata(Object obj) throws ReflectiveOperationException { - if( obj == null ) { + if (obj == null) { return null; } if (obj instanceof HasMetadata) { @@ -44,7 +45,7 @@ public static ObjectMeta objectMetadata(Object obj) throws ReflectiveOperationEx } public static String namespace(Object obj) throws ReflectiveOperationException { - if( obj == null ) { + if (obj == null) { return ""; } return objectMetadata(obj).getNamespace(); diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReplaceValueStream.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReplaceValueStream.java index 3de30393951..3e5163c0604 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReplaceValueStream.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ReplaceValueStream.java @@ -47,7 +47,7 @@ private ReplaceValueStream(Map valuesMap) { } private InputStream createInputStream(InputStream is) throws IOException { - return new ByteArrayInputStream( + return new ByteArrayInputStream( interpolateString(IOHelpers.readFully(is), valuesMap).getBytes(StandardCharsets.UTF_8)); } } diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ResourceCompare.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ResourceCompare.java index 18da084157f..d111de99230 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ResourceCompare.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/ResourceCompare.java @@ -25,15 +25,16 @@ import java.util.Map; public class ResourceCompare { - private ResourceCompare() {} + private ResourceCompare() { + } - private static TypeReference> TYPE_REF = new TypeReference>(){}; + private static TypeReference> TYPE_REF = new TypeReference>() { + }; private static final String METADATA = "metadata"; private static final String SPEC = "spec"; private static final String ITEMS = "items"; - /** * This method returns true when left Kubernetes resource contains * all data that's present in right Kubernetes resource, this method @@ -46,7 +47,7 @@ private ResourceCompare() {} * * @return boolean value whether both resources are actually equal or not */ - public static boolean equals(T left, T right) { + public static boolean equals(T left, T right) { ObjectMapper jsonMapper = Serialization.jsonMapper(); if (left == null && right == null) { return true; @@ -66,8 +67,8 @@ public static boolean equals(T left, T right) { } public static boolean compareKubernetesList(Map leftJson, Map rightJson) { - List> leftItems = (List>)leftJson.get(ITEMS); - List> rightItems = (List>)rightJson.get(ITEMS); + List> leftItems = (List>) leftJson.get(ITEMS); + List> rightItems = (List>) rightJson.get(ITEMS); if (leftItems != null && rightItems != null) { if (leftItems.size() != rightItems.size()) { @@ -79,13 +80,14 @@ public static boolean compareKubernetesList(Map leftJson, Map leftJson, Map rightJson) { return isEqualMetadata(leftJson, rightJson) && - isEqualSpec(leftJson, rightJson); + isEqualSpec(leftJson, rightJson); } private static boolean isEqualMetadata(Map leftMap, Map rightMap) { diff --git a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/URLUtils.java b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/URLUtils.java index dc715cbde25..bfe9ee156f4 100644 --- a/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/URLUtils.java +++ b/kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/URLUtils.java @@ -64,58 +64,59 @@ public String toString() { private URLUtils() { throw new IllegalStateException("Utility class"); } + public static String join(String... parts) { - StringBuilder sb = new StringBuilder(); - - String urlQueryParams = ""; - if (parts.length > 0) { - String urlWithoutQuery = parts[0]; - try { - URI uri = new URI(parts[0]); - if (containsQueryParam(uri)) { - urlQueryParams = uri.getQuery(); - urlWithoutQuery = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), null, uri.getFragment()) - .toString(); - } - } catch (URISyntaxException e) { - // Not all first parameters are URL - } - sb.append(urlWithoutQuery).append("/"); + StringBuilder sb = new StringBuilder(); + + String urlQueryParams = ""; + if (parts.length > 0) { + String urlWithoutQuery = parts[0]; + try { + URI uri = new URI(parts[0]); + if (containsQueryParam(uri)) { + urlQueryParams = uri.getQuery(); + urlWithoutQuery = new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), null, uri.getFragment()) + .toString(); } + } catch (URISyntaxException e) { + // Not all first parameters are URL + } + sb.append(urlWithoutQuery).append("/"); + } - StringBuilder queryParams = new StringBuilder(); - for (int i = 1; i < parts.length; i++) { - try { - URI partUri = new URI(parts[i]); - if (containsQueryParam(partUri)) { - queryParams = getQueryParams(partUri, parts, i+1); - // If we start detecting query params then everything will be query params part - break; - } + StringBuilder queryParams = new StringBuilder(); + for (int i = 1; i < parts.length; i++) { + try { + URI partUri = new URI(parts[i]); + if (containsQueryParam(partUri)) { + queryParams = getQueryParams(partUri, parts, i + 1); + // If we start detecting query params then everything will be query params part + break; + } - sb.append(parts[i]); + sb.append(parts[i]); - } catch (URISyntaxException e) { - sb.append(parts[i]); - } + } catch (URISyntaxException e) { + sb.append(parts[i]); + } - if (i < parts.length - 1) { - sb.append("/"); - } + if (i < parts.length - 1) { + sb.append("/"); + } - } + } - appendQueryParametersFromOriginalUrl(sb, urlQueryParams, queryParams); - String joined = sb.toString(); + appendQueryParametersFromOriginalUrl(sb, urlQueryParams, queryParams); + String joined = sb.toString(); - // And normalize it... - return joined - .replaceAll("/+", "/") - .replaceAll("/\\?", "?") - .replaceAll("/#", "#") - .replaceAll(":/", "://"); + // And normalize it... + return joined + .replaceAll("/+", "/") + .replaceAll("/\\?", "?") + .replaceAll("/#", "#") + .replaceAll(":/", "://"); - } + } private static void appendQueryParametersFromOriginalUrl(StringBuilder sb, String urlQueryParams, StringBuilder queryParams) { if (!urlQueryParams.isEmpty()) { @@ -131,27 +132,28 @@ private static void appendQueryParametersFromOriginalUrl(StringBuilder sb, Strin } private static StringBuilder getQueryParams(URI firstPart, String[] parts, int index) { - StringBuilder queryParams = new StringBuilder(); - queryParams.append(firstPart.toString()); - - for (int i = index; i < parts.length; i++) { - String param = parts[i]; + StringBuilder queryParams = new StringBuilder(); + queryParams.append(firstPart.toString()); - if (!param.startsWith("&")) { - queryParams.append("&"); - } - queryParams.append((param)); - } + for (int i = index; i < parts.length; i++) { + String param = parts[i]; - return queryParams; + if (!param.startsWith("&")) { + queryParams.append("&"); + } + queryParams.append((param)); } - private static boolean containsQueryParam(URI uri) { - return uri.getQuery() != null; - } + return queryParams; + } + + private static boolean containsQueryParam(URI uri) { + return uri.getQuery() != null; + } /** - * Joins all the given strings, ignoring nulls so that they form a URL with / between the paths without a // if the previous path ends with / and the next path starts with / unless a path item is blank + * Joins all the given strings, ignoring nulls so that they form a URL with / between the paths without a // if the previous + * path ends with / and the next path starts with / unless a path item is blank * * @param strings A list of strings which you need to concatenate. * @return the strings concatenated together with / while avoiding a double // between non blank strings. @@ -194,6 +196,6 @@ public static boolean isValidURL(String url) { } public static String encodeToUTF(String url) { - return HttpRequest.formURLEncode(url); + return HttpRequest.formURLEncode(url); } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/Custom.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/Custom.java index 04948513e14..02ee34058da 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/Custom.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/Custom.java @@ -26,8 +26,7 @@ @Singular(Custom.SINGULAR) @Plural(Custom.PLURAL) @Kind(Custom.KIND) -public -class Custom extends CustomResource { +public class Custom extends CustomResource { public static final String VERSION = "v1beta1"; public static final String GROUP = "sample.fabric8.io"; public static final String SINGULAR = "foo"; diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/CustomResourceTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/CustomResourceTest.java index 29bee7a72de..7eac3b1433c 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/CustomResourceTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/CustomResourceTest.java @@ -15,26 +15,26 @@ */ package io.fabric8.kubernetes.client; +import io.fabric8.kubernetes.model.annotation.Group; +import io.fabric8.kubernetes.model.annotation.Version; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; -import io.fabric8.kubernetes.model.annotation.Group; -import io.fabric8.kubernetes.model.annotation.Version; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; - class CustomResourceTest { private static class MissingApiVersion extends CustomResource { } - + @Test void missingGroupAndVersionShouldFail() { assertThrows(IllegalArgumentException.class, MissingApiVersion::new); } - + @Test void valuesShouldProperlyBeComputedFromDefaultsAndAnnotations() { final Good good = new Good(); @@ -48,7 +48,7 @@ void valuesShouldProperlyBeComputedFromDefaultsAndAnnotations() { assertTrue(good.isServed()); assertTrue(good.isStorage()); } - + @Test @DisplayName("fully annotated custom resource should use annotation values instead of defaults") void customCRShouldWork() { @@ -63,7 +63,7 @@ void customCRShouldWork() { assertFalse(custom.isServed()); assertFalse(custom.isStorage()); } - + @Test void untypedCustomResourceInitShouldWork() { final CustomResource cr = new Untyped(); @@ -84,15 +84,16 @@ void subclassWithOverriddenInitShouldWork() { assertNull(cri.getSpec()); assertEquals(7, cri.getStatus()); } - + @Group("example.com") @Version("v1") - private static class Untyped extends CustomResource{} - + private static class Untyped extends CustomResource { + } + @Group("example.com") @Version("v1") private static class CRI extends CustomResource { - + @Override protected Integer initStatus() { return 7; @@ -101,5 +102,6 @@ protected Integer initStatus() { @Group("example.com") @Version("v1") - private static class VoidVoid extends CustomResource {} + private static class VoidVoid extends CustomResource { + } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/Good.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/Good.java index b11d0af8ccf..471de1be008 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/Good.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/Good.java @@ -20,8 +20,7 @@ @Version(Good.VERSION) @Group(Good.GROUP) -public -class Good extends CustomResource { +public class Good extends CustomResource { public static final String VERSION = "v1beta1"; public static final String GROUP = "sample.fabric8.io"; } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/dsl/base/CustomResourceDefinitionContextTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/dsl/base/CustomResourceDefinitionContextTest.java index e027ef95cd8..0b5f2a05f58 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/dsl/base/CustomResourceDefinitionContextTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/dsl/base/CustomResourceDefinitionContextTest.java @@ -27,14 +27,14 @@ import static org.assertj.core.api.Assertions.assertThat; class CustomResourceDefinitionContextTest { - + @Test @DisplayName("v1beta1CRDFromCustomResourceType correctly generates CRD builder for v1beta1 version") void v1beta1CRDFromCustomResourceType() { final CustomResourceDefinition crd = CustomResourceDefinitionContext.v1beta1CRDFromCustomResourceType(Good.class).build(); final CustomResourceDefinitionSpec spec = crd.getSpec(); final CustomResourceDefinitionNames names = spec.getNames(); - final String plural = "goods"; + final String plural = "goods"; Assertions.assertEquals(plural, names.getPlural()); Assertions.assertEquals("good", names.getSingular()); Assertions.assertEquals("Good", names.getKind()); @@ -42,11 +42,12 @@ void v1beta1CRDFromCustomResourceType() { Assertions.assertEquals(Good.VERSION, spec.getVersion()); Assertions.assertEquals(Good.VERSION, spec.getVersions().get(0).getName()); } - + @Test @DisplayName("v1CRDFromCustomResourceType correctly generates CRD builder for v1 version") void v1CRDFromCustomResourceType() { - final io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition crd = CustomResourceDefinitionContext.v1CRDFromCustomResourceType(Custom.class).build(); + final io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition crd = CustomResourceDefinitionContext + .v1CRDFromCustomResourceType(Custom.class).build(); final io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionSpec spec = crd.getSpec(); final io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionNames names = spec.getNames(); Assertions.assertEquals(Custom.PLURAL, names.getPlural()); @@ -60,8 +61,7 @@ void v1CRDFromCustomResourceType() { @DisplayName("fromCrd, with v1 CRD, should infer correct properties") void fromCrdV1() { // Given - final io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition crd = - new io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionBuilder() + final io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinition crd = new io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionBuilder() .withNewMetadata().withName("foobar.the-foo.com").endMetadata() .withNewSpec() .withGroup("the-foo.com") @@ -76,21 +76,19 @@ void fromCrdV1() { final CustomResourceDefinitionContext result = CustomResourceDefinitionContext.fromCrd(crd); // Then assertThat(result) - .hasFieldOrPropertyWithValue("group", "the-foo.com") - .hasFieldOrPropertyWithValue("version", "v1") - .hasFieldOrPropertyWithValue("scope", "Namespaced") - .hasFieldOrPropertyWithValue("name", "foobar.the-foo.com") - .hasFieldOrPropertyWithValue("plural", "foobars") - .hasFieldOrPropertyWithValue("kind", "Foobar"); + .hasFieldOrPropertyWithValue("group", "the-foo.com") + .hasFieldOrPropertyWithValue("version", "v1") + .hasFieldOrPropertyWithValue("scope", "Namespaced") + .hasFieldOrPropertyWithValue("name", "foobar.the-foo.com") + .hasFieldOrPropertyWithValue("plural", "foobars") + .hasFieldOrPropertyWithValue("kind", "Foobar"); } - @Test @DisplayName("fromCrd, with v1beta1 CRD with versions, should infer correct properties") void fromCrdV1beta1() { // Given - final io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition crd = - new io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder() + final io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition crd = new io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder() .withNewMetadata().withName("foobar.the-foo.com").endMetadata() .withNewSpec() .withGroup("the-foo.com") @@ -105,20 +103,19 @@ void fromCrdV1beta1() { final CustomResourceDefinitionContext result = CustomResourceDefinitionContext.fromCrd(crd); // Then assertThat(result) - .hasFieldOrPropertyWithValue("group", "the-foo.com") - .hasFieldOrPropertyWithValue("version", "v1") - .hasFieldOrPropertyWithValue("scope", "Namespaced") - .hasFieldOrPropertyWithValue("name", "foobar.the-foo.com") - .hasFieldOrPropertyWithValue("plural", "foobars") - .hasFieldOrPropertyWithValue("kind", "Foobar"); + .hasFieldOrPropertyWithValue("group", "the-foo.com") + .hasFieldOrPropertyWithValue("version", "v1") + .hasFieldOrPropertyWithValue("scope", "Namespaced") + .hasFieldOrPropertyWithValue("name", "foobar.the-foo.com") + .hasFieldOrPropertyWithValue("plural", "foobars") + .hasFieldOrPropertyWithValue("kind", "Foobar"); } @Test @DisplayName("fromCrd, with v1beta1 CRD with spec.version, should infer correct properties") void fromCrdV1beta1OldVersionStyle() { // Given - final io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition crd = - new io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder() + final io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition crd = new io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder() .withNewMetadata().withName("foobar.the-foo.com").endMetadata() .withNewSpec() .withGroup("the-foo.com") @@ -131,19 +128,21 @@ void fromCrdV1beta1OldVersionStyle() { final CustomResourceDefinitionContext result = CustomResourceDefinitionContext.fromCrd(crd); // Then assertThat(result) - .hasFieldOrPropertyWithValue("group", "the-foo.com") - .hasFieldOrPropertyWithValue("version", "v1") - .hasFieldOrPropertyWithValue("scope", "Namespaced") - .hasFieldOrPropertyWithValue("name", "foobar.the-foo.com") - .hasFieldOrPropertyWithValue("plural", "foobars") - .hasFieldOrPropertyWithValue("kind", "Foobar"); + .hasFieldOrPropertyWithValue("group", "the-foo.com") + .hasFieldOrPropertyWithValue("version", "v1") + .hasFieldOrPropertyWithValue("scope", "Namespaced") + .hasFieldOrPropertyWithValue("name", "foobar.the-foo.com") + .hasFieldOrPropertyWithValue("plural", "foobars") + .hasFieldOrPropertyWithValue("kind", "Foobar"); } @Test void isNamespaceScoped() { // Given - CustomResourceDefinitionContext crdc1 = new CustomResourceDefinitionContext.Builder().withPlural("values").withScope("Namespaced").build(); - CustomResourceDefinitionContext crdc2 = new CustomResourceDefinitionContext.Builder().withPlural("values").withScope("Cluster").build(); + CustomResourceDefinitionContext crdc1 = new CustomResourceDefinitionContext.Builder().withPlural("values") + .withScope("Namespaced").build(); + CustomResourceDefinitionContext crdc2 = new CustomResourceDefinitionContext.Builder().withPlural("values") + .withScope("Cluster").build(); // When + Then assertThat(crdc1.isNamespaceScoped()).isTrue(); diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/extended/run/RunConfigUtilTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/extended/run/RunConfigUtilTest.java index a2b7ba1d0c3..68f0e87d64d 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/extended/run/RunConfigUtilTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/extended/run/RunConfigUtilTest.java @@ -35,9 +35,9 @@ class RunConfigUtilTest { void testGetObjectMetadataFromRunConfig() { // Given RunConfig config = new RunConfigBuilder() - .withName("test") - .withLabels(Collections.singletonMap("foo", "bar")) - .build(); + .withName("test") + .withLabels(Collections.singletonMap("foo", "bar")) + .build(); // When ObjectMeta objectMeta = RunConfigUtil.getObjectMetadataFromRunConfig(config); @@ -53,12 +53,12 @@ void testGetObjectMetadataFromRunConfig() { void testGetPodSpecFromRunConfig() { // Given RunConfig config = new RunConfigBuilder() - .withName("test") - .withImage("test:latest") - .withEnv(Collections.singletonMap("TEST_KEY", "TEST_VALUE")) - .withImagePullPolicy("IfNotPresent") - .withLimits(getLimits()) - .build(); + .withName("test") + .withImage("test:latest") + .withEnv(Collections.singletonMap("TEST_KEY", "TEST_VALUE")) + .withImagePullPolicy("IfNotPresent") + .withLimits(getLimits()) + .build(); // When PodSpec podSpec = RunConfigUtil.getPodSpecFromRunConfig(config); @@ -105,46 +105,46 @@ void testContainerFromConfig() { void testContainerFromConfigWithArgs() { // Given final RunConfig runConfig = initMockRunConfigBuilder() - .withArgs("arg1", "arg2") - .build(); + .withArgs("arg1", "arg2") + .build(); // When final Container result = RunConfigUtil.containerFromConfig(runConfig); // Then assertThat(result) - .hasFieldOrPropertyWithValue("command", Collections.emptyList()) - .extracting(Container::getArgs) - .asList().containsExactly("arg1", "arg2"); + .hasFieldOrPropertyWithValue("command", Collections.emptyList()) + .extracting(Container::getArgs) + .asList().containsExactly("arg1", "arg2"); } @Test void testContainerFromConfigWithCommand() { // Given final RunConfig runConfig = initMockRunConfigBuilder() - .withCommand("/bin/sh") - .build(); + .withCommand("/bin/sh") + .build(); // When final Container result = RunConfigUtil.containerFromConfig(runConfig); // Then assertThat(result) - .hasFieldOrPropertyWithValue("args", Collections.emptyList()) - .extracting(Container::getCommand) - .asList().containsExactly("/bin/sh"); + .hasFieldOrPropertyWithValue("args", Collections.emptyList()) + .extracting(Container::getCommand) + .asList().containsExactly("/bin/sh"); } @Test void testContainerFromConfigWithCommandAndArgs() { // Given final RunConfig runConfig = initMockRunConfigBuilder() - .withCommand("/bin/sh") - .withArgs("-c", "echo hello") - .build(); + .withCommand("/bin/sh") + .withArgs("-c", "echo hello") + .build(); // When final Container result = RunConfigUtil.containerFromConfig(runConfig); // Then assertThat(result) - .hasFieldOrPropertyWithValue("args", Collections.emptyList()) - .extracting(Container::getCommand) - .asList().containsExactly("/bin/sh", "-c", "echo hello"); + .hasFieldOrPropertyWithValue("args", Collections.emptyList()) + .extracting(Container::getCommand) + .asList().containsExactly("/bin/sh", "-c", "echo hello"); } private Map getLimits() { @@ -163,12 +163,12 @@ private Map getRequests() { private RunConfigBuilder initMockRunConfigBuilder() { return new RunConfigBuilder() - .withName("test") - .withImage("test:latest") - .withEnv(Collections.singletonMap("TEST_KEY", "TEST_VALUE")) - .withImagePullPolicy("IfNotPresent") - .withPort(5701) - .withLimits(getLimits()) - .withRequests(getRequests()); + .withName("test") + .withImage("test:latest") + .withEnv(Collections.singletonMap("TEST_KEY", "TEST_VALUE")) + .withImagePullPolicy("IfNotPresent") + .withPort(5701) + .withLimits(getLimits()) + .withRequests(getRequests()); } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/extended/run/RunOperationsTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/extended/run/RunOperationsTest.java index 457baa1f2da..4f16c47f935 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/extended/run/RunOperationsTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/extended/run/RunOperationsTest.java @@ -43,16 +43,16 @@ void testConvertRunConfigIntoPod() { labels.put("first", "FIRST"); labels.put("second", "SECOND"); RunConfigBuilder generatorRunConfig = new RunConfigBuilder() - .withName("test") - .withImage("test:latest") - .withLabels(labels) - .withEnv(Collections.singletonMap("TEST_KEY", "TEST_VALUE")) - .withImagePullPolicy("IfNotPresent") - .withRestartPolicy("OnFailure") - .withServiceAccount("ribbon") - .withPort(5701) - .withLimits(limits) - .withRequests(requests); + .withName("test") + .withImage("test:latest") + .withLabels(labels) + .withEnv(Collections.singletonMap("TEST_KEY", "TEST_VALUE")) + .withImagePullPolicy("IfNotPresent") + .withRestartPolicy("OnFailure") + .withServiceAccount("ribbon") + .withPort(5701) + .withLimits(limits) + .withRequests(requests); RunOperations deploymentGenerator = new RunOperations(Mockito.mock(KubernetesClient.class), generatorRunConfig); // When diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/WebSocketTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/WebSocketTest.java index 6fe10b76233..00d3a423b18 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/WebSocketTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/http/WebSocketTest.java @@ -15,7 +15,6 @@ */ package io.fabric8.kubernetes.client.http; -import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java index 801c3a6aa36..6f696d81885 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/CertUtilsTest.java @@ -69,26 +69,27 @@ public void resetSystemPropertiesBack() { } @Test - void testLoadingMultipleCertsFromSameFile() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { + void testLoadingMultipleCertsFromSameFile() + throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { KeyStore ts = CertUtils.createTrustStore( - null, "src/test/resources/ssl/multiple-certs.pem", null, "changeit"); + null, "src/test/resources/ssl/multiple-certs.pem", null, "changeit"); assertTrue(ts.size() >= 2); } @Test - void testLoadingMultipleCertsWithSameSubjectFromSameFile() throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { + void testLoadingMultipleCertsWithSameSubjectFromSameFile() + throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { KeyStore ts = CertUtils.createTrustStore( - null, "src/test/resources/ssl/nonunique-subject.pem", null, "changeit"); + null, "src/test/resources/ssl/nonunique-subject.pem", null, "changeit"); assertTrue(ts.size() >= 2); } @Test void testLoadTrustStoreFromFileUsingConfigProperties() - throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { + throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { - KeyStore trustStore = - CertUtils.createTrustStore( + KeyStore trustStore = CertUtils.createTrustStore( null, "src/test/resources/ssl/multiple-certs.pem", FABRIC8_STORE_PATH, FABRIC8_STORE_PASSPHRASE); assertEquals(3, trustStore.size()); @@ -97,13 +98,12 @@ void testLoadTrustStoreFromFileUsingConfigProperties() @Test void testLoadTrustStoreFromFileUsingSystemProperties() - throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { + throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { System.setProperty("javax.net.ssl.trustStore", FABRIC8_STORE_PATH); System.setProperty("javax.net.ssl.trustStorePassword", FABRIC8_STORE_PASSPHRASE); - KeyStore trustStore = - CertUtils.createTrustStore( + KeyStore trustStore = CertUtils.createTrustStore( null, "src/test/resources/ssl/multiple-certs.pem", null, null); assertEquals(3, trustStore.size()); @@ -112,10 +112,9 @@ void testLoadTrustStoreFromFileUsingSystemProperties() @Test void testLoadKeyStoreFromFileUsingConfigProperties() - throws InvalidKeySpecException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { + throws InvalidKeySpecException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException { - KeyStore trustStore = - CertUtils.createKeyStore( + KeyStore trustStore = CertUtils.createKeyStore( null, "src/test/resources/ssl/multiple-certs.pem", null, "src/test/resources/ssl/fabric8", "RSA", "changeit", FABRIC8_STORE_PATH, FABRIC8_STORE_PASSPHRASE); @@ -126,7 +125,8 @@ void testLoadKeyStoreFromFileUsingConfigProperties() @Test void testLoadKeyStoreFromFileUsingSystemProperties() - throws InvalidKeySpecException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException, URISyntaxException { + throws InvalidKeySpecException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException, + URISyntaxException { System.setProperty("javax.net.ssl.keyStore", FABRIC8_STORE_PATH); System.setProperty("javax.net.ssl.keyStorePassword", String.valueOf(FABRIC8_STORE_PASSPHRASE)); @@ -134,8 +134,8 @@ void testLoadKeyStoreFromFileUsingSystemProperties() String privateKeyPath = Utils.filePath(getClass().getResource("/ssl/fabric8")); String multipleCertsPath = Utils.filePath(getClass().getResource("/ssl/multiple-certs.pem")); - KeyStore trustStore = - CertUtils.createKeyStore(null, multipleCertsPath, null, privateKeyPath, "RSA", "changeit", null, null); + KeyStore trustStore = CertUtils.createKeyStore(null, multipleCertsPath, null, privateKeyPath, "RSA", "changeit", null, + null); assertEquals(2, trustStore.size()); verifyFabric8InStore(trustStore); @@ -144,7 +144,8 @@ void testLoadKeyStoreFromFileUsingSystemProperties() @Test void testGetInputStreamFromDataOrFileShouldNotDecodedPEMAgain() throws IOException { // Given - File certFile = new File(Objects.requireNonNull(getClass().getResource("/ssl/valid-non-base64-encoded-cert.pem")).getFile()); + File certFile = new File( + Objects.requireNonNull(getClass().getResource("/ssl/valid-non-base64-encoded-cert.pem")).getFile()); String certData = new String(Files.readAllBytes(certFile.toPath())); // When @@ -170,13 +171,13 @@ void testGetInputStreamFromDataOrFileShouldDecodeBase64EncodedString() throws IO } private void verifyFabric8InStore(KeyStore trustStore) - throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException { + throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException { Certificate certificate = trustStore.getCertificate("fabric8-in-store"); assertNotNull(certificate); KeyStore storeWithCert = CertUtils.createTrustStore( - null, "src/test/resources/ssl/fabric8.crt", null, ""); + null, "src/test/resources/ssl/fabric8.crt", null, ""); String certificateAlias = storeWithCert.getCertificateAlias(certificate); assertNotNull(certificateAlias); } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/KubeConfigUtilsTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/KubeConfigUtilsTest.java index 3d7a310b6df..53c45f6f642 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/KubeConfigUtilsTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/internal/KubeConfigUtilsTest.java @@ -117,56 +117,56 @@ void testGetUserAuthInfo() { private Config getTestKubeConfig() { return new ConfigBuilder() - .withCurrentContext("test-context") - .addNewCluster() - .withName("api-testing:6334") - .withNewCluster() - .withServer("https://api-testing:6334") - .withInsecureSkipTlsVerify(true) - .endCluster() - .endCluster() - .addNewContext() - .withName("test-context") - .withNewContext() - .withCluster("api-testing:6334") - .withNamespace("ns1") - .withUser("system:admin/api-testing:6334") - .endContext() - .endContext() - .addNewContext() - .withNewContext() - .withCluster("minikube") - .withUser("minikube") - .endContext() - .withName("minikube") - .endContext() - .addNewUser() - .withName("test/api-test-com:443") - .withNewUser() - .withToken("token") - .endUser() - .endUser() - .addNewUser() - .withName("minikube") - .withNewUser() - .withClientCertificate("/home/.minikube/profiles/minikube/client.crt") - .withClientKey("/home/.minikube/profiles/minikube/client.key") - .endUser() - .endUser() - .addNewUser() - .withName("test/test-cluster:443") - .withNewUser() - .withNewAuthProvider() - .withConfig(Collections.singletonMap("id-token", "token")) - .endAuthProvider() - .endUser() - .endUser() - .addNewUser() - .withName("system:admin/api-testing:6334") - .withNewUser() - .withToken("test-token-2") - .endUser() - .endUser() - .build(); + .withCurrentContext("test-context") + .addNewCluster() + .withName("api-testing:6334") + .withNewCluster() + .withServer("https://api-testing:6334") + .withInsecureSkipTlsVerify(true) + .endCluster() + .endCluster() + .addNewContext() + .withName("test-context") + .withNewContext() + .withCluster("api-testing:6334") + .withNamespace("ns1") + .withUser("system:admin/api-testing:6334") + .endContext() + .endContext() + .addNewContext() + .withNewContext() + .withCluster("minikube") + .withUser("minikube") + .endContext() + .withName("minikube") + .endContext() + .addNewUser() + .withName("test/api-test-com:443") + .withNewUser() + .withToken("token") + .endUser() + .endUser() + .addNewUser() + .withName("minikube") + .withNewUser() + .withClientCertificate("/home/.minikube/profiles/minikube/client.crt") + .withClientKey("/home/.minikube/profiles/minikube/client.key") + .endUser() + .endUser() + .addNewUser() + .withName("test/test-cluster:443") + .withNewUser() + .withNewAuthProvider() + .withConfig(Collections.singletonMap("id-token", "token")) + .endAuthProvider() + .endUser() + .endUser() + .addNewUser() + .withName("system:admin/api-testing:6334") + .withNewUser() + .withToken("test-token-2") + .endUser() + .endUser() + .build(); } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ApiVersionUtilTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ApiVersionUtilTest.java index f657ade76e4..b06ef8db802 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ApiVersionUtilTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ApiVersionUtilTest.java @@ -26,48 +26,48 @@ class ApiVersionUtilTest { @Test void apiGroup() { assertThat(ApiVersionUtil.apiGroup(new Deployment(), "apps/v1")) - .isEqualTo("apps"); + .isEqualTo("apps"); assertThat(ApiVersionUtil.apiGroup(new DeploymentSpec(), "apps/v1")) - .isEqualTo("apps"); + .isEqualTo("apps"); assertThat(ApiVersionUtil.apiGroup(new Pod(), "v1")) - .isNull(); + .isNull(); assertThat(ApiVersionUtil.apiGroup(new DeploymentSpec(), "")) - .isNull(); + .isNull(); } @Test void apiVersion() { assertThat(ApiVersionUtil.apiVersion(new Deployment(), "apps/v1")) - .isEqualTo("v1"); + .isEqualTo("v1"); assertThat(ApiVersionUtil.apiVersion(new DeploymentSpec(), "apps/v1")) - .isEqualTo("v1"); + .isEqualTo("v1"); assertThat(ApiVersionUtil.apiVersion(new Pod(), "v1")) - .isEqualTo("v1"); + .isEqualTo("v1"); assertThat(ApiVersionUtil.apiVersion(new DeploymentSpec(), "")) - .isNull(); + .isNull(); } @Test void joinApiGroupAndVersion() { assertThat(ApiVersionUtil.joinApiGroupAndVersion("", "v1")) - .isEqualTo("v1"); + .isEqualTo("v1"); assertThat(ApiVersionUtil.joinApiGroupAndVersion("apps", "v1")) - .isEqualTo("apps/v1"); + .isEqualTo("apps/v1"); } @Test void trimVersion() { assertThat(ApiVersionUtil.trimVersion("rbac.authorization.k8s.io/v1")) - .isEqualTo("v1"); + .isEqualTo("v1"); assertThat(ApiVersionUtil.trimVersion("v1")) - .isEqualTo("v1"); + .isEqualTo("v1"); } @Test void trimGroup() { assertThat(ApiVersionUtil.trimGroup("rbac.authorization.k8s.io/v1")) - .isEqualTo("rbac.authorization.k8s.io"); + .isEqualTo("rbac.authorization.k8s.io"); assertThat(ApiVersionUtil.trimGroup("v1")) - .isEqualTo("v1"); + .isEqualTo("v1"); } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/CachedSingleThreadSchedulerTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/CachedSingleThreadSchedulerTest.java index 7915b3b0e73..288f1859eb7 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/CachedSingleThreadSchedulerTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/CachedSingleThreadSchedulerTest.java @@ -27,7 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; class CachedSingleThreadSchedulerTest { - + @Test void testAutoShutdown() throws InterruptedException { CachedSingleThreadScheduler scheduler = new CachedSingleThreadScheduler(50); @@ -38,7 +38,7 @@ void testAutoShutdown() throws InterruptedException { latch.await(); assertFalse(future.isDone()); future.cancel(true); - await().atMost(1, TimeUnit.SECONDS).until(()->!scheduler.hasExecutor()); + await().atMost(1, TimeUnit.SECONDS).until(() -> !scheduler.hasExecutor()); // should start again future = scheduler.scheduleWithFixedDelay(latch::countDown, 50, 50, TimeUnit.MILLISECONDS); assertTrue(scheduler.hasExecutor()); diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/KubernetesVersionFactoryTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/KubernetesVersionFactoryTest.java index 6c764ffff64..18f8be10c4b 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/KubernetesVersionFactoryTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/KubernetesVersionFactoryTest.java @@ -23,420 +23,419 @@ import java.util.Optional; import java.util.stream.Collectors; -import static org.assertj.core.api.Assertions.assertThat; import static io.fabric8.kubernetes.client.utils.KubernetesVersionFactory.KubernetesVersion; import static io.fabric8.kubernetes.client.utils.KubernetesVersionFactory.NonKubernetesVersion; import static io.fabric8.kubernetes.client.utils.KubernetesVersionFactory.Version; +import static org.assertj.core.api.Assertions.assertThat; class KubernetesVersionFactoryTest { - @Test - void create_should_create_kubernetes_version() { - // given - KubernetesVersionFactory.Version version = KubernetesVersionFactory.create("v42beta1"); - // when - // then - assertThat(version).isInstanceOf(KubernetesVersionFactory.KubernetesVersion.class); - } - - @Test - void create_should_create_non_kubernetes_version() { - // given - Version version = KubernetesVersionFactory.create("darthVader"); - // when - // then - assertThat(version).isInstanceOf(NonKubernetesVersion.class); - } - - @Test - void create_should_create_nonkubernetes_version_when_version_has_illegal_qualifier() { - // given - Version version = NonKubernetesVersion.FACTORY.create("v1gamma"); - // when - boolean isKubernetes = version.isKubernetes(); - // then - assertThat(isKubernetes).isFalse(); - } - - @Test - void create_should_create_nonkubernetes_version_when_version_is_missing_major() { - // given - Version version = KubernetesVersionFactory.create("vbeta"); - // when - boolean isKubernetes = version.isKubernetes(); - // then - assertThat(isKubernetes).isFalse(); - } - - @Test - void isKubernetes_should_return_true_for_kubernetes_version() { - // given - Version version = KubernetesVersion.FACTORY.create("v84"); - // when - boolean isKubernetes = version.isKubernetes(); - // then - assertThat(isKubernetes).isTrue(); - } - - @Test - void isKubernetes_should_return_false_for_non_kubernetes_version() { - // given - Version version = NonKubernetesVersion.FACTORY.create("darthVader"); - // when - boolean isKubernetes = version.isKubernetes(); - // then - assertThat(isKubernetes).isFalse(); - } - - @Test - void FactoryCreate_should_create_kubernetes_version_when_version_is_kubernetes_version() { - // given - Version version = KubernetesVersionFactory.create("v10beta42"); - // when - boolean isKubernetes = version.isKubernetes(); - // then - assertThat(isKubernetes).isTrue(); - } - - @Test - void isStable_should_report_stable_when_there_is_no_qualifier() { - // given - KubernetesVersion version = KubernetesVersion.FACTORY.create("v1"); - // when - boolean stable = version.isStable(); - // then - assertThat(stable).isTrue(); - } - - @Test - void isStable_should_report_unstable_when_there_is_a_qualifier() { - // given - KubernetesVersion version = KubernetesVersion.FACTORY.create("v42alpha"); - // when - boolean stable = version.isStable(); - // then - assertThat(stable).isFalse(); - } - - @Test - void getMajor_should_return_major() { - // given - Integer majorInteger = 1; - KubernetesVersion version = KubernetesVersion.FACTORY.create("v" + majorInteger + "beta42"); - // when - Integer major = version.getMajor(); - // then - assertThat(major).isEqualTo(majorInteger); - } - - @Test - void getQualifier_should_return_qualifier() { - // given - String beta = "beta"; - KubernetesVersion version = KubernetesVersion.FACTORY.create("v422" + beta + "442"); - // when - Optional qualifier = version.getQualifier(); - // then - assertThat(qualifier.get()).isEqualTo(beta); - } - - @Test - void getQualifier_should_return_empty_optional_qualifier_when_there_is_no_qualifier() { - // given - KubernetesVersion version = KubernetesVersion.FACTORY.create("v422"); - // when - Optional qualifier = version.getQualifier(); - // then - assertThat(qualifier).isNotPresent(); - } - - @Test - void getMinor_should_return_minor() { - // given - Integer minorInteger = 42; - KubernetesVersion version = KubernetesVersion.FACTORY.create("v1alpha" + minorInteger); - // when - Optional minor = version.getMinor(); - // then - assertThat(minor.get()).isEqualTo(minorInteger); - } - - @Test - void getMinor_should_return_empty_optional_when_there_is_no_minor() { - // given - KubernetesVersion version = KubernetesVersion.FACTORY.create("v1alpha"); - // when - Optional minor = version.getMinor(); - // then - assertThat(minor).isNotPresent(); - } - - @Test - void toString_kubernetesVersion_should_return_original_version_for_GA_version() { - // given - String versionString = "v42"; - KubernetesVersion version = KubernetesVersion.FACTORY.create(versionString); - // when - String toString = version.toString(); - // then - assertThat(toString).isEqualTo(versionString); - } - - @Test - void toString_kubernetesVersion_should_return_original_version_for_unstable_version() { - // given - String versionString = "v42beta42"; - KubernetesVersion version = KubernetesVersion.FACTORY.create(versionString); - // when - String toString = version.toString(); - // then - assertThat(toString).isEqualTo(versionString); - } - - @Test - void compareTo_kubernetesVersion_should_be_greater_than_nonKubernetesVersion() { - // given - Version kVersion = KubernetesVersion.FACTORY.create("v42beta42"); - Version nkVersion = NonKubernetesVersion.FACTORY.create("lukeSkywalker"); - // when - // then - assertThat(kVersion).isGreaterThan(nkVersion); - } - - @Test - void compareTo_nonKubernetesVersion_should_be_less_than_kubernetesVersion() { - // given - Version kVersion = KubernetesVersion.FACTORY.create("v42beta42"); - Version nkVersion = NonKubernetesVersion.FACTORY.create("lukeSkywalker"); - // when - // then - assertThat(nkVersion).isLessThan(kVersion); - } - - @Test - void compareTo_same_major_version_should_be_same_as_other_major() { - // given - Version version42_1 = KubernetesVersion.FACTORY.create("v42"); - Version version42_2 = KubernetesVersion.FACTORY.create("v42"); - // when - int majorComparison = version42_1.compareTo(version42_2); - // then - assertThat(majorComparison).isZero(); - } - - @Test - void compareTo_kubernetesVersion_with_greater_major_version_should_be_greater_than_smaller_major_version() { - // given - Version version42 = KubernetesVersion.FACTORY.create("v42"); - Version version84 = KubernetesVersion.FACTORY.create("v84"); - // when - // then - assertThat(version84).isGreaterThan(version42); - } - - @Test - void compareTo_kubernetesVersion_with_smaller_major_should_be_less_than_greater_major() { - // given - Version version42 = KubernetesVersion.FACTORY.create("v42"); - Version version84 = KubernetesVersion.FACTORY.create("v84"); - // when - // then - assertThat(version42).isLessThan(version84); - } - - @Test - void compareTo_kubernetesVersion_with_alpha_qualifier_should_be_less_than_beta_qualifier() { - // given - Version alpha = KubernetesVersion.FACTORY.create("v42alpha"); - Version beta = KubernetesVersion.FACTORY.create("v42beta"); - // when - // then - assertThat(alpha).isLessThan(beta); - } - - @Test - void compareTo_kubernetesVersion_with_beta_qualifier_should_be_greater_than_alpha_qualifier() { - // given - Version alpha = KubernetesVersion.FACTORY.create("v42alpha"); - Version beta = KubernetesVersion.FACTORY.create("v42beta"); - // when - // then - assertThat(beta).isGreaterThan(alpha); - } - - @Test - void compareTo_GA_kubernetesVersion_should_be_greater_than_beta_qualifier() { - // given - Version ga = KubernetesVersion.FACTORY.create("v42"); - Version beta = KubernetesVersion.FACTORY.create("v42beta"); - // when - // then - assertThat(ga).isGreaterThan(beta); - } - - @Test - void compareTo_kubernetesVersion_same_qualifier_should_be_same_as_other_qualifier() { - // given - Version beta1 = KubernetesVersion.FACTORY.create("v42beta"); - Version beta2 = KubernetesVersion.FACTORY.create("v42beta"); - // when - int qualifierComparison = beta1.compareTo(beta2); - // then - assertThat(qualifierComparison).isZero(); - } - - @Test - void compareTo_beta_kubernetesVersion_should_be_less_than_GA() { - // given - Version ga = KubernetesVersion.FACTORY.create("v42"); - Version beta = KubernetesVersion.FACTORY.create("v42beta"); - // when - // then - assertThat(beta).isLessThan(ga); - } - - @Test - void compareTo_kubernetesVersion_greater_minor_should_be_greater_than_smaller_minor() { - // given - Version minor42 = KubernetesVersion.FACTORY.create("v42alpha42"); - Version minor84 = KubernetesVersion.FACTORY.create("v42alpha84"); - // when - // then - assertThat(minor84).isGreaterThan(minor42); - } - - @Test - void compareTo_kubernetesVersion_smaller_minor_should_be_smaller_than_greater_minor() { - // given - Version minor42 = KubernetesVersion.FACTORY.create("v42beta42"); - Version minor84 = KubernetesVersion.FACTORY.create("v42beta84"); - // when - // then - assertThat(minor42).isLessThan(minor84); - } - - @Test - void compareTo_kubernetesVersion_minor_should_be_same_as_other_minor() { - // given - Version minor42_1 = KubernetesVersion.FACTORY.create("v42alpha42"); - Version minor42_2 = KubernetesVersion.FACTORY.create("v42alpha42"); - // when - int minorComparison = minor42_1.compareTo(minor42_2); - // then - assertThat(minorComparison).isZero(); - } - - @Test - void compareTo_kubernetesVersion_without_minor_should_be_less_than_version_with_minor() { - // given - Version noMinor = KubernetesVersion.FACTORY.create("v42alpha"); - Version minor42 = KubernetesVersion.FACTORY.create("v42alpha42"); - // when - // then - assertThat(noMinor).isLessThan(minor42); - } - - @Test - void compareTo_kubernetesVersion_with_minor_should_be_greater_than_version_without_minor() { - // given - Version noMinor = KubernetesVersion.FACTORY.create("v42alpha"); - Version minor42 = KubernetesVersion.FACTORY.create("v42alpha42"); - // when - // then - assertThat(minor42).isGreaterThan(noMinor); - } - - @Test - void compareTo_nonKubernetesVersion_should_be_same_as_other_with_same_version() { - // given - Version skywalker1_1 = NonKubernetesVersion.FACTORY.create("skywalker1"); - Version skywalker1_2 = NonKubernetesVersion.FACTORY.create("skywalker1"); - // when - int minorComparison = skywalker1_1.compareTo(skywalker1_2); - // then - assertThat(minorComparison).isZero(); - } - - @Test - void compareTo_nonKubernetesVersion_with_minor_should_be_less_than_version_without_minor() { - // given - Version skywalker = NonKubernetesVersion.FACTORY.create("skywalker"); - Version skywalker1 = NonKubernetesVersion.FACTORY.create("skywalker1"); - // when - // then - assertThat(skywalker1).isLessThan(skywalker); - } - - @Test - void compareTo_nonKubernetesVersion_with_greater_minor_should_be_less_than_version_with_smaller_minor() { - // given - Version skywalker1 = NonKubernetesVersion.FACTORY.create("skywalker1"); - Version skywalker10 = NonKubernetesVersion.FACTORY.create("skywalker10"); - // when - // then - assertThat(skywalker10).isLessThan(skywalker1); - } - - @Test - void compareTo_nonKubernetesVersion_with_smaller_minor_should_be_less_than_version_with_greater_minor() { - // given - Version skywalker1 = NonKubernetesVersion.FACTORY.create("skywalker1"); - Version skywalker10 = NonKubernetesVersion.FACTORY.create("skywalker10"); - // when - // then - assertThat(skywalker1).isGreaterThan(skywalker10); - } - - @Test - void compareTo_nonKubernetesVersion_alphabetically_lower_char_should_be_greater() { - // given - Version a = NonKubernetesVersion.FACTORY.create("a"); - Version b = NonKubernetesVersion.FACTORY.create("b"); - // when - // then - assertThat(a).isGreaterThan(b); - } - - @Test - void should_sort_spec_example_correctly() { - // given - Version v10 = KubernetesVersionFactory.create("v10"); - Version v2 = KubernetesVersionFactory.create("v2"); - Version v1 = KubernetesVersionFactory.create("v1"); - Version v11beta2 = KubernetesVersionFactory.create("v11beta2"); - Version v10beta3 = KubernetesVersionFactory.create("v10beta3"); - Version v3beta1 = KubernetesVersionFactory.create("v3beta1"); - Version v12alpha1 = KubernetesVersionFactory.create("v12alpha1"); - Version v11alpha2 = KubernetesVersionFactory.create("v11alpha2"); - Version foo1 = KubernetesVersionFactory.create("foo1"); - Version foo10 = KubernetesVersionFactory.create("foo10"); - List versions = Arrays.asList( - foo10, - v11alpha2, - foo1, - v3beta1, - v2, - v10beta3, - v11beta2, - v1, - v12alpha1, - v10 - ); - // when - List sorted = versions.stream() - .sorted(Collections.reverseOrder()) - .collect(Collectors.toList()); - // then - assertThat(sorted).containsExactly( - v10, - v2, - v1, - v11beta2, - v10beta3, - v3beta1, - v12alpha1, - v11alpha2, - foo1, - foo10); - } + @Test + void create_should_create_kubernetes_version() { + // given + KubernetesVersionFactory.Version version = KubernetesVersionFactory.create("v42beta1"); + // when + // then + assertThat(version).isInstanceOf(KubernetesVersionFactory.KubernetesVersion.class); + } + + @Test + void create_should_create_non_kubernetes_version() { + // given + Version version = KubernetesVersionFactory.create("darthVader"); + // when + // then + assertThat(version).isInstanceOf(NonKubernetesVersion.class); + } + + @Test + void create_should_create_nonkubernetes_version_when_version_has_illegal_qualifier() { + // given + Version version = NonKubernetesVersion.FACTORY.create("v1gamma"); + // when + boolean isKubernetes = version.isKubernetes(); + // then + assertThat(isKubernetes).isFalse(); + } + + @Test + void create_should_create_nonkubernetes_version_when_version_is_missing_major() { + // given + Version version = KubernetesVersionFactory.create("vbeta"); + // when + boolean isKubernetes = version.isKubernetes(); + // then + assertThat(isKubernetes).isFalse(); + } + + @Test + void isKubernetes_should_return_true_for_kubernetes_version() { + // given + Version version = KubernetesVersion.FACTORY.create("v84"); + // when + boolean isKubernetes = version.isKubernetes(); + // then + assertThat(isKubernetes).isTrue(); + } + + @Test + void isKubernetes_should_return_false_for_non_kubernetes_version() { + // given + Version version = NonKubernetesVersion.FACTORY.create("darthVader"); + // when + boolean isKubernetes = version.isKubernetes(); + // then + assertThat(isKubernetes).isFalse(); + } + + @Test + void FactoryCreate_should_create_kubernetes_version_when_version_is_kubernetes_version() { + // given + Version version = KubernetesVersionFactory.create("v10beta42"); + // when + boolean isKubernetes = version.isKubernetes(); + // then + assertThat(isKubernetes).isTrue(); + } + + @Test + void isStable_should_report_stable_when_there_is_no_qualifier() { + // given + KubernetesVersion version = KubernetesVersion.FACTORY.create("v1"); + // when + boolean stable = version.isStable(); + // then + assertThat(stable).isTrue(); + } + + @Test + void isStable_should_report_unstable_when_there_is_a_qualifier() { + // given + KubernetesVersion version = KubernetesVersion.FACTORY.create("v42alpha"); + // when + boolean stable = version.isStable(); + // then + assertThat(stable).isFalse(); + } + + @Test + void getMajor_should_return_major() { + // given + Integer majorInteger = 1; + KubernetesVersion version = KubernetesVersion.FACTORY.create("v" + majorInteger + "beta42"); + // when + Integer major = version.getMajor(); + // then + assertThat(major).isEqualTo(majorInteger); + } + + @Test + void getQualifier_should_return_qualifier() { + // given + String beta = "beta"; + KubernetesVersion version = KubernetesVersion.FACTORY.create("v422" + beta + "442"); + // when + Optional qualifier = version.getQualifier(); + // then + assertThat(qualifier.get()).isEqualTo(beta); + } + + @Test + void getQualifier_should_return_empty_optional_qualifier_when_there_is_no_qualifier() { + // given + KubernetesVersion version = KubernetesVersion.FACTORY.create("v422"); + // when + Optional qualifier = version.getQualifier(); + // then + assertThat(qualifier).isNotPresent(); + } + + @Test + void getMinor_should_return_minor() { + // given + Integer minorInteger = 42; + KubernetesVersion version = KubernetesVersion.FACTORY.create("v1alpha" + minorInteger); + // when + Optional minor = version.getMinor(); + // then + assertThat(minor.get()).isEqualTo(minorInteger); + } + + @Test + void getMinor_should_return_empty_optional_when_there_is_no_minor() { + // given + KubernetesVersion version = KubernetesVersion.FACTORY.create("v1alpha"); + // when + Optional minor = version.getMinor(); + // then + assertThat(minor).isNotPresent(); + } + + @Test + void toString_kubernetesVersion_should_return_original_version_for_GA_version() { + // given + String versionString = "v42"; + KubernetesVersion version = KubernetesVersion.FACTORY.create(versionString); + // when + String toString = version.toString(); + // then + assertThat(toString).isEqualTo(versionString); + } + + @Test + void toString_kubernetesVersion_should_return_original_version_for_unstable_version() { + // given + String versionString = "v42beta42"; + KubernetesVersion version = KubernetesVersion.FACTORY.create(versionString); + // when + String toString = version.toString(); + // then + assertThat(toString).isEqualTo(versionString); + } + + @Test + void compareTo_kubernetesVersion_should_be_greater_than_nonKubernetesVersion() { + // given + Version kVersion = KubernetesVersion.FACTORY.create("v42beta42"); + Version nkVersion = NonKubernetesVersion.FACTORY.create("lukeSkywalker"); + // when + // then + assertThat(kVersion).isGreaterThan(nkVersion); + } + + @Test + void compareTo_nonKubernetesVersion_should_be_less_than_kubernetesVersion() { + // given + Version kVersion = KubernetesVersion.FACTORY.create("v42beta42"); + Version nkVersion = NonKubernetesVersion.FACTORY.create("lukeSkywalker"); + // when + // then + assertThat(nkVersion).isLessThan(kVersion); + } + + @Test + void compareTo_same_major_version_should_be_same_as_other_major() { + // given + Version version42_1 = KubernetesVersion.FACTORY.create("v42"); + Version version42_2 = KubernetesVersion.FACTORY.create("v42"); + // when + int majorComparison = version42_1.compareTo(version42_2); + // then + assertThat(majorComparison).isZero(); + } + + @Test + void compareTo_kubernetesVersion_with_greater_major_version_should_be_greater_than_smaller_major_version() { + // given + Version version42 = KubernetesVersion.FACTORY.create("v42"); + Version version84 = KubernetesVersion.FACTORY.create("v84"); + // when + // then + assertThat(version84).isGreaterThan(version42); + } + + @Test + void compareTo_kubernetesVersion_with_smaller_major_should_be_less_than_greater_major() { + // given + Version version42 = KubernetesVersion.FACTORY.create("v42"); + Version version84 = KubernetesVersion.FACTORY.create("v84"); + // when + // then + assertThat(version42).isLessThan(version84); + } + + @Test + void compareTo_kubernetesVersion_with_alpha_qualifier_should_be_less_than_beta_qualifier() { + // given + Version alpha = KubernetesVersion.FACTORY.create("v42alpha"); + Version beta = KubernetesVersion.FACTORY.create("v42beta"); + // when + // then + assertThat(alpha).isLessThan(beta); + } + + @Test + void compareTo_kubernetesVersion_with_beta_qualifier_should_be_greater_than_alpha_qualifier() { + // given + Version alpha = KubernetesVersion.FACTORY.create("v42alpha"); + Version beta = KubernetesVersion.FACTORY.create("v42beta"); + // when + // then + assertThat(beta).isGreaterThan(alpha); + } + + @Test + void compareTo_GA_kubernetesVersion_should_be_greater_than_beta_qualifier() { + // given + Version ga = KubernetesVersion.FACTORY.create("v42"); + Version beta = KubernetesVersion.FACTORY.create("v42beta"); + // when + // then + assertThat(ga).isGreaterThan(beta); + } + + @Test + void compareTo_kubernetesVersion_same_qualifier_should_be_same_as_other_qualifier() { + // given + Version beta1 = KubernetesVersion.FACTORY.create("v42beta"); + Version beta2 = KubernetesVersion.FACTORY.create("v42beta"); + // when + int qualifierComparison = beta1.compareTo(beta2); + // then + assertThat(qualifierComparison).isZero(); + } + + @Test + void compareTo_beta_kubernetesVersion_should_be_less_than_GA() { + // given + Version ga = KubernetesVersion.FACTORY.create("v42"); + Version beta = KubernetesVersion.FACTORY.create("v42beta"); + // when + // then + assertThat(beta).isLessThan(ga); + } + + @Test + void compareTo_kubernetesVersion_greater_minor_should_be_greater_than_smaller_minor() { + // given + Version minor42 = KubernetesVersion.FACTORY.create("v42alpha42"); + Version minor84 = KubernetesVersion.FACTORY.create("v42alpha84"); + // when + // then + assertThat(minor84).isGreaterThan(minor42); + } + + @Test + void compareTo_kubernetesVersion_smaller_minor_should_be_smaller_than_greater_minor() { + // given + Version minor42 = KubernetesVersion.FACTORY.create("v42beta42"); + Version minor84 = KubernetesVersion.FACTORY.create("v42beta84"); + // when + // then + assertThat(minor42).isLessThan(minor84); + } + + @Test + void compareTo_kubernetesVersion_minor_should_be_same_as_other_minor() { + // given + Version minor42_1 = KubernetesVersion.FACTORY.create("v42alpha42"); + Version minor42_2 = KubernetesVersion.FACTORY.create("v42alpha42"); + // when + int minorComparison = minor42_1.compareTo(minor42_2); + // then + assertThat(minorComparison).isZero(); + } + + @Test + void compareTo_kubernetesVersion_without_minor_should_be_less_than_version_with_minor() { + // given + Version noMinor = KubernetesVersion.FACTORY.create("v42alpha"); + Version minor42 = KubernetesVersion.FACTORY.create("v42alpha42"); + // when + // then + assertThat(noMinor).isLessThan(minor42); + } + + @Test + void compareTo_kubernetesVersion_with_minor_should_be_greater_than_version_without_minor() { + // given + Version noMinor = KubernetesVersion.FACTORY.create("v42alpha"); + Version minor42 = KubernetesVersion.FACTORY.create("v42alpha42"); + // when + // then + assertThat(minor42).isGreaterThan(noMinor); + } + + @Test + void compareTo_nonKubernetesVersion_should_be_same_as_other_with_same_version() { + // given + Version skywalker1_1 = NonKubernetesVersion.FACTORY.create("skywalker1"); + Version skywalker1_2 = NonKubernetesVersion.FACTORY.create("skywalker1"); + // when + int minorComparison = skywalker1_1.compareTo(skywalker1_2); + // then + assertThat(minorComparison).isZero(); + } + + @Test + void compareTo_nonKubernetesVersion_with_minor_should_be_less_than_version_without_minor() { + // given + Version skywalker = NonKubernetesVersion.FACTORY.create("skywalker"); + Version skywalker1 = NonKubernetesVersion.FACTORY.create("skywalker1"); + // when + // then + assertThat(skywalker1).isLessThan(skywalker); + } + + @Test + void compareTo_nonKubernetesVersion_with_greater_minor_should_be_less_than_version_with_smaller_minor() { + // given + Version skywalker1 = NonKubernetesVersion.FACTORY.create("skywalker1"); + Version skywalker10 = NonKubernetesVersion.FACTORY.create("skywalker10"); + // when + // then + assertThat(skywalker10).isLessThan(skywalker1); + } + + @Test + void compareTo_nonKubernetesVersion_with_smaller_minor_should_be_less_than_version_with_greater_minor() { + // given + Version skywalker1 = NonKubernetesVersion.FACTORY.create("skywalker1"); + Version skywalker10 = NonKubernetesVersion.FACTORY.create("skywalker10"); + // when + // then + assertThat(skywalker1).isGreaterThan(skywalker10); + } + + @Test + void compareTo_nonKubernetesVersion_alphabetically_lower_char_should_be_greater() { + // given + Version a = NonKubernetesVersion.FACTORY.create("a"); + Version b = NonKubernetesVersion.FACTORY.create("b"); + // when + // then + assertThat(a).isGreaterThan(b); + } + + @Test + void should_sort_spec_example_correctly() { + // given + Version v10 = KubernetesVersionFactory.create("v10"); + Version v2 = KubernetesVersionFactory.create("v2"); + Version v1 = KubernetesVersionFactory.create("v1"); + Version v11beta2 = KubernetesVersionFactory.create("v11beta2"); + Version v10beta3 = KubernetesVersionFactory.create("v10beta3"); + Version v3beta1 = KubernetesVersionFactory.create("v3beta1"); + Version v12alpha1 = KubernetesVersionFactory.create("v12alpha1"); + Version v11alpha2 = KubernetesVersionFactory.create("v11alpha2"); + Version foo1 = KubernetesVersionFactory.create("foo1"); + Version foo10 = KubernetesVersionFactory.create("foo10"); + List versions = Arrays.asList( + foo10, + v11alpha2, + foo1, + v3beta1, + v2, + v10beta3, + v11beta2, + v1, + v12alpha1, + v10); + // when + List sorted = versions.stream() + .sorted(Collections.reverseOrder()) + .collect(Collectors.toList()); + // then + assertThat(sorted).containsExactly( + v10, + v2, + v1, + v11beta2, + v10beta3, + v3beta1, + v12alpha1, + v11alpha2, + foo1, + foo10); + } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriorityTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriorityTest.java index 14db8a7d636..b673011ea30 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriorityTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/KubernetesVersionPriorityTest.java @@ -15,37 +15,33 @@ */ package io.fabric8.kubernetes.client.utils; -import io.fabric8.kubernetes.api.model.apiextensions.v1.CustomResourceDefinitionVersion; import org.junit.Test; import java.util.Arrays; import java.util.List; import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; public class KubernetesVersionPriorityTest { - @Test - public void should_version_with_highest_priority() { - // given - String highest = "v10"; - List versions = Arrays.asList( - "foo10", - "v11alpha2", - "foo1", - "v3beta1", - "v2", - "v10beta3", - highest, - "v11beta2", - "v1", - "v12alpha1" - ); - // when - String computed = KubernetesVersionPriority.highestPriority(versions); - // then - assertThat(computed).isEqualTo(highest); - } + @Test + public void should_version_with_highest_priority() { + // given + String highest = "v10"; + List versions = Arrays.asList( + "foo10", + "v11alpha2", + "foo1", + "v3beta1", + "v2", + "v10beta3", + highest, + "v11beta2", + "v1", + "v12alpha1"); + // when + String computed = KubernetesVersionPriority.highestPriority(versions); + // then + assertThat(computed).isEqualTo(highest); + } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/PodMockUtils.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/PodMockUtils.java index 2da61936408..59c0847e484 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/PodMockUtils.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/PodMockUtils.java @@ -38,427 +38,426 @@ */ public class PodMockUtils { + /** + * Returns a builder that allows to create a pod with the given name. + * + * @param name the name of the pod + * @return the build that one can use to create a mock for a pod + */ + public static PodMockBuilder pod(String name) { + return new PodMockBuilder(name); + } + + /** + * Returns a {@link PodCondition} for the given type and status. + * + * @param type the type of the pod condition + * @param status the status of the pod condition + * + * @return a pod condition + * + * @see PodStatus#getConditions() + */ + public static PodCondition condition(String type, String status) { + PodCondition mock = mock(PodCondition.class); + when(mock.getType()) + .thenReturn(type); + when(mock.getStatus()) + .thenReturn(status); + return mock; + } + + /** + * Returns a {@link ContainerStatus} for the given {@link ContainerState}. + * The ready property for the container status that's used is {@code false} + * + * @param state the container state for the container status + * @return the container status + * + * @see PodStatus#getContainerStatuses() + * @see ContainerStatus#getReady() + */ + public static ContainerStatus containerStatus(ContainerState state) { + return containerStatus(false, state); + } + + /** + * Returns a {@link ContainerStatus} for the given {@link ContainerState} and ready property. + * The ready property for the container status that's used is {@code false} + * + * @param state the container state for the container status + * @return the container status + * + * @see PodStatus#getContainerStatuses() + * @see ContainerStatus#getReady() + */ + public static ContainerStatus containerStatus(Boolean ready, ContainerState state) { + ContainerStatus mock = mock(ContainerStatus.class); + when(mock.getReady()) + .thenReturn(ready); + when(mock.getState()) + .thenReturn(state); + return mock; + } + + /** + * Returns a {@link ContainerState} for the given terminated, waiting and running state. + * + * @param terminated the terminated state + * @param waiting the waiting state + * @param running the running state + * + * @return a container state + * + * @see ContainerStatus#getState() + */ + public static ContainerState containerState(ContainerStateTerminated terminated, ContainerStateWaiting waiting, + ContainerStateRunning running) { + ContainerState mock = mock(ContainerState.class); + when(mock.getTerminated()) + .thenReturn(terminated); + when(mock.getWaiting()) + .thenReturn(waiting); + when(mock.getRunning()) + .thenReturn(running); + return mock; + } + + /** + * Returns a {@link ContainerStateTerminated} for the given exit code and reason. + * + * @param exitCode the exist code + * @param reason the reason + * + * @return the container state terminated + * + * @see ContainerState#getTerminated() + */ + public static ContainerStateTerminated containerStateTerminated(Integer exitCode, String reason) { + ContainerStateTerminated mock = mock(ContainerStateTerminated.class); + when(mock.getExitCode()) + .thenReturn(exitCode); + when(mock.getReason()) + .thenReturn(reason); + return mock; + } + + /** + * Returns a {@link ContainerStateWaiting} for the given reason. + * + * @param reason the reason + * + * @return the container state waiting + * + * @see ContainerState#getWaiting() + */ + public static ContainerStateWaiting containerStateWaiting(String reason) { + ContainerStateWaiting mock = mock(ContainerStateWaiting.class); + when(mock.getReason()) + .thenReturn(reason); + return mock; + } + + /** + * Returns a {@link ContainerStateRunning}. + * + * @return the container state running + * + * @see ContainerState#getRunning() + */ + public static ContainerStateRunning containerStateRunning() { + return mock(ContainerStateRunning.class); + } + + /** + * A builder that allows to create a mock for a {@link Pod}. + */ + static class PodMockBuilder { + + private final String name; + private final String namespace; + private final String uid; + private PodStatus status; + private String timestamp; + + PodMockBuilder(String name) { + this(name, null, String.valueOf(System.currentTimeMillis())); + } + + PodMockBuilder(String name, String namespace, String uid) { + this.name = name; + this.namespace = namespace; + this.uid = uid; + } + /** - * Returns a builder that allows to create a pod with the given name. - * - * @param name the name of the pod - * @return the build that one can use to create a mock for a pod + * Sets the given pod to initializing. This is achieved by mocking an initContainerStatus that + * is terminated with an exit code that's not 0. */ - public static PodMockBuilder pod(String name) { - return new PodMockBuilder(name); + public PodMockBuilder setInitializing() { + ContainerStatus containerStatus = containerStatus( + containerState( + containerStateTerminated(42, null), + null, + null)); + initContainerStatus(Collections.singletonList(containerStatus)); + return this; } /** - * Returns a {@link PodCondition} for the given type and status. + * Sets the given {@link PodStatus} to the pod that this builder is creating. * - * @param type the type of the pod condition - * @param status the status of the pod condition + * @param status the status to use for the pod under construction * - * @return a pod condition + * @return the builder + */ + public PodMockBuilder status(PodStatus status) { + this.status = status; + return this; + } + + /** + * Returns a builder for the {@link PodStatus} in the pod under construction. * - * @see PodStatus#getConditions() + * @return the builder for the pod status for the pod under construction */ - public static PodCondition condition(String type, String status) { - PodCondition mock = mock(PodCondition.class); - when(mock.getType()) - .thenReturn(type); - when(mock.getStatus()) - .thenReturn(status); - return mock; + public PodStatusMockBuilder statusBuilder() { + return new PodStatusMockBuilder(this); } /** - * Returns a {@link ContainerStatus} for the given {@link ContainerState}. - * The ready property for the container status that's used is {@code false} + * Creates a {@link PodStatus} for given phase and reason for the pod under construction. * - * @param state the container state for the container status - * @return the container status + * @return the pod status + */ + public PodMockBuilder status(String phase, String reason) { + return status(phase, reason, Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); + } + + /** + * Sets an empty ContainerStatus to the pod under construction. * - * @see PodStatus#getContainerStatuses() - * @see ContainerStatus#getReady() + * @return the builder */ - public static ContainerStatus containerStatus(ContainerState state) { - return containerStatus(false, state); + public PodMockBuilder initContainerStatus() { + return initContainerStatus(Collections.singletonList(containerStatus(null, null))); } + public PodMockBuilder initContainerStatus(List initContainerStatus) { + return status( + null, + null, + initContainerStatus, + Collections.emptyList(), + Collections.emptyList()); + } /** - * Returns a {@link ContainerStatus} for the given {@link ContainerState} and ready property. - * The ready property for the container status that's used is {@code false} + * Creates a {@link PodStatus} for the pod that this builder is creating. * - * @param state the container state for the container status - * @return the container status + * @param phase the phase for the pod status + * @param reason the reason for the pod status + * @param initContainerStatuses the init container statuses for the pod status + * @param containerStatuses the container statuses for the pod status + * @param conditions the conditions for the pod status * - * @see PodStatus#getContainerStatuses() - * @see ContainerStatus#getReady() + * @return the builder */ - public static ContainerStatus containerStatus(Boolean ready, ContainerState state) { - ContainerStatus mock = mock(ContainerStatus.class); - when(mock.getReady()) - .thenReturn(ready); - when(mock.getState()) - .thenReturn(state); - return mock; + public PodMockBuilder status( + String phase, + String reason, + List initContainerStatuses, + List containerStatuses, + List conditions) { + PodStatus mock = mock(PodStatus.class); + when(mock.getPhase()) + .thenReturn(phase); + when(mock.getReason()) + .thenReturn(reason); + when(mock.getInitContainerStatuses()) + .thenReturn(initContainerStatuses); + when(mock.getContainerStatuses()) + .thenReturn(containerStatuses); + when(mock.getConditions()) + .thenReturn(conditions); + return status(mock); } /** - * Returns a {@link ContainerState} for the given terminated, waiting and running state. - * - * @param terminated the terminated state - * @param waiting the waiting state - * @param running the running state + * Creates a deletion timestamp for given timestamp for the pod under construction. * - * @return a container state + * @param timestamp the timestamp for the deletion timestamp + * @return the builder * - * @see ContainerStatus#getState() + * @see ObjectMeta#getDeletionTimestamp() */ - public static ContainerState containerState(ContainerStateTerminated terminated, ContainerStateWaiting waiting, ContainerStateRunning running) { - ContainerState mock = mock(ContainerState.class); - when(mock.getTerminated()) - .thenReturn(terminated); - when(mock.getWaiting()) - .thenReturn(waiting); - when(mock.getRunning()) - .thenReturn(running); - return mock; + public PodMockBuilder deletion(String timestamp) { + this.timestamp = timestamp; + return this; } /** - * Returns a {@link ContainerStateTerminated} for the given exit code and reason. - * - * @param exitCode the exist code - * @param reason the reason + * Creates the pod for this builder + * + * @return + */ + public Pod build() { + Pod pod = pod(name, namespace, uid); + when(pod.getStatus()) + .thenReturn(status); + when(pod.getMetadata().getDeletionTimestamp()) + .thenReturn(timestamp); + return pod; + } + + private Pod pod(String name, String namespace, String uid) { + ObjectMeta metadata = metadata(name, namespace, uid); + Pod mock = mock(Pod.class); + when(mock.getMetadata()) + .thenReturn(metadata); + when(mock.getApiVersion()) + .thenReturn("PodMock"); + when(mock.getKind()) + .thenReturn(Pod.class.getSimpleName()); + return mock; + } + + private ObjectMeta metadata() { + return metadata(null, null, null); + } + + private ObjectMeta metadata(String name, String namespace, String uid) { + ObjectMeta metaData = mock(ObjectMeta.class); + when(metaData.getName()) + .thenReturn(name); + when(metaData.getNamespace()) + .thenReturn(namespace); + when(metaData.getUid()) + .thenReturn(uid); + return metaData; + } + } + + /** + * A builder that allows to create a mock for a {@link PodStatus}. + */ + static public class PodStatusMockBuilder { + + private final PodMockBuilder parent; + private String phase; + private String reason; + private List initContainerStatuses = Collections.emptyList(); + private List containerStatuses = Collections.emptyList(); + private List podConditions = Collections.emptyList(); + + private PodStatusMockBuilder(PodMockBuilder parent) { + this.parent = parent; + } + + /** + * Sets the phase for the pod status under construction. * - * @return the container state terminated + * @param phase the phase for this pod status + * @return the builder + */ + public PodStatusMockBuilder phase(String phase) { + this.phase = phase; + return this; + } + + /** + * Sets the reason for the pod status under construction. * - * @see ContainerState#getTerminated() + * @param reason the phase for this pod status + * @return the builder */ - public static ContainerStateTerminated containerStateTerminated(Integer exitCode, String reason) { - ContainerStateTerminated mock = mock(ContainerStateTerminated.class); - when(mock.getExitCode()) - .thenReturn(exitCode); - when(mock.getReason()) - .thenReturn(reason); - return mock; + public PodStatusMockBuilder reason(String reason) { + this.reason = reason; + return this; } /** - * Returns a {@link ContainerStateWaiting} for the given reason. + * Sets the given init container Statuses for the pod status under construction. * - * @param reason the reason + * @param initContainerStatuses the init container statuses + * @return the builder + */ + public PodStatusMockBuilder initContainerStatuses(List initContainerStatuses) { + this.initContainerStatuses = initContainerStatuses; + return this; + } + + /** + * Sets the given init container Statuses for the pod status under construction. * - * @return the container state waiting + * @param initContainerStatuses the init container statuses + * @return the builder * - * @see ContainerState#getWaiting() + * @see PodStatus#getInitContainerStatuses() */ - public static ContainerStateWaiting containerStateWaiting(String reason) { - ContainerStateWaiting mock = mock(ContainerStateWaiting.class); - when(mock.getReason()) - .thenReturn(reason); - return mock; + public PodStatusMockBuilder initContainerStatuses(ContainerStatus... initContainerStatuses) { + return initContainerStatuses(Arrays.asList(initContainerStatuses)); } /** - * Returns a {@link ContainerStateRunning}. + * Sets the given container Statuses for the pod status under construction. * - * @return the container state running + * @param containerStatuses the init container statuses + * @return the builder * - * @see ContainerState#getRunning() + * @see PodStatus#getContainerStatuses() */ - public static ContainerStateRunning containerStateRunning() { - return mock(ContainerStateRunning.class); + public PodStatusMockBuilder containerStatuses(List containerStatuses) { + this.containerStatuses = containerStatuses; + return this; } + /** + * Sets the given container Statuses for the pod status under construction. + * + * @param containerStatuses the init container statuses + * @return the builder + * + * @see PodStatus#getContainerStatuses() + */ + public PodStatusMockBuilder containerStatuses(ContainerStatus... containerStatuses) { + return containerStatuses(Arrays.asList(containerStatuses)); + } /** - * A builder that allows to create a mock for a {@link Pod}. + * Sets the given pod conditions for the pod status under construction. + * + * @param podConditions the pod conditions for this pod status + * @return + * + * @see PodStatus#getConditions() */ - static class PodMockBuilder { - - private final String name; - private final String namespace; - private final String uid; - private PodStatus status; - private String timestamp; - - PodMockBuilder(String name) { - this(name, null, String.valueOf(System.currentTimeMillis())); - } - - PodMockBuilder(String name, String namespace, String uid) { - this.name = name; - this.namespace = namespace; - this.uid = uid; - } - - /** - * Sets the given pod to initializing. This is achieved by mocking an initContainerStatus that - * is terminated with an exit code that's not 0. - */ - public PodMockBuilder setInitializing() { - ContainerStatus containerStatus = containerStatus( - containerState( - containerStateTerminated(42, null), - null, - null) - ); - initContainerStatus(Collections.singletonList(containerStatus)); - return this; - } - - /** - * Sets the given {@link PodStatus} to the pod that this builder is creating. - * - * @param status the status to use for the pod under construction - * - * @return the builder - */ - public PodMockBuilder status(PodStatus status) { - this.status = status; - return this; - } - - /** - * Returns a builder for the {@link PodStatus} in the pod under construction. - * - * @return the builder for the pod status for the pod under construction - */ - public PodStatusMockBuilder statusBuilder() { - return new PodStatusMockBuilder(this); - } - - /** - * Creates a {@link PodStatus} for given phase and reason for the pod under construction. - * - * @return the pod status - */ - public PodMockBuilder status(String phase, String reason) { - return status(phase, reason, Collections.emptyList(), Collections.emptyList(), Collections.emptyList()); - } - - /** - * Sets an empty ContainerStatus to the pod under construction. - * - * @return the builder - */ - public PodMockBuilder initContainerStatus() { - return initContainerStatus(Collections.singletonList(containerStatus(null, null))); - } - - public PodMockBuilder initContainerStatus(List initContainerStatus) { - return status( - null, - null, - initContainerStatus, - Collections.emptyList(), - Collections.emptyList()); - } - - /** - * Creates a {@link PodStatus} for the pod that this builder is creating. - * - * @param phase the phase for the pod status - * @param reason the reason for the pod status - * @param initContainerStatuses the init container statuses for the pod status - * @param containerStatuses the container statuses for the pod status - * @param conditions the conditions for the pod status - * - * @return the builder - */ - public PodMockBuilder status( - String phase, - String reason, - List initContainerStatuses, - List containerStatuses, - List conditions) { - PodStatus mock = mock(PodStatus.class); - when(mock.getPhase()) - .thenReturn(phase); - when(mock.getReason()) - .thenReturn(reason); - when(mock.getInitContainerStatuses()) - .thenReturn(initContainerStatuses); - when(mock.getContainerStatuses()) - .thenReturn(containerStatuses); - when(mock.getConditions()) - .thenReturn(conditions); - return status(mock); - } - - /** - * Creates a deletion timestamp for given timestamp for the pod under construction. - * - * @param timestamp the timestamp for the deletion timestamp - * @return the builder - * - * @see ObjectMeta#getDeletionTimestamp() - */ - public PodMockBuilder deletion(String timestamp) { - this.timestamp = timestamp; - return this; - } - - /** - * Creates the pod for this builder - * @return - */ - public Pod build() { - Pod pod = pod(name, namespace, uid); - when(pod.getStatus()) - .thenReturn(status); - when(pod.getMetadata().getDeletionTimestamp()) - .thenReturn(timestamp); - return pod; - } - - private Pod pod(String name, String namespace, String uid) { - ObjectMeta metadata = metadata(name, namespace, uid); - Pod mock = mock(Pod.class); - when(mock.getMetadata()) - .thenReturn(metadata); - when(mock.getApiVersion()) - .thenReturn("PodMock"); - when(mock.getKind()) - .thenReturn(Pod.class.getSimpleName()); - return mock; - } - - private ObjectMeta metadata() { - return metadata(null, null, null); - } - - private ObjectMeta metadata(String name, String namespace, String uid) { - ObjectMeta metaData = mock(ObjectMeta.class); - when(metaData.getName()) - .thenReturn(name); - when(metaData.getNamespace()) - .thenReturn(namespace); - when(metaData.getUid()) - .thenReturn(uid); - return metaData; - } + public PodStatusMockBuilder podConditions(List podConditions) { + this.podConditions = podConditions; + return this; } /** - * A builder that allows to create a mock for a {@link PodStatus}. + * Sets the given pod conditions for the pod status under construction. + * + * @param podConditions the pod conditions for this pod status + * @return + * + * @see PodStatus#getConditions() */ - static public class PodStatusMockBuilder { - - private final PodMockBuilder parent; - private String phase; - private String reason; - private List initContainerStatuses = Collections.emptyList(); - private List containerStatuses = Collections.emptyList(); - private List podConditions = Collections.emptyList(); - - private PodStatusMockBuilder(PodMockBuilder parent) { - this.parent = parent; - } - - /** - * Sets the phase for the pod status under construction. - * - * @param phase the phase for this pod status - * @return the builder - */ - public PodStatusMockBuilder phase(String phase) { - this.phase = phase; - return this; - } - - /** - * Sets the reason for the pod status under construction. - * - * @param reason the phase for this pod status - * @return the builder - */ - public PodStatusMockBuilder reason(String reason) { - this.reason = reason; - return this; - } - - /** - * Sets the given init container Statuses for the pod status under construction. - * - * @param initContainerStatuses the init container statuses - * @return the builder - */ - public PodStatusMockBuilder initContainerStatuses(List initContainerStatuses) { - this.initContainerStatuses = initContainerStatuses; - return this; - } - - /** - * Sets the given init container Statuses for the pod status under construction. - * - * @param initContainerStatuses the init container statuses - * @return the builder - * - * @see PodStatus#getInitContainerStatuses() - */ - public PodStatusMockBuilder initContainerStatuses(ContainerStatus... initContainerStatuses) { - return initContainerStatuses(Arrays.asList(initContainerStatuses)); - } - - /** - * Sets the given container Statuses for the pod status under construction. - * - * @param containerStatuses the init container statuses - * @return the builder - * - * @see PodStatus#getContainerStatuses() - */ - public PodStatusMockBuilder containerStatuses(List containerStatuses) { - this.containerStatuses = containerStatuses; - return this; - } - - /** - * Sets the given container Statuses for the pod status under construction. - * - * @param containerStatuses the init container statuses - * @return the builder - * - * @see PodStatus#getContainerStatuses() - */ - public PodStatusMockBuilder containerStatuses(ContainerStatus... containerStatuses) { - return containerStatuses(Arrays.asList(containerStatuses)); - } - - /** - * Sets the given pod conditions for the pod status under construction. - * - * @param podConditions the pod conditions for this pod status - * @return - * - * @see PodStatus#getConditions() - */ - public PodStatusMockBuilder podConditions(List podConditions) { - this.podConditions = podConditions; - return this; - } - - /** - * Sets the given pod conditions for the pod status under construction. - * - * @param podConditions the pod conditions for this pod status - * @return - * - * @see PodStatus#getConditions() - */ - public PodStatusMockBuilder podConditions(PodCondition... podConditions) { - return podConditions(Arrays.asList(podConditions)); - } - - /** - * Creates the {@link PodStatus} for this builder. - * - * @return the pod builder for this pod status builderP - */ - public PodMockBuilder build() { - parent.status(phase, reason, initContainerStatuses, containerStatuses, podConditions); - return parent; - } + public PodStatusMockBuilder podConditions(PodCondition... podConditions) { + return podConditions(Arrays.asList(podConditions)); + } + /** + * Creates the {@link PodStatus} for this builder. + * + * @return the pod builder for this pod status builderP + */ + public PodMockBuilder build() { + parent.status(phase, reason, initContainerStatuses, containerStatuses, podConditions); + return parent; } + + } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/PodStatusUtilTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/PodStatusUtilTest.java index 8a6b8c2fc55..54bf62a52c2 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/PodStatusUtilTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/PodStatusUtilTest.java @@ -33,327 +33,305 @@ public class PodStatusUtilTest { - private ContainerStatus runningReady = containerStatus( - true, - containerState( - null, - null, - containerStateRunning() - ) - ); - - @Test - public void isRunning_should_return_true_if_pod_is_in_phase_running() { - // given - Pod pod = pod("starwars") - .status("Running", "") - .build(); - // when - boolean running = PodStatusUtil.isRunning(pod); - // then - assertThat(running).isTrue(); - } + private ContainerStatus runningReady = containerStatus( + true, + containerState( + null, + null, + containerStateRunning())); - @Test - public void isRunning_should_return_true_if_pod_has_reason_running() { - // given - Pod pod = pod("anakin") - .status("", "Running") - .build(); - // when - boolean running = PodStatusUtil.isRunning(pod); - // then - assertThat(running).isTrue(); - } + @Test + public void isRunning_should_return_true_if_pod_is_in_phase_running() { + // given + Pod pod = pod("starwars") + .status("Running", "") + .build(); + // when + boolean running = PodStatusUtil.isRunning(pod); + // then + assertThat(running).isTrue(); + } - @Test - public void isRunning_should_return_false_if_pod_has_deletion_Timestamp() { - // given - Pod pod = pod("some pod") - .status("", "") - .deletion("2020-06-10") - .build(); - // when - boolean running = PodStatusUtil.isRunning(pod); - // then - assertThat(running).isFalse(); - } + @Test + public void isRunning_should_return_true_if_pod_has_reason_running() { + // given + Pod pod = pod("anakin") + .status("", "Running") + .build(); + // when + boolean running = PodStatusUtil.isRunning(pod); + // then + assertThat(running).isTrue(); + } - @Test - public void isRunning_should_return_false_if_pod_is_initializing() { - // given - Pod pod = pod("some pod") - .setInitializing() - .build(); - // when - boolean running = PodStatusUtil.isRunning(pod); - // then - assertThat(running).isFalse(); - } + @Test + public void isRunning_should_return_false_if_pod_has_deletion_Timestamp() { + // given + Pod pod = pod("some pod") + .status("", "") + .deletion("2020-06-10") + .build(); + // when + boolean running = PodStatusUtil.isRunning(pod); + // then + assertThat(running).isFalse(); + } - @Test - public void isInitializing_should_return_false_if_pod_has_no_initContainerStatus() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .build() - .build(); - // when - boolean initializing = PodStatusUtil.isInitializing(pod); - // then - assertThat(initializing).isFalse(); - } + @Test + public void isRunning_should_return_false_if_pod_is_initializing() { + // given + Pod pod = pod("some pod") + .setInitializing() + .build(); + // when + boolean running = PodStatusUtil.isRunning(pod); + // then + assertThat(running).isFalse(); + } - @Test - public void isInitializing_should_return_true_if_pod_has_initContainerStatus_without_state() { - // given - Pod pod = pod("some pod") - .initContainerStatus() - .build(); - // when - boolean initializing = PodStatusUtil.isInitializing(pod); - // then - assertThat(initializing).isTrue(); - } + @Test + public void isInitializing_should_return_false_if_pod_has_no_initContainerStatus() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .build() + .build(); + // when + boolean initializing = PodStatusUtil.isInitializing(pod); + // then + assertThat(initializing).isFalse(); + } - @Test - public void isInitializing_should_return_true_if_pod_has_initContainerStatus_without_terminated_value_nor_waiting_value() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .initContainerStatuses( - containerStatus(false, containerState(null, null, null)) - ) - .build() - .build(); - // when - boolean initializing = PodStatusUtil.isInitializing(pod); - // then - assertThat(initializing).isTrue(); - } + @Test + public void isInitializing_should_return_true_if_pod_has_initContainerStatus_without_state() { + // given + Pod pod = pod("some pod") + .initContainerStatus() + .build(); + // when + boolean initializing = PodStatusUtil.isInitializing(pod); + // then + assertThat(initializing).isTrue(); + } - @Test - public void isInitializing_should_return_true_if_pod_has_initContainerStatus_without_terminated_value_but_waiting_value() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .initContainerStatuses( - containerStatus( - false, - containerState( - null, - containerStateWaiting("WaitingForTheBus"), - null) - ) - ) - .build() - .build(); - // when - boolean initializing = PodStatusUtil.isInitializing(pod); - // then - assertThat(initializing).isTrue(); - } + @Test + public void isInitializing_should_return_true_if_pod_has_initContainerStatus_without_terminated_value_nor_waiting_value() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .initContainerStatuses( + containerStatus(false, containerState(null, null, null))) + .build() + .build(); + // when + boolean initializing = PodStatusUtil.isInitializing(pod); + // then + assertThat(initializing).isTrue(); + } + @Test + public void isInitializing_should_return_true_if_pod_has_initContainerStatus_without_terminated_value_but_waiting_value() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .initContainerStatuses( + containerStatus( + false, + containerState( + null, + containerStateWaiting("WaitingForTheBus"), + null))) + .build() + .build(); + // when + boolean initializing = PodStatusUtil.isInitializing(pod); + // then + assertThat(initializing).isTrue(); + } - @Test - public void isInitializing_should_return_false_if_pod_has_initContainerStatus_without_terminated_value_but_waiting_value_PodInitializing() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .initContainerStatuses( - containerStatus( - false, - containerState( - null, - containerStateWaiting("PodInitializing"), - null) - ) - ) - .build() - .build(); - // when - boolean initializing = PodStatusUtil.isInitializing(pod); - // then - assertThat(initializing).isFalse(); - } + @Test + public void isInitializing_should_return_false_if_pod_has_initContainerStatus_without_terminated_value_but_waiting_value_PodInitializing() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .initContainerStatuses( + containerStatus( + false, + containerState( + null, + containerStateWaiting("PodInitializing"), + null))) + .build() + .build(); + // when + boolean initializing = PodStatusUtil.isInitializing(pod); + // then + assertThat(initializing).isFalse(); + } - @Test - public void isInitializing_should_return_false_if_pod_has_initContainerStatus_with_state_with_exit_code_0() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .initContainerStatuses( - containerStatus( - false, - containerState( - containerStateTerminated(0, null), - null, - null) - ) - ) - .build() - .build(); - // when - boolean initializing = PodStatusUtil.isInitializing(pod); - // then - assertThat(initializing).isFalse(); - } + @Test + public void isInitializing_should_return_false_if_pod_has_initContainerStatus_with_state_with_exit_code_0() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .initContainerStatuses( + containerStatus( + false, + containerState( + containerStateTerminated(0, null), + null, + null))) + .build() + .build(); + // when + boolean initializing = PodStatusUtil.isInitializing(pod); + // then + assertThat(initializing).isFalse(); + } - @Test - public void isRunning_should_return_true_if_pod_has_containerStatus_ready_and_running() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .containerStatuses(runningReady) - .build() - .build(); - // when - boolean running = PodStatusUtil.isRunning(pod); - // then - assertThat(running).isTrue(); - } + @Test + public void isRunning_should_return_true_if_pod_has_containerStatus_ready_and_running() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .containerStatuses(runningReady) + .build() + .build(); + // when + boolean running = PodStatusUtil.isRunning(pod); + // then + assertThat(running).isTrue(); + } - @Test - public void isRunning_should_return_false_if_pod_has_containerStatus_ready_but_not_running() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .containerStatuses( - containerStatus( - true, - containerState(null, null, null) - ) - ) - .build() - .build(); - // when - boolean running = PodStatusUtil.isRunning(pod); - // then - assertThat(running).isFalse(); - } + @Test + public void isRunning_should_return_false_if_pod_has_containerStatus_ready_but_not_running() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .containerStatuses( + containerStatus( + true, + containerState(null, null, null))) + .build() + .build(); + // when + boolean running = PodStatusUtil.isRunning(pod); + // then + assertThat(running).isFalse(); + } - @Test - public void isRunning_should_return_true_if_pod_has_running_container_and_another_that_is_completed_and_ready_condition_is_true() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .containerStatuses( - runningReady, - containerStatus( - false, - containerState( - containerStateTerminated( - null, - "Completed"), - null, - null) - ) - ) - .podConditions( - condition("Ready", "true")) - .build() - .build(); - // when - boolean running = PodStatusUtil.isRunning(pod); - // then - assertThat(running).isTrue(); - } + @Test + public void isRunning_should_return_true_if_pod_has_running_container_and_another_that_is_completed_and_ready_condition_is_true() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .containerStatuses( + runningReady, + containerStatus( + false, + containerState( + containerStateTerminated( + null, + "Completed"), + null, + null))) + .podConditions( + condition("Ready", "true")) + .build() + .build(); + // when + boolean running = PodStatusUtil.isRunning(pod); + // then + assertThat(running).isTrue(); + } - @Test - public void isRunning_should_return_false_if_pod_has_running_container_and_another_that_is_completed_and_ready_condition_is_false() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .containerStatuses( - runningReady, - containerStatus( - false, - containerState( - containerStateTerminated(null,"Completed"), - null, - null) - ) - ) - .podConditions( - condition("Ready", "false") - ) - .build() - .build(); - // when - boolean running = PodStatusUtil.isRunning(pod); - // then - assertThat(running).isFalse(); - } + @Test + public void isRunning_should_return_false_if_pod_has_running_container_and_another_that_is_completed_and_ready_condition_is_false() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .containerStatuses( + runningReady, + containerStatus( + false, + containerState( + containerStateTerminated(null, "Completed"), + null, + null))) + .podConditions( + condition("Ready", "false")) + .build() + .build(); + // when + boolean running = PodStatusUtil.isRunning(pod); + // then + assertThat(running).isFalse(); + } - @Test - public void isRunning_should_return_true_if_pod_has_running_container_and_another_that_is_terminated_for_other_reason_than_completed() { - // given - Pod pod = pod("some pod") - .statusBuilder() - .containerStatuses( - runningReady, - containerStatus( - false, - containerState( - containerStateTerminated( - null, - "I was bored"), - null, - null) - ) - ) - .build() - .build(); - // when - boolean running = PodStatusUtil.isRunning(pod); - // then - assertThat(running).isTrue(); - } + @Test + public void isRunning_should_return_true_if_pod_has_running_container_and_another_that_is_terminated_for_other_reason_than_completed() { + // given + Pod pod = pod("some pod") + .statusBuilder() + .containerStatuses( + runningReady, + containerStatus( + false, + containerState( + containerStateTerminated( + null, + "I was bored"), + null, + null))) + .build() + .build(); + // when + boolean running = PodStatusUtil.isRunning(pod); + // then + assertThat(running).isTrue(); + } - @Test - public void getContainersStatuses_should_return_all_containers() { - // given - ContainerStatus waitingReady = containerStatus( - true, - containerState( - null, - containerStateWaiting(null), - null) - ); - ContainerStatus terminatedNonReady = containerStatus( - false, - containerState( - containerStateTerminated(null, null), - null, - null) - ); - Pod pod = pod("some pod") - .statusBuilder() - .containerStatuses( - runningReady, - waitingReady, - terminatedNonReady - ) - .build() - .build(); - // when - List containers = PodStatusUtil.getContainerStatus(pod); - // then - assertThat(containers).containsExactlyInAnyOrder( - runningReady, - waitingReady, - terminatedNonReady); - } + @Test + public void getContainersStatuses_should_return_all_containers() { + // given + ContainerStatus waitingReady = containerStatus( + true, + containerState( + null, + containerStateWaiting(null), + null)); + ContainerStatus terminatedNonReady = containerStatus( + false, + containerState( + containerStateTerminated(null, null), + null, + null)); + Pod pod = pod("some pod") + .statusBuilder() + .containerStatuses( + runningReady, + waitingReady, + terminatedNonReady) + .build() + .build(); + // when + List containers = PodStatusUtil.getContainerStatus(pod); + // then + assertThat(containers).containsExactlyInAnyOrder( + runningReady, + waitingReady, + terminatedNonReady); + } - @Test - public void getContainersStatuses_should_return_emptyList_if_pod_has_no_status() { - // given - Pod pod = pod("some pod") - .build(); - assertThat(pod.getStatus()).isNull(); - // when - List containers = PodStatusUtil.getContainerStatus(pod); - // then - assertThat(containers).isEmpty(); - } + @Test + public void getContainersStatuses_should_return_emptyList_if_pod_has_no_status() { + // given + Pod pod = pod("some pod") + .build(); + assertThat(pod.getStatus()).isNull(); + // when + List containers = PodStatusUtil.getContainerStatus(pod); + // then + assertThat(containers).isEmpty(); + } } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ReflectUtilsTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ReflectUtilsTest.java index 1725570454f..c3a94b68b79 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ReflectUtilsTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ReflectUtilsTest.java @@ -15,22 +15,23 @@ */ package io.fabric8.kubernetes.client.utils; -import static org.assertj.core.api.AssertionsForClassTypes.assertThat; -import static org.junit.jupiter.api.Assertions.assertSame; - import io.fabric8.kubernetes.api.model.ConfigMapBuilder; -import org.junit.jupiter.api.Test; - import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.ObjectMeta; +import org.junit.jupiter.api.Test; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; +import static org.junit.jupiter.api.Assertions.assertSame; class ReflectUtilsTest { static class Foo { private ObjectMeta metadata; + public void setMetadata(ObjectMeta metadata) { this.metadata = metadata; } + public ObjectMeta getMetadata() { return metadata; } @@ -47,14 +48,17 @@ static abstract class AbstractBaz implements HasMetadata { public void setMetadata(ObjectMeta metadata) { this.metadata = metadata; } + @Override public ObjectMeta getMetadata() { return this.metadata; } + @Override public void setApiVersion(String version) { - this.apiVersion = version; + this.apiVersion = version; } + @Override public String getApiVersion() { return this.apiVersion; @@ -70,7 +74,7 @@ public String getKind() { } @Test - void testDirectReflection () throws ReflectiveOperationException { + void testDirectReflection() throws ReflectiveOperationException { ObjectMeta meta = new ObjectMeta(); Foo foo = new Foo(); foo.setMetadata(meta); @@ -78,7 +82,7 @@ void testDirectReflection () throws ReflectiveOperationException { } @Test - void testDerivedReflection () throws ReflectiveOperationException { + void testDerivedReflection() throws ReflectiveOperationException { ObjectMeta meta = new ObjectMeta(); Foo bar = new Bar(); bar.setMetadata(meta); diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ResourceCompareTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ResourceCompareTest.java index 4457c0aa3e1..3bdf8c8f3bc 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ResourceCompareTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/ResourceCompareTest.java @@ -15,11 +15,6 @@ */ package io.fabric8.kubernetes.client.utils; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - import io.fabric8.kubernetes.api.model.IntOrString; import io.fabric8.kubernetes.api.model.KubernetesList; import io.fabric8.kubernetes.api.model.KubernetesListBuilder; @@ -33,7 +28,11 @@ import org.junit.jupiter.api.Test; import java.util.Collections; -import java.util.List; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; class ResourceCompareTest { @@ -43,14 +42,15 @@ class ResourceCompareTest { @BeforeEach public void setup() { - pod = new PodBuilder().withNewMetadata().withName("pod1").withNamespace("test").withLabels(Collections.singletonMap("label", "value")).and().build(); + pod = new PodBuilder().withNewMetadata().withName("pod1").withNamespace("test") + .withLabels(Collections.singletonMap("label", "value")).and().build(); service = new ServiceBuilder() - .withNewMetadata().withName("service1").withNamespace("test").and() - .build(); + .withNewMetadata().withName("service1").withNamespace("test").and() + .build(); final ReplicationController rc = new ReplicationControllerBuilder() - .withNewMetadata().withName("repl1").withNamespace("test").endMetadata() - .withNewSpec().withReplicas(1).endSpec() - .build(); + .withNewMetadata().withName("repl1").withNamespace("test").endMetadata() + .withNewSpec().withReplicas(1).endSpec() + .build(); kubeList = new KubernetesListBuilder().withItems(pod, service, rc).build(); } @@ -63,11 +63,10 @@ void testResourceCompareEqualsTrue() { @Test void testResourceCompareEqualsFalse() { final ReplicationController rc = new ReplicationControllerBuilder() - .withNewMetadata().withName("repl1").withNamespace("test").endMetadata() - .withNewSpec().withReplicas(2).endSpec() - .build(); - final KubernetesList kubeList2 = - new KubernetesListBuilder(kubeList).withItems(pod, service, rc).build(); + .withNewMetadata().withName("repl1").withNamespace("test").endMetadata() + .withNewSpec().withReplicas(2).endSpec() + .build(); + final KubernetesList kubeList2 = new KubernetesListBuilder(kubeList).withItems(pod, service, rc).build(); assertThat(ResourceCompare.equals(kubeList, kubeList2), is(false)); } @@ -79,13 +78,15 @@ void testPodResourceCompareEqualsTrueNoLabels() { @Test void testPodResourceCompareEqualsTrueMatchingLabels() { - Pod podWithLabels = new PodBuilder().withNewMetadata().withName("pod1").withNamespace("test").withLabels(Collections.singletonMap("label", "value")).and().build(); + Pod podWithLabels = new PodBuilder().withNewMetadata().withName("pod1").withNamespace("test") + .withLabels(Collections.singletonMap("label", "value")).and().build(); assertThat(ResourceCompare.equals(pod, podWithLabels), is(true)); } @Test void testPodResourceCompareEqualsFalseDifferentLabels() { - Pod podWithLabels = new PodBuilder().withNewMetadata().withName("pod1").withNamespace("test").withLabels(Collections.singletonMap("label", "another value")).and().build(); + Pod podWithLabels = new PodBuilder().withNewMetadata().withName("pod1").withNamespace("test") + .withLabels(Collections.singletonMap("label", "another value")).and().build(); assertThat(ResourceCompare.equals(pod, podWithLabels), is(false)); } @@ -93,37 +94,37 @@ void testPodResourceCompareEqualsFalseDifferentLabels() { void testServiceDifferenceFromClusterAndAsObject() { // Given Service serviceFromCluster = new ServiceBuilder() - .withNewMetadata() - .withCreationTimestamp("2020-07-27T10:36:33Z") - .withName("my-service") - .withNamespace("default") - .withResourceVersion("202998") - .withSelfLink("/api/v1/namespaces/default/services/my-service") - .withUid("99fe3964-b53b-473f-b1d8-bdb0390d1634") - .endMetadata() - .withNewSpec() - .withClusterIP("10.110.153.70") - .addNewPort() - .withPort(80) - .withProtocol("TCP") - .withTargetPort(new IntOrString("9376")) - .endPort() - .addToSelector(Collections.singletonMap("app", "MyApp")) - .withType("ClusterIP") - .endSpec() - .build(); + .withNewMetadata() + .withCreationTimestamp("2020-07-27T10:36:33Z") + .withName("my-service") + .withNamespace("default") + .withResourceVersion("202998") + .withSelfLink("/api/v1/namespaces/default/services/my-service") + .withUid("99fe3964-b53b-473f-b1d8-bdb0390d1634") + .endMetadata() + .withNewSpec() + .withClusterIP("10.110.153.70") + .addNewPort() + .withPort(80) + .withProtocol("TCP") + .withTargetPort(new IntOrString("9376")) + .endPort() + .addToSelector(Collections.singletonMap("app", "MyApp")) + .withType("ClusterIP") + .endSpec() + .build(); Service serviceAsObj = new ServiceBuilder() - .withNewMetadata().withName("my-service").endMetadata() - .withNewSpec() - .addToSelector(Collections.singletonMap("app", "MyApp")) - .addNewPort() - .withPort(80) - .withProtocol("TCP") - .withTargetPort(new IntOrString("9376")) - .endPort() - .endSpec() - .build(); + .withNewMetadata().withName("my-service").endMetadata() + .withNewSpec() + .addToSelector(Collections.singletonMap("app", "MyApp")) + .addNewPort() + .withPort(80) + .withProtocol("TCP") + .withTargetPort(new IntOrString("9376")) + .endPort() + .endSpec() + .build(); // When boolean result = ResourceCompare.equals(serviceFromCluster, serviceAsObj); diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/SerializationYamlTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/SerializationYamlTest.java index 1087e2e5ce0..f5ec62357f9 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/SerializationYamlTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/SerializationYamlTest.java @@ -33,14 +33,14 @@ class SerializationYamlTest { void unmarshalEvaluatesNonStandardClasses() { // Given final String genericResourceYaml = "kind: MyCustomResource\n" + - "apiVersion: my.custom.resource.example.com/v1\n" + - "spec:\n" + - " complex: !!io.fabric8.kubernetes.client.utils.SerializationYamlTest$NonStandardJavaClass [ evil ]"; + "apiVersion: my.custom.resource.example.com/v1\n" + + "spec:\n" + + " complex: !!io.fabric8.kubernetes.client.utils.SerializationYamlTest$NonStandardJavaClass [ evil ]"; // When final HasMetadata resource = Serialization.unmarshal(genericResourceYaml); // Then assertThat(resource) - .hasFieldOrPropertyWithValue("additionalProperties.spec.complex.field", "evil"); + .hasFieldOrPropertyWithValue("additionalProperties.spec.complex.field", "evil"); } @Test @@ -48,21 +48,23 @@ void unmarshalEvaluatesNonStandardClasses() { void unmarshalShouldNotEvaluateNonStandardClasses() { // Given final String genericResourceYaml = "kind: MyCustomResource\n" + - "apiVersion: my.custom.resource.example.com/v1\n" + - "spec:\n" + - " complex: !!io.fabric8.kubernetes.client.utils.SerializationYamlTest$NonStandardJavaClass [ evil ]"; + "apiVersion: my.custom.resource.example.com/v1\n" + + "spec:\n" + + " complex: !!io.fabric8.kubernetes.client.utils.SerializationYamlTest$NonStandardJavaClass [ evil ]"; // When final Exception result = assertThrows(ConstructorException.class, () -> Serialization.unmarshal(genericResourceYaml)); // Then assertThat(result).hasMessageStartingWith("could not determine a constructor for the tag " + - "tag:yaml.org,2002:io.fabric8.kubernetes.client.utils.SerializationYamlTest$NonStandardJavaClass"); + "tag:yaml.org,2002:io.fabric8.kubernetes.client.utils.SerializationYamlTest$NonStandardJavaClass"); } static final class NonStandardJavaClass { public String field; + NonStandardJavaClass() { } + NonStandardJavaClass(String field) { this.field = field; } diff --git a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/URLUtilsTest.java b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/URLUtilsTest.java index 15844e7f3c9..fd410d465a9 100644 --- a/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/URLUtilsTest.java +++ b/kubernetes-client-api/src/test/java/io/fabric8/kubernetes/client/utils/URLUtilsTest.java @@ -22,7 +22,6 @@ class URLUtilsTest { - @Test void shouldJoinUrlWithoutQueryParams() { @@ -91,5 +90,4 @@ void shouldJoinNoneUrl() { } - } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/DefaultOperationInfo.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/DefaultOperationInfo.java index 497a6967b47..396230048bf 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/DefaultOperationInfo.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/DefaultOperationInfo.java @@ -27,7 +27,8 @@ public class DefaultOperationInfo implements OperationInfo { private final String plural; private final String version; - public DefaultOperationInfo(String kind, String operationType, String name, String namespace, String group, String plural, String version) { + public DefaultOperationInfo(String kind, String operationType, String name, String namespace, String group, String plural, + String version) { this.kind = kind; this.name = name; this.namespace = namespace; @@ -37,7 +38,6 @@ public DefaultOperationInfo(String kind, String operationType, String name, Stri this.version = version; } - @Override public String getKind() { return kind; diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/MetricOperationsImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/MetricOperationsImpl.java index 36520117f8b..946e8945c65 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/MetricOperationsImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/MetricOperationsImpl.java @@ -18,8 +18,8 @@ import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.dsl.MetricOperation; import io.fabric8.kubernetes.client.utils.URLUtils; -import io.fabric8.kubernetes.client.utils.Utils; import io.fabric8.kubernetes.client.utils.URLUtils.URLBuilder; +import io.fabric8.kubernetes.client.utils.Utils; import java.io.IOException; import java.util.HashMap; @@ -107,11 +107,11 @@ private String getUrlWithLabels(String baseUrl, Map labels) { URLBuilder httpUrlBuilder = new URLBuilder(baseUrl); StringBuilder sb = new StringBuilder(); - for(Map.Entry entry : labels.entrySet()) { + for (Map.Entry entry : labels.entrySet()) { sb.append(entry.getKey()).append("=").append(entry.getValue()).append(","); } httpUrlBuilder.addQueryParameter("labelSelector", sb.substring(0, sb.toString().length() - 1)); return httpUrlBuilder.toString(); } - + } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PortForwarder.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PortForwarder.java index 715a53cc43a..ab8aac58a73 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PortForwarder.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PortForwarder.java @@ -15,14 +15,14 @@ */ package io.fabric8.kubernetes.client.dsl.internal; +import io.fabric8.kubernetes.client.LocalPortForward; +import io.fabric8.kubernetes.client.PortForward; + import java.net.InetAddress; import java.net.URL; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; -import io.fabric8.kubernetes.client.LocalPortForward; -import io.fabric8.kubernetes.client.PortForward; - /** * Allows to forward local ports (or nio channels) to remote ports in Kubernetes pods. */ diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/SharedInformerFactoryImpl.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/SharedInformerFactoryImpl.java index 2de88270ecc..49cdbe8eb43 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/SharedInformerFactoryImpl.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/informers/impl/SharedInformerFactoryImpl.java @@ -32,7 +32,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CompletionStage; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Future; diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/CreateOrReplaceHelper.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/CreateOrReplaceHelper.java index e4c2afe135d..6671516336d 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/CreateOrReplaceHelper.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/CreateOrReplaceHelper.java @@ -31,7 +31,8 @@ public class CreateOrReplaceHelper { private final UnaryOperator waitTask; private final UnaryOperator reloadTask; - public CreateOrReplaceHelper(UnaryOperator createTask, UnaryOperator replaceTask, UnaryOperator waitTask, UnaryOperator reloadTask) { + public CreateOrReplaceHelper(UnaryOperator createTask, UnaryOperator replaceTask, UnaryOperator waitTask, + UnaryOperator reloadTask) { this.createTask = createTask; this.replaceTask = replaceTask; this.waitTask = waitTask; @@ -67,8 +68,8 @@ public T createOrReplace(T item) { } private T replace(T item, String resourceVersion) { - KubernetesResourceUtil.setResourceVersion(item, resourceVersion); - return replaceTask.apply(item); + KubernetesResourceUtil.setResourceVersion(item, resourceVersion); + return replaceTask.apply(item); } private boolean shouldRetry(int responseCode) { diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/OptionalDependencyWrapper.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/OptionalDependencyWrapper.java index 7c3ef464114..f33a8740311 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/OptionalDependencyWrapper.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/OptionalDependencyWrapper.java @@ -15,10 +15,10 @@ */ package io.fabric8.kubernetes.client.utils.internal; -import java.util.function.Supplier; - import io.fabric8.kubernetes.client.KubernetesClientException; +import java.util.function.Supplier; + public class OptionalDependencyWrapper { private OptionalDependencyWrapper() { @@ -29,7 +29,7 @@ private OptionalDependencyWrapper() { * * @param supplier implementation to safely run * @param message to display for caught exceptions (e.g. "Base64InputStream class is provided by - * commons-codec" + * commons-codec" * @param type of supplier * @return run object */ @@ -39,8 +39,8 @@ public static R wrapRunWithOptionalDependency(Supplier supplier, String m return supplier.get(); } catch (NoClassDefFoundError ex) { throw new KubernetesClientException(String.format( - "%s, an optional dependency. To use this functionality you must explicitly add this dependency to the classpath.", - message), ex); + "%s, an optional dependency. To use this functionality you must explicitly add this dependency to the classpath.", + message), ex); } } } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/URLFromServiceUtil.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/URLFromServiceUtil.java index fd70c123e9f..92be6e1bb27 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/URLFromServiceUtil.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/internal/URLFromServiceUtil.java @@ -34,9 +34,11 @@ public class URLFromServiceUtil { private static final String HOST_SUFFIX = "_SERVICE_HOST"; private static final String PORT_SUFFIX = "_SERVICE_PORT"; private static final String PROTO_SUFFIX = "_TCP_PROTO"; + private URLFromServiceUtil() { throw new IllegalStateException("Utility class"); } + public static String resolveHostFromEnvVarOrSystemProperty(String serviceName) { return getEnvVarOrSystemProperty(toServiceHostEnvironmentVariable(serviceName), ""); } @@ -59,7 +61,8 @@ private static String getEnvVarOrSystemProperty(String envVarName, String defaul } public static String resolveProtocolFromEnvVarOrSystemProperty(String serviceName, String servicePort) { - return getEnvVarOrSystemProperty(toEnvVariable(serviceName + PORT_SUFFIX + "_" + servicePort + PROTO_SUFFIX), DEFAULT_PROTO); + return getEnvVarOrSystemProperty(toEnvVariable(serviceName + PORT_SUFFIX + "_" + servicePort + PROTO_SUFFIX), + DEFAULT_PROTO); } public static Map getOrCreateAnnotations(HasMetadata entity) { @@ -100,10 +103,11 @@ public static String toEnvVariable(String serviceName) { return serviceName.toUpperCase(Locale.ROOT).replaceAll("-", "_"); } - public static String getURLFromIngressList(List ingressList, String namespace, String serviceName, ServicePort port) { - for(Ingress item : ingressList) { + public static String getURLFromIngressList(List ingressList, String namespace, String serviceName, + ServicePort port) { + for (Ingress item : ingressList) { String ns = getNamespace(item); - if(Objects.equals(ns, namespace) && item.getSpec() != null) { + if (Objects.equals(ns, namespace) && item.getSpec() != null) { return getURLFromIngressSpec(item.getSpec(), serviceName, port); } } @@ -112,10 +116,10 @@ public static String getURLFromIngressList(List ingressList, String nam public static String getURLFromIngressSpec(IngressSpec spec, String serviceName, ServicePort port) { List ingressRules = spec.getRules(); - if(ingressRules != null && !ingressRules.isEmpty()) { - for(IngressRule rule : ingressRules) { + if (ingressRules != null && !ingressRules.isEmpty()) { + for (IngressRule rule : ingressRules) { HTTPIngressRuleValue http = rule.getHttp(); - if(http != null && http.getPaths() != null) { + if (http != null && http.getPaths() != null) { return getURLFromIngressRules(http.getPaths(), spec, serviceName, port, rule); } } @@ -123,18 +127,19 @@ public static String getURLFromIngressSpec(IngressSpec spec, String serviceName, return null; } - public static String getURLFromIngressRules(List paths, IngressSpec spec, String serviceName, ServicePort port, IngressRule rule) { - for(HTTPIngressPath path : paths) { + public static String getURLFromIngressRules(List paths, IngressSpec spec, String serviceName, + ServicePort port, IngressRule rule) { + for (HTTPIngressPath path : paths) { IngressBackend backend = path.getBackend(); - if(backend != null) { + if (backend != null) { String backendServiceName = backend.getServiceName(); - if(serviceName.equals(backendServiceName) && portsMatch(port, backend.getServicePort())) { + if (serviceName.equals(backendServiceName) && portsMatch(port, backend.getServicePort())) { String pathPostFix = path.getPath(); - if(spec.getTls() != null) { + if (spec.getTls() != null) { return getURLFromTLSHost(rule, pathPostFix); } String answer = rule.getHost(); - if(answer != null && !answer.isEmpty()) { + if (answer != null && !answer.isEmpty()) { pathPostFix = fixPathPostFixIfEmpty(pathPostFix); return "http://" + URLUtils.pathJoin(answer, pathPostFix); } @@ -168,7 +173,7 @@ private static boolean portsMatch(ServicePort servicePort, IntOrString intOrStri } else { /// should we find the port by name now? } - } else if (strVal != null ){ + } else if (strVal != null) { return strVal.equals(servicePort.getName()); } } diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/apps/v1/AppsV1ControllerPodOperationTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/apps/v1/AppsV1ControllerPodOperationTest.java index 1305cd9a267..6bbd3efcf81 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/apps/v1/AppsV1ControllerPodOperationTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/apps/v1/AppsV1ControllerPodOperationTest.java @@ -33,15 +33,15 @@ class AppsV1ControllerPodOperationTest { void testDeploymentSelectorLabels() { // Given Deployment deployment = new DeploymentBuilder() - .withNewSpec() - .withNewTemplate() - .withNewMetadata() - .addToLabels("foo", "bar") - .addToLabels("one", "two") - .endMetadata() - .endTemplate() - .endSpec() - .build(); + .withNewSpec() + .withNewTemplate() + .withNewMetadata() + .addToLabels("foo", "bar") + .addToLabels("one", "two") + .endMetadata() + .endTemplate() + .endSpec() + .build(); // When Map labels = DeploymentOperationsImpl.getDeploymentSelectorLabels(deployment); @@ -57,12 +57,12 @@ void testDeploymentSelectorLabels() { void testReplicaSetSelectorLabels() { // Given ReplicaSet replicaSet = new ReplicaSetBuilder() - .withNewSpec() - .withNewSelector() - .addToMatchLabels("foo", "bar") - .endSelector() - .endSpec() - .build(); + .withNewSpec() + .withNewSelector() + .addToMatchLabels("foo", "bar") + .endSelector() + .endSpec() + .build(); // When Map labels = ReplicaSetOperationsImpl.getReplicaSetSelectorLabels(replicaSet); @@ -77,15 +77,15 @@ void testReplicaSetSelectorLabels() { void testStatefulSetSelectorLabels() { // Given StatefulSet statefulSet = new StatefulSetBuilder() - .withNewSpec() - .withNewTemplate() - .withNewMetadata() - .addToLabels("foo", "bar") - .addToLabels("one", "two") - .endMetadata() - .endTemplate() - .endSpec() - .build(); + .withNewSpec() + .withNewTemplate() + .withNewMetadata() + .addToLabels("foo", "bar") + .addToLabels("one", "two") + .endMetadata() + .endTemplate() + .endSpec() + .build(); // When Map labels = StatefulSetOperationsImpl.getStatefulSetSelectorLabels(statefulSet); diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/batch/v1/JobOperationsImplTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/batch/v1/JobOperationsImplTest.java index 7ba309081b1..47f5e8c0662 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/batch/v1/JobOperationsImplTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/dsl/internal/batch/v1/JobOperationsImplTest.java @@ -42,13 +42,13 @@ void testGetJobPodLabels() { private Job getMockedJob() { return new JobBuilder() - .withNewMetadata() - .addToLabels("controller-uid", "63e8e54b-bc7a-4bb3-a7ad-2ea5f0b5b591") - .addToLabels("job-name", "pi") - .withName("pi") - .withUid("63e8e54b-bc7a-4bb3-a7ad-2ea5f0b5b591") - .endMetadata() - .build(); + .withNewMetadata() + .addToLabels("controller-uid", "63e8e54b-bc7a-4bb3-a7ad-2ea5f0b5b591") + .addToLabels("job-name", "pi") + .withName("pi") + .withUid("63e8e54b-bc7a-4bb3-a7ad-2ea5f0b5b591") + .endMetadata() + .build(); } } diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/impl/HandlersTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/impl/HandlersTest.java index 17d2a1bbb6b..77771097701 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/impl/HandlersTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/impl/HandlersTest.java @@ -22,8 +22,6 @@ import io.fabric8.kubernetes.client.dsl.internal.HasMetadataOperation; import io.fabric8.kubernetes.client.dsl.internal.HasMetadataOperationsImpl; import io.fabric8.kubernetes.client.dsl.internal.OperationContext; -import io.fabric8.kubernetes.client.impl.BaseClient; -import io.fabric8.kubernetes.client.impl.Handlers; import org.hamcrest.Matchers; import org.junit.jupiter.api.Test; import org.mockito.Mockito; diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/informers/impl/cache/ProcessorListenerTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/informers/impl/cache/ProcessorListenerTest.java index 7c9df65b238..9eee26acb09 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/informers/impl/cache/ProcessorListenerTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/informers/impl/cache/ProcessorListenerTest.java @@ -18,7 +18,6 @@ import io.fabric8.kubernetes.api.model.Pod; import io.fabric8.kubernetes.api.model.PodBuilder; import io.fabric8.kubernetes.client.informers.ResourceEventHandler; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static junit.framework.TestCase.assertTrue; @@ -33,25 +32,25 @@ void testNotificationHandling() { Pod pod = new PodBuilder().withNewMetadata().withName("foo").withNamespace("default").endMetadata().build(); ProcessorListener listener = new ProcessorListener<>( - new ResourceEventHandler() { - @Override - public void onAdd(Pod obj) { - assertEquals(pod, obj); - addNotificationReceived = true; - } + new ResourceEventHandler() { + @Override + public void onAdd(Pod obj) { + assertEquals(pod, obj); + addNotificationReceived = true; + } - @Override - public void onUpdate(Pod oldObj, Pod newObj) { - assertEquals(pod, newObj); - updateNotificationReceived = true; - } + @Override + public void onUpdate(Pod oldObj, Pod newObj) { + assertEquals(pod, newObj); + updateNotificationReceived = true; + } - @Override - public void onDelete(Pod obj, boolean deletedFinalStateUnknown) { - assertEquals(pod, obj); - deleteNotificationReceived = true; - } - }, 0); + @Override + public void onDelete(Pod obj, boolean deletedFinalStateUnknown) { + assertEquals(pod, obj); + deleteNotificationReceived = true; + } + }, 0); listener.add(new ProcessorListener.AddNotification<>(pod)); listener.add(new ProcessorListener.UpdateNotification<>(null, pod)); diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/informers/impl/cache/SharedProcessorTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/informers/impl/cache/SharedProcessorTest.java index f6daa182bd1..754f451ab3b 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/informers/impl/cache/SharedProcessorTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/informers/impl/cache/SharedProcessorTest.java @@ -66,13 +66,16 @@ private static class ExpectingNotificationHandler extends ProcessorListener notification) { this(new ResourceEventHandler() { @Override - public void onAdd(T obj) { } + public void onAdd(T obj) { + } @Override - public void onUpdate(T oldObj, T newObj) { } + public void onUpdate(T oldObj, T newObj) { + } @Override - public void onDelete(T obj, boolean deletedFinalStateUnknown) { } + public void onDelete(T obj, boolean deletedFinalStateUnknown) { + } }, 0); this.expectingNotification = notification; } diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/utils/internal/CreateOrReplaceHelperTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/utils/internal/CreateOrReplaceHelperTest.java index 0c0cbbc3235..7940721f077 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/utils/internal/CreateOrReplaceHelperTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/utils/internal/CreateOrReplaceHelperTest.java @@ -19,7 +19,6 @@ import io.fabric8.kubernetes.api.model.PodBuilder; import io.fabric8.kubernetes.api.model.StatusBuilder; import io.fabric8.kubernetes.client.KubernetesClientException; -import io.fabric8.kubernetes.client.utils.internal.CreateOrReplaceHelper; import org.junit.jupiter.api.Test; import org.mockito.Mockito; @@ -45,11 +44,10 @@ void testCreateOrReplaceShouldCreate() { return getPod(); }; CreateOrReplaceHelper podCreateOrReplaceHelper = new CreateOrReplaceHelper<>( - createPodTask, - p -> getPod(), - p -> getPod(), - p -> getPod() - ); + createPodTask, + p -> getPod(), + p -> getPod(), + p -> getPod()); Pod p = getPod(); p.getMetadata().setResourceVersion("1"); @@ -69,18 +67,17 @@ void testCreateOrReplaceShouldReplace() { AtomicBoolean wasPodReplaced = new AtomicBoolean(false); UnaryOperator createPodTask = p -> { throw new KubernetesClientException("Already exist", - HttpURLConnection.HTTP_CONFLICT, new StatusBuilder().withCode(HttpURLConnection.HTTP_CONFLICT).build()); + HttpURLConnection.HTTP_CONFLICT, new StatusBuilder().withCode(HttpURLConnection.HTTP_CONFLICT).build()); }; UnaryOperator replacePodTask = p -> { wasPodReplaced.set(true); return getPod(); }; CreateOrReplaceHelper podCreateOrReplaceHelper = new CreateOrReplaceHelper<>( - createPodTask, - replacePodTask, - p -> getPod(), - p -> getPod() - ); + createPodTask, + replacePodTask, + p -> getPod(), + p -> getPod()); // When Pod podCreated = podCreateOrReplaceHelper.createOrReplace(getPod()); @@ -98,19 +95,18 @@ void testCreateOrReplaceShouldRetryOnInternalServerError() { UnaryOperator reloadTask = Mockito.mock(UnaryOperator.class, Mockito.RETURNS_DEEP_STUBS); when(reloadTask.apply(any())).thenReturn(null); when(createPodTask.apply(any())).thenThrow(new KubernetesClientException("The POST operation could not be completed at " + - "this time, please try again", - HttpURLConnection.HTTP_INTERNAL_ERROR, new StatusBuilder().withCode(HttpURLConnection.HTTP_INTERNAL_ERROR).build())) - .thenReturn(getPod()); + "this time, please try again", + HttpURLConnection.HTTP_INTERNAL_ERROR, new StatusBuilder().withCode(HttpURLConnection.HTTP_INTERNAL_ERROR).build())) + .thenReturn(getPod()); UnaryOperator waitTask = p -> { waitedForPod.set(true); return getPod(); }; CreateOrReplaceHelper podCreateOrReplaceHelper = new CreateOrReplaceHelper<>( - createPodTask, - p -> getPod(), - waitTask, - reloadTask - ); + createPodTask, + p -> getPod(), + waitTask, + reloadTask); // When Pod podCreated = podCreateOrReplaceHelper.createOrReplace(getPod()); @@ -125,21 +121,20 @@ void testCreateOrReplaceThrowExceptionOnErrorCodeLessThan500() { // Given UnaryOperator createPodTask = p -> { throw new KubernetesClientException("The POST operation could not be completed at " + - "this time, please try again", - HttpURLConnection.HTTP_BAD_REQUEST, new StatusBuilder().withCode(HttpURLConnection.HTTP_BAD_REQUEST).build()); + "this time, please try again", + HttpURLConnection.HTTP_BAD_REQUEST, new StatusBuilder().withCode(HttpURLConnection.HTTP_BAD_REQUEST).build()); }; CreateOrReplaceHelper podCreateOrReplaceHelper = new CreateOrReplaceHelper<>(createPodTask, - p -> getPod(), p ->getPod(), p -> getPod()); + p -> getPod(), p -> getPod(), p -> getPod()); Pod podToCreate = getPod(); // When assertThrows(KubernetesClientException.class, () -> podCreateOrReplaceHelper.createOrReplace(podToCreate)); } - private Pod getPod() { return new PodBuilder() - .withNewMetadata().withName("p1").endMetadata() - .build(); + .withNewMetadata().withName("p1").endMetadata() + .build(); } } diff --git a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/utils/internal/OptionalDependencyWrapperTest.java b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/utils/internal/OptionalDependencyWrapperTest.java index cf776a61e24..a35601518c5 100644 --- a/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/utils/internal/OptionalDependencyWrapperTest.java +++ b/kubernetes-client/src/test/java/io/fabric8/kubernetes/client/utils/internal/OptionalDependencyWrapperTest.java @@ -28,7 +28,7 @@ class OptionalDependencyWrapperTest { @Test void testWrapRunWithOptionalDependencyHasAllDependenciesShouldNotThrowException() { final boolean result = wrapRunWithOptionalDependency(() -> true, - "I have no optional dependencies"); + "I have no optional dependencies"); assertThat(result, equalTo(true)); } @@ -36,11 +36,11 @@ void testWrapRunWithOptionalDependencyHasAllDependenciesShouldNotThrowException( @Test void testWrapRunWithOptionalDependencyUsesDependencyShouldThrowException() { final KubernetesClientException exception = assertThrows(KubernetesClientException.class, - () -> wrapRunWithOptionalDependency(() -> { - throw new NoClassDefFoundError("com.1337.invalid.IDontExist"); - }, "IDontExist class is provided by some optional package")); + () -> wrapRunWithOptionalDependency(() -> { + throw new NoClassDefFoundError("com.1337.invalid.IDontExist"); + }, "IDontExist class is provided by some optional package")); assertThat(exception.getMessage(), equalTo( - "IDontExist class is provided by some optional package, an optional dependency. To use this functionality you must explicitly add this dependency to the classpath.")); + "IDontExist class is provided by some optional package, an optional dependency. To use this functionality you must explicitly add this dependency to the classpath.")); } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/BindingExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/BindingExample.java index 0ed864b923a..5bc6bb0d3bd 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/BindingExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/BindingExample.java @@ -24,8 +24,9 @@ import io.fabric8.kubernetes.client.KubernetesClientBuilder; import java.util.UUID; + /** - * This is an example of pod binding node. + * This is an example of pod binding node. */ public class BindingExample { @@ -40,33 +41,32 @@ public static void main(String[] args) { namespace = client.getNamespace(); } else { namespace = client.namespaces().list().getItems().stream().findFirst() - .orElseThrow(() -> new IllegalStateException("No namespace available")).getMetadata().getName(); + .orElseThrow(() -> new IllegalStateException("No namespace available")).getMetadata().getName(); } client.pods().inNamespace(namespace).create(new PodBuilder() - .withMetadata(new ObjectMetaBuilder() - .withName(podName) - .build()) - .withSpec(new PodSpecBuilder() - .withSchedulerName("random-scheduler-name-which-does-not-exist") - .addNewContainer() - .withName(podName) - .withImage("nginx:latest") - .endContainer() - .build()) - .build() - ); + .withMetadata(new ObjectMetaBuilder() + .withName(podName) + .build()) + .withSpec(new PodSpecBuilder() + .withSchedulerName("random-scheduler-name-which-does-not-exist") + .addNewContainer() + .withName(podName) + .withImage("nginx:latest") + .endContainer() + .build()) + .build()); final Node firstNode = client.nodes().list().getItems().stream().findFirst() - .orElseThrow(() -> new IllegalStateException("No nodes available")); + .orElseThrow(() -> new IllegalStateException("No nodes available")); client.bindings().inNamespace(namespace).create(new BindingBuilder() - .withNewMetadata().withName(podName).endMetadata() - .withNewTarget() - .withKind(firstNode.getKind()) - .withApiVersion(firstNode.getApiVersion()) - .withName(firstNode.getMetadata().getName()).endTarget() - .build()); + .withNewMetadata().withName(podName).endMetadata() + .withNewTarget() + .withKind(firstNode.getKind()) + .withApiVersion(firstNode.getApiVersion()) + .withName(firstNode.getMetadata().getName()).endTarget() + .build()); System.out.printf("Successfully bound Pod %s to Node %s%n", - podName, firstNode.getMetadata().getName()); + podName, firstNode.getMetadata().getName()); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CRDLoadExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CRDLoadExample.java index 69a49922846..115ce3c11f9 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CRDLoadExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CRDLoadExample.java @@ -35,12 +35,13 @@ public static void main(String[] args) { // Creating a custom resource from yaml CustomResourceDefinition aCustomResourceDefinition = client.apiextensions().v1beta1().customResourceDefinitions() - .load(CRDLoadExample.class.getResourceAsStream("/crd.yml")).get(); + .load(CRDLoadExample.class.getResourceAsStream("/crd.yml")).get(); logger.info("Creating CRD..."); client.apiextensions().v1beta1().customResourceDefinitions().create(aCustomResourceDefinition); logger.info("Updated Custom Resource Definitions: "); - client.apiextensions().v1beta1().customResourceDefinitions().list().getItems().forEach(crd -> logger.info(crd.getMetadata().getName())); + client.apiextensions().v1beta1().customResourceDefinitions().list().getItems() + .forEach(crd -> logger.info(crd.getMetadata().getName())); } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ConfigMapExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ConfigMapExample.java index ff31cf779e6..8f8cc30e0d5 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ConfigMapExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ConfigMapExample.java @@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory; import java.util.Date; + /** * This is an example of how to use the client to update or create a ConfigMap. */ @@ -50,12 +51,8 @@ public static void main(String[] args) { String name = "cheese"; Resource configMapResource = client.configMaps().inNamespace(namespace).withName(name); - - ConfigMap configMap = configMapResource.createOrReplace(new ConfigMapBuilder(). - withNewMetadata().withName(name).endMetadata(). - addToData("foo", "" + new Date()). - addToData("bar", "beer"). - build()); + ConfigMap configMap = configMapResource.createOrReplace(new ConfigMapBuilder().withNewMetadata().withName(name) + .endMetadata().addToData("foo", "" + new Date()).addToData("bar", "beer").build()); logger.info("Upserted ConfigMap at {} data {}", configMap.getMetadata().getSelfLink(), configMap.getData()); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CredentialsExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CredentialsExample.java index 4948753bbe6..dada7d3cefe 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CredentialsExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CredentialsExample.java @@ -24,32 +24,32 @@ public class CredentialsExample { - private static final Logger logger = LoggerFactory.getLogger(CredentialsExample.class); + private static final Logger logger = LoggerFactory.getLogger(CredentialsExample.class); - public static void main(String[] args) { - final ConfigBuilder configBuilder = new ConfigBuilder(); - if (args.length > 0) { - configBuilder.withMasterUrl(args[0]); - } - Config config = configBuilder - .withTrustCerts(true) - .withUsername("developer") - .withPassword("developer") - .withNamespace("myproject") - .build(); - try (final KubernetesClient client = new KubernetesClientBuilder().withConfig(config).build()) { + public static void main(String[] args) { + final ConfigBuilder configBuilder = new ConfigBuilder(); + if (args.length > 0) { + configBuilder.withMasterUrl(args[0]); + } + Config config = configBuilder + .withTrustCerts(true) + .withUsername("developer") + .withPassword("developer") + .withNamespace("myproject") + .build(); + try (final KubernetesClient client = new KubernetesClientBuilder().withConfig(config).build()) { - logger.info("Received pods {}", client.pods().list()); + logger.info("Received pods {}", client.pods().list()); - } catch (Exception e) { - logger.error(e.getMessage(), e); + } catch (Exception e) { + logger.error(e.getMessage(), e); - Throwable[] suppressed = e.getSuppressed(); - if (suppressed != null) { - for (Throwable t : suppressed) { - logger.error(t.getMessage(), t); - } - } + Throwable[] suppressed = e.getSuppressed(); + if (suppressed != null) { + for (Throwable t : suppressed) { + logger.error(t.getMessage(), t); } + } } + } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CronJobExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CronJobExample.java index 662f3d8dca8..3cff0a72205 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CronJobExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/CronJobExample.java @@ -41,33 +41,33 @@ public static void main(String[] args) { log("Using master with url ", master); Config config = new ConfigBuilder().withMasterUrl(master).build(); - try(final KubernetesClient client = new KubernetesClientBuilder().withConfig(config).build()) { + try (final KubernetesClient client = new KubernetesClientBuilder().withConfig(config).build()) { final String namespace = client.getNamespace(); CronJob cronJob1 = new CronJobBuilder() - .withApiVersion("batch/v1beta1") - .withNewMetadata() - .withName("hello") - .withLabels(Collections.singletonMap("foo", "bar")) - .endMetadata() - .withNewSpec() - .withSchedule("*/1 * * * *") - .withNewJobTemplate() - .withNewSpec() - .withNewTemplate() - .withNewSpec() - .addNewContainer() - .withName("hello") - .withImage("busybox") - .withArgs("/bin/sh", "-c", "date; echo Hello from Kubernetes") - .endContainer() - .withRestartPolicy("OnFailure") - .endSpec() - .endTemplate() - .endSpec() - .endJobTemplate() - .endSpec() - .build(); + .withApiVersion("batch/v1beta1") + .withNewMetadata() + .withName("hello") + .withLabels(Collections.singletonMap("foo", "bar")) + .endMetadata() + .withNewSpec() + .withSchedule("*/1 * * * *") + .withNewJobTemplate() + .withNewSpec() + .withNewTemplate() + .withNewSpec() + .addNewContainer() + .withName("hello") + .withImage("busybox") + .withArgs("/bin/sh", "-c", "date; echo Hello from Kubernetes") + .endContainer() + .withRestartPolicy("OnFailure") + .endSpec() + .endTemplate() + .endSpec() + .endJobTemplate() + .endSpec() + .build(); log("Creating cron job from object"); cronJob1 = client.batch().v1().cronjobs().inNamespace(namespace).create(cronJob1); @@ -79,7 +79,7 @@ public static void main(String[] args) { @Override public void eventReceived(Action action, Pod aPod) { log(aPod.getMetadata().getName(), aPod.getStatus().getPhase()); - if(aPod.getStatus().getPhase().equals("Succeeded")) { + if (aPod.getStatus().getPhase().equals("Succeeded")) { log("Logs -> ", client.pods().inNamespace(namespace).withName(aPod.getMetadata().getName()).getLog()); watchLatch.countDown(); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/DeleteExamples.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/DeleteExamples.java index 52ae6400594..6c62b8a01e6 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/DeleteExamples.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/DeleteExamples.java @@ -29,10 +29,10 @@ public class DeleteExamples { private static final String NAMESPACE = "this-is-a-test"; public static void main(String[] args) { - try(KubernetesClient client = new KubernetesClientBuilder().build()) { + try (KubernetesClient client = new KubernetesClientBuilder().build()) { try { logger.info("Create namespace: {}", client.namespaces().create( - new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).endMetadata().build())); + new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).endMetadata().build())); logger.info("Deleted namespace: {}", client.namespaces().withName(NAMESPACE).delete()); logger.info("Deleted testPod: {}", client.pods().inNamespace(NAMESPACE).withName("test-pod").delete()); logger.info("Deleted pod by label: {}", client.pods().withLabel("this", "works").delete()); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/DeploymentExamples.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/DeploymentExamples.java index e52d6061967..c5a1b4113f3 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/DeploymentExamples.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/DeploymentExamples.java @@ -36,7 +36,8 @@ public class DeploymentExamples { public static void main(String[] args) { try (KubernetesClient client = new KubernetesClientBuilder().build()) { // Create a namespace for all our stuff - Namespace ns = new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).addToLabels("this", "rocks").endMetadata().build(); + Namespace ns = new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).addToLabels("this", "rocks").endMetadata() + .build(); logger.info("Created namespace: {}", client.namespaces().createOrReplace(ns)); ServiceAccount fabric8 = new ServiceAccountBuilder().withNewMetadata().withName("fabric8").endMetadata().build(); @@ -44,30 +45,30 @@ public static void main(String[] args) { client.serviceAccounts().inNamespace(NAMESPACE).createOrReplace(fabric8); try { Deployment deployment = new DeploymentBuilder() - .withNewMetadata() - .withName("nginx") - .endMetadata() - .withNewSpec() - .withReplicas(1) - .withNewTemplate() - .withNewMetadata() - .addToLabels("app", "nginx") - .endMetadata() - .withNewSpec() - .addNewContainer() - .withName("nginx") - .withImage("nginx") - .addNewPort() - .withContainerPort(80) - .endPort() - .endContainer() - .endSpec() - .endTemplate() - .withNewSelector() - .addToMatchLabels("app", "nginx") - .endSelector() - .endSpec() - .build(); + .withNewMetadata() + .withName("nginx") + .endMetadata() + .withNewSpec() + .withReplicas(1) + .withNewTemplate() + .withNewMetadata() + .addToLabels("app", "nginx") + .endMetadata() + .withNewSpec() + .addNewContainer() + .withName("nginx") + .withImage("nginx") + .addNewPort() + .withContainerPort(80) + .endPort() + .endContainer() + .endSpec() + .endTemplate() + .withNewSelector() + .addToMatchLabels("app", "nginx") + .endSelector() + .endSpec() + .build(); deployment = client.apps().deployments().inNamespace(NAMESPACE).create(deployment); logger.info("Created deployment: {}", deployment); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/EndpointsExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/EndpointsExample.java index acc66c8f3dc..1d6cb443549 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/EndpointsExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/EndpointsExample.java @@ -38,24 +38,27 @@ public class EndpointsExample { public static void main(String[] args) { try (KubernetesClient client = new KubernetesClientBuilder().build()) { - Namespace ns = new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).addToLabels("this", "rocks").endMetadata().build(); + Namespace ns = new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).addToLabels("this", "rocks").endMetadata() + .build(); logger.info("Created namespace: {}", client.namespaces().createOrReplace(ns)); try { logger.info("Namespace: {}", ns); - Deployment deployment = client.apps().deployments().inNamespace(NAMESPACE).load(EndpointsExample.class.getResourceAsStream("/endpoints-deployment.yml")).get(); + Deployment deployment = client.apps().deployments().inNamespace(NAMESPACE) + .load(EndpointsExample.class.getResourceAsStream("/endpoints-deployment.yml")).get(); logger.info("Deployment created"); client.apps().deployments().inNamespace(NAMESPACE).create(deployment); - Service service = client.services().inNamespace(NAMESPACE).load(EndpointsExample.class.getResourceAsStream("/endpoints-service.yml")).get(); + Service service = client.services().inNamespace(NAMESPACE) + .load(EndpointsExample.class.getResourceAsStream("/endpoints-service.yml")).get(); logger.info("Service created"); client.services().inNamespace(NAMESPACE).create(service); Endpoints endpoints = new EndpointsBuilder() - .withNewMetadata().withName("external-web").withNamespace(NAMESPACE).endMetadata() - .withSubsets().addNewSubset().addNewAddress().withIp("10.10.50.53").endAddress() - .addNewPort().withPort(80).withName("apache").endPort() - .endSubset() - .build(); + .withNewMetadata().withName("external-web").withNamespace(NAMESPACE).endMetadata() + .withSubsets().addNewSubset().addNewAddress().withIp("10.10.50.53").endAddress() + .addNewPort().withPort(80).withName("apache").endPort() + .endSubset() + .build(); logger.info("Endpoint created"); client.endpoints().inNamespace(NAMESPACE).create(endpoints); logger.info("Endpoint url"); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecLoopExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecLoopExample.java index 4da45589bd8..f48e80e052b 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecLoopExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecLoopExample.java @@ -70,7 +70,7 @@ public void onClose(int code, String reason) { } }).exec("date"); pump = InputStreamPumper.pump(watch.getOutput(), (b, o, l) -> System.out.print(new String(b, o, l)), - executorService); + executorService); executorService.scheduleAtFixedRate(new FutureChecker("Pump " + (i + 1), pump), 0, 2, TimeUnit.SECONDS); latch.await(5, TimeUnit.SECONDS); @@ -94,7 +94,7 @@ private FutureChecker(String name, Future future) { @Override public void run() { - if(!future.isDone()) { + if (!future.isDone()) { System.out.println("Future:[" + name + "] is not done yet"); } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecuteCommandOnPodExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecuteCommandOnPodExample.java index 361947b6ea0..eeadb123067 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecuteCommandOnPodExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecuteCommandOnPodExample.java @@ -48,7 +48,7 @@ public void close() { public String execCommandOnPod(String podName, String namespace, String... cmd) { Pod pod = client.pods().inNamespace(namespace).withName(podName).get(); System.out.printf("Running command: [%s] on pod [%s] in namespace [%s]%n", - Arrays.toString(cmd), pod.getMetadata().getName(), namespace); + Arrays.toString(cmd), pod.getMetadata().getName(), namespace); CompletableFuture data = new CompletableFuture<>(); try (ExecWatch execWatch = execCmd(pod, data, cmd)) { @@ -60,12 +60,12 @@ public String execCommandOnPod(String podName, String namespace, String... cmd) private ExecWatch execCmd(Pod pod, CompletableFuture data, String... command) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); return client.pods() - .inNamespace(pod.getMetadata().getNamespace()) - .withName(pod.getMetadata().getName()) - .writingOutput(baos) - .writingError(baos) - .usingListener(new SimpleListener(data, baos)) - .exec(command); + .inNamespace(pod.getMetadata().getNamespace()) + .withName(pod.getMetadata().getName()) + .writingOutput(baos) + .writingError(baos) + .usingListener(new SimpleListener(data, baos)) + .exec(command); } static class SimpleListener implements ExecListener { diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/GenericKubernetesResourceExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/GenericKubernetesResourceExample.java index 7c57c216b80..8afd83c7e81 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/GenericKubernetesResourceExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/GenericKubernetesResourceExample.java @@ -49,7 +49,7 @@ public static void main(String[] args) throws Exception { String namespace = "default"; CustomResourceDefinition prometheousRuleCrd = client.apiextensions().v1beta1().customResourceDefinitions() - .load(GenericKubernetesResourceExample.class.getResourceAsStream("/prometheous-rule-crd.yml")).get(); + .load(GenericKubernetesResourceExample.class.getResourceAsStream("/prometheous-rule-crd.yml")).get(); client.apiextensions().v1beta1().customResourceDefinitions().createOrReplace(prometheousRuleCrd); logger.info("Successfully created Prometheous custom resource definition"); @@ -57,17 +57,17 @@ public static void main(String[] args) throws Exception { ResourceDefinitionContext crdContext = CustomResourceDefinitionContext.fromCrd(prometheousRuleCrd); client.load(GenericKubernetesResourceExample.class.getResourceAsStream("/prometheous-rule-cr.yml")) - .inNamespace(namespace) - .createOrReplace(); + .inNamespace(namespace) + .createOrReplace(); logger.info("Created Custom Resource successfully too"); // Listing all custom resources in given namespace: - NonNamespaceOperation> resourcesInNamespace = - client.genericKubernetesResources(crdContext).inNamespace(namespace); - GenericKubernetesResourceList list = resourcesInNamespace.list(); + NonNamespaceOperation> resourcesInNamespace = client + .genericKubernetesResources(crdContext).inNamespace(namespace); + GenericKubernetesResourceList list = resourcesInNamespace.list(); List items = list.getItems(); logger.info("Custom Resources :- "); - for(GenericKubernetesResource customResource : items) { + for (GenericKubernetesResource customResource : items) { ObjectMeta metadata = customResource.getMetadata(); final String name = metadata.getName(); logger.info(name); @@ -97,7 +97,7 @@ public void onClose(WatcherException e) { logger.info("Deleting custom resources..."); resourcesInNamespace.withName("prometheus-example-rules").delete(); client.apiextensions().v1beta1().customResourceDefinitions() - .withName(prometheousRuleCrd.getMetadata().getName()).delete(); + .withName(prometheousRuleCrd.getMetadata().getName()).delete(); } catch (KubernetesClientException e) { logger.error("Could not create resource: {}", e.getMessage(), e); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/HorizontalPodAutoscalerV1Example.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/HorizontalPodAutoscalerV1Example.java index 01e05b8348a..6156eb420c4 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/HorizontalPodAutoscalerV1Example.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/HorizontalPodAutoscalerV1Example.java @@ -35,18 +35,18 @@ public static void main(String[] args) { } try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { HorizontalPodAutoscaler horizontalPodAutoscaler = new HorizontalPodAutoscalerBuilder() - .withNewMetadata().withName("the-hpa").withNamespace("default").endMetadata() - .withNewSpec() - .withNewScaleTargetRef() - .withApiVersion("apps/v1") - .withKind("Deployment") - .withName("the-deployment") - .endScaleTargetRef() - .withMinReplicas(1) - .withMaxReplicas(10) - .withTargetCPUUtilizationPercentage(50) - .endSpec() - .build(); + .withNewMetadata().withName("the-hpa").withNamespace("default").endMetadata() + .withNewSpec() + .withNewScaleTargetRef() + .withApiVersion("apps/v1") + .withKind("Deployment") + .withName("the-deployment") + .endScaleTargetRef() + .withMinReplicas(1) + .withMaxReplicas(10) + .withTargetCPUUtilizationPercentage(50) + .endSpec() + .build(); client.autoscaling().v1().horizontalPodAutoscalers().inNamespace("default").createOrReplace(horizontalPodAutoscaler); } catch (KubernetesClientException e) { diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/HorizontalPodAutoscalerV2beta2Example.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/HorizontalPodAutoscalerV2beta2Example.java index c4a38c66ec3..21b80b7a9d4 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/HorizontalPodAutoscalerV2beta2Example.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/HorizontalPodAutoscalerV2beta2Example.java @@ -36,41 +36,41 @@ public static void main(String[] args) { } try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { HorizontalPodAutoscaler horizontalPodAutoscaler = new HorizontalPodAutoscalerBuilder() - .withNewMetadata().withName("the-hpa").withNamespace("default").endMetadata() - .withNewSpec() - .withNewScaleTargetRef() - .withApiVersion("apps/v1") - .withKind("Deployment") - .withName("the-deployment") - .endScaleTargetRef() - .withMinReplicas(1) - .withMaxReplicas(10) - .addToMetrics(new MetricSpecBuilder() - .withType("Resource") - .withNewResource() - .withName("cpu") - .withNewTarget() - .withType("Utilization") - .withAverageUtilization(50) - .endTarget() - .endResource() - .build()) - .withNewBehavior() - .withNewScaleDown() - .addNewPolicy() - .withType("Pods") - .withValue(4) - .withPeriodSeconds(60) - .endPolicy() - .addNewPolicy() - .withType("Percent") - .withValue(10) - .withPeriodSeconds(60) - .endPolicy() - .endScaleDown() - .endBehavior() - .endSpec() - .build(); + .withNewMetadata().withName("the-hpa").withNamespace("default").endMetadata() + .withNewSpec() + .withNewScaleTargetRef() + .withApiVersion("apps/v1") + .withKind("Deployment") + .withName("the-deployment") + .endScaleTargetRef() + .withMinReplicas(1) + .withMaxReplicas(10) + .addToMetrics(new MetricSpecBuilder() + .withType("Resource") + .withNewResource() + .withName("cpu") + .withNewTarget() + .withType("Utilization") + .withAverageUtilization(50) + .endTarget() + .endResource() + .build()) + .withNewBehavior() + .withNewScaleDown() + .addNewPolicy() + .withType("Pods") + .withValue(4) + .withPeriodSeconds(60) + .endPolicy() + .addNewPolicy() + .withType("Percent") + .withValue(10) + .withPeriodSeconds(60) + .endPolicy() + .endScaleDown() + .endBehavior() + .endSpec() + .build(); client.autoscaling().v2beta2().horizontalPodAutoscalers().inNamespace("default").create(horizontalPodAutoscaler); } catch (KubernetesClientException e) { diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/KubernetesVersionExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/KubernetesVersionExample.java index 58c9a0ce887..154e9495606 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/KubernetesVersionExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/KubernetesVersionExample.java @@ -28,7 +28,7 @@ public static void main(String[] args) { if (args.length > 0) { configBuilder.withMasterUrl(args[0]); } - try(KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { + try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { VersionInfo versionInfo = client.getVersion(); logger.info("Version details of this Kubernetes cluster :-"); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ListExamples.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ListExamples.java index 8e214ddcf0b..3d9e9f6e33e 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ListExamples.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ListExamples.java @@ -40,40 +40,35 @@ public static void main(String[] args) { final String namespace = Optional.ofNullable(client.getNamespace()).orElse("default"); System.out.println( - client.namespaces().list() - ); + client.namespaces().list()); System.out.println( - client.namespaces().withLabel("this", "works").list() - ); + client.namespaces().withLabel("this", "works").list()); System.out.println( - client.pods().withLabel("this", "works").list() - ); + client.pods().withLabel("this", "works").list()); System.out.println( - client.pods().inNamespace("test").withLabel("this", "works").list() - ); + client.pods().inNamespace("test").withLabel("this", "works").list()); System.out.println( - client.pods().inNamespace("test").withName("testing").get() - ); + client.pods().inNamespace("test").withName("testing").get()); /* - * The continue option should be set when retrieving more results from the server. - * Since this value is server defined, clients may only use the continue value from - * a previous query result with identical query parameters (except for the value of - * continue) and the server may reject a continue value it does not recognize. + * The continue option should be set when retrieving more results from the server. + * Since this value is server defined, clients may only use the continue value from + * a previous query result with identical query parameters (except for the value of + * continue) and the server may reject a continue value it does not recognize. */ PodList podList = client.pods().inNamespace(namespace).list(new ListOptionsBuilder().withLimit(5L).build()); podList.getItems().forEach(obj -> System.out.println(obj.getMetadata().getName())); podList = client.pods().inNamespace(namespace) - .list(new ListOptionsBuilder().withLimit(5L).withContinue(podList.getMetadata().getContinue()).build()); + .list(new ListOptionsBuilder().withLimit(5L).withContinue(podList.getMetadata().getContinue()).build()); podList.getItems().forEach(obj -> System.out.println(obj.getMetadata().getName())); Integer services = client.services().inNamespace(namespace) - .list(new ListOptionsBuilder().withLimit(1L).build()).getItems().size(); + .list(new ListOptionsBuilder().withLimit(1L).build()).getItems().size(); client.services().inNamespace(namespace).list(new ListOptionsBuilder().withLimit(1L).withContinue(null).build()); System.out.println(services); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ListStorageClassExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ListStorageClassExample.java index fe55753eb7c..2461de7b9b9 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ListStorageClassExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ListStorageClassExample.java @@ -33,7 +33,7 @@ public static void main(String[] args) { } try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { client.storage().storageClasses().list().getItems() - .forEach(sc -> logger.info("Storage class: {}", sc.getMetadata().getName())); + .forEach(sc -> logger.info("Storage class: {}", sc.getMetadata().getName())); } catch (KubernetesClientException e) { logger.error(e.getMessage(), e); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/LoadMultipleDocumentsFromFileExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/LoadMultipleDocumentsFromFileExample.java index 97858d7de69..10dbb8b39d3 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/LoadMultipleDocumentsFromFileExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/LoadMultipleDocumentsFromFileExample.java @@ -38,7 +38,8 @@ public static void main(String[] args) { configBuilder.withMasterUrl(args[0]); } try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { - List list = client.load(LoadMultipleDocumentsFromFileExample.class.getResourceAsStream("/multiple-document-template.yml")).get(); + List list = client + .load(LoadMultipleDocumentsFromFileExample.class.getResourceAsStream("/multiple-document-template.yml")).get(); logger.info("Found in file: {} items.", list.size()); for (HasMetadata meta : list) { logger.info(display(meta)); @@ -46,12 +47,12 @@ public static void main(String[] args) { //noinspection Convert2Lambda list = client.load(LoadMultipleDocumentsFromFileExample.class.getResourceAsStream("/multiple-document-template.yml")) - .accept(new Visitor() { - @Override - public void visit(ObjectMetaBuilder item) { - item.addToLabels("visitorkey", "visitorvalue"); - } - }).get(); + .accept(new Visitor() { + @Override + public void visit(ObjectMetaBuilder item) { + item.addToLabels("visitorkey", "visitorvalue"); + } + }).get(); logger.info("Visited: {} items.", list.size()); for (HasMetadata meta : list) { diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/NetworkPolicyExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/NetworkPolicyExample.java index 2cb9f36f2c5..4d054123674 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/NetworkPolicyExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/NetworkPolicyExample.java @@ -37,32 +37,31 @@ public static void main(String[] args) { } try (KubernetesClient client = new KubernetesClientBuilder().build()) { NetworkPolicy networkPolicy = new NetworkPolicyBuilder() - .withNewMetadata() - .withName("test-network-policy") - .endMetadata() - .withNewSpec() - .withNewPodSelector() - .withMatchLabels(Collections.singletonMap("role","db")) - .endPodSelector() - .endSpec() - .build(); - + .withNewMetadata() + .withName("test-network-policy") + .endMetadata() + .withNewSpec() + .withNewPodSelector() + .withMatchLabels(Collections.singletonMap("role", "db")) + .endPodSelector() + .endSpec() + .build(); // create policy using NetworkPolicyBuilder object networkPolicy = client.network() - .v1() - .networkPolicies() - .inNamespace(namespace) - .createOrReplace(networkPolicy); + .v1() + .networkPolicies() + .inNamespace(namespace) + .createOrReplace(networkPolicy); logger.info("NetworkPolicy {}/{} created via builders", namespace, networkPolicy.getMetadata().getName()); // crate policy using YAML resource networkPolicy = client.network() - .v1() - .networkPolicies() - .inNamespace(namespace) - .load(NetworkPolicyExample.class.getResourceAsStream("/network-policy.yml")) - .createOrReplace(); + .v1() + .networkPolicies() + .inNamespace(namespace) + .load(NetworkPolicyExample.class.getResourceAsStream("/network-policy.yml")) + .createOrReplace(); logger.info("NetworkPolicy {}/{} created via YAML manifest", namespace, networkPolicy.getMetadata().getName()); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PersistentVolumeClaimExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PersistentVolumeClaimExample.java index 33624bade5d..8d5a307b913 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PersistentVolumeClaimExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PersistentVolumeClaimExample.java @@ -49,34 +49,33 @@ public static void main(String[] args) { try { StorageClass storageClass = client.storage().storageClasses() - .load(PersistentVolumeClaimExample.class.getResourceAsStream("/test-storage.yml")).get(); + .load(PersistentVolumeClaimExample.class.getResourceAsStream("/test-storage.yml")).get(); client.storage().storageClasses().create(storageClass); logger.info("Creating PersistentVolume object"); PersistentVolume pv = new PersistentVolumeBuilder() - .withNewMetadata().withName("test-local-pv").endMetadata() - .withNewSpec() - .addToCapacity(Collections.singletonMap("storage", new Quantity("500Gi"))) - .withAccessModes("ReadWriteOnce") - .withPersistentVolumeReclaimPolicy("Retain") - .withStorageClassName(storageClassName) - .withNewLocal() - .withPath("/mnt/disks/vol1") - .endLocal() - .withNewNodeAffinity() - .withNewRequired() - .addNewNodeSelectorTerm() - .withMatchExpressions(Collections.singletonList(new NodeSelectorRequirementBuilder() - .withKey("kubernetes.io/hostname") - .withOperator("In") - .withValues("my-node") - .build() - )) - .endNodeSelectorTerm() - .endRequired() - .endNodeAffinity() - .endSpec() - .build(); + .withNewMetadata().withName("test-local-pv").endMetadata() + .withNewSpec() + .addToCapacity(Collections.singletonMap("storage", new Quantity("500Gi"))) + .withAccessModes("ReadWriteOnce") + .withPersistentVolumeReclaimPolicy("Retain") + .withStorageClassName(storageClassName) + .withNewLocal() + .withPath("/mnt/disks/vol1") + .endLocal() + .withNewNodeAffinity() + .withNewRequired() + .addNewNodeSelectorTerm() + .withMatchExpressions(Collections.singletonList(new NodeSelectorRequirementBuilder() + .withKey("kubernetes.io/hostname") + .withOperator("In") + .withValues("my-node") + .build())) + .endNodeSelectorTerm() + .endRequired() + .endNodeAffinity() + .endSpec() + .build(); client.persistentVolumes().create(pv); @@ -84,21 +83,22 @@ public static void main(String[] args) { logger.info("Creating PersistentVolumeClaim object"); PersistentVolumeClaim persistentVolumeClaim = new PersistentVolumeClaimBuilder() - .withNewMetadata().withName("test-pv-claim").withNamespace(namespace).endMetadata() - .withNewSpec() - .withStorageClassName(storageClassName) - .withAccessModes("ReadWriteOnce") - .withNewResources() - .addToRequests("storage", new Quantity("500Gi")) - .endResources() - .endSpec() - .build(); + .withNewMetadata().withName("test-pv-claim").withNamespace(namespace).endMetadata() + .withNewSpec() + .withStorageClassName(storageClassName) + .withAccessModes("ReadWriteOnce") + .withNewResources() + .addToRequests("storage", new Quantity("500Gi")) + .endResources() + .endSpec() + .build(); client.persistentVolumeClaims().create(persistentVolumeClaim); logger.info("Successfully created PersistentVolumeClaim object"); logger.info("Creating pod"); - Pod pod = client.pods().inNamespace(namespace).load(PersistentVolumeClaimExample.class.getResourceAsStream("/test-pv-pod.yml")).get(); + Pod pod = client.pods().inNamespace(namespace) + .load(PersistentVolumeClaimExample.class.getResourceAsStream("/test-pv-pod.yml")).get(); client.pods().inNamespace(namespace).create(pod); logger.info("Successfully created pod"); } finally { diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PersistentVolumeExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PersistentVolumeExample.java index 7099811a425..601b4e56544 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PersistentVolumeExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PersistentVolumeExample.java @@ -41,29 +41,28 @@ public static void main(String[] args) { try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { logger.info("Creating persistent volume object"); PersistentVolume pv = new PersistentVolumeBuilder() - .withNewMetadata().withName("example-local-pv").endMetadata() - .withNewSpec() - .addToCapacity(Collections.singletonMap("storage", new Quantity("500Gi"))) - .withAccessModes("ReadWriteOnce") - .withPersistentVolumeReclaimPolicy("Retain") - .withStorageClassName("local-storage") - .withNewLocal() - .withPath("/mnt/disks/vol1") - .endLocal() - .withNewNodeAffinity() - .withNewRequired() - .addNewNodeSelectorTerm() - .withMatchExpressions(Collections.singletonList(new NodeSelectorRequirementBuilder() - .withKey("kubernetes.io/hostname") - .withOperator("In") - .withValues("my-node") - .build() - )) - .endNodeSelectorTerm() - .endRequired() - .endNodeAffinity() - .endSpec() - .build(); + .withNewMetadata().withName("example-local-pv").endMetadata() + .withNewSpec() + .addToCapacity(Collections.singletonMap("storage", new Quantity("500Gi"))) + .withAccessModes("ReadWriteOnce") + .withPersistentVolumeReclaimPolicy("Retain") + .withStorageClassName("local-storage") + .withNewLocal() + .withPath("/mnt/disks/vol1") + .endLocal() + .withNewNodeAffinity() + .withNewRequired() + .addNewNodeSelectorTerm() + .withMatchExpressions(Collections.singletonList(new NodeSelectorRequirementBuilder() + .withKey("kubernetes.io/hostname") + .withOperator("In") + .withValues("my-node") + .build())) + .endNodeSelectorTerm() + .endRequired() + .endNodeAffinity() + .endSpec() + .build(); client.persistentVolumes().create(pv); logger.info("Successfully created Persistent Volume object"); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodDisruptionBudgetExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodDisruptionBudgetExample.java index 74c2a66c5cb..ca6f0940ad5 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodDisruptionBudgetExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodDisruptionBudgetExample.java @@ -36,17 +36,17 @@ public static void main(String[] args) { configBuilder.withMasterUrl(args[0]); logger.info("Using master with URL: {}", args[0]); } - try (KubernetesClient client= new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { + try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { final String namespace = "default"; PodDisruptionBudget podDisruptionBudget = new PodDisruptionBudgetBuilder() - .withNewMetadata().withName("zk-pkb").endMetadata() - .withNewSpec() - .withMaxUnavailable(new IntOrString("1%")) - .withNewSelector() - .withMatchLabels(Collections.singletonMap("app", "zookeeper")) - .endSelector() - .endSpec() - .build(); + .withNewMetadata().withName("zk-pkb").endMetadata() + .withNewSpec() + .withMaxUnavailable(new IntOrString("1%")) + .withNewSelector() + .withMatchLabels(Collections.singletonMap("app", "zookeeper")) + .endSelector() + .endSpec() + .build(); logger.info("Current namespace is {}", namespace); client.policy().v1().podDisruptionBudget().inNamespace(namespace).createOrReplace(podDisruptionBudget); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodLogExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodLogExample.java index 3b5f6935217..f66e50ba645 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodLogExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodLogExample.java @@ -43,9 +43,8 @@ public static void main(String[] args) { System.out.println("----------------------------------------------------------------"); try ( - KubernetesClient client = new KubernetesClientBuilder().build(); - LogWatch ignore = client.pods().inNamespace(namespace).withName(podName).tailingLines(10).watchLog(System.out) - ) { + KubernetesClient client = new KubernetesClientBuilder().build(); + LogWatch ignore = client.pods().inNamespace(namespace).withName(podName).tailingLines(10).watchLog(System.out)) { Thread.sleep(5 * 1000L); } catch (Exception e) { logger.error(e.getMessage(), e); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodPriorityExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodPriorityExample.java index 9b25ab5cd97..9b8b1983078 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodPriorityExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodPriorityExample.java @@ -40,21 +40,21 @@ public static void main(String[] args) { } try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { PriorityClass priorityClass = new PriorityClassBuilder() - .withNewMetadata().withName("high-priority").endMetadata() - .withValue(100000) - .withGlobalDefault(false) - .withDescription("This priority class should be used for XYZ service pods only.") - .build(); + .withNewMetadata().withName("high-priority").endMetadata() + .withValue(100000) + .withGlobalDefault(false) + .withDescription("This priority class should be used for XYZ service pods only.") + .build(); client.scheduling().v1beta1().priorityClasses().create(priorityClass); client.pods().inNamespace("default").create(new PodBuilder() - .withNewMetadata().withName("nginx").withLabels(Collections.singletonMap("env", "test")).endMetadata() - .withNewSpec() - .addToContainers(new ContainerBuilder().withName("nginx").withImage("nginx").withImagePullPolicy("IfNotPresent").build()) - .withPriorityClassName("high-priority") - .endSpec() - .build() - ); + .withNewMetadata().withName("nginx").withLabels(Collections.singletonMap("env", "test")).endMetadata() + .withNewSpec() + .addToContainers( + new ContainerBuilder().withName("nginx").withImage("nginx").withImagePullPolicy("IfNotPresent").build()) + .withPriorityClassName("high-priority") + .endSpec() + .build()); } catch (KubernetesClientException e) { logger.error("Could not create resource: {}", e.getMessage(), e); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodSecurityPolicyExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodSecurityPolicyExample.java index 0f2ad779e88..586b08b17fc 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodSecurityPolicyExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PodSecurityPolicyExample.java @@ -43,7 +43,7 @@ public static void main(String[] args) { final PodSecurityPolicy podSecurityPolicy = client.policy().v1beta1().podSecurityPolicies().load(localYamlStream).get(); client.policy().v1beta1().podSecurityPolicies().withName(podSecurityPolicy.getMetadata().getName()).delete(); client.policy().v1beta1().podSecurityPolicies().withName(podSecurityPolicy.getMetadata().getName()) - .waitUntilCondition(Objects::isNull, 5, TimeUnit.SECONDS); + .waitUntilCondition(Objects::isNull, 5, TimeUnit.SECONDS); client.policy().v1beta1().podSecurityPolicies().create(podSecurityPolicy); logger.info("PodSecurityPolicy created with Name : {}", podSecurityPolicy.getMetadata().getName()); } @@ -52,18 +52,18 @@ public static void main(String[] args) { final String podSecurityPolicyName = "example2"; client.policy().v1beta1().podSecurityPolicies().withName(podSecurityPolicyName).delete(); client.policy().v1beta1().podSecurityPolicies().withName(podSecurityPolicyName) - .waitUntilCondition(Objects::isNull, 5, TimeUnit.SECONDS); + .waitUntilCondition(Objects::isNull, 5, TimeUnit.SECONDS); final PodSecurityPolicy programmaticPodSecurityPolicy = new PodSecurityPolicyBuilder().withNewMetadata() - .withName(podSecurityPolicyName) - .endMetadata() - .withNewSpec() - .withPrivileged(false) - .withNewRunAsUser().withRule("RunAsAny").endRunAsUser() - .withNewFsGroup().withRule("RunAsAny").endFsGroup() - .withNewSeLinux().withRule("RunAsAny").endSeLinux() - .withNewSupplementalGroups().withRule("RunAsAny").endSupplementalGroups() - .endSpec() - .build(); + .withName(podSecurityPolicyName) + .endMetadata() + .withNewSpec() + .withPrivileged(false) + .withNewRunAsUser().withRule("RunAsAny").endRunAsUser() + .withNewFsGroup().withRule("RunAsAny").endFsGroup() + .withNewSeLinux().withRule("RunAsAny").endSeLinux() + .withNewSupplementalGroups().withRule("RunAsAny").endSupplementalGroups() + .endSpec() + .build(); client.policy().v1beta1().podSecurityPolicies().create(programmaticPodSecurityPolicy); logger.info("PodSecurityPolicy created with Name: {}", programmaticPodSecurityPolicy.getMetadata().getName()); } catch (KubernetesClientException clientException) { diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PortForwardExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PortForwardExample.java index 1c8913f2465..5a34690e1e7 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PortForwardExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/PortForwardExample.java @@ -21,7 +21,6 @@ import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientBuilder; import io.fabric8.kubernetes.client.LocalPortForward; - import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.ResponseBody; @@ -45,22 +44,23 @@ public static void main(String[] args) { String namespace = "default"; logger.info("Using namespace: {}", namespace); Pod pod = client.pods().inNamespace(namespace) - .load(PortForwardExample.class.getResourceAsStream("/portforward-example-pod.yml")).get(); + .load(PortForwardExample.class.getResourceAsStream("/portforward-example-pod.yml")).get(); final String podName = pod.getMetadata().getName(); client.pods().inNamespace(namespace).create(pod); logger.info("Pod {} created", podName); - int containerPort = pod.getSpec().getContainers().get(0).getPorts().get(0).getContainerPort(); + int containerPort = pod.getSpec().getContainers().get(0).getPorts().get(0).getContainerPort(); client.pods().inNamespace(namespace).withName(podName).waitUntilReady(10, TimeUnit.SECONDS); - InetAddress inetAddress = InetAddress.getByAddress(new byte[]{127,0,0,1}); - LocalPortForward portForward = client.pods().inNamespace("default").withName("testpod").portForward(containerPort, inetAddress, 8080); + InetAddress inetAddress = InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }); + LocalPortForward portForward = client.pods().inNamespace("default").withName("testpod").portForward(containerPort, + inetAddress, 8080); logger.info("Port forwarded for 60 seconds at http://127.0.0.1:{}", portForward.getLocalPort()); logger.info("Checking forwarded port:-"); - final ResponseBody responseBody = new OkHttpClient() - .newCall(new Request.Builder().get().url("http://127.0.0.1:" + portForward.getLocalPort()).build()).execute() - .body(); + final ResponseBody responseBody = new OkHttpClient() + .newCall(new Request.Builder().get().url("http://127.0.0.1:" + portForward.getLocalPort()).build()).execute() + .body(); logger.info("Response: \n{}", responseBody != null ? responseBody.string() : "[Empty Body]"); Thread.sleep(60 * 1000L); logger.info("Closing forwarded port"); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ReplaceExamples.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ReplaceExamples.java index 05e76da90a2..1831d7e6db0 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ReplaceExamples.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ReplaceExamples.java @@ -42,29 +42,27 @@ public static void main(String[] args) { try (KubernetesClient client = new KubernetesClientBuilder().withConfig(configBuilder.build()).build()) { try { final Namespace namespace = client.namespaces().create( - new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).endMetadata().build() - ); + new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).endMetadata().build()); logger.info("Create namespace: {}", NAMESPACE); Pod createdPod = client.pods().inNamespace(namespace.getMetadata().getName()).create(new PodBuilder() - .withNewMetadata() - .withName("test-pod") - .addToLabels("server", "nginx") - .endMetadata() - .withNewSpec() - .addNewContainer().withName("nginx").withImage("nginx") - .addNewPort().withContainerPort(80).endPort() - .endContainer() - .endSpec() - .build()); + .withNewMetadata() + .withName("test-pod") + .addToLabels("server", "nginx") + .endMetadata() + .withNewSpec() + .addNewContainer().withName("nginx").withImage("nginx") + .addNewPort().withContainerPort(80).endPort() + .endContainer() + .endSpec() + .build()); logger.info("Created Pod: {}", createdPod.getMetadata().getName()); logger.info(Serialization.asYaml(createdPod)); Pod updatedPod = client.pods().inNamespace(NAMESPACE).withName("test-pod").edit(p -> new PodBuilder(p) - .editMetadata() - .addToLabels("server2", "nginx2") - .and().build() - ); + .editMetadata() + .addToLabels("server2", "nginx2") + .and().build()); logger.info("Replaced Pod: {}", updatedPod.getMetadata().getName()); logger.info(Serialization.asYaml(updatedPod)); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ServiceExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ServiceExample.java index 7f6f3ac2711..779c525630f 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ServiceExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ServiceExample.java @@ -38,25 +38,26 @@ public static void main(String[] args) { namespace = args[0]; } Service service = new ServiceBuilder() - .withNewMetadata() - .withName("my-service") - .endMetadata() - .withNewSpec() - .withSelector(Collections.singletonMap("app", "MyApp")) - .addNewPort() - .withName("test-port") - .withProtocol("TCP") - .withPort(80) - .withTargetPort(new IntOrString(9376)) - .endPort() - .withType("LoadBalancer") - .endSpec() - .build(); + .withNewMetadata() + .withName("my-service") + .endMetadata() + .withNewSpec() + .withSelector(Collections.singletonMap("app", "MyApp")) + .addNewPort() + .withName("test-port") + .withProtocol("TCP") + .withPort(80) + .withTargetPort(new IntOrString(9376)) + .endPort() + .withType("LoadBalancer") + .endSpec() + .build(); service = client.services().inNamespace(namespace).create(service); logger.info("Created service with name {}", service.getMetadata().getName()); - String serviceURL = client.services().inNamespace(namespace).withName(service.getMetadata().getName()).getURL("test-port"); + String serviceURL = client.services().inNamespace(namespace).withName(service.getMetadata().getName()) + .getURL("test-port"); logger.info("Service URL {}", serviceURL); } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/SharedInformerExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/SharedInformerExample.java index f6b2dd3d2e7..4ebcaa8f91e 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/SharedInformerExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/SharedInformerExample.java @@ -41,47 +41,46 @@ public static void main(String[] args) throws InterruptedException { logger.info("Informer factory initialized."); podInformer.addEventHandler( - new ResourceEventHandler() { - @Override - public void onAdd(Pod pod) { - logger.info("{} pod added", pod.getMetadata().getName()); - } + new ResourceEventHandler() { + @Override + public void onAdd(Pod pod) { + logger.info("{} pod added", pod.getMetadata().getName()); + } - @Override - public void onUpdate(Pod oldPod, Pod newPod) { - logger.info("{} pod updated", oldPod.getMetadata().getName()); - } + @Override + public void onUpdate(Pod oldPod, Pod newPod) { + logger.info("{} pod updated", oldPod.getMetadata().getName()); + } - @Override - public void onDelete(Pod pod, boolean deletedFinalStateUnknown) { - logger.info("{} pod deleted", pod.getMetadata().getName()); - } - } - ); + @Override + public void onDelete(Pod pod, boolean deletedFinalStateUnknown) { + logger.info("{} pod deleted", pod.getMetadata().getName()); + } + }); logger.info("Starting all registered informers"); sharedInformerFactory.startAllRegisteredInformers(); Pod testPod = new PodBuilder() - .withNewMetadata().withName(POD_NAME).withLabels(Collections.singletonMap("app", POD_NAME)).endMetadata() - .withNewSpec() - .addNewContainer() - .withName("myapp-container") - .withImage("busybox:1.28") - .withCommand("sh", "-c", "echo The app is running!; sleep 10") - .endContainer() - .addNewInitContainer() - .withName("init-myservice") - .withImage("busybox:1.28") - .withCommand("sh", "-c", "echo inititalizing...; sleep 5") - .endInitContainer() - .endSpec() - .build(); + .withNewMetadata().withName(POD_NAME).withLabels(Collections.singletonMap("app", POD_NAME)).endMetadata() + .withNewSpec() + .addNewContainer() + .withName("myapp-container") + .withImage("busybox:1.28") + .withCommand("sh", "-c", "echo The app is running!; sleep 10") + .endContainer() + .addNewInitContainer() + .withName("init-myservice") + .withImage("busybox:1.28") + .withCommand("sh", "-c", "echo inititalizing...; sleep 5") + .endInitContainer() + .endSpec() + .build(); client.pods().inNamespace("default").create(testPod); logger.info("Pod created"); Thread.sleep(3000L); - Lister podLister = new Lister<> (podInformer.getIndexer(), "default"); + Lister podLister = new Lister<>(podInformer.getIndexer(), "default"); Pod myPod = podLister.get(POD_NAME); logger.info("PodLister has {}", podLister.list().size()); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/WaitUntilReadyExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/WaitUntilReadyExample.java index bae69d07f55..1069c8bb5f2 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/WaitUntilReadyExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/WaitUntilReadyExample.java @@ -36,22 +36,21 @@ public static void main(String[] args) throws InterruptedException { try (KubernetesClient client = new KubernetesClientBuilder().build()) { final String namespace = Optional.ofNullable(client.getNamespace()).orElse("default"); final Pod pod = client.pods().inNamespace(namespace).create( - new PodBuilder() - .withNewMetadata().withName("myapp-pod").withLabels(Collections.singletonMap("app", "myapp-pod")).endMetadata() - .withNewSpec() - .addNewContainer() - .withName("myapp-container") - .withImage("busybox:1.28") - .withCommand("sh", "-c", "echo 'The app is running!'; sleep 10") - .endContainer() - .addNewInitContainer() - .withName("init-myservice") - .withImage("busybox:1.28") - .withCommand("sh", "-c", "echo 'inititalizing...'; sleep 5") - .endInitContainer() - .endSpec() - .build() - ); + new PodBuilder() + .withNewMetadata().withName("myapp-pod").withLabels(Collections.singletonMap("app", "myapp-pod")).endMetadata() + .withNewSpec() + .addNewContainer() + .withName("myapp-container") + .withImage("busybox:1.28") + .withCommand("sh", "-c", "echo 'The app is running!'; sleep 10") + .endContainer() + .addNewInitContainer() + .withName("init-myservice") + .withImage("busybox:1.28") + .withCommand("sh", "-c", "echo 'inititalizing...'; sleep 5") + .endInitContainer() + .endSpec() + .build()); logger.info("Pod created, waiting for it to get ready..."); client.resource(pod).inNamespace(namespace).waitUntilReady(10, TimeUnit.SECONDS); logger.info("Pod is ready now"); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/WatchExample.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/WatchExample.java index cb2608d1f6f..26e79dfc571 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/WatchExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/WatchExample.java @@ -37,17 +37,15 @@ public class WatchExample { @SuppressWarnings("java:S1604") public static void main(String[] args) { try ( - KubernetesClient client = new KubernetesClientBuilder().build(); - Watch ignored = newConfigMapWatch(client) - ) { + KubernetesClient client = new KubernetesClientBuilder().build(); + Watch ignored = newConfigMapWatch(client)) { final String namespace = Optional.ofNullable(client.getNamespace()).orElse("default"); final String name = "watch-config-map-test-" + UUID.randomUUID(); final ConfigMap cm = client.configMaps().inNamespace(namespace).createOrReplace(new ConfigMapBuilder() - .withNewMetadata().withName(name).endMetadata() - .build() - ); + .withNewMetadata().withName(name).endMetadata() + .build()); client.configMaps().inNamespace(namespace).withName(name) - .patch(new ConfigMapBuilder().withNewMetadata().withName(name).endMetadata().addToData("key", "value").build()); + .patch(new ConfigMapBuilder().withNewMetadata().withName(name).endMetadata().addToData("key", "value").build()); //noinspection Convert2Lambda client.configMaps().inNamespace(namespace).withName(name).edit(new Visitor() { @Override diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/crds/DummySpec.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/crds/DummySpec.java index a4176c5dc6c..f9f70c90fe1 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/crds/DummySpec.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/crds/DummySpec.java @@ -21,9 +21,7 @@ /** */ -@JsonDeserialize( - using = JsonDeserializer.None.class -) +@JsonDeserialize(using = JsonDeserializer.None.class) public class DummySpec implements KubernetesResource { private String foo; private String bar; diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CanIEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CanIEquivalent.java index ee287e1bd16..44a10a2f15a 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CanIEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CanIEquivalent.java @@ -31,15 +31,15 @@ public class CanIEquivalent { public static void main(String[] args) { try (KubernetesClient client = new KubernetesClientBuilder().build()) { SelfSubjectAccessReview ssar = new SelfSubjectAccessReviewBuilder() - .withNewSpec() - .withNewResourceAttributes() - .withGroup("apps") - .withResource("deployments") - .withVerb("create") - .withNamespace("dev") - .endResourceAttributes() - .endSpec() - .build(); + .withNewSpec() + .withNewResourceAttributes() + .withGroup("apps") + .withResource("deployments") + .withVerb("create") + .withNamespace("dev") + .endResourceAttributes() + .endSpec() + .build(); ssar = client.authorization().v1().selfSubjectAccessReview().create(ssar); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestApproveYamlEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestApproveYamlEquivalent.java index 8537df6702c..0ad36ece9df 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestApproveYamlEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestApproveYamlEquivalent.java @@ -28,13 +28,13 @@ public class CertificateSigningRequestApproveYamlEquivalent { public static void main(String[] args) { - try( KubernetesClient client = new KubernetesClientBuilder().build()) { + try (KubernetesClient client = new KubernetesClientBuilder().build()) { CertificateSigningRequestCondition csrCondition = new CertificateSigningRequestConditionBuilder() - .withType("Approved") - .withStatus("True") - .withReason("ApprovedViaRESTApi") - .withMessage("Approved by REST API /approval endpoint.") - .build(); + .withType("Approved") + .withStatus("True") + .withReason("ApprovedViaRESTApi") + .withMessage("Approved by REST API /approval endpoint.") + .build(); client.certificates().v1().certificateSigningRequests().withName("my-cert").approve(csrCondition); } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestCreateYamlEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestCreateYamlEquivalent.java index 125fe7529e9..820d51dd8a6 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestCreateYamlEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestCreateYamlEquivalent.java @@ -28,7 +28,8 @@ public class CertificateSigningRequestCreateYamlEquivalent { public static void main(String[] args) { try (KubernetesClient client = new KubernetesClientBuilder().build()) { - CertificateSigningRequest csr = client.certificates().v1().certificateSigningRequests().load(CertificateSigningRequestCreateYamlEquivalent.class.getResourceAsStream("/test-csr-v1.yml")).get(); + CertificateSigningRequest csr = client.certificates().v1().certificateSigningRequests() + .load(CertificateSigningRequestCreateYamlEquivalent.class.getResourceAsStream("/test-csr-v1.yml")).get(); client.certificates().v1().certificateSigningRequests().create(csr); } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestDenyYamlEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestDenyYamlEquivalent.java index 40679e8194b..e608486d6ac 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestDenyYamlEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CertificateSigningRequestDenyYamlEquivalent.java @@ -25,15 +25,15 @@ * a csr with specified name exists in the cluster. */ public class CertificateSigningRequestDenyYamlEquivalent { - public static void main(String[] args) { - try(KubernetesClient client = new KubernetesClientBuilder().build()) { - CertificateSigningRequestCondition csrCondition = new CertificateSigningRequestConditionBuilder() - .withType("Denied") - .withStatus("True") - .withReason("DeniedViaRESTApi") - .withMessage("Denied by REST API /approval endpoint.") - .build(); - client.certificates().v1().certificateSigningRequests().withName("my-cert").deny(csrCondition); - } + public static void main(String[] args) { + try (KubernetesClient client = new KubernetesClientBuilder().build()) { + CertificateSigningRequestCondition csrCondition = new CertificateSigningRequestConditionBuilder() + .withType("Denied") + .withStatus("True") + .withReason("DeniedViaRESTApi") + .withMessage("Denied by REST API /approval endpoint.") + .build(); + client.certificates().v1().certificateSigningRequests().withName("my-cert").deny(csrCondition); } + } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigGetContextsEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigGetContextsEquivalent.java index 6f297956855..5fb0f663960 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigGetContextsEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigGetContextsEquivalent.java @@ -31,9 +31,9 @@ public class ConfigGetContextsEquivalent { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.getConfiguration().getContexts() - .stream() - .map(NamedContext::getName) - .forEach(logger::info); + .stream() + .map(NamedContext::getName) + .forEach(logger::info); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigListUsers.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigListUsers.java index cb7c3369ab2..bc5f8acef47 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigListUsers.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigListUsers.java @@ -41,8 +41,8 @@ public static void main(String[] args) throws FileNotFoundException { // Print users kubeConfigObj.getUsers().stream() - .map(NamedAuthInfo::getName) - .forEach(logger::info); + .map(NamedAuthInfo::getName) + .forEach(logger::info); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigUseContext.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigUseContext.java index b25f09ff975..ba139c42bd3 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigUseContext.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigUseContext.java @@ -26,20 +26,21 @@ /** * Java equivalent of `kubectl config use-context my-cluster-name`. You can specify a different * context before creating the client(which may be different from current context in your KubeConfig). - * Changing context after creation of client is not supported right now: https://github.com/fabric8io/kubernetes-client/issues/1512 + * Changing context after creation of client is not supported right now: + * https://github.com/fabric8io/kubernetes-client/issues/1512 */ public class ConfigUseContext { private static final Logger logger = LoggerFactory.getLogger(ConfigUseContext.class); public static void main(String[] args) { // Pass the context you want to use in Config.autoConfigure(..) - Config config = Config.autoConfigure( "minikube"); + Config config = Config.autoConfigure("minikube"); // Use modified Config for your operations with KubernetesClient try (final KubernetesClient k8s = new KubernetesClientBuilder().withConfig(config).build()) { k8s.pods().inNamespace("default").list().getItems().stream() - .map(Pod::getMetadata) - .map(ObjectMeta::getName) - .forEach(logger::info); + .map(Pod::getMetadata) + .map(ObjectMeta::getName) + .forEach(logger::info); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigViewEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigViewEquivalent.java index 7aeccbda820..62c40d16d8e 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigViewEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/ConfigViewEquivalent.java @@ -34,7 +34,7 @@ public static void main(String[] args) throws IOException { if (kubeConfigFileName != null) { File kubeConfigFile = new File(kubeConfigFileName); Files.readAllLines(kubeConfigFile.toPath()) - .forEach(logger::warn); + .forEach(logger::warn); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CreateOrReplaceResourceList.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CreateOrReplaceResourceList.java index 138001210b8..8de52fa0003 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CreateOrReplaceResourceList.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CreateOrReplaceResourceList.java @@ -26,8 +26,8 @@ public class CreateOrReplaceResourceList { public static void main(String[] args) { try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.load(CreateOrReplaceResourceList.class.getResourceAsStream("/test-resource-list.yaml")) - .inNamespace("default") - .createOrReplace(); + .inNamespace("default") + .createOrReplace(); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CustomResourceCreateDemoTypeless.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CustomResourceCreateDemoTypeless.java index 40ebae1d152..ec7f4e4aa25 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CustomResourceCreateDemoTypeless.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/CustomResourceCreateDemoTypeless.java @@ -32,18 +32,17 @@ public class CustomResourceCreateDemoTypeless { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { // Create Custom Resource Context - ResourceDefinitionContext context = new ResourceDefinitionContext - .Builder() - .withGroup("demo.fabric8.io") - .withKind("Dummy") - .withPlural("dummies") - .withNamespaced(true) - .withVersion("v1") - .build(); + ResourceDefinitionContext context = new ResourceDefinitionContext.Builder() + .withGroup("demo.fabric8.io") + .withKind("Dummy") + .withPlural("dummies") + .withNamespaced(true) + .withVersion("v1") + .build(); // Load from Yaml Resource dummyObject = k8s.genericKubernetesResources(context) - .load(CustomResourceCreateDemoTypeless.class.getResourceAsStream("/test-customresource.yaml")); + .load(CustomResourceCreateDemoTypeless.class.getResourceAsStream("/test-customresource.yaml")); // Create Custom Resource dummyObject.create(); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/DownloadFileFromMultiContainerPod.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/DownloadFileFromMultiContainerPod.java index dc0ce807440..c1ebde316a8 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/DownloadFileFromMultiContainerPod.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/DownloadFileFromMultiContainerPod.java @@ -32,11 +32,11 @@ public static void main(String[] args) { Path downloadToPath = new File("/tmp/docker-entrypoint.sh").toPath(); // Using Kubernetes Client to copy file from pod client.pods() - .inNamespace("default") // <- Namespace of pod - .withName("multi-container-pod") // <- Name of pod - .inContainer("c1") // <- Container from which file has to be downloaded - .file("/docker-entrypoint.sh") // <- Path of file inside pod - .copy(downloadToPath); // <- Local path where to copy downloaded file + .inNamespace("default") // <- Namespace of pod + .withName("multi-container-pod") // <- Name of pod + .inContainer("c1") // <- Container from which file has to be downloaded + .file("/docker-entrypoint.sh") // <- Path of file inside pod + .copy(downloadToPath); // <- Local path where to copy downloaded file } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/DownloadFileFromPod.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/DownloadFileFromPod.java index bbd939b474d..2319db15e6c 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/DownloadFileFromPod.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/DownloadFileFromPod.java @@ -32,10 +32,10 @@ public static void main(String[] args) { Path downloadToPath = new File("/home/rohaan/Downloads/test-1.0.0-runner.jar").toPath(); // Using Kubernetes Client to copy file from pod client.pods() - .inNamespace("default") // <- Namespace of pod - .withName("my-pod") // <- Name of pod - .file("/tmp/test-1.0.0-runner.jar") // <- Path of file inside pod - .copy(downloadToPath); // <- Local path where to copy downloaded file + .inNamespace("default") // <- Namespace of pod + .withName("my-pod") // <- Name of pod + .file("/tmp/test-1.0.0-runner.jar") // <- Path of file inside pod + .copy(downloadToPath); // <- Local path where to copy downloaded file } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/EventsGetEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/EventsGetEquivalent.java index 6096cfa4ba0..072a38065ce 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/EventsGetEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/EventsGetEquivalent.java @@ -22,8 +22,8 @@ import org.slf4j.LoggerFactory; /** - * This example is Java equivalent to `kubectl get events`. It gets - * events related to specified namespace in a Kubernetes Cluster. + * This example is Java equivalent to `kubectl get events`. It gets + * events related to specified namespace in a Kubernetes Cluster. */ public class EventsGetEquivalent { private static final Logger logger = LoggerFactory.getLogger(EventsGetEquivalent.class); @@ -31,8 +31,8 @@ public class EventsGetEquivalent { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.v1().events().inNamespace("default").list().getItems().stream() - .map(Event::getMessage) - .forEach(logger::info); + .map(Event::getMessage) + .forEach(logger::info); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateCustomResourceDefinition.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateCustomResourceDefinition.java index fbc2e2c4223..2d57e08f325 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateCustomResourceDefinition.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateCustomResourceDefinition.java @@ -28,9 +28,9 @@ public class LoadAndCreateCustomResourceDefinition { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { CustomResourceDefinition crd = k8s.apiextensions().v1() - .customResourceDefinitions() - .load(LoadAndCreateCustomResourceDefinition.class.getResourceAsStream("/test-crd.yaml")) - .get(); + .customResourceDefinitions() + .load(LoadAndCreateCustomResourceDefinition.class.getResourceAsStream("/test-crd.yaml")) + .get(); k8s.apiextensions().v1().customResourceDefinitions().create(crd); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateDeployment.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateDeployment.java index 50f9079565a..48137a521b1 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateDeployment.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateDeployment.java @@ -28,8 +28,8 @@ public static void main(String[] args) { try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { // Load Deployment YAML Manifest into Java object Deployment deploy1 = k8s.apps().deployments() - .load(LoadAndCreateDeployment.class.getResourceAsStream("/test-deploy.yaml")) - .get(); + .load(LoadAndCreateDeployment.class.getResourceAsStream("/test-deploy.yaml")) + .get(); // Apply it to Kubernetes Cluster k8s.apps().deployments().inNamespace("default").create(deploy1); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateService.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateService.java index e1646ea86cb..f9296383221 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateService.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/LoadAndCreateService.java @@ -24,14 +24,14 @@ * Service YAML manifest and then applies it to the Kubernetes Cluster. */ public class LoadAndCreateService { - public static void main(String[] args) { - try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { - // Load Service YAML Manifest into Java object - Service svc = k8s.services() - .load(LoadAndCreateService.class.getResourceAsStream("/test-svc.yaml")) - .get(); - // Apply it to Kubernetes Cluster - k8s.services().inNamespace("default").create(svc); - } + public static void main(String[] args) { + try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { + // Load Service YAML Manifest into Java object + Service svc = k8s.services() + .load(LoadAndCreateService.class.getResourceAsStream("/test-svc.yaml")) + .get(); + // Apply it to Kubernetes Cluster + k8s.services().inNamespace("default").create(svc); } + } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/NamespaceListEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/NamespaceListEquivalent.java index 2a02a8324f3..17edb8d67d7 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/NamespaceListEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/NamespaceListEquivalent.java @@ -33,12 +33,12 @@ public static void main(String[] args) { // List all namespaces client.namespaces() - .list() - .getItems() - .stream() - .map(Namespace::getMetadata) - .map(ObjectMeta::getName) - .forEach(logger::info); + .list() + .getItems() + .stream() + .map(Namespace::getMetadata) + .map(ObjectMeta::getName) + .forEach(logger::info); } catch (KubernetesClientException aException) { logger.error("Problem encountered in Kubernetes Client"); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodAddAnnotation.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodAddAnnotation.java index 9687dee6b8e..50c597b3305 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodAddAnnotation.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodAddAnnotation.java @@ -26,9 +26,9 @@ public class PodAddAnnotation { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.pods().inNamespace("default").withName("my-pod").edit(p -> new PodBuilder(p).editMetadata() - .addToAnnotations("icon-url", "http://goo.gl/XXBTWq") - .endMetadata() - .build()); + .addToAnnotations("icon-url", "http://goo.gl/XXBTWq") + .endMetadata() + .build()); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodAddLabel.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodAddLabel.java index a3181647ce1..01da14e4822 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodAddLabel.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodAddLabel.java @@ -26,9 +26,9 @@ public class PodAddLabel { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.pods().inNamespace("default").withName("my-pod").edit(p -> new PodBuilder(p).editMetadata() - .addToLabels("new-label", "awesome") - .endMetadata() - .build()); + .addToLabels("new-label", "awesome") + .endMetadata() + .build()); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodDelete.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodDelete.java index e39186a990e..abb8e25bf49 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodDelete.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodDelete.java @@ -23,9 +23,9 @@ * a Pod with specified name exists in the cluster. */ public class PodDelete { - public static void main(String[] args) { - try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { - k8s.pods().inNamespace("default").withName("my-pod").delete(); - } + public static void main(String[] args) { + try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { + k8s.pods().inNamespace("default").withName("my-pod").delete(); } + } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodDeleteViaYaml.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodDeleteViaYaml.java index a81eb067efe..9da54da4324 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodDeleteViaYaml.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodDeleteViaYaml.java @@ -19,9 +19,9 @@ import io.fabric8.kubernetes.client.KubernetesClientBuilder; /** - * This sample code is Java equivalent to `kubectl delete -f test-pod.yml`. It loads - * YAML manifest and deletes all objects in the manifest if they're present in - * the cluster + * This sample code is Java equivalent to `kubectl delete -f test-pod.yml`. It loads + * YAML manifest and deletes all objects in the manifest if they're present in + * the cluster */ public class PodDeleteViaYaml { public static void main(String[] args) { @@ -32,8 +32,8 @@ public static void main(String[] args) { * here. */ k8s.load(PodDeleteViaYaml.class.getResourceAsStream("/test-pod.yaml")) - .inNamespace("default") - .delete(); + .inNamespace("default") + .delete(); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodExecEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodExecEquivalent.java index c6632e39182..e1f72026362 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodExecEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodExecEquivalent.java @@ -40,10 +40,10 @@ public static void main(String[] args) { ByteArrayOutputStream error = new ByteArrayOutputStream(); ExecWatch execWatch = k8s.pods().inNamespace("default").withName("my-pod") - .writingOutput(out) - .writingError(error) - .usingListener(new MyPodExecListener()) - .exec("ls", "/"); + .writingOutput(out) + .writingError(error) + .usingListener(new MyPodExecListener()) + .exec("ls", "/"); boolean latchTerminationStatus = execLatch.await(5, TimeUnit.SECONDS); if (!latchTerminationStatus) { diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListEquivalent.java index 6c3d935f8b5..0118ee253b0 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListEquivalent.java @@ -27,17 +27,17 @@ * all the pods in specified namespace("default" in this case). */ public class PodListEquivalent { - private static final Logger logger = LoggerFactory.getLogger(PodListEquivalent.class); + private static final Logger logger = LoggerFactory.getLogger(PodListEquivalent.class); - public static void main(String[] args) { - try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { - // Print names of all pods in specified namespace - k8s.pods().inNamespace("default").list() - .getItems() - .stream() - .map(Pod::getMetadata) - .map(ObjectMeta::getName) - .forEach(logger::info); - } + public static void main(String[] args) { + try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { + // Print names of all pods in specified namespace + k8s.pods().inNamespace("default").list() + .getItems() + .stream() + .map(Pod::getMetadata) + .map(ObjectMeta::getName) + .forEach(logger::info); } + } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListFilterByLabel.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListFilterByLabel.java index 5438fa23d18..567bc0f8be2 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListFilterByLabel.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListFilterByLabel.java @@ -31,13 +31,13 @@ public class PodListFilterByLabel { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.pods().inNamespace("default") - .withLabel("version", "v1") - .list() - .getItems() - .stream() - .map(Pod::getMetadata) - .map(ObjectMeta::getName) - .forEach(logger::info); + .withLabel("version", "v1") + .list() + .getItems() + .stream() + .map(Pod::getMetadata) + .map(ObjectMeta::getName) + .forEach(logger::info); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListFilterFieldSelector.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListFilterFieldSelector.java index d3bcd8ba1aa..2d7d0225371 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListFilterFieldSelector.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListFilterFieldSelector.java @@ -32,9 +32,9 @@ public class PodListFilterFieldSelector { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.pods().inNamespace("default").withField("status.phase", "Running").list().getItems() - .stream() - .map(Pod::getMetadata).map(ObjectMeta::getName) - .forEach(logger::info); + .stream() + .map(Pod::getMetadata).map(ObjectMeta::getName) + .forEach(logger::info); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListGlobalEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListGlobalEquivalent.java index 4ce391a18ee..59a61b64256 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListGlobalEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodListGlobalEquivalent.java @@ -32,10 +32,10 @@ public class PodListGlobalEquivalent { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.pods().inAnyNamespace().list().getItems() - .stream() - .map(Pod::getMetadata) - .map(ObjectMeta::getName) - .forEach(logger::info); + .stream() + .map(Pod::getMetadata) + .map(ObjectMeta::getName) + .forEach(logger::info); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodLogsFollowEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodLogsFollowEquivalent.java index 53bc34b8e25..29874084c2f 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodLogsFollowEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodLogsFollowEquivalent.java @@ -19,7 +19,7 @@ import io.fabric8.kubernetes.client.KubernetesClientBuilder; /** - * Java equivalent to `kubectl logs pod/my-pod -f` + * Java equivalent to `kubectl logs pod/my-pod -f` */ public class PodLogsFollowEquivalent { public static void main(String[] args) { diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodLogsMultiContainerEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodLogsMultiContainerEquivalent.java index 4aa75df49e1..cbeb4c4783a 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodLogsMultiContainerEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodLogsMultiContainerEquivalent.java @@ -26,8 +26,8 @@ public class PodLogsMultiContainerEquivalent { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { logger.info(k8s.pods().inNamespace("default").withName("multi-container-pod") - .inContainer("c1") - .getLog()); + .inContainer("c1") + .getLog()); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodRunEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodRunEquivalent.java index d7472b17fed..d6f49b9b158 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodRunEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodRunEquivalent.java @@ -26,9 +26,9 @@ public class PodRunEquivalent { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.run().inNamespace("default") - .withImage("nginx:mainline-alpine") - .withName("my-pod") - .done(); + .withImage("nginx:mainline-alpine") + .withName("my-pod") + .done(); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodShowLabels.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodShowLabels.java index 2517f32fc77..b402a7635db 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodShowLabels.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodShowLabels.java @@ -33,12 +33,12 @@ public class PodShowLabels { public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.pods().inNamespace("default").list().getItems() - .stream() - .map(Pod::getMetadata) - .map(ObjectMeta::getLabels) - .filter(Objects::nonNull) - .map(Objects::toString) - .forEach(logger::info); + .stream() + .map(Pod::getMetadata) + .map(ObjectMeta::getLabels) + .filter(Objects::nonNull) + .map(Objects::toString) + .forEach(logger::info); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodSortByCreationTimestamp.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodSortByCreationTimestamp.java index 399c4e0e444..ea0f05b2c6a 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodSortByCreationTimestamp.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodSortByCreationTimestamp.java @@ -40,13 +40,13 @@ public static void main(String[] args) { podList.sort((o1, o2) -> { long o1Timestamp = Instant.parse(o1.getMetadata().getCreationTimestamp()).getEpochSecond(); long o2Timestamp = Instant.parse(o2.getMetadata().getCreationTimestamp()).getEpochSecond(); - return (int)(o2Timestamp - o1Timestamp); + return (int) (o2Timestamp - o1Timestamp); }); // Check if list is sorted for (Pod pod : podList) { logger.info("{} : {} minutes old", pod.getMetadata().getName(), - Duration.between(Instant.now(), Instant.parse(pod.getMetadata().getCreationTimestamp())).toMinutes()); + Duration.between(Instant.now(), Instant.parse(pod.getMetadata().getCreationTimestamp())).toMinutes()); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodWatchEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodWatchEquivalent.java index 59dbdb0cae8..b8717eae4b6 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodWatchEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PodWatchEquivalent.java @@ -30,45 +30,45 @@ * all the pods in specified namespace("default" in this case). */ public class PodWatchEquivalent { - private static final Logger logger = LoggerFactory.getLogger(PodWatchEquivalent.class.getSimpleName()); + private static final Logger logger = LoggerFactory.getLogger(PodWatchEquivalent.class.getSimpleName()); - public static void main(String[] args) { - String namespace = "default"; + public static void main(String[] args) { + String namespace = "default"; - // Latch for Watch termination - final CountDownLatch isWatchClosed = new CountDownLatch(1); - try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { - k8s.pods().inNamespace(namespace).watch(new Watcher() { - @Override - public void eventReceived(Action action, Pod pod) { - logger.info("{} {}", action.name(), pod.getMetadata().getName()); - switch (action) { - case ADDED: - logger.info("{} got added", pod.getMetadata().getName()); - break; - case DELETED: - logger.info("{} got deleted", pod.getMetadata().getName()); - break; - case MODIFIED: - logger.info("{} got modified", pod.getMetadata().getName()); - break; - default: - logger.error("Unrecognized event: {}", action.name()); - } - } - - @Override - public void onClose(WatcherException e) { - logger.info( "Closed"); - isWatchClosed.countDown(); - } - }); + // Latch for Watch termination + final CountDownLatch isWatchClosed = new CountDownLatch(1); + try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { + k8s.pods().inNamespace(namespace).watch(new Watcher() { + @Override + public void eventReceived(Action action, Pod pod) { + logger.info("{} {}", action.name(), pod.getMetadata().getName()); + switch (action) { + case ADDED: + logger.info("{} got added", pod.getMetadata().getName()); + break; + case DELETED: + logger.info("{} got deleted", pod.getMetadata().getName()); + break; + case MODIFIED: + logger.info("{} got modified", pod.getMetadata().getName()); + break; + default: + logger.error("Unrecognized event: {}", action.name()); + } + } - // Wait till watch gets closed - isWatchClosed.await(); - } catch (InterruptedException interruptedException) { - logger.warn("Interrupted while waiting for the watch to close: {}", interruptedException.getMessage()); - Thread.currentThread().interrupt(); + @Override + public void onClose(WatcherException e) { + logger.info("Closed"); + isWatchClosed.countDown(); } + }); + + // Wait till watch gets closed + isWatchClosed.await(); + } catch (InterruptedException interruptedException) { + logger.warn("Interrupted while waiting for the watch to close: {}", interruptedException.getMessage()); + Thread.currentThread().interrupt(); } + } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PortForwardEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PortForwardEquivalent.java index 4a8c88300d5..f27b37815bd 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PortForwardEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/PortForwardEquivalent.java @@ -33,7 +33,7 @@ public static void main(String[] args) { try (final KubernetesClient k8s = new KubernetesClientBuilder().build()) { CountDownLatch countDownLatch = new CountDownLatch(1); k8s.pods().inNamespace("default").withName("my-pod") - .portForward(80, 8080); // (container port , localhost port) + .portForward(80, 8080); // (container port , localhost port) logger.info("Port forward open for 10 seconds"); boolean latchTerminationStatus = countDownLatch.await(10, TimeUnit.SECONDS); diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutPauseEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutPauseEquivalent.java index 81b61842b8c..4d03788a7c9 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutPauseEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutPauseEquivalent.java @@ -25,8 +25,8 @@ public class RolloutPauseEquivalent { public static void main(String[] args) { try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.apps().deployments().inNamespace("default").withName("nginx-deployment") - .rolling() - .pause(); + .rolling() + .pause(); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutRestartEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutRestartEquivalent.java index b0765a4e558..7cc080e5228 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutRestartEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutRestartEquivalent.java @@ -25,8 +25,8 @@ public class RolloutRestartEquivalent { public static void main(String[] args) { try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.apps().deployments().inNamespace("default").withName("nginx-deployment") - .rolling() - .restart(); + .rolling() + .restart(); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutResumeEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutResumeEquivalent.java index cf5eaaae093..0bd9303f815 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutResumeEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutResumeEquivalent.java @@ -25,8 +25,8 @@ public class RolloutResumeEquivalent { public static void main(String[] args) { try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.apps().deployments().inNamespace("default").withName("nginx-deployment") - .rolling() - .resume(); + .rolling() + .resume(); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutSetImageEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutSetImageEquivalent.java index 71a16f27656..e638a5bdf4a 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutSetImageEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutSetImageEquivalent.java @@ -24,8 +24,8 @@ public class RolloutSetImageEquivalent { public static void main(String[] args) { try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.apps().deployments().inNamespace("default").withName("nginx-deployment") - .rolling() - .updateImage(Collections.singletonMap("nginx", "nginx:alpine")); + .rolling() + .updateImage(Collections.singletonMap("nginx", "nginx:alpine")); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutUndoEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutUndoEquivalent.java index 13e9b1f0e30..f60f6d504d8 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutUndoEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/RolloutUndoEquivalent.java @@ -25,8 +25,8 @@ public class RolloutUndoEquivalent { public static void main(String[] args) { try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { k8s.apps().deployments().inNamespace("default").withName("nginx-deployment") - .rolling() - .undo(); + .rolling() + .undo(); } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/TopEquivalent.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/TopEquivalent.java index 30445e48228..956df698c56 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/TopEquivalent.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/TopEquivalent.java @@ -29,14 +29,14 @@ public class TopEquivalent { private static final Logger logger = LoggerFactory.getLogger(TopEquivalent.class); public static void main(String[] args) { - try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { - NodeMetricsList nodeMetricsList = k8s.top().nodes().metrics(); + try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { + NodeMetricsList nodeMetricsList = k8s.top().nodes().metrics(); - for (NodeMetrics nodeMetrics : nodeMetricsList.getItems()) { - logger.info("{} {} {}", nodeMetrics.getMetadata().getName(), + for (NodeMetrics nodeMetrics : nodeMetricsList.getItems()) { + logger.info("{} {} {}", nodeMetrics.getMetadata().getName(), nodeMetrics.getUsage().get("cpu"), nodeMetrics.getUsage().get("memory")); - } } + } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/UploadDirectoryToPod.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/UploadDirectoryToPod.java index a88fd4f4828..c940cc677f2 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/UploadDirectoryToPod.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/UploadDirectoryToPod.java @@ -28,10 +28,10 @@ public class UploadDirectoryToPod { public static void main(String[] args) { try (KubernetesClient k8s = new KubernetesClientBuilder().build()) { File fileToUpload = new File("/tmp/test-dir-src"); - k8s.pods().inNamespace("default") // <- Namespace of Pod - .withName("my-pod") // <- Name of Pod - .dir("/tmp/test-dir") // <- Path of directory inside Pod - .upload(fileToUpload.toPath()); // <- Local Path of directory + k8s.pods().inNamespace("default") // <- Namespace of Pod + .withName("my-pod") // <- Name of Pod + .dir("/tmp/test-dir") // <- Path of directory inside Pod + .upload(fileToUpload.toPath()); // <- Local Path of directory } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/UploadFileToPod.java b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/UploadFileToPod.java index 1af7bac90d9..1a1c052225a 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/UploadFileToPod.java +++ b/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/kubectl/equivalents/UploadFileToPod.java @@ -28,10 +28,10 @@ public class UploadFileToPod { public static void main(String[] args) { try (KubernetesClient client = new KubernetesClientBuilder().build()) { File fileToUpload = new File("/tmp/jobExample.yml"); - client.pods().inNamespace("default") // <- Namespace of Pod - .withName("my-pod") // <- Name of Pod - .file("/home/jobExample.yml") // <- Target location of copied file inside Pod - .upload(fileToUpload.toPath()); // <- Path of local file + client.pods().inNamespace("default") // <- Namespace of Pod + .withName("my-pod") // <- Name of Pod + .file("/home/jobExample.yml") // <- Target location of copied file inside Pod + .upload(fileToUpload.toPath()); // <- Path of local file } } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/BuildConfigExamples.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/BuildConfigExamples.java index cfaea793de0..c92481b07dc 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/BuildConfigExamples.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/BuildConfigExamples.java @@ -41,7 +41,7 @@ public class BuildConfigExamples { @SuppressWarnings("java:S106") public static void main(String[] args) throws InterruptedException { - try(KubernetesClient kubernetesClient = new KubernetesClientBuilder().build()) { + try (KubernetesClient kubernetesClient = new KubernetesClientBuilder().build()) { final OpenShiftClient client = kubernetesClient.adapt(OpenShiftClient.class); final String namespace; if (client.getNamespace() != null) { @@ -49,86 +49,82 @@ public static void main(String[] args) throws InterruptedException { logger.info("Using configured namespace: {}", namespace); } else { final Namespace ns = client.namespaces().create( - new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).addToLabels("this", "rocks").endMetadata().build() - ); + new NamespaceBuilder().withNewMetadata().withName(NAMESPACE).addToLabels("this", "rocks").endMetadata().build()); namespace = ns.getMetadata().getName(); logger.info("Created namespace: {}", namespace); } client.serviceAccounts().inNamespace(namespace).create( - new ServiceAccountBuilder().withNewMetadata().withName("fabric8").endMetadata().build() - ); + new ServiceAccountBuilder().withNewMetadata().withName("fabric8").endMetadata().build()); final ImageStream is = client.imageStreams().inNamespace(namespace).create(new ImageStreamBuilder() - .withNewMetadata() - .withName("example-camel-cdi") - .endMetadata() - .withNewSpec() - .addNewTag() - .withName("latest") - .endTag() - .withDockerImageRepository("fabric8/example-camel-cdi") - .endSpec() - .withNewStatus().withDockerImageRepository("").endStatus() - .build() - ); + .withNewMetadata() + .withName("example-camel-cdi") + .endMetadata() + .withNewSpec() + .addNewTag() + .withName("latest") + .endTag() + .withDockerImageRepository("fabric8/example-camel-cdi") + .endSpec() + .withNewStatus().withDockerImageRepository("").endStatus() + .build()); logger.info("Created image stream: {}", is.getMetadata().getName()); final String buildConfigName = "custom-build-config"; final BuildConfig buildConfig = client.buildConfigs().inNamespace(namespace).create(new BuildConfigBuilder() - .withNewMetadata() - .withName(buildConfigName) - .endMetadata() - .withNewSpec() - .withServiceAccount("fabric8") - .withNewSource() - .withType("Git") - .withNewGit() - .withUri("https://github.com/fabric8io/example-camel-cdi.git") - .endGit() - .endSource() - .withNewResources() - .addToLimits("mykey", new Quantity("10")) - .addToRequests("mykey", new Quantity("10")) - .endResources() - .withNewStrategy() - .withType("Source") - .withNewSourceStrategy() - .withNewFrom().withName("java-sti:latest").withKind("DockerImage").endFrom() - .endSourceStrategy() - .endStrategy() - .withNewOutput() - .withNewTo().withKind("DockerImage").withName("example-camel-cdi:latest").endTo() - .endOutput() - .addNewTrigger() - .withType("GitHub") - .withNewGithub() - .withSecret("secret101") - .endGithub() - .endTrigger() - .endSpec() - .build() - ); + .withNewMetadata() + .withName(buildConfigName) + .endMetadata() + .withNewSpec() + .withServiceAccount("fabric8") + .withNewSource() + .withType("Git") + .withNewGit() + .withUri("https://github.com/fabric8io/example-camel-cdi.git") + .endGit() + .endSource() + .withNewResources() + .addToLimits("mykey", new Quantity("10")) + .addToRequests("mykey", new Quantity("10")) + .endResources() + .withNewStrategy() + .withType("Source") + .withNewSourceStrategy() + .withNewFrom().withName("java-sti:latest").withKind("DockerImage").endFrom() + .endSourceStrategy() + .endStrategy() + .withNewOutput() + .withNewTo().withKind("DockerImage").withName("example-camel-cdi:latest").endTo() + .endOutput() + .addNewTrigger() + .withType("GitHub") + .withNewGithub() + .withSecret("secret101") + .endGithub() + .endTrigger() + .endSpec() + .build()); logger.info("Created Build Config: {}", buildConfig.getMetadata().getName()); - final Build build = client.buildConfigs().inNamespace(namespace).withName("custom-build-config").instantiate(new BuildRequestBuilder() - .withNewMetadata().withName(buildConfigName).endMetadata() - .build()); + final Build build = client.buildConfigs().inNamespace(namespace).withName("custom-build-config") + .instantiate(new BuildRequestBuilder() + .withNewMetadata().withName(buildConfigName).endMetadata() + .build()); logger.info("Instantiated Build: {}", build.getMetadata().getName()); client.buildConfigs().inNamespace(namespace).withName(buildConfigName) - .withSecret("secret101") - .withType("github") - .trigger(new WebHookTriggerBuilder() .withSecret("secret101") - .build()); + .withType("github") + .trigger(new WebHookTriggerBuilder() + .withSecret("secret101") + .build()); logger.info("Triggered Build Config: {}", buildConfigName); - Thread.sleep(6000); logger.info("Builds:"); - for (Build b: client.builds().inNamespace(namespace).list().getItems()) { + for (Build b : client.builds().inNamespace(namespace).list().getItems()) { logger.info("\t\t\t{}", b.getMetadata().getName()); logger.info("\t\t\t\t\t Log:"); diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/DeploymentConfigExamples.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/DeploymentConfigExamples.java index 341707e33ca..ddb7d488bb9 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/DeploymentConfigExamples.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/DeploymentConfigExamples.java @@ -33,7 +33,7 @@ public class DeploymentConfigExamples { private static final String NAMESPACE = "this-is-a-test"; private static final String IMAGE = "busybox"; - public static void main(String[] args) { + public static void main(String[] args) { try (KubernetesClient kubernetesClient = new KubernetesClientBuilder().build()) { final OpenShiftClient client = kubernetesClient.adapt(OpenShiftClient.class); @@ -43,12 +43,11 @@ public static void main(String[] args) { logger.info("Using configured project: {}", project); } else { client.projectrequests().create( - new ProjectRequestBuilder() - .withNewMetadata() - .withName(NAMESPACE) - .endMetadata() - .build() - ); + new ProjectRequestBuilder() + .withNewMetadata() + .withName(NAMESPACE) + .endMetadata() + .build()); project = NAMESPACE; logger.info("Created project: {}", project); } @@ -58,32 +57,31 @@ public static void main(String[] args) { client.serviceAccounts().inNamespace(project).createOrReplace(fabric8); log("Created deployment", client.deploymentConfigs().inNamespace(project).createOrReplace(new DeploymentConfigBuilder() - .withNewMetadata() + .withNewMetadata() .withName(IMAGE) - .endMetadata() - .withNewSpec() + .endMetadata() + .withNewSpec() .withReplicas(1) .addNewTrigger() - .withType("ConfigChange") + .withType("ConfigChange") .endTrigger() .addToSelector("app", IMAGE) .withNewTemplate() - .withNewMetadata() - .addToLabels("app", IMAGE) - .endMetadata() - .withNewSpec() - .addNewContainer() - .withName(IMAGE) - .withImage(IMAGE) - .addNewPort() - .withContainerPort(80) - .endPort() - .endContainer() - .endSpec() + .withNewMetadata() + .addToLabels("app", IMAGE) + .endMetadata() + .withNewSpec() + .addNewContainer() + .withName(IMAGE) + .withImage(IMAGE) + .addNewPort() + .withContainerPort(80) + .endPort() + .endContainer() + .endSpec() .endTemplate() - .endSpec() - .build())); - + .endSpec() + .build())); client.deploymentConfigs().inNamespace(project).withName(IMAGE).scale(2, true); log("Created pods:", client.pods().inNamespace(project).list().getItems()); @@ -95,7 +93,6 @@ public static void main(String[] args) { } } - private static void log(String action, Object obj) { logger.info("{}: {}", action, obj); } diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/DeploymentConfigScale.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/DeploymentConfigScale.java index 3f66dc4b4b7..32a29373778 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/DeploymentConfigScale.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/DeploymentConfigScale.java @@ -60,18 +60,18 @@ public static void main(String[] args) { oldReplicas = spec.getReplicas(); spec.setReplicas(replicas); DeploymentConfig updated = resource.patch(deploymentConfig); - System.out.println("Updated the DeploymentConfig " + name + " version: " + deploymentConfig.getApiVersion() + " with replicas: " + replicas + " to resourceVersion: " + updated.getMetadata().getResourceVersion()); + System.out.println("Updated the DeploymentConfig " + name + " version: " + deploymentConfig.getApiVersion() + + " with replicas: " + replicas + " to resourceVersion: " + updated.getMetadata().getResourceVersion()); } catch (Exception e) { System.out.println("Failed to update the DeploymentConfig " + name + " with replicas: " + replicas); e.printStackTrace(); } - // now lets find the DC via list DeploymentConfigList list = Objects.requireNonNull(client.deploymentConfigs().list(), - "No DeploymentConfigList returned"); + "No DeploymentConfigList returned"); List items = Objects.requireNonNull(list.getItems(), - "No DeploymentConfigList.getItems() returned"); + "No DeploymentConfigList.getItems() returned"); DeploymentConfig found = null; for (DeploymentConfig item : items) { @@ -85,7 +85,8 @@ public static void main(String[] args) { try { DeploymentConfig updated = resource.patch(found); - System.out.println("Updated the list.item DeploymentConfig " + name + " version: " + found.getApiVersion() + " with replicas: " + oldReplicas + " to resourceVersion: " + updated.getMetadata().getResourceVersion()); + System.out.println("Updated the list.item DeploymentConfig " + name + " version: " + found.getApiVersion() + + " with replicas: " + oldReplicas + " to resourceVersion: " + updated.getMetadata().getResourceVersion()); } catch (Exception e) { System.out.println("Failed to update the list.item DeploymentConfig " + name + " with replicas: " + oldReplicas); e.printStackTrace(); diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ImageStreamExample.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ImageStreamExample.java index 1c08307a1fb..dd78c4f29bc 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ImageStreamExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ImageStreamExample.java @@ -35,34 +35,29 @@ public static void main(String[] args) { final String project = Optional.ofNullable(client.getNamespace()).orElse("myproject"); final String imageStreamName = "slave-jenkins"; final ImageStream imageStream = client.imageStreams().inNamespace(project).create( - new ImageStreamBuilder() - .withNewMetadata() - .withName(imageStreamName) - .endMetadata() - .withNewSpec() - .addToTags(0, new TagReferenceBuilder() - .withName("base") - .withFrom(new ObjectReferenceBuilder() - .withKind("DockerImage") - .withName("docker.io/openshift/jenkins-slave-maven-centos7:latest") - .build() - ) - .build() - ) - .addToTags(1, new TagReferenceBuilder() - .addToAnnotations("role", "jenkins-slave") - .addToAnnotations("slave-label", "jenkins-slave") - .withName("latest") - .withFrom(new ObjectReferenceBuilder() - .withKind("ImageStreamTag") - .withName("base") - .build() - ) - .build() - ) - .endSpec() - .build() - ); + new ImageStreamBuilder() + .withNewMetadata() + .withName(imageStreamName) + .endMetadata() + .withNewSpec() + .addToTags(0, new TagReferenceBuilder() + .withName("base") + .withFrom(new ObjectReferenceBuilder() + .withKind("DockerImage") + .withName("docker.io/openshift/jenkins-slave-maven-centos7:latest") + .build()) + .build()) + .addToTags(1, new TagReferenceBuilder() + .addToAnnotations("role", "jenkins-slave") + .addToAnnotations("slave-label", "jenkins-slave") + .withName("latest") + .withFrom(new ObjectReferenceBuilder() + .withKind("ImageStreamTag") + .withName("base") + .build()) + .build()) + .endSpec() + .build()); logger.info("Created ImageStream: {}/{}", project, imageStream.getMetadata().getName()); final ImageStream isFromServer = client.imageStreams().inNamespace(project).withName(imageStreamName).fromServer().get(); logger.info("Tags in ImageStream are:"); @@ -74,4 +69,3 @@ public static void main(String[] args) { } } } - diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListBuildConfigs.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListBuildConfigs.java index 5f240ea408e..5ac7f20dfb3 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListBuildConfigs.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListBuildConfigs.java @@ -32,7 +32,7 @@ public class ListBuildConfigs { private static final Logger logger = LoggerFactory.getLogger(ListBuildConfigs.class); public static void main(String[] args) { - try(OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) { + try (OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) { if (!client.supportsOpenShiftAPIGroup(OpenShiftAPIGroups.BUILD)) { logger.warn("This cluster does not support the API Group {}", OpenShiftAPIGroups.BUILD); return; diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListDeploymentConfigs.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListDeploymentConfigs.java index bb6963db274..3dd90f42acb 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListDeploymentConfigs.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListDeploymentConfigs.java @@ -32,7 +32,7 @@ public class ListDeploymentConfigs { private static final Logger logger = LoggerFactory.getLogger(ListDeploymentConfigs.class); public static void main(String[] args) { - try(OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) { + try (OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) { if (!client.supportsOpenShiftAPIGroup(OpenShiftAPIGroups.APPS)) { logger.warn("This cluster does not support the API Group {}", OpenShiftAPIGroups.APPS); return; diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListImageStreams.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListImageStreams.java index 3ba619c0160..44b331cc253 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListImageStreams.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/ListImageStreams.java @@ -32,7 +32,7 @@ public class ListImageStreams { private static final Logger logger = LoggerFactory.getLogger(ListImageStreams.class); public static void main(String[] args) { - try(OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) { + try (OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) { if (!client.supportsOpenShiftAPIGroup(OpenShiftAPIGroups.IMAGE)) { logger.warn("This cluster does not support the API Group {}", OpenShiftAPIGroups.IMAGE); return; diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/LoginExample.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/LoginExample.java index 047e06940d7..54827b93303 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/LoginExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/LoginExample.java @@ -30,11 +30,10 @@ public class LoginExample { public static void main(String[] args) { try (KubernetesClient kubernetesClient = new KubernetesClientBuilder().withConfig(new ConfigBuilder() - .withMasterUrl("cluster_url") - .withUsername("my_username") - .withPassword("my_password") - .build()).build() - ) { + .withMasterUrl("cluster_url") + .withUsername("my_username") + .withPassword("my_password") + .build()).build()) { final OpenShiftClient openShiftClient = kubernetesClient.adapt(OpenShiftClient.class); logger.info("Login Successful"); final ProjectList pl = openShiftClient.projects().list(); diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/NewProjectExamples.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/NewProjectExamples.java index f447edb1881..2a96ba2df8c 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/NewProjectExamples.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/NewProjectExamples.java @@ -30,13 +30,13 @@ public static void main(String[] args) { configBuilder.withMasterUrl(args[0]); } try (OpenShiftClient client = new KubernetesClientBuilder() - .withConfig(configBuilder.build()).build().adapt(OpenShiftClient.class)) { + .withConfig(configBuilder.build()).build().adapt(OpenShiftClient.class)) { ProjectRequest request = null; try { - request = client.projectrequests().create( + request = client.projectrequests().create( new ProjectRequestBuilder() - .withNewMetadata().withName("thisisatest").endMetadata().withDescription("Jimmi").withDisplayName("Jimmi").build() - ); + .withNewMetadata().withName("thisisatest").endMetadata().withDescription("Jimmi").withDisplayName("Jimmi") + .build()); } finally { if (request != null) { client.projects().withName(request.getMetadata().getName()).delete(); diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/OpenShiftVersionExample.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/OpenShiftVersionExample.java index 1ad56470faa..987806e8450 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/OpenShiftVersionExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/OpenShiftVersionExample.java @@ -32,7 +32,7 @@ public static void main(String[] args) { configBuilder.withMasterUrl(args[0]); } try (OpenShiftClient client = new KubernetesClientBuilder() - .withConfig(configBuilder.build()).build().adapt(OpenShiftClient.class)) { + .withConfig(configBuilder.build()).build().adapt(OpenShiftClient.class)) { VersionInfo openShiftVersionInfo = client.getVersion(); logger.info("Version details of this OpenShift cluster :-"); diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/SecurityContextConstraintExample.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/SecurityContextConstraintExample.java index 9f0a9470989..bd49f737987 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/SecurityContextConstraintExample.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/SecurityContextConstraintExample.java @@ -25,41 +25,39 @@ public class SecurityContextConstraintExample { - private static final Logger logger = LoggerFactory.getLogger(SecurityContextConstraintExample.class); + private static final Logger logger = LoggerFactory.getLogger(SecurityContextConstraintExample.class); - //You need to be login as admin on OpenShift for this Example - //command for that is - //oc login -u system:admin + //You need to be login as admin on OpenShift for this Example + //command for that is + //oc login -u system:admin - public static void main(String[] args) { - try (OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) { - logger.info("Cluster SecurityContextConstraints:"); - client.securityContextConstraints().list().getItems().forEach(scc -> - logger.info(" - {}", scc.getMetadata().getName())); - final SecurityContextConstraints scc = client.securityContextConstraints().create( - new SecurityContextConstraintsBuilder() - .withNewMetadata().withName("scc").endMetadata() - .withAllowPrivilegedContainer(true) - .withNewRunAsUser() - .withType("RunAsAny") - .endRunAsUser() - .withNewSeLinuxContext() - .withType("RunAsAny") - .endSeLinuxContext() - .withNewFsGroup() - .withType("RunAsAny") - .endFsGroup() - .withNewSupplementalGroups() - .withType("RunAsAny") - .endSupplementalGroups() - .addToUsers("admin") - .addToGroups("admin-group") - .build() - ); - logger.info("Created SecurityContextConstraints {}", scc); - } catch (KubernetesClientException e) { - logger.error(e.getMessage(), e); - } + public static void main(String[] args) { + try (OpenShiftClient client = new KubernetesClientBuilder().build().adapt(OpenShiftClient.class)) { + logger.info("Cluster SecurityContextConstraints:"); + client.securityContextConstraints().list().getItems().forEach(scc -> logger.info(" - {}", scc.getMetadata().getName())); + final SecurityContextConstraints scc = client.securityContextConstraints().create( + new SecurityContextConstraintsBuilder() + .withNewMetadata().withName("scc").endMetadata() + .withAllowPrivilegedContainer(true) + .withNewRunAsUser() + .withType("RunAsAny") + .endRunAsUser() + .withNewSeLinuxContext() + .withType("RunAsAny") + .endSeLinuxContext() + .withNewFsGroup() + .withType("RunAsAny") + .endFsGroup() + .withNewSupplementalGroups() + .withType("RunAsAny") + .endSupplementalGroups() + .addToUsers("admin") + .addToGroups("admin-group") + .build()); + logger.info("Created SecurityContextConstraints {}", scc); + } catch (KubernetesClientException e) { + logger.error(e.getMessage(), e); } + } } diff --git a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/WatchBuildConfigs.java b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/WatchBuildConfigs.java index 6f2485fcff4..43529765a47 100644 --- a/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/WatchBuildConfigs.java +++ b/kubernetes-examples/src/main/java/io/fabric8/openshift/examples/WatchBuildConfigs.java @@ -40,7 +40,7 @@ public static void main(String[] args) { @Override public void eventReceived(Action action, BuildConfig resource) { logger.info(">> Action: {} on BuildConfig {} with version: {}", - action.name(), resource.getMetadata().getName(), resource.getApiVersion()); + action.name(), resource.getMetadata().getName(), resource.getApiVersion()); } @Override diff --git a/kubernetes-itests/src/test/java/io/fabric8/crd/pet/Pet.java b/kubernetes-itests/src/test/java/io/fabric8/crd/pet/Pet.java index 95bba5ed965..73fa0d108ce 100644 --- a/kubernetes-itests/src/test/java/io/fabric8/crd/pet/Pet.java +++ b/kubernetes-itests/src/test/java/io/fabric8/crd/pet/Pet.java @@ -22,4 +22,5 @@ @Version("v1alpha1") @Group("testing.fabric8.io") -public class Pet extends CustomResource implements Namespaced { } +public class Pet extends CustomResource implements Namespaced { +} diff --git a/kubernetes-itests/src/test/java/io/fabric8/crd/pet/PetSpec.java b/kubernetes-itests/src/test/java/io/fabric8/crd/pet/PetSpec.java index 236bc3e8db4..ab235e7811c 100644 --- a/kubernetes-itests/src/test/java/io/fabric8/crd/pet/PetSpec.java +++ b/kubernetes-itests/src/test/java/io/fabric8/crd/pet/PetSpec.java @@ -28,7 +28,6 @@ public void setType(String type) { @Override public String toString() { - return "PetSpec{type=" + type + "}"; + return "PetSpec{type=" + type + "}"; } } - diff --git a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/DefaultSharedIndexInformerIT.java b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/DefaultSharedIndexInformerIT.java index e1390755222..766bbdf7f8c 100644 --- a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/DefaultSharedIndexInformerIT.java +++ b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/DefaultSharedIndexInformerIT.java @@ -118,7 +118,7 @@ public TestResourceEventHandler(CountDownLatch addLatch, CountDownLatch updateLa @Override public void onAdd(T resource) { - addEventRecievedLatch.countDown(); + addEventRecievedLatch.countDown(); } @Override @@ -128,7 +128,8 @@ public void onUpdate(T oldResource, T newResource) { } @Override - public void onDelete(T obj, boolean deletedFinalStateUnknown) { } + public void onDelete(T obj, boolean deletedFinalStateUnknown) { + } public int getUpdateEventsCount() { return updateCount.get(); diff --git a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/SelfSubjectAccessReviewIT.java b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/SelfSubjectAccessReviewIT.java index 761fe94a50d..4a58556750d 100644 --- a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/SelfSubjectAccessReviewIT.java +++ b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/SelfSubjectAccessReviewIT.java @@ -34,14 +34,14 @@ class SelfSubjectAccessReviewIT { void testCreate() { // Given SelfSubjectAccessReview selfSubjectAccessReview = new SelfSubjectAccessReviewBuilder() - .withNewSpec() - .withNewResourceAttributes() - .withNamespace(namespace.getMetadata().getName()) - .withVerb("get") - .withResource("pods") - .endResourceAttributes() - .endSpec() - .build(); + .withNewSpec() + .withNewResourceAttributes() + .withNamespace(namespace.getMetadata().getName()) + .withVerb("get") + .withResource("pods") + .endResourceAttributes() + .endSpec() + .build(); // When selfSubjectAccessReview = client.authorization().v1().selfSubjectAccessReview().create(selfSubjectAccessReview); diff --git a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/WatchIT.java b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/WatchIT.java index b3c32854a35..6360b407155 100644 --- a/kubernetes-itests/src/test/java/io/fabric8/kubernetes/WatchIT.java +++ b/kubernetes-itests/src/test/java/io/fabric8/kubernetes/WatchIT.java @@ -47,11 +47,11 @@ class WatchIT { @Test void testWatch() throws InterruptedException { Pod pod1 = new PodBuilder() - .withNewMetadata().withName("sample-watch-pod").endMetadata() - .withNewSpec() - .addNewContainer().withName("nginx").withImage("nginx").endContainer() - .endSpec() - .build(); + .withNewMetadata().withName("sample-watch-pod").endMetadata() + .withNewSpec() + .addNewContainer().withName("nginx").withImage("nginx").endContainer() + .endSpec() + .build(); client.pods().create(pod1); @@ -152,11 +152,11 @@ public void onClose() { .build()); configMapClient - .patch(PatchContext.of(PatchType.STRATEGIC_MERGE), new ConfigMapBuilder() - .withNewMetadata() - .addToLabels("foo", "bar1") - .endMetadata() - .build()); + .patch(PatchContext.of(PatchType.STRATEGIC_MERGE), new ConfigMapBuilder() + .withNewMetadata() + .addToLabels("foo", "bar1") + .endMetadata() + .build()); assertTrue(eventLatch.await(10, TimeUnit.SECONDS)); assertTrue(modifyLatch.await(15, TimeUnit.SECONDS)); diff --git a/kubernetes-model-generator/kubernetes-model-admissionregistration/src/main/java/io/fabric8/kubernetes/api/model/admission/v1/AdmissionRequest.java b/kubernetes-model-generator/kubernetes-model-admissionregistration/src/main/java/io/fabric8/kubernetes/api/model/admission/v1/AdmissionRequest.java index d4bd40125f5..dd6ab70ad9a 100644 --- a/kubernetes-model-generator/kubernetes-model-admissionregistration/src/main/java/io/fabric8/kubernetes/api/model/admission/v1/AdmissionRequest.java +++ b/kubernetes-model-generator/kubernetes-model-admissionregistration/src/main/java/io/fabric8/kubernetes/api/model/admission/v1/AdmissionRequest.java @@ -41,12 +41,11 @@ @JsonDeserialize @ToString @EqualsAndHashCode -public class AdmissionRequest implements KubernetesResource -{ +public class AdmissionRequest implements KubernetesResource { /* * DryRun indicates that modifications will definitely not be persisted for this request. - * Defaults to false. + * Defaults to false. */ @JsonProperty("dryRun") private Boolean dryRun; @@ -58,8 +57,8 @@ public class AdmissionRequest implements KubernetesResource private GroupVersionKind kind; /* - * Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and - * rely on the server to generate the name. If that is the case, this field will contain an empty string. + * Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and + * rely on the server to generate the name. If that is the case, this field will contain an empty string. */ @JsonProperty("name") private String name; @@ -84,7 +83,7 @@ public class AdmissionRequest implements KubernetesResource /* * Operation is the operation being performed. This may be different than the operation - * requested. e.g. a patch can result in either a CREATE or UPDATE Operation. + * requested. e.g. a patch can result in either a CREATE or UPDATE Operation. */ @JsonProperty("operation") private String operation; @@ -94,13 +93,14 @@ public class AdmissionRequest implements KubernetesResource /* * RequestResource is the fully-qualified resource of the original API request (for example, v1.pods). - * If this is specified and differs from the value in "resource", an equivalent match and conversion was performed. - * - * For example, if deployments can be modified via apps/v1 and apps/v1beta1, and a webhook registered a rule of - * `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and `matchPolicy: Equivalent`, - * an API request to apps/v1beta1 deployments would be converted and sent to the webhook - * with `resource: {group:"apps", version:"v1", resource:"deployments"}` (matching the resource the webhook registered for), - * and `requestResource: {group:"apps", version:"v1beta1", resource:"deployments"}` (indicating the resource of the original API request). + * If this is specified and differs from the value in "resource", an equivalent match and conversion was performed. + * + * For example, if deployments can be modified via apps/v1 and apps/v1beta1, and a webhook registered a rule of + * `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and `matchPolicy: Equivalent`, + * an API request to apps/v1beta1 deployments would be converted and sent to the webhook + * with `resource: {group:"apps", version:"v1", resource:"deployments"}` (matching the resource the webhook registered for), + * and `requestResource: {group:"apps", version:"v1beta1", resource:"deployments"}` (indicating the resource of the original + * API request). */ @JsonProperty("requestKind") private GroupVersionKind requestKind; @@ -113,7 +113,8 @@ public class AdmissionRequest implements KubernetesResource * `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and `matchPolicy: Equivalent`, * an API request to apps/v1beta1 deployments would be converted and sent to the webhook * with `resource: {group:"apps", version:"v1", resource:"deployments"}` (matching the resource the webhook registered for), - * and `requestResource: {group:"apps", version:"v1beta1", resource:"deployments"}` (indicating the resource of the original API request). + * and `requestResource: {group:"apps", version:"v1beta1", resource:"deployments"}` (indicating the resource of the original + * API request). * * See documentation for the "matchPolicy" field in the webhook configuration type. */ @@ -163,7 +164,10 @@ public class AdmissionRequest implements KubernetesResource public AdmissionRequest() { } - public AdmissionRequest(Boolean dryRun, GroupVersionKind kind, String name, String namespace, KubernetesResource object, KubernetesResource oldObject, String operation, KubernetesResource options, GroupVersionKind requestKind, GroupVersionResource requestResource, String requestSubResource, GroupVersionResource resource, String subResource, String uid, UserInfo userInfo) { + public AdmissionRequest(Boolean dryRun, GroupVersionKind kind, String name, String namespace, KubernetesResource object, + KubernetesResource oldObject, String operation, KubernetesResource options, GroupVersionKind requestKind, + GroupVersionResource requestResource, String requestSubResource, GroupVersionResource resource, String subResource, + String uid, UserInfo userInfo) { this.dryRun = dryRun; this.kind = kind; this.name = name; @@ -193,6 +197,7 @@ public Boolean getDryRun() { /** * Set Dry run + * * @param dryRun The dryRun */ @JsonProperty("dryRun") diff --git a/kubernetes-model-generator/kubernetes-model-admissionregistration/src/main/java/io/fabric8/kubernetes/api/model/admission/v1beta1/AdmissionRequest.java b/kubernetes-model-generator/kubernetes-model-admissionregistration/src/main/java/io/fabric8/kubernetes/api/model/admission/v1beta1/AdmissionRequest.java index d73cc974f0d..19a53192f7b 100644 --- a/kubernetes-model-generator/kubernetes-model-admissionregistration/src/main/java/io/fabric8/kubernetes/api/model/admission/v1beta1/AdmissionRequest.java +++ b/kubernetes-model-generator/kubernetes-model-admissionregistration/src/main/java/io/fabric8/kubernetes/api/model/admission/v1beta1/AdmissionRequest.java @@ -41,12 +41,11 @@ @JsonDeserialize @ToString @EqualsAndHashCode -public class AdmissionRequest implements KubernetesResource -{ +public class AdmissionRequest implements KubernetesResource { /* * DryRun indicates that modifications will definitely not be persisted for this request. - * Defaults to false. + * Defaults to false. */ @JsonProperty("dryRun") private Boolean dryRun; @@ -58,8 +57,8 @@ public class AdmissionRequest implements KubernetesResource private GroupVersionKind kind; /* - * Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and - * rely on the server to generate the name. If that is the case, this field will contain an empty string. + * Name is the name of the object as presented in the request. On a CREATE operation, the client may omit name and + * rely on the server to generate the name. If that is the case, this field will contain an empty string. */ @JsonProperty("name") private String name; @@ -84,7 +83,7 @@ public class AdmissionRequest implements KubernetesResource /* * Operation is the operation being performed. This may be different than the operation - * requested. e.g. a patch can result in either a CREATE or UPDATE Operation. + * requested. e.g. a patch can result in either a CREATE or UPDATE Operation. */ @JsonProperty("operation") private String operation; @@ -94,13 +93,14 @@ public class AdmissionRequest implements KubernetesResource /* * RequestResource is the fully-qualified resource of the original API request (for example, v1.pods). - * If this is specified and differs from the value in "resource", an equivalent match and conversion was performed. - * - * For example, if deployments can be modified via apps/v1 and apps/v1beta1, and a webhook registered a rule of - * `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and `matchPolicy: Equivalent`, - * an API request to apps/v1beta1 deployments would be converted and sent to the webhook - * with `resource: {group:"apps", version:"v1", resource:"deployments"}` (matching the resource the webhook registered for), - * and `requestResource: {group:"apps", version:"v1beta1", resource:"deployments"}` (indicating the resource of the original API request). + * If this is specified and differs from the value in "resource", an equivalent match and conversion was performed. + * + * For example, if deployments can be modified via apps/v1 and apps/v1beta1, and a webhook registered a rule of + * `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and `matchPolicy: Equivalent`, + * an API request to apps/v1beta1 deployments would be converted and sent to the webhook + * with `resource: {group:"apps", version:"v1", resource:"deployments"}` (matching the resource the webhook registered for), + * and `requestResource: {group:"apps", version:"v1beta1", resource:"deployments"}` (indicating the resource of the original + * API request). */ @JsonProperty("requestKind") private GroupVersionKind requestKind; @@ -113,7 +113,8 @@ public class AdmissionRequest implements KubernetesResource * `apiGroups:["apps"], apiVersions:["v1"], resources: ["deployments"]` and `matchPolicy: Equivalent`, * an API request to apps/v1beta1 deployments would be converted and sent to the webhook * with `resource: {group:"apps", version:"v1", resource:"deployments"}` (matching the resource the webhook registered for), - * and `requestResource: {group:"apps", version:"v1beta1", resource:"deployments"}` (indicating the resource of the original API request). + * and `requestResource: {group:"apps", version:"v1beta1", resource:"deployments"}` (indicating the resource of the original + * API request). * * See documentation for the "matchPolicy" field in the webhook configuration type. */ @@ -163,7 +164,10 @@ public class AdmissionRequest implements KubernetesResource public AdmissionRequest() { } - public AdmissionRequest(Boolean dryRun, GroupVersionKind kind, String name, String namespace, KubernetesResource object, KubernetesResource oldObject, String operation, KubernetesResource options, GroupVersionKind requestKind, GroupVersionResource requestResource, String requestSubResource, GroupVersionResource resource, String subResource, String uid, UserInfo userInfo) { + public AdmissionRequest(Boolean dryRun, GroupVersionKind kind, String name, String namespace, KubernetesResource object, + KubernetesResource oldObject, String operation, KubernetesResource options, GroupVersionKind requestKind, + GroupVersionResource requestResource, String requestSubResource, GroupVersionResource resource, String subResource, + String uid, UserInfo userInfo) { this.dryRun = dryRun; this.kind = kind; this.name = name; @@ -193,6 +197,7 @@ public Boolean getDryRun() { /** * Set Dry run + * * @param dryRun The dryRun */ @JsonProperty("dryRun") diff --git a/kubernetes-model-generator/kubernetes-model-admissionregistration/src/test/java/io/fabric8/kubernetes/api/model/admissionregistration/ValidatingWebhookConfigurationTest.java b/kubernetes-model-generator/kubernetes-model-admissionregistration/src/test/java/io/fabric8/kubernetes/api/model/admissionregistration/ValidatingWebhookConfigurationTest.java index d8eb5c34d56..0f94d3ec290 100644 --- a/kubernetes-model-generator/kubernetes-model-admissionregistration/src/test/java/io/fabric8/kubernetes/api/model/admissionregistration/ValidatingWebhookConfigurationTest.java +++ b/kubernetes-model-generator/kubernetes-model-admissionregistration/src/test/java/io/fabric8/kubernetes/api/model/admissionregistration/ValidatingWebhookConfigurationTest.java @@ -16,7 +16,6 @@ package io.fabric8.kubernetes.api.model.admissionregistration; import io.fabric8.kubernetes.api.model.admissionregistration.v1.ValidatingWebhookConfiguration; - import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -25,27 +24,27 @@ public class ValidatingWebhookConfigurationTest { @Test public void testBuilder() { ValidatingWebhookConfiguration vwc = new io.fabric8.kubernetes.api.model.admissionregistration.v1.ValidatingWebhookConfigurationBuilder() - .withNewMetadata().withName("pod-policy.example.com").endMetadata() - .addNewWebhook() - .withName("pod-policy.example.com") - .addNewRule() - .withApiGroups("") - .withApiVersions("v1") - .withOperations("CREATE") - .withResources("pods") - .withScope("Namespaced") - .endRule() - .withNewClientConfig() - .withNewService() - .withNamespace("example-namespace") - .withName("example-service") - .endService() - .endClientConfig() - .withAdmissionReviewVersions("v1", "v1beta1") - .withSideEffects("None") - .withTimeoutSeconds(5) - .endWebhook() - .build(); + .withNewMetadata().withName("pod-policy.example.com").endMetadata() + .addNewWebhook() + .withName("pod-policy.example.com") + .addNewRule() + .withApiGroups("") + .withApiVersions("v1") + .withOperations("CREATE") + .withResources("pods") + .withScope("Namespaced") + .endRule() + .withNewClientConfig() + .withNewService() + .withNamespace("example-namespace") + .withName("example-service") + .endService() + .endClientConfig() + .withAdmissionReviewVersions("v1", "v1beta1") + .withSideEffects("None") + .withTimeoutSeconds(5) + .endWebhook() + .build(); assertEquals("pod-policy.example.com", vwc.getMetadata().getName()); assertEquals(1, vwc.getWebhooks().size()); diff --git a/kubernetes-model-generator/kubernetes-model-admissionregistration/src/test/java/io/fabric8/kubernetes/api/model/authorization/SubjectAccessReviewTest.java b/kubernetes-model-generator/kubernetes-model-admissionregistration/src/test/java/io/fabric8/kubernetes/api/model/authorization/SubjectAccessReviewTest.java index 3aa9a3f8bf6..fe4872b4c52 100644 --- a/kubernetes-model-generator/kubernetes-model-admissionregistration/src/test/java/io/fabric8/kubernetes/api/model/authorization/SubjectAccessReviewTest.java +++ b/kubernetes-model-generator/kubernetes-model-admissionregistration/src/test/java/io/fabric8/kubernetes/api/model/authorization/SubjectAccessReviewTest.java @@ -17,26 +17,23 @@ import io.fabric8.kubernetes.api.model.authorization.v1.SubjectAccessReview; import io.fabric8.kubernetes.api.model.authorization.v1.SubjectAccessReviewBuilder; - import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; - public class SubjectAccessReviewTest { @Test public void testBuilder() { SubjectAccessReview sar = new SubjectAccessReviewBuilder() - .withNewMetadata().withName("test-sar").endMetadata() - .withNewSpec() - .withNewResourceAttributes() - .withGroup("apps") - .withResource("deployments") - .withNamespace("dev") - .withVerb("create") - .endResourceAttributes() - .endSpec() - .build(); + .withNewMetadata().withName("test-sar").endMetadata() + .withNewSpec() + .withNewResourceAttributes() + .withGroup("apps") + .withResource("deployments") + .withNamespace("dev") + .withVerb("create") + .endResourceAttributes() + .endSpec() + .build(); Assertions.assertEquals("test-sar", sar.getMetadata().getName()); Assertions.assertEquals("apps", sar.getSpec().getResourceAttributes().getGroup()); diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrArraySerDe.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrArraySerDe.java index 6ce79b81d3a..9e9995c12f4 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrArraySerDe.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrArraySerDe.java @@ -15,9 +15,6 @@ */ package io.fabric8.kubernetes.api.model.apiextensions.v1; -import java.io.IOException; -import java.util.List; - import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.type.TypeReference; @@ -26,6 +23,9 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.List; + public class JSONSchemaPropsOrArraySerDe { private JSONSchemaPropsOrArraySerDe() { @@ -34,8 +34,8 @@ private JSONSchemaPropsOrArraySerDe() { public static class Serializer extends JsonSerializer { @Override public void serialize(JSONSchemaPropsOrArray jsonSchemaPropsOrArray, - JsonGenerator jsonGenerator, - SerializerProvider serializerProvider) throws IOException { + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider) throws IOException { if (jsonSchemaPropsOrArray.getJSONSchemas() != null && !jsonSchemaPropsOrArray.getJSONSchemas().isEmpty()) { jsonGenerator.writeStartArray(); for (JSONSchemaProps schema : jsonSchemaPropsOrArray.getJSONSchemas()) { @@ -51,13 +51,15 @@ public void serialize(JSONSchemaPropsOrArray jsonSchemaPropsOrArray, public static class Deserializer extends JsonDeserializer { @Override - public JSONSchemaPropsOrArray deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { + public JSONSchemaPropsOrArray deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException { JSONSchemaPropsOrArrayBuilder builder = new JSONSchemaPropsOrArrayBuilder(); if (jsonParser.isExpectedStartObjectToken()) { builder.withSchema( - jsonParser.readValueAs(JSONSchemaProps.class)); + jsonParser.readValueAs(JSONSchemaProps.class)); } else if (jsonParser.isExpectedStartArrayToken()) { - builder.withJSONSchemas(jsonParser.>readValueAs(new TypeReference>() {})); + builder.withJSONSchemas(jsonParser.> readValueAs(new TypeReference>() { + })); } return builder.build(); } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrBoolSerDe.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrBoolSerDe.java index bd427a22e8c..28501c50ca5 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrBoolSerDe.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrBoolSerDe.java @@ -15,8 +15,6 @@ */ package io.fabric8.kubernetes.api.model.apiextensions.v1; -import java.io.IOException; - import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; @@ -24,6 +22,8 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; + public class JSONSchemaPropsOrBoolSerDe { private JSONSchemaPropsOrBoolSerDe() { @@ -32,8 +32,8 @@ private JSONSchemaPropsOrBoolSerDe() { public static class Serializer extends JsonSerializer { @Override public void serialize(JSONSchemaPropsOrBool jsonSchemaPropsOrBool, - JsonGenerator jsonGenerator, - SerializerProvider serializerProvider) throws IOException { + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider) throws IOException { if (jsonSchemaPropsOrBool.getSchema() != null) { jsonGenerator.writeObject(jsonSchemaPropsOrBool.getSchema()); } else { @@ -45,11 +45,12 @@ public void serialize(JSONSchemaPropsOrBool jsonSchemaPropsOrBool, public static class Deserializer extends JsonDeserializer { @Override - public JSONSchemaPropsOrBool deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { + public JSONSchemaPropsOrBool deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException { JSONSchemaPropsOrBoolBuilder builder = new JSONSchemaPropsOrBoolBuilder(); if (jsonParser.isExpectedStartObjectToken()) { builder.withSchema( - jsonParser.readValueAs(JSONSchemaProps.class)); + jsonParser.readValueAs(JSONSchemaProps.class)); builder.withAllows(true); } else { builder.withAllows(jsonParser.getBooleanValue()); diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrStringArraySerDe.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrStringArraySerDe.java index 557b4ff30b6..16be058c2d2 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrStringArraySerDe.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrStringArraySerDe.java @@ -15,9 +15,6 @@ */ package io.fabric8.kubernetes.api.model.apiextensions.v1; -import java.io.IOException; -import java.util.List; - import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.type.TypeReference; @@ -26,6 +23,9 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.List; + public class JSONSchemaPropsOrStringArraySerDe { private JSONSchemaPropsOrStringArraySerDe() { } @@ -33,8 +33,8 @@ private JSONSchemaPropsOrStringArraySerDe() { public static class Serializer extends JsonSerializer { @Override public void serialize(JSONSchemaPropsOrStringArray jsonSchemaPropsOrStringArray, - JsonGenerator jsonGenerator, - SerializerProvider serializerProvider) throws IOException { + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider) throws IOException { if (jsonSchemaPropsOrStringArray.getProperty() != null && !jsonSchemaPropsOrStringArray.getProperty().isEmpty()) { jsonGenerator.writeStartArray(); for (String property : jsonSchemaPropsOrStringArray.getProperty()) { @@ -50,13 +50,15 @@ public void serialize(JSONSchemaPropsOrStringArray jsonSchemaPropsOrStringArray, public static class Deserializer extends JsonDeserializer { @Override - public JSONSchemaPropsOrStringArray deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { + public JSONSchemaPropsOrStringArray deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException { JSONSchemaPropsOrStringArrayBuilder builder = new JSONSchemaPropsOrStringArrayBuilder(); if (jsonParser.isExpectedStartObjectToken()) { builder.withSchema( - jsonParser.readValueAs(JSONSchemaProps.class)); + jsonParser.readValueAs(JSONSchemaProps.class)); } else if (jsonParser.isExpectedStartArrayToken()) { - builder.withProperty(jsonParser.>readValueAs(new TypeReference>() {})); + builder.withProperty(jsonParser.> readValueAs(new TypeReference>() { + })); } return builder.build(); } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrArraySerDe.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrArraySerDe.java index c9e5724ae42..6dc44fb4e36 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrArraySerDe.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrArraySerDe.java @@ -15,9 +15,6 @@ */ package io.fabric8.kubernetes.api.model.apiextensions.v1beta1; -import java.io.IOException; -import java.util.List; - import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.type.TypeReference; @@ -26,6 +23,9 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.List; + public class JSONSchemaPropsOrArraySerDe { private JSONSchemaPropsOrArraySerDe() { @@ -34,8 +34,8 @@ private JSONSchemaPropsOrArraySerDe() { public static class Serializer extends JsonSerializer { @Override public void serialize(JSONSchemaPropsOrArray jsonSchemaPropsOrArray, - JsonGenerator jsonGenerator, - SerializerProvider serializerProvider) throws IOException { + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider) throws IOException { if (jsonSchemaPropsOrArray.getJSONSchemas() != null && !jsonSchemaPropsOrArray.getJSONSchemas().isEmpty()) { jsonGenerator.writeStartArray(); for (JSONSchemaProps schema : jsonSchemaPropsOrArray.getJSONSchemas()) { @@ -51,13 +51,15 @@ public void serialize(JSONSchemaPropsOrArray jsonSchemaPropsOrArray, public static class Deserializer extends JsonDeserializer { @Override - public JSONSchemaPropsOrArray deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { + public JSONSchemaPropsOrArray deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException { JSONSchemaPropsOrArrayBuilder builder = new JSONSchemaPropsOrArrayBuilder(); if (jsonParser.isExpectedStartObjectToken()) { builder.withSchema( - jsonParser.readValueAs(JSONSchemaProps.class)); + jsonParser.readValueAs(JSONSchemaProps.class)); } else if (jsonParser.isExpectedStartArrayToken()) { - builder.withJSONSchemas(jsonParser.>readValueAs(new TypeReference>() {})); + builder.withJSONSchemas(jsonParser.> readValueAs(new TypeReference>() { + })); } return builder.build(); } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrBoolSerDe.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrBoolSerDe.java index f5431d8497d..ca360ea6a47 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrBoolSerDe.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrBoolSerDe.java @@ -15,8 +15,6 @@ */ package io.fabric8.kubernetes.api.model.apiextensions.v1beta1; -import java.io.IOException; - import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.DeserializationContext; @@ -24,6 +22,8 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; + public class JSONSchemaPropsOrBoolSerDe { private JSONSchemaPropsOrBoolSerDe() { @@ -32,8 +32,8 @@ private JSONSchemaPropsOrBoolSerDe() { public static class Serializer extends JsonSerializer { @Override public void serialize(JSONSchemaPropsOrBool jsonSchemaPropsOrBool, - JsonGenerator jsonGenerator, - SerializerProvider serializerProvider) throws IOException { + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider) throws IOException { if (jsonSchemaPropsOrBool.getSchema() != null) { jsonGenerator.writeObject(jsonSchemaPropsOrBool.getSchema()); } else { @@ -45,11 +45,12 @@ public void serialize(JSONSchemaPropsOrBool jsonSchemaPropsOrBool, public static class Deserializer extends JsonDeserializer { @Override - public JSONSchemaPropsOrBool deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { + public JSONSchemaPropsOrBool deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException { JSONSchemaPropsOrBoolBuilder builder = new JSONSchemaPropsOrBoolBuilder(); if (jsonParser.isExpectedStartObjectToken()) { builder.withSchema( - jsonParser.readValueAs(JSONSchemaProps.class)); + jsonParser.readValueAs(JSONSchemaProps.class)); builder.withAllows(true); } else { builder.withAllows(jsonParser.getBooleanValue()); diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrStringArraySerDe.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrStringArraySerDe.java index adad269a2c7..29b1be62620 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrStringArraySerDe.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/main/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrStringArraySerDe.java @@ -15,9 +15,6 @@ */ package io.fabric8.kubernetes.api.model.apiextensions.v1beta1; -import java.io.IOException; -import java.util.List; - import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.type.TypeReference; @@ -26,6 +23,9 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.List; + public class JSONSchemaPropsOrStringArraySerDe { private JSONSchemaPropsOrStringArraySerDe() { } @@ -33,8 +33,8 @@ private JSONSchemaPropsOrStringArraySerDe() { public static class Serializer extends JsonSerializer { @Override public void serialize(JSONSchemaPropsOrStringArray jsonSchemaPropsOrStringArray, - JsonGenerator jsonGenerator, - SerializerProvider serializerProvider) throws IOException { + JsonGenerator jsonGenerator, + SerializerProvider serializerProvider) throws IOException { if (jsonSchemaPropsOrStringArray.getProperty() != null && !jsonSchemaPropsOrStringArray.getProperty().isEmpty()) { jsonGenerator.writeStartArray(); for (String property : jsonSchemaPropsOrStringArray.getProperty()) { @@ -50,13 +50,15 @@ public void serialize(JSONSchemaPropsOrStringArray jsonSchemaPropsOrStringArray, public static class Deserializer extends JsonDeserializer { @Override - public JSONSchemaPropsOrStringArray deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException { + public JSONSchemaPropsOrStringArray deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) + throws IOException { JSONSchemaPropsOrStringArrayBuilder builder = new JSONSchemaPropsOrStringArrayBuilder(); if (jsonParser.isExpectedStartObjectToken()) { builder.withSchema( - jsonParser.readValueAs(JSONSchemaProps.class)); + jsonParser.readValueAs(JSONSchemaProps.class)); } else if (jsonParser.isExpectedStartArrayToken()) { - builder.withProperty(jsonParser.>readValueAs(new TypeReference>() {})); + builder.withProperty(jsonParser.> readValueAs(new TypeReference>() { + })); } return builder.build(); } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/ConversionReviewTest.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/ConversionReviewTest.java index 084fc26d99e..f3754198337 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/ConversionReviewTest.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/ConversionReviewTest.java @@ -39,6 +39,6 @@ void testDeserializationAndSerialization() throws Exception { // then assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS) - .isEqualTo(originalJson); + .isEqualTo(originalJson); } }; diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrArrayTest.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrArrayTest.java index d9e02538132..7e8c6ba84cb 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrArrayTest.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrArrayTest.java @@ -35,29 +35,30 @@ void itDeserializesAdditionalPropertiesTrue() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .withItems(new JSONSchemaPropsOrArrayBuilder() - .withJSONSchemas( - new JSONSchemaPropsBuilder().withType("object").build(), - new JSONSchemaPropsBuilder().withType("string").build()) - .build()) - .build()); + .withType("object") + .withItems(new JSONSchemaPropsOrArrayBuilder() + .withJSONSchemas( + new JSONSchemaPropsBuilder().withType("object").build(), + new JSONSchemaPropsBuilder().withType("string").build()) + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTrue() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/items_array.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/items_array.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .withItems(new JSONSchemaPropsOrArrayBuilder() - .withJSONSchemas( - new JSONSchemaPropsBuilder().withType("object").build(), - new JSONSchemaPropsBuilder().withType("string").build()) - .build()) - .build()); + .withType("object") + .withItems(new JSONSchemaPropsOrArrayBuilder() + .withJSONSchemas( + new JSONSchemaPropsBuilder().withType("object").build(), + new JSONSchemaPropsBuilder().withType("string").build()) + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } @@ -68,21 +69,24 @@ void itDeserializesAdditionalPropertiesTyped() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .withItems(new JSONSchemaPropsOrArrayBuilder().withSchema(new JSONSchemaPropsBuilder().withType("object").build()).build()) - .build()); + .withType("object") + .withItems( + new JSONSchemaPropsOrArrayBuilder().withSchema(new JSONSchemaPropsBuilder().withType("object").build()).build()) + .build()); } @Test void itSerializesAdditionalPropertiesTyped() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/items_typed.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/items_typed.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .withItems(new JSONSchemaPropsOrArrayBuilder().withSchema(new JSONSchemaPropsBuilder().withType("object").build()).build()) - .build()); + .withType("object") + .withItems( + new JSONSchemaPropsOrArrayBuilder().withSchema(new JSONSchemaPropsBuilder().withType("object").build()).build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrBoolTest.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrBoolTest.java index 33a37737ba3..085baa446b5 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrBoolTest.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrBoolTest.java @@ -36,25 +36,26 @@ void itDeserializesAdditionalPropertiesTrue() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() - .withAllows(true) - .build()) - .build()); + .withType("object") + .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() + .withAllows(true) + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTrue() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_true.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_true.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() - .withAllows(true) - .build()) - .build()); + .withType("object") + .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() + .withAllows(true) + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } @@ -65,26 +66,27 @@ void itDeserializesAdditionalPropertiesTyped() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() - .withAllows(true) - .withNewSchema().withType("string").endSchema() - .build()) - .build()); + .withType("object") + .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() + .withAllows(true) + .withNewSchema().withType("string").endSchema() + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTyped() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_typed.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_typed.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() - .withNewSchema().withType("string").endSchema() - .build()) - .build()); + .withType("object") + .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() + .withNewSchema().withType("string").endSchema() + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrStringArrayTest.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrStringArrayTest.java index 195bda98959..3a474cf05ff 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrStringArrayTest.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1/JSONSchemaPropsOrStringArrayTest.java @@ -34,29 +34,30 @@ void itDeserializesAdditionalPropertiesTrue() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .addToDependencies( - "foo", - new JSONSchemaPropsOrStringArrayBuilder() - .withProperty("a", "b") - .build()) - .build()); + .withType("object") + .addToDependencies( + "foo", + new JSONSchemaPropsOrStringArrayBuilder() + .withProperty("a", "b") + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTrue() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/dependencies_array.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/dependencies_array.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .addToDependencies( - "foo", - new JSONSchemaPropsOrStringArrayBuilder() - .withProperty("a", "b") - .build()) - .build()); + .withType("object") + .addToDependencies( + "foo", + new JSONSchemaPropsOrStringArrayBuilder() + .withProperty("a", "b") + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } @@ -67,33 +68,34 @@ void itDeserializesAdditionalPropertiesTyped() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .addToDependencies( - "foo", - new JSONSchemaPropsOrStringArrayBuilder() - .withNewSchema() - .withType("object") - .endSchema() - .build()) - .build()); + .withType("object") + .addToDependencies( + "foo", + new JSONSchemaPropsOrStringArrayBuilder() + .withNewSchema() + .withType("object") + .endSchema() + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTyped() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/dependencies_typed.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/dependencies_typed.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .addToDependencies( - "foo", - new JSONSchemaPropsOrStringArrayBuilder() - .withNewSchema() - .withType("object") - .endSchema() - .build()) - .build()); + .withType("object") + .addToDependencies( + "foo", + new JSONSchemaPropsOrStringArrayBuilder() + .withNewSchema() + .withType("object") + .endSchema() + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/CustomResourceDefinitionTest.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/CustomResourceDefinitionTest.java index d8482cf635e..3fdfc29f985 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/CustomResourceDefinitionTest.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/CustomResourceDefinitionTest.java @@ -35,27 +35,28 @@ class CustomResourceDefinitionTest { @Test public void testBuilder() { CustomResourceDefinition crd = new io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionBuilder() - .withApiVersion("apiextensions.k8s.io/v1beta1") - .withNewMetadata() - .withName("itests.examples.fabric8.io") - .endMetadata() - .withNewSpec() - .withGroup("examples.fabric8.io") - .withVersion("v1") - .addAllToVersions(Collections.singletonList(new io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionBuilder() - .withName("v1") - .withServed(true) - .withStorage(true) - .build())) - .withScope("Namespaced") - .withNewNames() - .withPlural("itests") - .withSingular("itest") - .withKind("Itest") - .withShortNames("it") - .endNames() - .endSpec() - .build(); + .withApiVersion("apiextensions.k8s.io/v1beta1") + .withNewMetadata() + .withName("itests.examples.fabric8.io") + .endMetadata() + .withNewSpec() + .withGroup("examples.fabric8.io") + .withVersion("v1") + .addAllToVersions(Collections + .singletonList(new io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinitionVersionBuilder() + .withName("v1") + .withServed(true) + .withStorage(true) + .build())) + .withScope("Namespaced") + .withNewNames() + .withPlural("itests") + .withSingular("itest") + .withKind("Itest") + .withShortNames("it") + .endNames() + .endSpec() + .build(); assertEquals("itests.examples.fabric8.io", crd.getMetadata().getName()); assertEquals("examples.fabric8.io", crd.getSpec().getGroup()); @@ -69,12 +70,13 @@ void testLoadFromJsonSchemaPropsOrBool() throws JsonProcessingException { final String originalJson = Helper.loadJson("/valid-crd.json"); // when - final CustomResourceDefinition customResourceDefinition = objectMapper.readValue(originalJson, CustomResourceDefinition.class); + final CustomResourceDefinition customResourceDefinition = objectMapper.readValue(originalJson, + CustomResourceDefinition.class); final String serializedJson = objectMapper.writeValueAsString(customResourceDefinition); // then assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS) - .isEqualTo(originalJson); + .isEqualTo(originalJson); } @Test @@ -91,7 +93,7 @@ void testLoadFromJsonSchemaPropsOrArray() throws JsonProcessingException { // then assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS) - .isEqualTo(jsonString); + .isEqualTo(jsonString); } @Test @@ -108,6 +110,6 @@ void testLoadFromJsonSchemaPropsOrStringArray() throws JsonProcessingException { // then assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS) - .isEqualTo(jsonString); + .isEqualTo(jsonString); } } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrArrayTest.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrArrayTest.java index 91972c9637c..b7d0fd88e07 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrArrayTest.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrArrayTest.java @@ -16,6 +16,11 @@ package io.fabric8.kubernetes.api.model.apiextensions.v1beta1; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -23,12 +28,6 @@ import java.nio.charset.StandardCharsets; import java.util.stream.Collectors; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - class JSONSchemaPropsOrArrayTest { @Test void itDeserializesAdditionalPropertiesTrue() throws IOException { @@ -36,29 +35,30 @@ void itDeserializesAdditionalPropertiesTrue() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .withItems(new JSONSchemaPropsOrArrayBuilder() - .withJSONSchemas( - new JSONSchemaPropsBuilder().withType("object").build(), - new JSONSchemaPropsBuilder().withType("string").build()) - .build()) - .build()); + .withType("object") + .withItems(new JSONSchemaPropsOrArrayBuilder() + .withJSONSchemas( + new JSONSchemaPropsBuilder().withType("object").build(), + new JSONSchemaPropsBuilder().withType("string").build()) + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTrue() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/items_array.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/items_array.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .withItems(new JSONSchemaPropsOrArrayBuilder() - .withJSONSchemas( - new JSONSchemaPropsBuilder().withType("object").build(), - new JSONSchemaPropsBuilder().withType("string").build()) - .build()) - .build()); + .withType("object") + .withItems(new JSONSchemaPropsOrArrayBuilder() + .withJSONSchemas( + new JSONSchemaPropsBuilder().withType("object").build(), + new JSONSchemaPropsBuilder().withType("string").build()) + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } @@ -69,21 +69,24 @@ void itDeserializesAdditionalPropertiesTyped() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .withItems(new JSONSchemaPropsOrArrayBuilder().withSchema(new JSONSchemaPropsBuilder().withType("object").build()).build()) - .build()); + .withType("object") + .withItems( + new JSONSchemaPropsOrArrayBuilder().withSchema(new JSONSchemaPropsBuilder().withType("object").build()).build()) + .build()); } @Test void itSerializesAdditionalPropertiesTyped() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/items_typed.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/items_typed.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .withItems(new JSONSchemaPropsOrArrayBuilder().withSchema(new JSONSchemaPropsBuilder().withType("object").build()).build()) - .build()); + .withType("object") + .withItems( + new JSONSchemaPropsOrArrayBuilder().withSchema(new JSONSchemaPropsBuilder().withType("object").build()).build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrBoolTest.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrBoolTest.java index 0e156e95d9c..9082e6ff1d1 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrBoolTest.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrBoolTest.java @@ -16,6 +16,11 @@ package io.fabric8.kubernetes.api.model.apiextensions.v1beta1; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -23,15 +28,6 @@ import java.nio.charset.StandardCharsets; import java.util.stream.Collectors; -import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.JSONSchemaProps; -import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.JSONSchemaPropsBuilder; -import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.JSONSchemaPropsOrBoolBuilder; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - class JSONSchemaPropsOrBoolTest { @Test @@ -40,25 +36,26 @@ void itDeserializesAdditionalPropertiesTrue() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() - .withAllows(true) - .build()) - .build()); + .withType("object") + .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() + .withAllows(true) + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTrue() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_true.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_true.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() - .withAllows(true) - .build()) - .build()); + .withType("object") + .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() + .withAllows(true) + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } @@ -69,26 +66,27 @@ void itDeserializesAdditionalPropertiesTyped() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() - .withAllows(true) - .withNewSchema().withType("string").endSchema() - .build()) - .build()); + .withType("object") + .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() + .withAllows(true) + .withNewSchema().withType("string").endSchema() + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTyped() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_typed.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/additionalproperties_typed.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() - .withNewSchema().withType("string").endSchema() - .build()) - .build()); + .withType("object") + .withAdditionalProperties(new JSONSchemaPropsOrBoolBuilder() + .withNewSchema().withType("string").endSchema() + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } diff --git a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrStringArrayTest.java b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrStringArrayTest.java index 3093e77c209..47b4bcd3685 100644 --- a/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrStringArrayTest.java +++ b/kubernetes-model-generator/kubernetes-model-apiextensions/src/test/java/io/fabric8/kubernetes/api/model/apiextensions/v1beta1/JSONSchemaPropsOrStringArrayTest.java @@ -15,6 +15,11 @@ */ package io.fabric8.kubernetes.api.model.apiextensions.v1beta1; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -22,12 +27,6 @@ import java.nio.charset.StandardCharsets; import java.util.stream.Collectors; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - class JSONSchemaPropsOrStringArrayTest { @Test void itDeserializesAdditionalPropertiesTrue() throws IOException { @@ -35,29 +34,30 @@ void itDeserializesAdditionalPropertiesTrue() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .addToDependencies( - "foo", - new JSONSchemaPropsOrStringArrayBuilder() - .withProperty("a", "b") - .build()) - .build()); + .withType("object") + .addToDependencies( + "foo", + new JSONSchemaPropsOrStringArrayBuilder() + .withProperty("a", "b") + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTrue() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/dependencies_array.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/dependencies_array.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .addToDependencies( - "foo", - new JSONSchemaPropsOrStringArrayBuilder() - .withProperty("a", "b") - .build()) - .build()); + .withType("object") + .addToDependencies( + "foo", + new JSONSchemaPropsOrStringArrayBuilder() + .withProperty("a", "b") + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } @@ -68,33 +68,34 @@ void itDeserializesAdditionalPropertiesTyped() throws IOException { JSONSchemaProps props = new ObjectMapper().readValue(resourceAsStream, JSONSchemaProps.class); Assertions.assertEquals(props, new JSONSchemaPropsBuilder() - .withType("object") - .addToDependencies( - "foo", - new JSONSchemaPropsOrStringArrayBuilder() - .withNewSchema() - .withType("object") - .endSchema() - .build()) - .build()); + .withType("object") + .addToDependencies( + "foo", + new JSONSchemaPropsOrStringArrayBuilder() + .withNewSchema() + .withType("object") + .endSchema() + .build()) + .build()); } @Test void itSerializesAdditionalPropertiesTyped() throws JsonProcessingException { - String expectedJson = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("/dependencies_typed.json"), StandardCharsets.UTF_8)) - .lines() - .collect(Collectors.joining("\n")); + String expectedJson = new BufferedReader( + new InputStreamReader(getClass().getResourceAsStream("/dependencies_typed.json"), StandardCharsets.UTF_8)) + .lines() + .collect(Collectors.joining("\n")); String outputJson = new ObjectMapper().writeValueAsString(new JSONSchemaPropsBuilder() - .withType("object") - .addToDependencies( - "foo", - new JSONSchemaPropsOrStringArrayBuilder() - .withNewSchema() - .withType("object") - .endSchema() - .build()) - .build()); + .withType("object") + .addToDependencies( + "foo", + new JSONSchemaPropsOrStringArrayBuilder() + .withNewSchema() + .withType("object") + .endSchema() + .build()) + .build()); Assertions.assertEquals(expectedJson, outputJson); } diff --git a/kubernetes-model-generator/kubernetes-model-autoscaling/src/test/java/io/fabric8/kubernetes/api/model/autoscaling/HorizontalPodAutoscalerTest.java b/kubernetes-model-generator/kubernetes-model-autoscaling/src/test/java/io/fabric8/kubernetes/api/model/autoscaling/HorizontalPodAutoscalerTest.java index aab4502b8f4..0b8f50a7af3 100644 --- a/kubernetes-model-generator/kubernetes-model-autoscaling/src/test/java/io/fabric8/kubernetes/api/model/autoscaling/HorizontalPodAutoscalerTest.java +++ b/kubernetes-model-generator/kubernetes-model-autoscaling/src/test/java/io/fabric8/kubernetes/api/model/autoscaling/HorizontalPodAutoscalerTest.java @@ -15,10 +15,10 @@ */ package io.fabric8.kubernetes.api.model.autoscaling; -import org.junit.jupiter.api.Test; import io.fabric8.kubernetes.api.model.autoscaling.v2beta2.HorizontalPodAutoscaler; -import io.fabric8.kubernetes.api.model.autoscaling.v2beta2.MetricSpecBuilder; import io.fabric8.kubernetes.api.model.autoscaling.v2beta2.HorizontalPodAutoscalerBuilder; +import io.fabric8.kubernetes.api.model.autoscaling.v2beta2.MetricSpecBuilder; +import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -26,27 +26,27 @@ public class HorizontalPodAutoscalerTest { @Test public void testBuilder() { HorizontalPodAutoscaler horizontalPodAutoscaler = new HorizontalPodAutoscalerBuilder() - .withNewMetadata().withName("the-hpa").withNamespace("default").endMetadata() - .withNewSpec() - .withNewScaleTargetRef() - .withApiVersion("apps/v1") - .withKind("Deployment") - .withName("the-deployment") - .endScaleTargetRef() - .withMinReplicas(1) - .withMaxReplicas(10) - .addToMetrics(new MetricSpecBuilder() - .withType("Resource") - .withNewResource() - .withName("cpu") - .withNewTarget() - .withType("Utilization") - .withAverageUtilization(50) - .endTarget() - .endResource() - .build()) - .endSpec() - .build(); + .withNewMetadata().withName("the-hpa").withNamespace("default").endMetadata() + .withNewSpec() + .withNewScaleTargetRef() + .withApiVersion("apps/v1") + .withKind("Deployment") + .withName("the-deployment") + .endScaleTargetRef() + .withMinReplicas(1) + .withMaxReplicas(10) + .addToMetrics(new MetricSpecBuilder() + .withType("Resource") + .withNewResource() + .withName("cpu") + .withNewTarget() + .withType("Utilization") + .withAverageUtilization(50) + .endTarget() + .endResource() + .build()) + .endSpec() + .build(); assertEquals("the-hpa", horizontalPodAutoscaler.getMetadata().getName()); assertEquals(1, horizontalPodAutoscaler.getSpec().getMetrics().size()); diff --git a/kubernetes-model-generator/kubernetes-model-batch/src/test/java/io/fabric8/kubernetes/api/model/batch/v1/JobTest.java b/kubernetes-model-generator/kubernetes-model-batch/src/test/java/io/fabric8/kubernetes/api/model/batch/v1/JobTest.java index af8b5be9e5d..637840b9c75 100644 --- a/kubernetes-model-generator/kubernetes-model-batch/src/test/java/io/fabric8/kubernetes/api/model/batch/v1/JobTest.java +++ b/kubernetes-model-generator/kubernetes-model-batch/src/test/java/io/fabric8/kubernetes/api/model/batch/v1/JobTest.java @@ -16,7 +16,7 @@ package io.fabric8.kubernetes.api.model.batch.v1; import org.junit.jupiter.api.Test; -import io.fabric8.kubernetes.api.model.batch.v1.JobBuilder; + import java.util.Collections; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -25,25 +25,25 @@ public class JobTest { @Test public void testBuilder() { final Job job = new JobBuilder() - .withApiVersion("batch/v1") - .withNewMetadata() - .withName("pi") - .withLabels(Collections.singletonMap("label1", "maximum-length-of-63-characters")) - .withAnnotations(Collections.singletonMap("annotation1", "some-very-long-annotation")) - .endMetadata() - .withNewSpec() - .withNewTemplate() - .withNewSpec() - .addNewContainer() - .withName("pi") - .withImage("perl") - .withArgs("perl", "-Mbignum=bpi", "-wle", "print bpi(2000)") - .endContainer() - .withRestartPolicy("Never") - .endSpec() - .endTemplate() - .endSpec() - .build(); + .withApiVersion("batch/v1") + .withNewMetadata() + .withName("pi") + .withLabels(Collections.singletonMap("label1", "maximum-length-of-63-characters")) + .withAnnotations(Collections.singletonMap("annotation1", "some-very-long-annotation")) + .endMetadata() + .withNewSpec() + .withNewTemplate() + .withNewSpec() + .addNewContainer() + .withName("pi") + .withImage("perl") + .withArgs("perl", "-Mbignum=bpi", "-wle", "print bpi(2000)") + .endContainer() + .withRestartPolicy("Never") + .endSpec() + .endTemplate() + .endSpec() + .build(); assertEquals("pi", job.getMetadata().getName()); assertEquals(1, job.getSpec().getTemplate().getSpec().getContainers().size()); diff --git a/kubernetes-model-generator/kubernetes-model-certificates/src/test/java/io/fabric8/kubernetes/api/model/certificates/v1/CertificateSigningRequestTest.java b/kubernetes-model-generator/kubernetes-model-certificates/src/test/java/io/fabric8/kubernetes/api/model/certificates/v1/CertificateSigningRequestTest.java index fa3b539efd3..470212c7d54 100644 --- a/kubernetes-model-generator/kubernetes-model-certificates/src/test/java/io/fabric8/kubernetes/api/model/certificates/v1/CertificateSigningRequestTest.java +++ b/kubernetes-model-generator/kubernetes-model-certificates/src/test/java/io/fabric8/kubernetes/api/model/certificates/v1/CertificateSigningRequestTest.java @@ -23,12 +23,12 @@ class CertificateSigningRequestTest { @Test void testBuilder() { CertificateSigningRequest csr = new io.fabric8.kubernetes.api.model.certificates.v1.CertificateSigningRequestBuilder() - .withNewMetadata().withName("my-svc.my-namespace").endMetadata() - .withNewSpec() - .withRequest("$(cat server.csr | base64 | tr -d '\\n')") - .addToUsages("digital signature", "key encipherment", "server auth") - .endSpec() - .build(); + .withNewMetadata().withName("my-svc.my-namespace").endMetadata() + .withNewSpec() + .withRequest("$(cat server.csr | base64 | tr -d '\\n')") + .addToUsages("digital signature", "key encipherment", "server auth") + .endSpec() + .build(); assertEquals("my-svc.my-namespace", csr.getMetadata().getName()); assertEquals("$(cat server.csr | base64 | tr -d '\\n')", csr.getSpec().getRequest()); diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/Scope.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/Scope.java index ed9db6d6df4..0fd2cd587ca 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/Scope.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/Scope.java @@ -20,7 +20,8 @@ * are visible within the confines of a given namespace. */ public enum Scope { - NAMESPACED("Namespaced"), CLUSTER("Cluster"); + NAMESPACED("Namespaced"), + CLUSTER("Cluster"); private final String value; diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Generated.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Generated.java index 73b2458e34b..0a98c681b81 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Generated.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Generated.java @@ -15,39 +15,38 @@ */ package io.fabric8.kubernetes.model.annotation; +import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; import static java.lang.annotation.ElementType.*; import static java.lang.annotation.RetentionPolicy.SOURCE; -import java.lang.annotation.Documented; - /** - * Drop-in replacement for javax.annotation.Generated, meant to be used itnernally to avoid bringin in the whole jar. - */ + * Drop-in replacement for javax.annotation.Generated, meant to be used itnernally to avoid bringin in the whole jar. + */ @Documented @Retention(SOURCE) -@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD, - LOCAL_VARIABLE, PARAMETER}) +@Target({ PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD, + LOCAL_VARIABLE, PARAMETER }) public @interface Generated { /** - * The value element must have the name of the code generator. - * The recommended convention is to use the fully qualified name of the - * code generator. For example: com.acme.generator.CodeGen. - */ - String[] value(); + * The value element must have the name of the code generator. + * The recommended convention is to use the fully qualified name of the + * code generator. For example: com.acme.generator.CodeGen. + */ + String[] value(); - /** - * Date when the source was generated. - */ - String date() default ""; + /** + * Date when the source was generated. + */ + String date() default ""; - /** - * A place holder for any comments that the code generator may want to - * include in the generated code. - */ - String comments() default ""; + /** + * A place holder for any comments that the code generator may want to + * include in the generated code. + */ + String comments() default ""; } diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Kind.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Kind.java index 03e374b7716..eac888d4fd0 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Kind.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Kind.java @@ -25,7 +25,7 @@ * Allows to specify which {@code Kind} value should be used to refer to instance of the annotated class. If not provided, * a default value is computed based on the annotated class name. See HasMetadata#getKind for more details. */ -@Target({TYPE}) +@Target({ TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface Kind { String value(); diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/LabelSelector.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/LabelSelector.java index f29272ffbb2..69105f3ae17 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/LabelSelector.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/LabelSelector.java @@ -23,5 +23,5 @@ @Target({ ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface LabelSelector { - + } diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Plural.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Plural.java index b3781857bb4..7c181a4ecee 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Plural.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Plural.java @@ -25,7 +25,7 @@ * Allows to specify the plural form associated with a Custom Resource. If not provided, it will default to a computed value. * See CustomResource#getPlural for more details. */ -@Target({TYPE}) +@Target({ TYPE }) @Retention(RUNTIME) public @interface Plural { String value(); diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/PrinterColumn.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/PrinterColumn.java index 9638f0b43d2..b049bfdf64f 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/PrinterColumn.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/PrinterColumn.java @@ -23,16 +23,18 @@ @Target({ ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface PrinterColumn { - + /** * The name of the column. * An empty column name implies the use of the property name + * * @return the column name, or empty string if the annotated property name should be used. */ String name() default ""; /** * The printer column format. + * * @return the format or empty string if no format is specified. */ String format() default ""; diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/ShortNames.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/ShortNames.java index 7361535fd12..1756bb45029 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/ShortNames.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/ShortNames.java @@ -22,13 +22,14 @@ import static java.lang.annotation.ElementType.TYPE; /** - * Specifies which are the short names associated by which instances of the annotated `CustomResource` can be referred to. + * Specifies which are the short names associated by which instances of the annotated `CustomResource` can be referred to. */ -@Target({TYPE}) +@Target({ TYPE }) @Retention(RetentionPolicy.RUNTIME) public @interface ShortNames { /** * The array of possible short names + * * @return possible short names */ String[] value() default {}; diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Singular.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Singular.java index 4af66a547f9..ee891eb233f 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Singular.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/Singular.java @@ -21,7 +21,7 @@ import static java.lang.annotation.ElementType.TYPE; import static java.lang.annotation.RetentionPolicy.RUNTIME; -@Target({TYPE}) +@Target({ TYPE }) @Retention(RUNTIME) public @interface Singular { String value(); diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/SpecReplicas.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/SpecReplicas.java index 3ccf1d388f6..a4fdb7fce02 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/SpecReplicas.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/SpecReplicas.java @@ -23,5 +23,5 @@ @Target({ ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface SpecReplicas { - + } diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/StatusReplicas.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/StatusReplicas.java index ae87e81a39c..d6f2b1d5986 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/StatusReplicas.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/annotation/StatusReplicas.java @@ -23,5 +23,5 @@ @Target({ ElementType.FIELD }) @Retention(RetentionPolicy.RUNTIME) public @interface StatusReplicas { - + } diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/jackson/JsonUnwrappedDeserializer.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/jackson/JsonUnwrappedDeserializer.java index 473d7b0d3bc..1c937bf3a83 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/jackson/JsonUnwrappedDeserializer.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/jackson/JsonUnwrappedDeserializer.java @@ -15,13 +15,6 @@ */ package io.fabric8.kubernetes.model.jackson; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - import com.fasterxml.jackson.annotation.JsonUnwrapped; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.BeanDescription; @@ -38,6 +31,13 @@ import com.fasterxml.jackson.databind.node.TreeTraversingParser; import com.fasterxml.jackson.databind.util.NameTransformer; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + /** * Desc: this is a workaround on the problem that Jackson's @JsonUnwrapped doesn't work with * polymorphism (@JsonTypeInfo) @@ -72,19 +72,20 @@ public JsonUnwrappedDeserializer(DeserializationContext deserializationContext) BeanDescription description = deserializationContext.getConfig().introspect(type); - final JsonUnwrapped[] tempUnwrappedAnnotation = {null}; - - List unwrappedProperties = description.findProperties().stream().filter(prop -> - Arrays.asList(prop.getConstructorParameter(), prop.getMutator(), prop.getField()).stream() - .filter(Objects::nonNull) - .anyMatch(member -> { - JsonUnwrapped unwrappedAnnotation = member.getAnnotation(JsonUnwrapped.class); - if (unwrappedAnnotation != null) { - tempUnwrappedAnnotation[0] = unwrappedAnnotation; - member.getAllAnnotations().add(cancelUnwrappedAnnotation); - } - return unwrappedAnnotation != null; - })).collect(Collectors.toList()); + final JsonUnwrapped[] tempUnwrappedAnnotation = { null }; + + List unwrappedProperties = description.findProperties().stream() + .filter(prop -> Arrays.asList(prop.getConstructorParameter(), prop.getMutator(), prop.getField()).stream() + .filter(Objects::nonNull) + .anyMatch(member -> { + JsonUnwrapped unwrappedAnnotation = member.getAnnotation(JsonUnwrapped.class); + if (unwrappedAnnotation != null) { + tempUnwrappedAnnotation[0] = unwrappedAnnotation; + member.getAllAnnotations().add(cancelUnwrappedAnnotation); + } + return unwrappedAnnotation != null; + })) + .collect(Collectors.toList()); if (unwrappedProperties.isEmpty()) { throw new UnsupportedOperationException("@JsonUnwrapped properties not found in " + type.getTypeName()); @@ -94,7 +95,8 @@ public JsonUnwrappedDeserializer(DeserializationContext deserializationContext) BeanPropertyDefinition unwrappedProperty = unwrappedProperties.get(0); - nameTransformer = NameTransformer.simpleTransformer(tempUnwrappedAnnotation[0].prefix(), tempUnwrappedAnnotation[0].suffix()); + nameTransformer = NameTransformer.simpleTransformer(tempUnwrappedAnnotation[0].prefix(), + tempUnwrappedAnnotation[0].suffix()); unwrappedPropertyName = unwrappedProperty.getName(); @@ -102,13 +104,15 @@ public JsonUnwrappedDeserializer(DeserializationContext deserializationContext) ownPropertyNames.remove(unwrappedPropertyName); ownPropertyNames.removeAll(description.getIgnoredPropertyNames()); - JsonDeserializer rawBeanDeserializer = deserializationContext.getFactory().createBeanDeserializer(deserializationContext, type, description); + JsonDeserializer rawBeanDeserializer = deserializationContext.getFactory() + .createBeanDeserializer(deserializationContext, type, description); ((ResolvableDeserializer) rawBeanDeserializer).resolve(deserializationContext); beanDeserializer = (JsonDeserializer) rawBeanDeserializer; } @Override - public JsonDeserializer createContextual(DeserializationContext deserializationContext, BeanProperty beanProperty) throws JsonMappingException { + public JsonDeserializer createContextual(DeserializationContext deserializationContext, BeanProperty beanProperty) + throws JsonMappingException { return new JsonUnwrappedDeserializer<>(deserializationContext); } diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/jackson/UnwrappedTypeResolverBuilder.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/jackson/UnwrappedTypeResolverBuilder.java index 175f46a9692..7d22eec7214 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/jackson/UnwrappedTypeResolverBuilder.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/jackson/UnwrappedTypeResolverBuilder.java @@ -15,18 +15,18 @@ */ package io.fabric8.kubernetes.model.jackson; -import java.util.Collection; - import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.SerializationConfig; import com.fasterxml.jackson.databind.jsontype.NamedType; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.jsontype.impl.StdTypeResolverBuilder; +import java.util.Collection; + public class UnwrappedTypeResolverBuilder extends StdTypeResolverBuilder { @Override public TypeSerializer buildTypeSerializer(SerializationConfig config, JavaType baseType, - Collection subtypes) { + Collection subtypes) { // To force Jackson to go through all the properties return null; } diff --git a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/util/Helper.java b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/util/Helper.java index 8da55200ca6..e3c05a6e0b1 100644 --- a/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/util/Helper.java +++ b/kubernetes-model-generator/kubernetes-model-common/src/main/java/io/fabric8/kubernetes/model/util/Helper.java @@ -28,15 +28,15 @@ public class Helper { private Helper() { throw new IllegalStateException("Utility class"); } - public static String loadJson(String path) { - try (InputStream resourceAsStream = Helper.class.getResourceAsStream(path)) { - final Scanner scanner = new Scanner(resourceAsStream).useDelimiter("\\A"); - return scanner.hasNext() ? scanner.next() : ""; - } catch (IOException e) { - throw new RuntimeException(e); - } - } + public static String loadJson(String path) { + try (InputStream resourceAsStream = Helper.class.getResourceAsStream(path)) { + final Scanner scanner = new Scanner(resourceAsStream).useDelimiter("\\A"); + return scanner.hasNext() ? scanner.next() : ""; + } catch (IOException e) { + throw new RuntimeException(e); + } + } public static String getAnnotationValue(Class kubernetesResourceType, Class annotationClass) { Annotation annotation = getAnnotation(kubernetesResourceType, annotationClass); @@ -50,8 +50,8 @@ public static String getAnnotationValue(Class kubernetesResourceType, Class anno private static Annotation getAnnotation(Class kubernetesResourceType, Class annotationClass) { return Arrays.stream(kubernetesResourceType.getAnnotations()) - .filter(annotation -> annotation.annotationType().equals(annotationClass)) - .findFirst() - .orElse(null); + .filter(annotation -> annotation.annotationType().equals(annotationClass)) + .findFirst() + .orElse(null); } } diff --git a/kubernetes-model-generator/kubernetes-model-coordination/src/main/java/io/fabric8/kubernetes/api/model/coordination/v1/LeaseSpec.java b/kubernetes-model-generator/kubernetes-model-coordination/src/main/java/io/fabric8/kubernetes/api/model/coordination/v1/LeaseSpec.java index 97baeac46db..b089165f047 100644 --- a/kubernetes-model-generator/kubernetes-model-coordination/src/main/java/io/fabric8/kubernetes/api/model/coordination/v1/LeaseSpec.java +++ b/kubernetes-model-generator/kubernetes-model-coordination/src/main/java/io/fabric8/kubernetes/api/model/coordination/v1/LeaseSpec.java @@ -36,14 +36,14 @@ @JsonInclude(JsonInclude.Include.NON_NULL) @Generated("org.jsonschema2pojo") @JsonPropertyOrder({ - "apiVersion", - "kind", - "metadata", - "acquireTime", - "holderIdentity", - "leaseDurationSeconds", - "leaseTransitions", - "renewTime" + "apiVersion", + "kind", + "metadata", + "acquireTime", + "holderIdentity", + "leaseDurationSeconds", + "leaseTransitions", + "renewTime" }) @JsonDeserialize(using = com.fasterxml.jackson.databind.JsonDeserializer.None.class) @ToString @@ -74,7 +74,8 @@ public class LeaseSpec implements KubernetesResource { public LeaseSpec() { } - public LeaseSpec(ZonedDateTime acquireTime, String holderIdentity, Integer leaseDurationSeconds, Integer leaseTransitions, ZonedDateTime renewTime) { + public LeaseSpec(ZonedDateTime acquireTime, String holderIdentity, Integer leaseDurationSeconds, Integer leaseTransitions, + ZonedDateTime renewTime) { this.acquireTime = acquireTime; this.holderIdentity = holderIdentity; this.leaseDurationSeconds = leaseDurationSeconds; diff --git a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/DeletionPropagation.java b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/DeletionPropagation.java index 6ddf91fa4a8..ad4b3802b76 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/DeletionPropagation.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/DeletionPropagation.java @@ -34,15 +34,18 @@ public enum DeletionPropagation { /* * The object exists in the key-value store until the garbage collector * deletes all the dependents whose ownerReference.blockOwnerDeletion=true - * from the key-value store. API sever will put the "foregroundDeletion" - * finalizer on the object, and sets its deletionTimestamp. This policy is + * from the key-value store. API sever will put the "foregroundDeletion" + * finalizer on the object, and sets its deletionTimestamp. This policy is * cascading, i.e., the dependents will be deleted with Foreground. */ FOREGROUND("Foreground"); + private final String value; + DeletionPropagation(String value) { this.value = value; } + @Override public String toString() { return value; diff --git a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/Duration.java b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/Duration.java index 78468bbf673..71ade25adff 100644 --- a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/Duration.java +++ b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/Duration.java @@ -39,13 +39,14 @@ import java.util.regex.Pattern; import java.util.stream.Stream; - /** * Duration represents a duration * - *

Duration stores a period of time as a valid {@link java.time.Duration}. + *

+ * Duration stores a period of time as a valid {@link java.time.Duration}. * - * @see github.com/go-openapi/strfmt/duration.go + * @see github.com/go-openapi/strfmt/duration.go */ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonDeserialize @@ -56,7 +57,6 @@ public class Duration implements KubernetesResource { private static final long serialVersionUID = -2326157920610452294L; - private static final String DURATION_REGEX = "(\\d+)\\s*([A-Za-zµ]+)"; private static final Pattern DURATION_PATTERN = Pattern.compile(DURATION_REGEX); private java.time.Duration javaDuration; @@ -107,23 +107,51 @@ public static boolean isDuration(String durationToTest) { * Parses {@link String} into Duration. * * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * *
Valid time abbreviations
AbbreviationTime Unit
ns, nano, nanosNanosecond
us, µs, micro, microsMicroseconds
ms, milli, millisMillisecond
s, sec, secsSecond
m, min, minsMinute
h, hr, hour, hoursHour
d, day, daysDay
w, wk, week, weeksWeek
Valid time abbreviations
AbbreviationTime Unit
ns, nano, nanosNanosecond
us, µs, micro, microsMicroseconds
ms, milli, millisMillisecond
s, sec, secsSecond
m, min, minsMinute
h, hr, hour, hoursHour
d, day, daysDay
w, wk, week, weeksWeek
*
- *

Example: + *

+ * Example: * *

{@code
    *   Duration.parse("1min1s");
@@ -138,11 +166,11 @@ public static Duration parse(String duration) throws ParseException {
     java.time.Duration accumulator = java.time.Duration.ZERO;
     boolean found = false;
     final Matcher matcher = Optional.ofNullable(duration).map(String::trim).map(DURATION_PATTERN::matcher).orElse(null);
-    while(matcher != null && matcher.find()) {
+    while (matcher != null && matcher.find()) {
       found = true;
       final java.time.Duration durationToken = Optional.ofNullable(TimeUnits.from(matcher.group(2)))
-        .map(tu -> java.time.Duration.of(Long.parseLong(matcher.group(1)), tu.timeUnit))
-        .orElseThrow(() -> new ParseException(String.format("Invalid duration token (%s)", matcher.group()), 0));
+          .map(tu -> java.time.Duration.of(Long.parseLong(matcher.group(1)), tu.timeUnit))
+          .orElseThrow(() -> new ParseException(String.format("Invalid duration token (%s)", matcher.group()), 0));
       accumulator = accumulator.plus(durationToken);
     }
     if (!found) {
@@ -180,7 +208,7 @@ private enum TimeUnits {
 
     static TimeUnits from(String abbreviation) {
       return Stream.of(values()).filter(tu -> tu.abbreviations.contains(abbreviation.toLowerCase())).findAny()
-        .orElse(null);
+          .orElse(null);
     }
   }
 
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/HasMetadataComparator.java b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/HasMetadataComparator.java
index 0bd1c2e80f3..19a6f0451aa 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/HasMetadataComparator.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/HasMetadataComparator.java
@@ -15,79 +15,78 @@
  */
 package io.fabric8.kubernetes.api.model;
 
-
 import java.util.Comparator;
 
 public class HasMetadataComparator implements Comparator {
 
-    private Integer getKindValue(String kind) {
-        try {
-            switch (kind) {
-                case "SecurityContextConstraints":
-                    return 0;
-                case "Namespace":
-                case "Project":
-                case "ProjectRequest":
-                    return 1;
-                case "LimitRange":
-                    return 2;
-                case "ResourceQuota":
-                    return 3;
-                case "RoleBindingRestriction":
-                    return 4;
-                case "Secret":
-                    return 12;
-                case "ServiceAccount":
-                    return 13;
-                case "OAuthClient":
-                    return 14;
-                case "Service":
-                    return 15;
-                case "PolicyBinding":
-                    return 16;
-                case "ClusterPolicyBinding":
-                    return 17;
-                case "Role":
-                    return 18;
-                case "RoleBinding":
-                    return 19;
-                case "PersistentVolume":
-                    return 20;
-                case "PersistentVolumeClaim":
-                    return 21;
-                case "ImageStream":
-                    return 30;
-                case "ImageStreamTag":
-                    return 31;
-                default:
-                    return 100;
-            }
-        } catch (IllegalArgumentException e) {
-            return 100;
-        }
+  private Integer getKindValue(String kind) {
+    try {
+      switch (kind) {
+        case "SecurityContextConstraints":
+          return 0;
+        case "Namespace":
+        case "Project":
+        case "ProjectRequest":
+          return 1;
+        case "LimitRange":
+          return 2;
+        case "ResourceQuota":
+          return 3;
+        case "RoleBindingRestriction":
+          return 4;
+        case "Secret":
+          return 12;
+        case "ServiceAccount":
+          return 13;
+        case "OAuthClient":
+          return 14;
+        case "Service":
+          return 15;
+        case "PolicyBinding":
+          return 16;
+        case "ClusterPolicyBinding":
+          return 17;
+        case "Role":
+          return 18;
+        case "RoleBinding":
+          return 19;
+        case "PersistentVolume":
+          return 20;
+        case "PersistentVolumeClaim":
+          return 21;
+        case "ImageStream":
+          return 30;
+        case "ImageStreamTag":
+          return 31;
+        default:
+          return 100;
+      }
+    } catch (IllegalArgumentException e) {
+      return 100;
     }
+  }
 
-    @Override
-    public int compare(HasMetadata a, HasMetadata b) {
-        if (a == null || b == null) {
-            throw new NullPointerException("Cannot compare null HasMetadata objects");
-        }
-        if (a == b || a.equals(b)) {
-            return 0;
-        }
+  @Override
+  public int compare(HasMetadata a, HasMetadata b) {
+    if (a == null || b == null) {
+      throw new NullPointerException("Cannot compare null HasMetadata objects");
+    }
+    if (a == b || a.equals(b)) {
+      return 0;
+    }
 
-        int kindOrderCompare = getKindValue(a.getKind()).compareTo(getKindValue(b.getKind()));
-        if (kindOrderCompare != 0) {
-            return kindOrderCompare;
-        }
+    int kindOrderCompare = getKindValue(a.getKind()).compareTo(getKindValue(b.getKind()));
+    if (kindOrderCompare != 0) {
+      return kindOrderCompare;
+    }
 
-        String classNameA = a.getClass().getSimpleName();
-        String classNameB = b.getClass().getSimpleName();
+    String classNameA = a.getClass().getSimpleName();
+    String classNameB = b.getClass().getSimpleName();
 
-        int classCompare = classNameA.compareTo(classNameB);
-        if (classCompare != 0) {
-            return classCompare;
-        }
-        return a.getMetadata().getName().compareTo(b.getMetadata().getName());
+    int classCompare = classNameA.compareTo(classNameB);
+    if (classCompare != 0) {
+      return classCompare;
     }
+    return a.getMetadata().getName().compareTo(b.getMetadata().getName());
+  }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResource.java b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResource.java
index 8bd76099879..c40e9708d53 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResource.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResource.java
@@ -17,6 +17,7 @@
 
 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
 import io.fabric8.kubernetes.internal.KubernetesDeserializer;
+
 import java.io.Serializable;
 
 @JsonDeserialize(using = KubernetesDeserializer.class)
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResourceList.java b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResourceList.java
index 1d9584bf48e..ddb9f95855e 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResourceList.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/KubernetesResourceList.java
@@ -18,11 +18,11 @@
 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
 import io.fabric8.kubernetes.internal.KubernetesDeserializer;
 
-import java.util.List;
 import java.io.Serializable;
+import java.util.List;
 
 @JsonDeserialize(using = KubernetesDeserializer.class)
-public interface KubernetesResourceList extends Serializable  {
+public interface KubernetesResourceList extends Serializable {
 
   ListMeta getMetadata();
 
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/MicroTimeSerDes.java b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/MicroTimeSerDes.java
index f7d34823763..933026957fb 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/MicroTimeSerDes.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/main/java/io/fabric8/kubernetes/api/model/MicroTimeSerDes.java
@@ -27,7 +27,8 @@
 import java.io.IOException;
 
 public class MicroTimeSerDes {
-  private MicroTimeSerDes() { }
+  private MicroTimeSerDes() {
+  }
 
   public static class Serializer extends JsonSerializer {
     @Override
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/PluralizeTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/PluralizeTest.java
index c681553ddb3..3ebdba89d12 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/PluralizeTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/PluralizeTest.java
@@ -23,7 +23,6 @@
 import java.util.stream.Stream;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
 import static org.junit.jupiter.params.provider.Arguments.arguments;
 
 class PluralizeTest {
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/AdditionalPropertiesTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/AdditionalPropertiesTest.java
index 0d33f0620d0..34eb405d4b4 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/AdditionalPropertiesTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/AdditionalPropertiesTest.java
@@ -23,28 +23,28 @@
 
 class AdditionalPropertiesTest {
 
-    @Test
-    void podBuilderDirectTest() throws Exception {
-        // given new method due to setter
-        PodBuilder builder = new PodBuilder().withNewMetadata().addToAdditionalProperties("x", "y").endMetadata();
-
-        // then
-        Map expected = new HashMap<>();
-        expected.put("x", "y");
-        org.junit.jupiter.api.Assertions.assertEquals(expected, builder.build().getMetadata().getAdditionalProperties());
-    }
-
-    @Test
-    void podBuilderIndirectTest() throws Exception {
-        // given new method due to setter
-        ObjectMeta meta = new ObjectMeta();
-        meta.setAdditionalProperty("x", "y");
-        PodBuilder builder = new PodBuilder().withMetadata(meta);
-
-        // then
-        Map expected = new HashMap<>();
-        expected.put("x", "y");
-        org.junit.jupiter.api.Assertions.assertEquals(expected, builder.build().getMetadata().getAdditionalProperties());
-    }
+  @Test
+  void podBuilderDirectTest() throws Exception {
+    // given new method due to setter
+    PodBuilder builder = new PodBuilder().withNewMetadata().addToAdditionalProperties("x", "y").endMetadata();
+
+    // then
+    Map expected = new HashMap<>();
+    expected.put("x", "y");
+    org.junit.jupiter.api.Assertions.assertEquals(expected, builder.build().getMetadata().getAdditionalProperties());
+  }
+
+  @Test
+  void podBuilderIndirectTest() throws Exception {
+    // given new method due to setter
+    ObjectMeta meta = new ObjectMeta();
+    meta.setAdditionalProperty("x", "y");
+    PodBuilder builder = new PodBuilder().withMetadata(meta);
+
+    // then
+    Map expected = new HashMap<>();
+    expected.put("x", "y");
+    org.junit.jupiter.api.Assertions.assertEquals(expected, builder.build().getMetadata().getAdditionalProperties());
+  }
 
 }
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ConfigMapTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ConfigMapTest.java
index 877887b81e1..8afbaa1e0fb 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ConfigMapTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ConfigMapTest.java
@@ -15,6 +15,12 @@
  */
 package io.fabric8.kubernetes.api.model;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.fabric8.kubernetes.model.util.Helper;
+import org.junit.jupiter.api.Test;
+
+import java.util.HashMap;
+
 import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
 import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS;
 import static net.javacrumbs.jsonunit.core.Option.TREATING_NULL_AS_ABSENT;
@@ -22,54 +28,51 @@
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.fabric8.kubernetes.model.util.Helper;
-import java.util.HashMap;
-import org.junit.jupiter.api.Test;
-
 public class ConfigMapTest {
-    private final ObjectMapper mapper = new ObjectMapper();
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @Test
-    public void configMapTest() throws Exception {
-        // given
-        final String originalJson = Helper.loadJson("/valid-configMap.json");
+  @Test
+  public void configMapTest() throws Exception {
+    // given
+    final String originalJson = Helper.loadJson("/valid-configMap.json");
 
-        // when
-        final ConfigMap configMap = mapper.readValue(originalJson, ConfigMap.class);
-        final String serializedJson = mapper.writeValueAsString(configMap);
+    // when
+    final ConfigMap configMap = mapper.readValue(originalJson, ConfigMap.class);
+    final String serializedJson = mapper.writeValueAsString(configMap);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
-    }
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
+  }
 
-    @Test
-    public void configMapBuilderTest() {
+  @Test
+  public void configMapBuilderTest() {
 
-        ConfigMap configMap = new io.fabric8.kubernetes.api.model.ConfigMapBuilder()
-                .withNewMetadata()
-                .withName("game-config")
-                .endMetadata()
-                .withData(
-                        new HashMap() {{
-                            put("game.properties", "enemies=aliens\nlives=3\nsecret.code.lives=30");
-                            put("ui.properties", "color.good=purple\ncolor.bad=yellow\n");
-                            put("special.how", "test1");
-                            put("special.type", "test2");
-                            put("example.property.file", "property.1=value-1\nproperty.2=value-2\nproperty.3=value-3");
-                        }}
-                )
-                .build();
+    ConfigMap configMap = new io.fabric8.kubernetes.api.model.ConfigMapBuilder()
+        .withNewMetadata()
+        .withName("game-config")
+        .endMetadata()
+        .withData(
+            new HashMap() {
+              {
+                put("game.properties", "enemies=aliens\nlives=3\nsecret.code.lives=30");
+                put("ui.properties", "color.good=purple\ncolor.bad=yellow\n");
+                put("special.how", "test1");
+                put("special.type", "test2");
+                put("example.property.file", "property.1=value-1\nproperty.2=value-2\nproperty.3=value-3");
+              }
+            })
+        .build();
 
-        assertNotNull(configMap);
-        assertEquals("game-config", configMap.getMetadata().getName());
-        assertEquals(5,configMap.getData().size());
-        assertEquals("enemies=aliens\nlives=3\nsecret.code.lives=30", configMap.getData().get("game.properties"));
-        assertEquals("color.good=purple\ncolor.bad=yellow\n", configMap.getData().get("ui.properties"));
-        assertEquals("test1", configMap.getData().get("special.how"));
-        assertEquals("test2", configMap.getData().get("special.type"));
-        assertEquals("property.1=value-1\nproperty.2=value-2\nproperty.3=value-3", configMap.getData().get("example.property.file"));
+    assertNotNull(configMap);
+    assertEquals("game-config", configMap.getMetadata().getName());
+    assertEquals(5, configMap.getData().size());
+    assertEquals("enemies=aliens\nlives=3\nsecret.code.lives=30", configMap.getData().get("game.properties"));
+    assertEquals("color.good=purple\ncolor.bad=yellow\n", configMap.getData().get("ui.properties"));
+    assertEquals("test1", configMap.getData().get("special.how"));
+    assertEquals("test2", configMap.getData().get("special.type"));
+    assertEquals("property.1=value-1\nproperty.2=value-2\nproperty.3=value-3",
+        configMap.getData().get("example.property.file"));
 
-    }
+  }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/EventTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/EventTest.java
index b7f7e034116..3a82bde3d14 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/EventTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/EventTest.java
@@ -39,6 +39,6 @@ void testEventSerializationDeserialization() throws JsonProcessingException {
 
     // then
     assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-      .isEqualTo(originalJson);
+        .isEqualTo(originalJson);
   }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/GenericKubernetesResourceListTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/GenericKubernetesResourceListTest.java
index 1851d751d1e..c25ec2fbc57 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/GenericKubernetesResourceListTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/GenericKubernetesResourceListTest.java
@@ -44,12 +44,13 @@ void serializeWithEmptyItems() {
     gkrl.setKind("SomeCustomResource");
     gkrl.setItems(Collections.emptyList());
     // When
-    final Map result = objectMapper.convertValue(gkrl, new TypeReference>() {});
+    final Map result = objectMapper.convertValue(gkrl, new TypeReference>() {
+    });
     // Then
     assertThat(result)
-      .hasFieldOrPropertyWithValue("apiVersion", "the-cr.example.com/v1")
-      .hasFieldOrPropertyWithValue("kind", "SomeCustomResource")
-      .hasFieldOrPropertyWithValue("items", Collections.emptyList());
+        .hasFieldOrPropertyWithValue("apiVersion", "the-cr.example.com/v1")
+        .hasFieldOrPropertyWithValue("kind", "SomeCustomResource")
+        .hasFieldOrPropertyWithValue("items", Collections.emptyList());
   }
 
   @Test
@@ -57,16 +58,16 @@ void serializeWithEmptyItems() {
   void deserializeWithEmptyItems() throws Exception {
     // Given
     final String list = "{" +
-      "\"apiVersion\": \"v1\"," +
-      "\"items\": []," +
-      "\"kind\": \"List\"" +
-      "}";
+        "\"apiVersion\": \"v1\"," +
+        "\"items\": []," +
+        "\"kind\": \"List\"" +
+        "}";
     // When
     final GenericKubernetesResourceList result = objectMapper.readValue(list, GenericKubernetesResourceList.class);
     // Then
     assertThat(result)
-      .hasFieldOrPropertyWithValue("apiVersion", "v1")
-      .hasFieldOrPropertyWithValue("kind", "List")
-      .hasFieldOrPropertyWithValue("items", Collections.emptyList());
+        .hasFieldOrPropertyWithValue("apiVersion", "v1")
+        .hasFieldOrPropertyWithValue("kind", "List")
+        .hasFieldOrPropertyWithValue("items", Collections.emptyList());
   }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/GenericKubernetesResourceTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/GenericKubernetesResourceTest.java
index c92427cdeff..63510c67d16 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/GenericKubernetesResourceTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/GenericKubernetesResourceTest.java
@@ -43,7 +43,7 @@ void setUp() {
   void deserializeWithEmptyShouldDeserializeEmpty() throws Exception {
     // When
     final GenericKubernetesResource result = objectMapper
-      .readValue(load("empty.json"), GenericKubernetesResource.class);
+        .readValue(load("empty.json"), GenericKubernetesResource.class);
     // Then
     assertThat(result).isEqualTo(new GenericKubernetesResource());
   }
@@ -55,12 +55,12 @@ void deserializeWithConfigMapStructureShouldDeserializeLikeConfigMap() throws Ex
     final ConfigMap configMap = objectMapper.readValue(load("config-map.json"), ConfigMap.class);
     // When
     final GenericKubernetesResource result = objectMapper
-      .readValue(load("config-map.json"), GenericKubernetesResource.class);
+        .readValue(load("config-map.json"), GenericKubernetesResource.class);
     // Then
     assertThat(result)
-      .hasFieldOrPropertyWithValue("metadata.namespace", "default")
-      .hasFieldOrPropertyWithValue("metadata.name", "generic-resource-test")
-      .hasFieldOrPropertyWithValue("additionalProperties.data", configMap.getData());
+        .hasFieldOrPropertyWithValue("metadata.namespace", "default")
+        .hasFieldOrPropertyWithValue("metadata.name", "generic-resource-test")
+        .hasFieldOrPropertyWithValue("additionalProperties.data", configMap.getData());
   }
 
   @Test
@@ -68,14 +68,14 @@ void deserializeWithConfigMapStructureShouldDeserializeLikeConfigMap() throws Ex
   void deserializeWithCustomResourceShouldDeserialize() throws Exception {
     // When
     final GenericKubernetesResource result = objectMapper
-      .readValue(load("custom-resource.json"), GenericKubernetesResource.class);
+        .readValue(load("custom-resource.json"), GenericKubernetesResource.class);
     // Then
     assertThat(result)
-      .hasFieldOrPropertyWithValue("apiVersion", "the-cr.example.com/v1")
-      .hasFieldOrPropertyWithValue("Kind", "SomeCustomResource")
-      .hasFieldOrPropertyWithValue("metadata.name", "custom-resource-example")
-      .hasFieldOrPropertyWithValue("additionalProperties.spec.field", "value")
-      .hasFieldOrPropertyWithValue("additionalProperties.status.reconciled", true);
+        .hasFieldOrPropertyWithValue("apiVersion", "the-cr.example.com/v1")
+        .hasFieldOrPropertyWithValue("Kind", "SomeCustomResource")
+        .hasFieldOrPropertyWithValue("metadata.name", "custom-resource-example")
+        .hasFieldOrPropertyWithValue("additionalProperties.spec.field", "value")
+        .hasFieldOrPropertyWithValue("additionalProperties.status.reconciled", true);
   }
 
   @Test
@@ -88,12 +88,13 @@ void serializeWithCustomResourceShouldSerialize() {
     gkr.setMetadata(new ObjectMetaBuilder().withName("custom-resource-example").build());
     gkr.setAdditionalProperties(Collections.singletonMap("spec", Collections.singletonMap("field", "value")));
     // When
-    final Map result = objectMapper.convertValue(gkr, new TypeReference>() {});
+    final Map result = objectMapper.convertValue(gkr, new TypeReference>() {
+    });
     // Then
     assertThat(result)
-      .hasFieldOrPropertyWithValue("kind", "SomeCustomResource")
-      .hasFieldOrPropertyWithValue("metadata.name", "custom-resource-example")
-      .hasFieldOrPropertyWithValue("spec.field", "value");
+        .hasFieldOrPropertyWithValue("kind", "SomeCustomResource")
+        .hasFieldOrPropertyWithValue("metadata.name", "custom-resource-example")
+        .hasFieldOrPropertyWithValue("spec.field", "value");
   }
 
   @Test
@@ -110,12 +111,12 @@ void equality() {
     final GenericKubernetesResource gkr1 = objectMapper.convertValue(gkr, GenericKubernetesResource.class);
     // Then
     assertThat(gkr)
-      .isEqualTo(gkr1);
+        .isEqualTo(gkr1);
 
     gkr1.getAdditionalProperties().put("key", "value");
 
     assertThat(gkr)
-      .isNotEqualTo(gkr1);
+        .isNotEqualTo(gkr1);
   }
 
   @Test
@@ -123,19 +124,19 @@ void equality() {
   void builder() {
     // Given
     GenericKubernetesResourceBuilder genericKubernetesResourceBuilder = new GenericKubernetesResourceBuilder()
-      .withApiVersion("the-cr.example.com/v1")
-      .withKind("SomeCustomResource")
-      .withNewMetadata().withName("foo").withNamespace("ns1").endMetadata();
+        .withApiVersion("the-cr.example.com/v1")
+        .withKind("SomeCustomResource")
+        .withNewMetadata().withName("foo").withNamespace("ns1").endMetadata();
 
     // When
     GenericKubernetesResource genericKubernetesResource = genericKubernetesResourceBuilder.build();
 
     // Then
     assertThat(genericKubernetesResource)
-      .hasFieldOrPropertyWithValue("kind", "SomeCustomResource")
-      .hasFieldOrPropertyWithValue("apiVersion", "the-cr.example.com/v1")
-      .hasFieldOrPropertyWithValue("metadata.namespace", "ns1")
-      .hasFieldOrPropertyWithValue("metadata.name", "foo");
+        .hasFieldOrPropertyWithValue("kind", "SomeCustomResource")
+        .hasFieldOrPropertyWithValue("apiVersion", "the-cr.example.com/v1")
+        .hasFieldOrPropertyWithValue("metadata.namespace", "ns1")
+        .hasFieldOrPropertyWithValue("metadata.name", "foo");
   }
 
   @Test
@@ -144,7 +145,7 @@ void getWithNestedMapsFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("field", Collections.singletonMap("nested", 42))));
+        Collections.singletonMap("field", Collections.singletonMap("nested", 42))));
     // When
     final int result = gkr.get("spec", "field", "nested");
     // Then
@@ -157,7 +158,7 @@ void getWithNestedMapsTraversedNotFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("field", Collections.singletonMap("nested", 42))));
+        Collections.singletonMap("field", Collections.singletonMap("nested", 42))));
     // When
     final Object result = gkr.get("spec", "field", "nested", "not", "here");
     // Then
@@ -170,10 +171,9 @@ void getWithNestedMapsAndArraysAndIndexOutOfBoundsNotFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("field",
-        Collections.singletonMap("nested", Arrays.asList(
-          true, false, 1337
-        )))));
+        Collections.singletonMap("field",
+            Collections.singletonMap("nested", Arrays.asList(
+                true, false, 1337)))));
     // When
     final Object result = gkr.get("spec", "field", "nested", Integer.MAX_VALUE);
     // Then
@@ -186,10 +186,9 @@ void getWithNestedMapsAndArraysFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("field",
-        Collections.singletonMap("nested", Arrays.asList(
-          true, false, 1337
-        )))));
+        Collections.singletonMap("field",
+            Collections.singletonMap("nested", Arrays.asList(
+                true, false, 1337)))));
     // When
     final boolean result = gkr.get("spec", "field", "nested", 1);
     // Then
@@ -202,11 +201,10 @@ void getWithNestedMapsAndArraysWithMapsFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("field",
-        Collections.singletonMap("nested", Arrays.asList(
-          Collections.singletonMap("objectField", "Atomic"),
-          Collections.singletonMap("objectField", "Particles")
-        )))));
+        Collections.singletonMap("field",
+            Collections.singletonMap("nested", Arrays.asList(
+                Collections.singletonMap("objectField", "Atomic"),
+                Collections.singletonMap("objectField", "Particles"))))));
     // When
     final String result = gkr.get("spec", "field", "nested", 1, "objectField");
     // Then
@@ -219,9 +217,8 @@ void getWithNestedMapsAndArraysWithPrimitiveFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("field",
-        Collections.singletonMap("nested", Arrays.asList(42, 13, 37)
-        ))));
+        Collections.singletonMap("field",
+            Collections.singletonMap("nested", Arrays.asList(42, 13, 37)))));
     // When
     final int result = gkr.get("spec", "field", "nested", 2);
     // Then
@@ -234,8 +231,8 @@ void getWithNestedMapsAndInvalidArrayReferenceNotFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("field", Collections.singletonMap("nested",
-        Collections.singletonMap("1", "not-an-array")))));
+        Collections.singletonMap("field", Collections.singletonMap("nested",
+            Collections.singletonMap("1", "not-an-array")))));
     // When
     final String result = gkr.get("spec", "field", "nested", 1);
     // Then
@@ -248,8 +245,8 @@ void getWithNestedMapsAndInvalidReferenceNotFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("field", Collections.singletonMap("nested",
-        Collections.singletonMap("false", "not-allowed")))));
+        Collections.singletonMap("field", Collections.singletonMap("nested",
+            Collections.singletonMap("false", "not-allowed")))));
     // When
     final String result = gkr.get("spec", "field", "nested", false);
     // Then
@@ -262,9 +259,8 @@ void getWithDotsInFieldFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("field\uD83E\uDD2Cwith.symbols[]!\"·$%&/()=`' {}_-<>",
-        Collections.singletonMap("check", "mate")
-      )));
+        Collections.singletonMap("field\uD83E\uDD2Cwith.symbols[]!\"·$%&/()=`' {}_-<>",
+            Collections.singletonMap("check", "mate"))));
     // When
     final String result = gkr.get("spec", "field\uD83E\uDD2Cwith.symbols[]!\"·$%&/()=`' {}_-<>", "check");
     // Then
@@ -307,17 +303,15 @@ void getWith2DArrayInFieldFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("nested",
-        Collections.singletonMap("2dList", Arrays.asList(
-          Arrays.asList(
-            Collections.singletonMap("entry", 0),
-            Collections.singletonMap("entry", 1),
-            Collections.singletonMap("entry", 2)
-          ),
-          Collections.singletonList(Collections.singletonMap("entry", 3))
-        )))));
+        Collections.singletonMap("nested",
+            Collections.singletonMap("2dList", Arrays.asList(
+                Arrays.asList(
+                    Collections.singletonMap("entry", 0),
+                    Collections.singletonMap("entry", 1),
+                    Collections.singletonMap("entry", 2)),
+                Collections.singletonList(Collections.singletonMap("entry", 3)))))));
     // When
-    final int result = gkr.get("spec","nested", "2dList", 1, 0, "entry");
+    final int result = gkr.get("spec", "nested", "2dList", 1, 0, "entry");
     // Then
     assertThat(result).isEqualTo(3);
   }
@@ -328,18 +322,16 @@ void getWithMultidimensionalArrayInFieldFound() {
     // Given
     final GenericKubernetesResource gkr = new GenericKubernetesResource();
     gkr.setAdditionalProperties(Collections.singletonMap("spec",
-      Collections.singletonMap("nested",
-        Collections.singletonMap("multidimensional", Collections.singletonList(
-          Collections.singletonList(
-            Collections.singletonList(
-              Arrays.asList(
-                Collections.singletonMap("entry", 0),
-                Collections.singletonMap("entry", 1),
-                Collections.singletonMap("entry", 2)
-              )
-            )))))));
+        Collections.singletonMap("nested",
+            Collections.singletonMap("multidimensional", Collections.singletonList(
+                Collections.singletonList(
+                    Collections.singletonList(
+                        Arrays.asList(
+                            Collections.singletonMap("entry", 0),
+                            Collections.singletonMap("entry", 1),
+                            Collections.singletonMap("entry", 2)))))))));
     // When
-    final int result = gkr.get("spec","nested", "multidimensional", 0, 0, 0, 2, "entry");
+    final int result = gkr.get("spec", "nested", "multidimensional", 0, 0, 0, 2, "entry");
     // Then
     assertThat(result).isEqualTo(2);
   }
@@ -349,18 +341,18 @@ void getWithMultidimensionalArrayInFieldFound() {
   void getWithComplexStructureShouldRetrieveQueried() throws Exception {
     // When
     final GenericKubernetesResource result = objectMapper
-      .readValue(load("complex-structure-resource.json"), GenericKubernetesResource.class);
+        .readValue(load("complex-structure-resource.json"), GenericKubernetesResource.class);
     // Then
     assertThat(result)
-      .hasFieldOrPropertyWithValue("kind", "SomeCustomResource")
-      .returns("value", gkr -> gkr.get("spec", "field"))
-      .returns(42, gkr -> gkr.get("spec", "dot.in.field"))
-      .returns(2, gkr -> gkr.get("spec", "nested", "list", 1, "entry"))
-      .returns(1, gkr -> gkr.get("spec", "nested", "list", 0, "entry"))
-      .returns("ambiguous", gkr -> gkr.get("spec", "nested", "list[0]", "entry"))
-      .returns(3, gkr -> gkr.get("spec", "nested", "2dList", 1, 0, "entry"))
-      .returns(313373, gkr -> gkr.get("spec", "oh!.come-on![1337]this.is#Outrageous[0][1]", 0, 0, "impossible", 0))
-      .returns(true, gkr -> gkr.get("status", "reconciled"));
+        .hasFieldOrPropertyWithValue("kind", "SomeCustomResource")
+        .returns("value", gkr -> gkr.get("spec", "field"))
+        .returns(42, gkr -> gkr.get("spec", "dot.in.field"))
+        .returns(2, gkr -> gkr.get("spec", "nested", "list", 1, "entry"))
+        .returns(1, gkr -> gkr.get("spec", "nested", "list", 0, "entry"))
+        .returns("ambiguous", gkr -> gkr.get("spec", "nested", "list[0]", "entry"))
+        .returns(3, gkr -> gkr.get("spec", "nested", "2dList", 1, 0, "entry"))
+        .returns(313373, gkr -> gkr.get("spec", "oh!.come-on![1337]this.is#Outrageous[0][1]", 0, 0, "impossible", 0))
+        .returns(true, gkr -> gkr.get("status", "reconciled"));
   }
 
   @Test
@@ -368,12 +360,12 @@ void getWithComplexStructureShouldRetrieveQueried() throws Exception {
   void getAdditionalPropertiesNodeWithComplexStructureShouldRetrieveQueried() throws Exception {
     // When
     final GenericKubernetesResource result = objectMapper
-      .readValue(load("complex-structure-resource.json"), GenericKubernetesResource.class);
+        .readValue(load("complex-structure-resource.json"), GenericKubernetesResource.class);
     // Then
     assertThat(result)
-      .extracting(GenericKubernetesResource::getAdditionalPropertiesNode)
-      .returns("value", node -> node.get("spec").get("field").asText())
-      .returns(2, node -> node.get("spec").get("nested").get("list").get(1).get("entry").asInt());
+        .extracting(GenericKubernetesResource::getAdditionalPropertiesNode)
+        .returns("value", node -> node.get("spec").get("field").asText())
+        .returns(2, node -> node.get("spec").get("nested").get("list").get(1).get("entry").asInt());
   }
 
   private static InputStream load(String resource) {
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/HasMetadataTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/HasMetadataTest.java
index 15ea93f9cf5..489826f17d2 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/HasMetadataTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/HasMetadataTest.java
@@ -18,9 +18,10 @@
 import io.fabric8.kubernetes.model.annotation.Group;
 import io.fabric8.kubernetes.model.annotation.Plural;
 import io.fabric8.kubernetes.model.annotation.Version;
-import java.util.Optional;
 import org.junit.jupiter.api.Test;
 
+import java.util.Optional;
+
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -28,7 +29,6 @@
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
-
 class HasMetadataTest {
   @Test
   void fullResourceNameShouldNotEndWithPeriodForHistoricResources() {
@@ -48,11 +48,11 @@ void validFinalizersShouldBeAddedAndCanBeRemoved() {
     final String finalizer = "example.fabric8.io/finalizer";
     assertTrue(hasMetadata.addFinalizer(finalizer));
     assertEquals(hasMetadata.getMetadata().getFinalizers().contains(finalizer), hasMetadata.hasFinalizer(finalizer));
-    
+
     assertTrue(hasMetadata.removeFinalizer(finalizer));
     assertFalse(hasMetadata.hasFinalizer(finalizer));
   }
-  
+
   @Test
   void shouldNotAddFinalizerToMarkedForDeletion() {
     HasMetadata hasMetadata = new Default() {
@@ -61,7 +61,7 @@ public boolean isMarkedForDeletion() {
         return true;
       }
     };
-    
+
     assertFalse(hasMetadata.addFinalizer("example.fabric8.io/finalizer"));
   }
 
@@ -73,7 +73,7 @@ void finalizerValidationShouldWork() {
     assertTrue(HasMetadata.validateFinalizer("fabric8.io/finalizer"));
     // other cases are indirectly validated in invalidFinalizersShouldFail
   }
-  
+
   @Test
   void invalidFinalizersShouldFail() {
     HasMetadata hasMetadata = new Default();
@@ -83,12 +83,15 @@ void invalidFinalizersShouldFail() {
     assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer("-fabric8.io/finalizer"));
     assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer("fabric8.i/finalizer"));
     assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer("fabric8./finalizer"));
-    assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer("this-label-is-too-long-12345678901234567890123456789012345678901234567890qwertyuiopasdfghjkl.io/finalizer"));
-    assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer("this.dns.name.is.way.way.too.long.more.than.255.characters.12345678901234567890.qwertyuiop.asdfghjkl.zxcvbnm.qwertyuiop.adfghjkl.zxcvbnm.mnbvcxz.lkjhgfdsa.poiuytrewq12345678901234567890.qwertyuiop.asdfghjkl.zxcvbnm.qwertyuiop.adfghjkl.zxcvbnm.mnbvcxz.lkjhgfdsa.poiuytrewq.io/finalizer"));
+    assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer(
+        "this-label-is-too-long-12345678901234567890123456789012345678901234567890qwertyuiopasdfghjkl.io/finalizer"));
+    assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer(
+        "this.dns.name.is.way.way.too.long.more.than.255.characters.12345678901234567890.qwertyuiop.asdfghjkl.zxcvbnm.qwertyuiop.adfghjkl.zxcvbnm.mnbvcxz.lkjhgfdsa.poiuytrewq12345678901234567890.qwertyuiop.asdfghjkl.zxcvbnm.qwertyuiop.adfghjkl.zxcvbnm.mnbvcxz.lkjhgfdsa.poiuytrewq.io/finalizer"));
     assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer(".io/finalizer"));
     assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer("fabric8.io/-finalizer"));
     assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer("fabric8.io/finalizer-"));
-    assertThrows(IllegalArgumentException.class, () -> hasMetadata.addFinalizer("fabric8.io/finalizerreallyreallywaywaywaytooooooooooooooooooooolooooooooonnnnnnnnnnng"));
+    assertThrows(IllegalArgumentException.class, () -> hasMetadata
+        .addFinalizer("fabric8.io/finalizerreallyreallywaywaywaytooooooooooooooooooooolooooooooonnnnnnnnnnng"));
   }
 
   @Test
@@ -102,7 +105,8 @@ public String getKind() {
       }
     };
 
-    IllegalArgumentException iae = assertThrows(IllegalArgumentException.class, () -> target.addOwnerReference((OwnerReference) null));
+    IllegalArgumentException iae = assertThrows(IllegalArgumentException.class,
+        () -> target.addOwnerReference((OwnerReference) null));
     String msg = iae.getMessage();
     assertTrue(msg.contains("null reference to '" + name + "' " + kind));
     iae = assertThrows(IllegalArgumentException.class, () -> target.addOwnerReference((HasMetadata) null));
@@ -115,7 +119,7 @@ void addingNullOwnerReferenceShouldNotCrashEvenIfTargetDoesNotHaveMetadata() {
     final HasMetadata target = new Empty();
 
     IllegalArgumentException iae = assertThrows(IllegalArgumentException.class,
-      () -> target.addOwnerReference((OwnerReference) null));
+        () -> target.addOwnerReference((OwnerReference) null));
     String msg = iae.getMessage();
     assertTrue(msg.contains("null reference to unnamed " + target.getKind()));
   }
@@ -152,11 +156,11 @@ void addingReferenceToOwnerWithMissingFieldsShouldFail() {
     HasMetadata owner = new InvalidOwner();
 
     IllegalArgumentException iae = assertThrows(IllegalArgumentException.class,
-      () -> hasMetadata.addOwnerReference(owner));
+        () -> hasMetadata.addOwnerReference(owner));
     final String msg = iae.getMessage();
     assertTrue(
-      msg.contains("uid") && msg.contains("apiVersion") && msg.contains("name") && msg.contains(
-        "kind"));
+        msg.contains("uid") && msg.contains("apiVersion") && msg.contains("name") && msg.contains(
+            "kind"));
   }
 
   @Test
@@ -306,7 +310,7 @@ public String getApiVersion() {
       return "   ";
     }
   }
-  
+
   private static class Default implements HasMetadata {
     protected final ObjectMeta meta = new ObjectMeta();
 
@@ -321,22 +325,22 @@ private static class Default implements HasMetadata {
     public ObjectMeta getMetadata() {
       return meta;
     }
-    
+
     @Override
     public void setMetadata(ObjectMeta metadata) {
       throw new RuntimeException("setMetadata shouldn't be called");
     }
-    
+
     @Override
     public String getKind() {
       throw new RuntimeException("getKind shouldn't be called");
     }
-    
+
     @Override
     public String getApiVersion() {
       throw new RuntimeException("getApiVersion shouldn't be called");
     }
-    
+
     @Override
     public void setApiVersion(String version) {
       throw new RuntimeException("setApiVersion shouldn't be called");
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/KubernetesListTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/KubernetesListTest.java
index db2717fc825..70170c5885c 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/KubernetesListTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/KubernetesListTest.java
@@ -15,90 +15,89 @@
  */
 package io.fabric8.kubernetes.api.model;
 
+import org.hamcrest.CoreMatchers;
+import org.junit.jupiter.api.Test;
+
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertNull;
 
-import org.hamcrest.CoreMatchers;
-import org.junit.jupiter.api.Test;
-
 public class KubernetesListTest {
 
-    @Test
-    public void testDefaultValues() {
-        Service service = new io.fabric8.kubernetes.api.model.ServiceBuilder()
-                .withNewMetadata()
-                    .withName("test-service")
-                .endMetadata()
-                .build();
-        assertNotNull(service.getApiVersion());
-        assertEquals("Service", service.getKind());
-
-        ReplicationController replicationController = new io.fabric8.kubernetes.api.model.ReplicationControllerBuilder()
-                .withNewMetadata()
-                .withName("test-controller")
-                .endMetadata()
-                .build();
-        assertNotNull(replicationController.getApiVersion());
-        assertEquals("ReplicationController", replicationController.getKind());
+  @Test
+  public void testDefaultValues() {
+    Service service = new io.fabric8.kubernetes.api.model.ServiceBuilder()
+        .withNewMetadata()
+        .withName("test-service")
+        .endMetadata()
+        .build();
+    assertNotNull(service.getApiVersion());
+    assertEquals("Service", service.getKind());
 
-        KubernetesList kubernetesList;
-        kubernetesList = new io.fabric8.kubernetes.api.model.KubernetesListBuilder()
-                .addNewServiceItem()
-                .withNewMetadata()
-                    .withName("test-service")
-                .endMetadata()
-                .and()
-                .addNewReplicationControllerItem()
-                .withNewMetadata()
-                    .withName("test-controller")
-                .endMetadata()
-                .and()
-                .build();
+    ReplicationController replicationController = new io.fabric8.kubernetes.api.model.ReplicationControllerBuilder()
+        .withNewMetadata()
+        .withName("test-controller")
+        .endMetadata()
+        .build();
+    assertNotNull(replicationController.getApiVersion());
+    assertEquals("ReplicationController", replicationController.getKind());
 
-        assertNotNull(kubernetesList.getApiVersion());
-        assertEquals("v1", kubernetesList.getApiVersion());
-        assertEquals("List", kubernetesList.getKind());
-        assertThat(kubernetesList.getItems(), CoreMatchers.hasItem(service));
-        assertThat(kubernetesList.getItems(), CoreMatchers.hasItem(replicationController));
-    }
+    KubernetesList kubernetesList;
+    kubernetesList = new io.fabric8.kubernetes.api.model.KubernetesListBuilder()
+        .addNewServiceItem()
+        .withNewMetadata()
+        .withName("test-service")
+        .endMetadata()
+        .and()
+        .addNewReplicationControllerItem()
+        .withNewMetadata()
+        .withName("test-controller")
+        .endMetadata()
+        .and()
+        .build();
 
-    @Test
-    void testVisitor() {
-        KubernetesList list = new io.fabric8.kubernetes.api.model.KubernetesListBuilder()
-                .addNewPodItem()
-                    .withNewSpec()
-                        .addNewContainer()
-                            .withName("my-container")
-                            .withImage("my/image")
-                        .endContainer()
-                    .endSpec()
-                .and()
-                .build();
+    assertNotNull(kubernetesList.getApiVersion());
+    assertEquals("v1", kubernetesList.getApiVersion());
+    assertEquals("List", kubernetesList.getKind());
+    assertThat(kubernetesList.getItems(), CoreMatchers.hasItem(service));
+    assertThat(kubernetesList.getItems(), CoreMatchers.hasItem(replicationController));
+  }
 
-        final KubernetesList visitedList =new io.fabric8.kubernetes.api.model.KubernetesListBuilder(list).accept(item -> {
-            if (item instanceof io.fabric8.kubernetes.api.model.PodSpecBuilder) {
-                ((io.fabric8.kubernetes.api.model.PodSpecBuilder)item).addNewContainer()
-                        .withName("other-container")
-                        .withImage("other/image")
-                        .and();
-            }
-        }).build();
-        final Container visitedContainer = ((Pod)visitedList.getItems().get(0)).getSpec().getContainers().get(1);
-        assertEquals("other-container", visitedContainer.getName());
-        assertEquals("other/image", visitedContainer.getImage());
-    }
+  @Test
+  void testVisitor() {
+    KubernetesList list = new io.fabric8.kubernetes.api.model.KubernetesListBuilder()
+        .addNewPodItem()
+        .withNewSpec()
+        .addNewContainer()
+        .withName("my-container")
+        .withImage("my/image")
+        .endContainer()
+        .endSpec()
+        .and()
+        .build();
 
+    final KubernetesList visitedList = new io.fabric8.kubernetes.api.model.KubernetesListBuilder(list).accept(item -> {
+      if (item instanceof io.fabric8.kubernetes.api.model.PodSpecBuilder) {
+        ((io.fabric8.kubernetes.api.model.PodSpecBuilder) item).addNewContainer()
+            .withName("other-container")
+            .withImage("other/image")
+            .and();
+      }
+    }).build();
+    final Container visitedContainer = ((Pod) visitedList.getItems().get(0)).getSpec().getContainers().get(1);
+    assertEquals("other-container", visitedContainer.getName());
+    assertEquals("other/image", visitedContainer.getImage());
+  }
 
-    @Test
-    public void testDefaultNullValues() {
-        Container container = new io.fabric8.kubernetes.api.model.ContainerBuilder().build();
-        assertNull(container.getLifecycle());
-        assertNull(container.getLivenessProbe());
+  @Test
+  public void testDefaultNullValues() {
+    Container container = new io.fabric8.kubernetes.api.model.ContainerBuilder().build();
+    assertNull(container.getLifecycle());
+    assertNull(container.getLivenessProbe());
 
-        Pod pod = new io.fabric8.kubernetes.api.model.PodBuilder().build();
-        assertNull(pod.getSpec());
-        assertNull(pod.getStatus());
-    }
+    Pod pod = new io.fabric8.kubernetes.api.model.PodBuilder().build();
+    assertNull(pod.getSpec());
+    assertNull(pod.getStatus());
+  }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/KubernetesResourceTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/KubernetesResourceTest.java
index f905d7e595e..407a7f528a4 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/KubernetesResourceTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/KubernetesResourceTest.java
@@ -36,13 +36,13 @@ void setUp() {
   void deserializeWithRegisteredApiVersionKindShouldReturnPod() throws Exception {
     // When
     final HasMetadata result = objectMapper.readerFor(KubernetesResource.class)
-      .readValue("{\"kind\": \"Pod\", \"apiVersion\": \"v1\"}");
+        .readValue("{\"kind\": \"Pod\", \"apiVersion\": \"v1\"}");
     // Then
     assertThat(result)
-      .isNotNull()
-      .isInstanceOf(Pod.class)
-      .hasFieldOrPropertyWithValue("kind", "Pod")
-      .hasFieldOrPropertyWithValue("apiVersion", "v1");
+        .isNotNull()
+        .isInstanceOf(Pod.class)
+        .hasFieldOrPropertyWithValue("kind", "Pod")
+        .hasFieldOrPropertyWithValue("apiVersion", "v1");
   }
 
   @Test
@@ -50,12 +50,12 @@ void deserializeWithRegisteredApiVersionKindShouldReturnPod() throws Exception {
   void deserializeWithUnregisteredApiVersionKindShouldReturnGenericCustomResource() throws Exception {
     // When
     final HasMetadata result = objectMapper.readerFor(KubernetesResource.class)
-      .readValue("{\"kind\": \"CustomKind\", \"apiVersion\": \"custom/v1\"}");
+        .readValue("{\"kind\": \"CustomKind\", \"apiVersion\": \"custom/v1\"}");
     // Then
     assertThat(result)
-      .isNotNull()
-      .isInstanceOf(GenericKubernetesResource.class)
-      .hasFieldOrPropertyWithValue("kind", "CustomKind")
-      .hasFieldOrPropertyWithValue("apiVersion", "custom/v1");
+        .isNotNull()
+        .isInstanceOf(GenericKubernetesResource.class)
+        .hasFieldOrPropertyWithValue("kind", "CustomKind")
+        .hasFieldOrPropertyWithValue("apiVersion", "custom/v1");
   }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ListOptionsTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ListOptionsTest.java
index 969a2773e38..d151878afe2 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ListOptionsTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ListOptionsTest.java
@@ -23,10 +23,10 @@ public class ListOptionsTest {
   @Test
   public void testBuilder() {
     ListOptions listOptions = new io.fabric8.kubernetes.api.model.ListOptionsBuilder()
-      .withLimit(100L)
-      .withContinue("23243434")
-      .withFieldSelector("metadata.name=my-service")
-      .build();
+        .withLimit(100L)
+        .withContinue("23243434")
+        .withFieldSelector("metadata.name=my-service")
+        .build();
 
     assertEquals(100L, listOptions.getLimit());
     assertEquals("23243434", listOptions.getContinue());
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/MicroTimeTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/MicroTimeTest.java
index d0d1d9c18ed..3b759368a2e 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/MicroTimeTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/MicroTimeTest.java
@@ -41,8 +41,8 @@ void testSerialization() throws JsonProcessingException {
     // Given
     String timeFormat = OffsetDateTime.now().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
     MicroTime microTime = new MicroTimeBuilder()
-      .withTime(timeFormat)
-      .build();
+        .withTime(timeFormat)
+        .build();
 
     // When
     String result = mapper.writeValueAsString(microTime);
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/QuantityTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/QuantityTest.java
index da8a05ecabe..e050c4edfc3 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/QuantityTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/QuantityTest.java
@@ -67,7 +67,7 @@ public void testNormalization() {
     Quantity quantity = new Quantity(".5Mi");
     assertEquals(new BigDecimal("524288.0"), Quantity.getAmountInBytes(quantity));
 
-    Quantity quantity1 =  new Quantity("512Ki");
+    Quantity quantity1 = new Quantity("512Ki");
     assertEquals(Quantity.getAmountInBytes(quantity1).toBigInteger(), Quantity.getAmountInBytes(quantity).toBigInteger());
   }
 
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/SecretTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/SecretTest.java
index c61e68f3afc..5a2820567db 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/SecretTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/SecretTest.java
@@ -16,6 +16,7 @@
 package io.fabric8.kubernetes.api.model;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
+import io.fabric8.kubernetes.model.util.Helper;
 import org.junit.jupiter.api.Test;
 
 import java.util.HashMap;
@@ -26,59 +27,58 @@
 import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import io.fabric8.kubernetes.model.util.Helper;
 
 public class SecretTest {
-    private final ObjectMapper mapper = new ObjectMapper();
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @Test
-    public void secretTest() throws Exception {
-        // given
-        final String originalJson = Helper.loadJson("/valid-secret.json");
+  @Test
+  public void secretTest() throws Exception {
+    // given
+    final String originalJson = Helper.loadJson("/valid-secret.json");
 
-        // when
-        final Secret secret = mapper.readValue(originalJson, Secret.class);
-        final String serializedJson = mapper.writeValueAsString(secret);
+    // when
+    final Secret secret = mapper.readValue(originalJson, Secret.class);
+    final String serializedJson = mapper.writeValueAsString(secret);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
-    }
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
+  }
 
-    @Test
-    public void secretBuilderTest(){
+  @Test
+  public void secretBuilderTest() {
 
-        Secret secret = new io.fabric8.kubernetes.api.model.SecretBuilder()
-                .withNewMetadata()
-                .withName("test-secret")
-                .withNamespace("my-namespace")
-                .endMetadata()
-                .withType("opaque")
-                .withData(new HashMap() {{
-                    put("username", "dmFsdWUtMQ0K");
-                    put("password", "dmFsdWUtMg0KDQo=");
-                    put(".secret-file", "dmFsdWUtMg0KDQo=");
-                    }}
-                )
-                .withStringData(new HashMap() {{
-                    put("hostname", "myapp.mydomain.com");
-                    put("secret.properties", "property1=valueA\nproperty2=valueB");
-                    }}
-                )
-                .build();
+    Secret secret = new io.fabric8.kubernetes.api.model.SecretBuilder()
+        .withNewMetadata()
+        .withName("test-secret")
+        .withNamespace("my-namespace")
+        .endMetadata()
+        .withType("opaque")
+        .withData(new HashMap() {
+          {
+            put("username", "dmFsdWUtMQ0K");
+            put("password", "dmFsdWUtMg0KDQo=");
+            put(".secret-file", "dmFsdWUtMg0KDQo=");
+          }
+        })
+        .withStringData(new HashMap() {
+          {
+            put("hostname", "myapp.mydomain.com");
+            put("secret.properties", "property1=valueA\nproperty2=valueB");
+          }
+        })
+        .build();
 
-        assertNotNull(secret);
-        assertEquals("test-secret", secret.getMetadata().getName());
-        assertEquals("my-namespace",secret.getMetadata().getNamespace());
-        assertEquals("opaque", secret.getType());
-        assertEquals(3,secret.getData().size());
-        assertEquals("dmFsdWUtMQ0K",secret.getData().get("username"));
-        assertEquals("dmFsdWUtMg0KDQo=",secret.getData().get("password"));
-        assertEquals("dmFsdWUtMg0KDQo=",secret.getData().get(".secret-file"));
-        assertEquals(2,secret.getStringData().size());
-        assertEquals("myapp.mydomain.com",secret.getStringData().get("hostname"));
-        assertEquals("property1=valueA\nproperty2=valueB",secret.getStringData().get("secret.properties"));
-    }
+    assertNotNull(secret);
+    assertEquals("test-secret", secret.getMetadata().getName());
+    assertEquals("my-namespace", secret.getMetadata().getNamespace());
+    assertEquals("opaque", secret.getType());
+    assertEquals(3, secret.getData().size());
+    assertEquals("dmFsdWUtMQ0K", secret.getData().get("username"));
+    assertEquals("dmFsdWUtMg0KDQo=", secret.getData().get("password"));
+    assertEquals("dmFsdWUtMg0KDQo=", secret.getData().get(".secret-file"));
+    assertEquals(2, secret.getStringData().size());
+    assertEquals("myapp.mydomain.com", secret.getStringData().get("hostname"));
+    assertEquals("property1=valueA\nproperty2=valueB", secret.getStringData().get("secret.properties"));
+  }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ServiceTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ServiceTest.java
index 81ff8cf1c86..e6e02cddcd3 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ServiceTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/ServiceTest.java
@@ -16,6 +16,7 @@
 package io.fabric8.kubernetes.api.model;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
+import io.fabric8.kubernetes.model.util.Helper;
 import org.junit.jupiter.api.Test;
 
 import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
@@ -24,120 +25,116 @@
 import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import io.fabric8.kubernetes.model.util.Helper;
 
 public class ServiceTest {
-    private final ObjectMapper mapper = new ObjectMapper();
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @Test
-    public void serviceTest() throws Exception {
-        // given
-        final String originalJson = Helper.loadJson("/valid-service.json");
+  @Test
+  public void serviceTest() throws Exception {
+    // given
+    final String originalJson = Helper.loadJson("/valid-service.json");
 
-        // when
-        final Service service = mapper.readValue(originalJson, Service.class);
-        final String serializedJson = mapper.writeValueAsString(service);
+    // when
+    final Service service = mapper.readValue(originalJson, Service.class);
+    final String serializedJson = mapper.writeValueAsString(service);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
-    }
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
+  }
 
-    @Test
-    public void serviceBuilderTest() {
+  @Test
+  public void serviceBuilderTest() {
 
-        Service service = new io.fabric8.kubernetes.api.model.ServiceBuilder()
-                .withNewMetadata()
-                    .withName("fabric8-maven-sample-zero-config")
-                    .addToLabels("expose", "true")
-                    .addToLabels("app", "fabric8-maven-sample-zero-config")
-                    .addToLabels("provider", "fabric8")
-                    .addToLabels("version", "3.5-SNAPSHOT")
-                    .addToLabels("group", "io.fabric8")
-                    .addToAnnotations("prometheus.io/port", "9779")
-                    .addToAnnotations("fabric8.io/scm-url", "https://github.com/spring-projects/spring-boot/spring-boot-starter-parent/fabric8-maven-sample-zero-config")
-                    .addToAnnotations("fabric8.io/iconUrl", "img/icons/spring-boot.svg")
-                    .addToAnnotations("prometheus.io/scrape", "true")
-                    .addToAnnotations("fabric8.io/scm-tag", "HEAD")
-                .endMetadata()
-                .withNewSpec()
-                .addToPorts(0, new io.fabric8.kubernetes.api.model.ServicePortBuilder()
-                        .withName("http")
-                        .withPort(8080)
-                        .withProtocol("TCP")
-                        .withNodePort(30080)
-                        .withNewTargetPort(8080)
-                        .build()
-                )
-                .addToPorts(1, new io.fabric8.kubernetes.api.model.ServicePortBuilder()
-                        .withName("https")
-                        .withPort(443)
-                        .withProtocol("TCP")
-                        .withNodePort(30043)
-                        .withNewTargetPort(9000)
-                        .build()
-                )
-                .addToSelector("app", "fabric8-maven-sample-zero-config")
-                .addToSelector("provider", "fabric8")
-                .addToSelector("group", "io.fabric8")
-                .withClusterIP("10.0.171.239")
-                .withLoadBalancerIP("78.11.24.19")
-                .withHealthCheckNodePort(50000)
-                .withType("LoadBalancer")
-                .addToExternalIPs(0,"80.11.12.10")
-                .addToExternalIPs(1, "80.12.13.11")
-                .withExternalName("my.database.example.com")
-                .withExternalTrafficPolicy("Local")
-                .addToLoadBalancerSourceRanges(0,"130.211.204.1/32")
-                .addToLoadBalancerSourceRanges(1,"130.211.204.2/32")
-                .withSessionAffinity("ClientIP")
-                .endSpec()
-                .build();
+    Service service = new io.fabric8.kubernetes.api.model.ServiceBuilder()
+        .withNewMetadata()
+        .withName("fabric8-maven-sample-zero-config")
+        .addToLabels("expose", "true")
+        .addToLabels("app", "fabric8-maven-sample-zero-config")
+        .addToLabels("provider", "fabric8")
+        .addToLabels("version", "3.5-SNAPSHOT")
+        .addToLabels("group", "io.fabric8")
+        .addToAnnotations("prometheus.io/port", "9779")
+        .addToAnnotations("fabric8.io/scm-url",
+            "https://github.com/spring-projects/spring-boot/spring-boot-starter-parent/fabric8-maven-sample-zero-config")
+        .addToAnnotations("fabric8.io/iconUrl", "img/icons/spring-boot.svg")
+        .addToAnnotations("prometheus.io/scrape", "true")
+        .addToAnnotations("fabric8.io/scm-tag", "HEAD")
+        .endMetadata()
+        .withNewSpec()
+        .addToPorts(0, new io.fabric8.kubernetes.api.model.ServicePortBuilder()
+            .withName("http")
+            .withPort(8080)
+            .withProtocol("TCP")
+            .withNodePort(30080)
+            .withNewTargetPort(8080)
+            .build())
+        .addToPorts(1, new io.fabric8.kubernetes.api.model.ServicePortBuilder()
+            .withName("https")
+            .withPort(443)
+            .withProtocol("TCP")
+            .withNodePort(30043)
+            .withNewTargetPort(9000)
+            .build())
+        .addToSelector("app", "fabric8-maven-sample-zero-config")
+        .addToSelector("provider", "fabric8")
+        .addToSelector("group", "io.fabric8")
+        .withClusterIP("10.0.171.239")
+        .withLoadBalancerIP("78.11.24.19")
+        .withHealthCheckNodePort(50000)
+        .withType("LoadBalancer")
+        .addToExternalIPs(0, "80.11.12.10")
+        .addToExternalIPs(1, "80.12.13.11")
+        .withExternalName("my.database.example.com")
+        .withExternalTrafficPolicy("Local")
+        .addToLoadBalancerSourceRanges(0, "130.211.204.1/32")
+        .addToLoadBalancerSourceRanges(1, "130.211.204.2/32")
+        .withSessionAffinity("ClientIP")
+        .endSpec()
+        .build();
 
-        assertNotNull(service);
-        assertEquals("fabric8-maven-sample-zero-config",service.getMetadata().getName());
-        assertEquals("true", service.getMetadata().getLabels().get("expose"));
+    assertNotNull(service);
+    assertEquals("fabric8-maven-sample-zero-config", service.getMetadata().getName());
+    assertEquals("true", service.getMetadata().getLabels().get("expose"));
 
-        assertEquals("fabric8-maven-sample-zero-config",service.getMetadata().getLabels().get("app"));
-        assertEquals("fabric8",service.getMetadata().getLabels().get("provider"));
-        assertEquals("3.5-SNAPSHOT",service.getMetadata().getLabels().get("version"));
-        assertEquals("io.fabric8",service.getMetadata().getLabels().get("group"));
-        assertEquals("9779",service.getMetadata().getAnnotations().get("prometheus.io/port"));
-        assertEquals("https://github.com/spring-projects/spring-boot/spring-boot-starter-parent/" +
-            "fabric8-maven-sample-zero-config", service.getMetadata().getAnnotations().get("fabric8.io/scm-url"));
-        assertEquals("img/icons/spring-boot.svg",service.getMetadata().getAnnotations().get("fabric8.io/iconUrl"));
-        assertEquals("true",service.getMetadata().getAnnotations().get("prometheus.io/scrape"));
-        assertEquals("HEAD",service.getMetadata().getAnnotations().get("fabric8.io/scm-tag"));
-        assertNotNull(service.getSpec().getPorts());
-        assertEquals(2,service.getSpec().getPorts().size());
-        assertEquals("http",service.getSpec().getPorts().get(0).getName());
-        assertEquals("TCP",service.getSpec().getPorts().get(0).getProtocol());
-        assertEquals(8080,service.getSpec().getPorts().get(0).getPort().intValue());
-        assertEquals(30080,service.getSpec().getPorts().get(0).getNodePort().intValue());
-        assertEquals(8080,service.getSpec().getPorts().get(0).getTargetPort().getIntVal().intValue());
-        assertEquals("https",service.getSpec().getPorts().get(1).getName());
-        assertEquals("TCP",service.getSpec().getPorts().get(1).getProtocol());
-        assertEquals(443,service.getSpec().getPorts().get(1).getPort().intValue());
-        assertEquals(30043,service.getSpec().getPorts().get(1).getNodePort().intValue());
-        assertEquals(9000,service.getSpec().getPorts().get(1).getTargetPort().getIntVal().intValue());
-        assertEquals(3,service.getSpec().getSelector().size());
-        assertEquals("fabric8-maven-sample-zero-config",service.getSpec().getSelector().get("app"));
-        assertEquals("fabric8",service.getSpec().getSelector().get("provider"));
-        assertEquals("io.fabric8",service.getSpec().getSelector().get("group"));
-        assertEquals("10.0.171.239",service.getSpec().getClusterIP());
-        assertEquals("78.11.24.19",service.getSpec().getLoadBalancerIP());
-        assertEquals(50000,service.getSpec().getHealthCheckNodePort().intValue());
-        assertEquals("LoadBalancer",service.getSpec().getType());
-        assertEquals(2,service.getSpec().getExternalIPs().size());
-        assertEquals("80.11.12.10",service.getSpec().getExternalIPs().get(0));
-        assertEquals("80.12.13.11",service.getSpec().getExternalIPs().get(1));
-        assertEquals("my.database.example.com",service.getSpec().getExternalName());
-        assertEquals("Local",service.getSpec().getExternalTrafficPolicy());
-        assertEquals(2,service.getSpec().getLoadBalancerSourceRanges().size());
-        assertEquals("130.211.204.1/32",service.getSpec().getLoadBalancerSourceRanges().get(0));
-        assertEquals("130.211.204.2/32",service.getSpec().getLoadBalancerSourceRanges().get(1));
-        assertEquals("ClientIP", service.getSpec().getSessionAffinity());
-    }
+    assertEquals("fabric8-maven-sample-zero-config", service.getMetadata().getLabels().get("app"));
+    assertEquals("fabric8", service.getMetadata().getLabels().get("provider"));
+    assertEquals("3.5-SNAPSHOT", service.getMetadata().getLabels().get("version"));
+    assertEquals("io.fabric8", service.getMetadata().getLabels().get("group"));
+    assertEquals("9779", service.getMetadata().getAnnotations().get("prometheus.io/port"));
+    assertEquals("https://github.com/spring-projects/spring-boot/spring-boot-starter-parent/" +
+        "fabric8-maven-sample-zero-config", service.getMetadata().getAnnotations().get("fabric8.io/scm-url"));
+    assertEquals("img/icons/spring-boot.svg", service.getMetadata().getAnnotations().get("fabric8.io/iconUrl"));
+    assertEquals("true", service.getMetadata().getAnnotations().get("prometheus.io/scrape"));
+    assertEquals("HEAD", service.getMetadata().getAnnotations().get("fabric8.io/scm-tag"));
+    assertNotNull(service.getSpec().getPorts());
+    assertEquals(2, service.getSpec().getPorts().size());
+    assertEquals("http", service.getSpec().getPorts().get(0).getName());
+    assertEquals("TCP", service.getSpec().getPorts().get(0).getProtocol());
+    assertEquals(8080, service.getSpec().getPorts().get(0).getPort().intValue());
+    assertEquals(30080, service.getSpec().getPorts().get(0).getNodePort().intValue());
+    assertEquals(8080, service.getSpec().getPorts().get(0).getTargetPort().getIntVal().intValue());
+    assertEquals("https", service.getSpec().getPorts().get(1).getName());
+    assertEquals("TCP", service.getSpec().getPorts().get(1).getProtocol());
+    assertEquals(443, service.getSpec().getPorts().get(1).getPort().intValue());
+    assertEquals(30043, service.getSpec().getPorts().get(1).getNodePort().intValue());
+    assertEquals(9000, service.getSpec().getPorts().get(1).getTargetPort().getIntVal().intValue());
+    assertEquals(3, service.getSpec().getSelector().size());
+    assertEquals("fabric8-maven-sample-zero-config", service.getSpec().getSelector().get("app"));
+    assertEquals("fabric8", service.getSpec().getSelector().get("provider"));
+    assertEquals("io.fabric8", service.getSpec().getSelector().get("group"));
+    assertEquals("10.0.171.239", service.getSpec().getClusterIP());
+    assertEquals("78.11.24.19", service.getSpec().getLoadBalancerIP());
+    assertEquals(50000, service.getSpec().getHealthCheckNodePort().intValue());
+    assertEquals("LoadBalancer", service.getSpec().getType());
+    assertEquals(2, service.getSpec().getExternalIPs().size());
+    assertEquals("80.11.12.10", service.getSpec().getExternalIPs().get(0));
+    assertEquals("80.12.13.11", service.getSpec().getExternalIPs().get(1));
+    assertEquals("my.database.example.com", service.getSpec().getExternalName());
+    assertEquals("Local", service.getSpec().getExternalTrafficPolicy());
+    assertEquals(2, service.getSpec().getLoadBalancerSourceRanges().size());
+    assertEquals("130.211.204.1/32", service.getSpec().getLoadBalancerSourceRanges().get(0));
+    assertEquals("130.211.204.2/32", service.getSpec().getLoadBalancerSourceRanges().get(1));
+    assertEquals("ClientIP", service.getSpec().getSessionAffinity());
+  }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/StatusTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/StatusTest.java
index 9fc3fad170b..9bdf3734221 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/StatusTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/api/model/StatusTest.java
@@ -23,20 +23,20 @@ public class StatusTest {
   @Test
   public void testBuilder() {
     Status status = new io.fabric8.kubernetes.api.model.StatusBuilder()
-      .withNewMetadata().withContinue("2343212").endMetadata()
-      .withStatus("Some status")
-      .withMessage("Some message")
-      .withCode(200)
-      .withNewDetails()
-      .withGroup("apps")
-      .withKind("Deployment")
-      .withName("nginx-deploy")
-      .addNewCause()
-      .withField("spec.replicas")
-      .withMessage("Detailed message")
-      .endCause()
-      .endDetails()
-      .build();
+        .withNewMetadata().withContinue("2343212").endMetadata()
+        .withStatus("Some status")
+        .withMessage("Some message")
+        .withCode(200)
+        .withNewDetails()
+        .withGroup("apps")
+        .withKind("Deployment")
+        .withName("nginx-deploy")
+        .addNewCause()
+        .withField("spec.replicas")
+        .withMessage("Detailed message")
+        .endCause()
+        .endDetails()
+        .build();
 
     assertEquals("2343212", status.getMetadata().getContinue());
     assertEquals("Some status", status.getStatus());
diff --git a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/internal/KubernetesDeserializerTest.java b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/internal/KubernetesDeserializerTest.java
index 8af525b35ce..3d91c468a9b 100644
--- a/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/internal/KubernetesDeserializerTest.java
+++ b/kubernetes-model-generator/kubernetes-model-core/src/test/java/io/fabric8/kubernetes/internal/KubernetesDeserializerTest.java
@@ -26,7 +26,6 @@
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.assertThrows;
 
 class KubernetesDeserializerTest {
 
diff --git a/kubernetes-model-generator/kubernetes-model-discovery/src/test/java/io/fabric8/kubernetes/api/model/discovery/v1beta1/EndpointSliceTest.java b/kubernetes-model-generator/kubernetes-model-discovery/src/test/java/io/fabric8/kubernetes/api/model/discovery/v1beta1/EndpointSliceTest.java
index a58ce4f6a1c..0a8a1bd104b 100644
--- a/kubernetes-model-generator/kubernetes-model-discovery/src/test/java/io/fabric8/kubernetes/api/model/discovery/v1beta1/EndpointSliceTest.java
+++ b/kubernetes-model-generator/kubernetes-model-discovery/src/test/java/io/fabric8/kubernetes/api/model/discovery/v1beta1/EndpointSliceTest.java
@@ -16,16 +16,13 @@
 package io.fabric8.kubernetes.api.model.discovery.v1beta1;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
-
-import io.fabric8.kubernetes.api.model.discovery.v1beta1.EndpointSlice;
-import io.fabric8.kubernetes.api.model.discovery.v1beta1.EndpointSliceBuilder;
 import io.fabric8.kubernetes.model.util.Helper;
+import org.junit.jupiter.api.Test;
+
 import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
 import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS;
 import static net.javacrumbs.jsonunit.core.Option.TREATING_NULL_AS_ABSENT;
 import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson;
-
-import org.junit.jupiter.api.Test;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 class EndpointSliceTest {
@@ -42,30 +39,30 @@ void loadTest() throws Exception {
 
     // then
     assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-      .isEqualTo(originalJson);
+        .isEqualTo(originalJson);
   }
 
   @Test
   void testBuilder() {
     // Given + When      
     EndpointSlice endpointSlice = new EndpointSliceBuilder()
-                    .withNewMetadata()
-                    .withName("example-abc")
-                    .addToLabels("kubernetes.io/service-name", "example")
-                    .endMetadata()
-                    .withAddressType("IPv4")
-                    .addNewPort()
-                    .withName("http")
-                    .withPort(80)
-                    .endPort()
-                    .addNewEndpoint()
-                    .withAddresses("10.1.2.3")
-                    .withNewConditions().withReady(true).endConditions()
-                    .withHostname("pod-1")
-                    .addToTopology("kubernetes.io/hostname", "node-1")
-                    .addToTopology("topology.kubernetes.io/zone", "us-west2-a")
-                    .endEndpoint()
-                    .build();
+        .withNewMetadata()
+        .withName("example-abc")
+        .addToLabels("kubernetes.io/service-name", "example")
+        .endMetadata()
+        .withAddressType("IPv4")
+        .addNewPort()
+        .withName("http")
+        .withPort(80)
+        .endPort()
+        .addNewEndpoint()
+        .withAddresses("10.1.2.3")
+        .withNewConditions().withReady(true).endConditions()
+        .withHostname("pod-1")
+        .addToTopology("kubernetes.io/hostname", "node-1")
+        .addToTopology("topology.kubernetes.io/zone", "us-west2-a")
+        .endEndpoint()
+        .build();
 
     // Then
     assertEquals("discovery.k8s.io/v1beta1", endpointSlice.getApiVersion());
diff --git a/kubernetes-model-generator/kubernetes-model-metrics/src/test/java/io/fabric8/kubernetes/api/model/metrics/v1beta1/NodeMetricsTest.java b/kubernetes-model-generator/kubernetes-model-metrics/src/test/java/io/fabric8/kubernetes/api/model/metrics/v1beta1/NodeMetricsTest.java
index 0fc69b1381d..7b8cc0e8831 100644
--- a/kubernetes-model-generator/kubernetes-model-metrics/src/test/java/io/fabric8/kubernetes/api/model/metrics/v1beta1/NodeMetricsTest.java
+++ b/kubernetes-model-generator/kubernetes-model-metrics/src/test/java/io/fabric8/kubernetes/api/model/metrics/v1beta1/NodeMetricsTest.java
@@ -40,8 +40,8 @@ void shouldNotImplementNamespacedInterface() {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-nodemetric.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final NodeMetrics nodeMetrics = mapper.readValue(originalJson, NodeMetrics.class);
@@ -59,20 +59,20 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
   void builderShouldCreateObject() throws ParseException {
     // Given
     NodeMetricsBuilder nodeMetricsBuilder = new NodeMetricsBuilder()
-      .withNewMetadata().withName("minikube").endMetadata()
-      .withTimestamp("2021-12-23T16:05:09Z")
-      .withWindow(Duration.parse("30s"))
-      .withUsage(Collections.singletonMap("cpu", new Quantity("134994244n")));
+        .withNewMetadata().withName("minikube").endMetadata()
+        .withTimestamp("2021-12-23T16:05:09Z")
+        .withWindow(Duration.parse("30s"))
+        .withUsage(Collections.singletonMap("cpu", new Quantity("134994244n")));
 
     // When
     NodeMetrics nodeMetrics = nodeMetricsBuilder.build();
 
     // Then
     assertThat(nodeMetrics)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "minikube")
-      .hasFieldOrPropertyWithValue("timestamp", "2021-12-23T16:05:09Z")
-      .hasFieldOrPropertyWithValue("window", Duration.parse("30s"))
-      .hasFieldOrPropertyWithValue("usage", Collections.singletonMap("cpu", new Quantity("134994244n")));
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "minikube")
+        .hasFieldOrPropertyWithValue("timestamp", "2021-12-23T16:05:09Z")
+        .hasFieldOrPropertyWithValue("window", Duration.parse("30s"))
+        .hasFieldOrPropertyWithValue("usage", Collections.singletonMap("cpu", new Quantity("134994244n")));
   }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-rbac/src/test/java/io/fabric8/kubernetes/api/model/rbac/RoleBindingTest.java b/kubernetes-model-generator/kubernetes-model-rbac/src/test/java/io/fabric8/kubernetes/api/model/rbac/RoleBindingTest.java
index 92386f0920d..e4de8fcfa45 100644
--- a/kubernetes-model-generator/kubernetes-model-rbac/src/test/java/io/fabric8/kubernetes/api/model/rbac/RoleBindingTest.java
+++ b/kubernetes-model-generator/kubernetes-model-rbac/src/test/java/io/fabric8/kubernetes/api/model/rbac/RoleBindingTest.java
@@ -16,10 +16,6 @@
 package io.fabric8.kubernetes.api.model.rbac;
 
 import com.fasterxml.jackson.databind.ObjectMapper;
-import io.fabric8.kubernetes.api.model.rbac.RoleBinding;
-import io.fabric8.kubernetes.api.model.rbac.SubjectBuilder;
-import io.fabric8.kubernetes.api.model.rbac.RoleRefBuilder;
-import io.fabric8.kubernetes.api.model.rbac.RoleBindingBuilder;
 import io.fabric8.kubernetes.model.util.Helper;
 import org.junit.jupiter.api.Test;
 
@@ -30,54 +26,52 @@
 
 public class RoleBindingTest {
 
-    private final ObjectMapper mapper = new ObjectMapper();
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @Test
-    public void kubernetesRoleBindingTest() throws Exception {
-        // given
-        final String originalJson = Helper.loadJson("/valid-roleBinding.json");
+  @Test
+  public void kubernetesRoleBindingTest() throws Exception {
+    // given
+    final String originalJson = Helper.loadJson("/valid-roleBinding.json");
 
-        // when
-        final RoleBinding kubernetesRoleBinding = mapper.readValue(originalJson, RoleBinding.class);
-        final String serializedJson = mapper.writeValueAsString(kubernetesRoleBinding);
+    // when
+    final RoleBinding kubernetesRoleBinding = mapper.readValue(originalJson, RoleBinding.class);
+    final String serializedJson = mapper.writeValueAsString(kubernetesRoleBinding);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
-    }
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
+  }
 
-    @Test
-    public void kubernetesRoleBuilderTest() throws Exception {
+  @Test
+  public void kubernetesRoleBuilderTest() throws Exception {
 
-        // given
-        final String originalJson = Helper.loadJson("/valid-roleBinding.json");
+    // given
+    final String originalJson = Helper.loadJson("/valid-roleBinding.json");
 
-        // when
-        RoleBinding kubernetesRoleBinding = new RoleBindingBuilder()
-                .withNewMetadata()
-                    .withName("read-jobs")
-                    .withNamespace("default")
-                .endMetadata()
-                .addToSubjects(0, new SubjectBuilder()
-                        .withApiGroup("rbac.authorization.k8s.io")
-                        .withKind("User")
-                        .withName("jane")
-                        .withNamespace("default")
-                        .build()
-                )
-                .withRoleRef(new RoleRefBuilder()
-                        .withApiGroup("rbac.authorization.k8s.io")
-                        .withKind("Role")
-                        .withName("job-reader")
-                        .build()
-                )
-                .build();
+    // when
+    RoleBinding kubernetesRoleBinding = new RoleBindingBuilder()
+        .withNewMetadata()
+        .withName("read-jobs")
+        .withNamespace("default")
+        .endMetadata()
+        .addToSubjects(0, new SubjectBuilder()
+            .withApiGroup("rbac.authorization.k8s.io")
+            .withKind("User")
+            .withName("jane")
+            .withNamespace("default")
+            .build())
+        .withRoleRef(new RoleRefBuilder()
+            .withApiGroup("rbac.authorization.k8s.io")
+            .withKind("Role")
+            .withName("job-reader")
+            .build())
+        .build();
 
-        final String serializedJson = mapper.writeValueAsString(kubernetesRoleBinding);
+    final String serializedJson = mapper.writeValueAsString(kubernetesRoleBinding);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                 .isEqualTo(originalJson);
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
 
-    }
+  }
 }
diff --git a/kubernetes-model-generator/kubernetes-model-rbac/src/test/java/io/fabric8/kubernetes/api/model/rbac/RoleTest.java b/kubernetes-model-generator/kubernetes-model-rbac/src/test/java/io/fabric8/kubernetes/api/model/rbac/RoleTest.java
index cfcd0390288..a2fbfb3c988 100644
--- a/kubernetes-model-generator/kubernetes-model-rbac/src/test/java/io/fabric8/kubernetes/api/model/rbac/RoleTest.java
+++ b/kubernetes-model-generator/kubernetes-model-rbac/src/test/java/io/fabric8/kubernetes/api/model/rbac/RoleTest.java
@@ -26,51 +26,50 @@
 
 public class RoleTest {
 
-    private final ObjectMapper mapper = new ObjectMapper();
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @Test
-    public void kubernetesRoleTest() throws Exception {
-        // given
-        final String originalJson = Helper.loadJson("/valid-role.json");
+  @Test
+  public void kubernetesRoleTest() throws Exception {
+    // given
+    final String originalJson = Helper.loadJson("/valid-role.json");
 
-        // when
-        final Role kubernetesRole = mapper.readValue(originalJson, Role.class);
-        final String serializedJson = mapper.writeValueAsString(kubernetesRole);
+    // when
+    final Role kubernetesRole = mapper.readValue(originalJson, Role.class);
+    final String serializedJson = mapper.writeValueAsString(kubernetesRole);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
-    }
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
+  }
 
-    @Test
-    public void kubernetesRoleBuilderTest() throws Exception {
+  @Test
+  public void kubernetesRoleBuilderTest() throws Exception {
 
-        // given
-        final String originalJson = Helper.loadJson("/valid-role.json");
+    // given
+    final String originalJson = Helper.loadJson("/valid-role.json");
 
-        // when
-        Role kubernetesRole = new RoleBuilder()
-                .withNewMetadata()
-                    .withName("job-reader")
-                    .withNamespace("default")
-                .endMetadata()
-                .addToRules(0, new PolicyRuleBuilder()
-                        .addToApiGroups(0,"batch")
-                        .addToNonResourceURLs(0,"/healthz")
-                        .addToResourceNames(0,"my-job")
-                        .addToResources(0,"jobs")
-                        .addToVerbs(0, "get")
-                        .addToVerbs(1, "watch")
-                        .addToVerbs(2, "list")
-                        .build()
-                    )
-                .build();
+    // when
+    Role kubernetesRole = new RoleBuilder()
+        .withNewMetadata()
+        .withName("job-reader")
+        .withNamespace("default")
+        .endMetadata()
+        .addToRules(0, new PolicyRuleBuilder()
+            .addToApiGroups(0, "batch")
+            .addToNonResourceURLs(0, "/healthz")
+            .addToResourceNames(0, "my-job")
+            .addToResources(0, "jobs")
+            .addToVerbs(0, "get")
+            .addToVerbs(1, "watch")
+            .addToVerbs(2, "list")
+            .build())
+        .build();
 
-        final String serializedJson = mapper.writeValueAsString(kubernetesRole);
+    final String serializedJson = mapper.writeValueAsString(kubernetesRole);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
 
-    }
+  }
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterClaimTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterClaimTest.java
index c8496ab3112..1d09aadd37e 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterClaimTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterClaimTest.java
@@ -32,8 +32,8 @@ class ClusterClaimTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException, ParseException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-clusterclaim.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final ClusterClaim clusterClaim = mapper.readValue(originalJson, ClusterClaim.class);
@@ -43,36 +43,37 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException, P
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(clusterClaim)
-      .isNotNull()
-      .isEqualTo(clusterClaimFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "foo")
-      .hasFieldOrPropertyWithValue("metadata.namespace", "my-project")
-      .hasFieldOrPropertyWithValue("spec.clusterPoolName", "openshift-46-aws-us-east-1")
-      .hasFieldOrPropertyWithValue("spec.lifetime", Duration.parse("8h"))
-      .hasFieldOrPropertyWithValue("spec.namespace", "openshift-46-aws-us-east-1-j495p");
+        .isNotNull()
+        .isEqualTo(clusterClaimFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "foo")
+        .hasFieldOrPropertyWithValue("metadata.namespace", "my-project")
+        .hasFieldOrPropertyWithValue("spec.clusterPoolName", "openshift-46-aws-us-east-1")
+        .hasFieldOrPropertyWithValue("spec.lifetime", Duration.parse("8h"))
+        .hasFieldOrPropertyWithValue("spec.namespace", "openshift-46-aws-us-east-1-j495p");
   }
 
   @Test
   void builderShouldCreateObject() throws ParseException {
     // Given
     ClusterClaimBuilder clusterClaimBuilder = new ClusterClaimBuilder()
-      .withNewMetadata()
-      .withName("foo")
-      .endMetadata()
-      .withNewSpec()
-      .withClusterPoolName("openshift-46-aws-us-east-1")
-      .withLifetime(Duration.parse("8h"))
-      .withNamespace("openshift-46-aws-us-east-1-j495p")
-      .endSpec();
+        .withNewMetadata()
+        .withName("foo")
+        .endMetadata()
+        .withNewSpec()
+        .withClusterPoolName("openshift-46-aws-us-east-1")
+        .withLifetime(Duration.parse("8h"))
+        .withNamespace("openshift-46-aws-us-east-1-j495p")
+        .endSpec();
 
     // When
     ClusterClaim clusterClaim = clusterClaimBuilder.build();
 
     // Then
     assertThat(clusterClaim)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "foo")
-      .hasFieldOrPropertyWithValue("spec.clusterPoolName", "openshift-46-aws-us-east-1")
-      .hasFieldOrPropertyWithValue("spec.lifetime", Duration.parse("8h"))
-      .hasFieldOrPropertyWithValue("spec.namespace", "openshift-46-aws-us-east-1-j495p");
-  }}
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "foo")
+        .hasFieldOrPropertyWithValue("spec.clusterPoolName", "openshift-46-aws-us-east-1")
+        .hasFieldOrPropertyWithValue("spec.lifetime", Duration.parse("8h"))
+        .hasFieldOrPropertyWithValue("spec.namespace", "openshift-46-aws-us-east-1-j495p");
+  }
+}
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterDeploymentTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterDeploymentTest.java
index e2cdcebc0f8..135abb01fb7 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterDeploymentTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterDeploymentTest.java
@@ -15,13 +15,13 @@
  */
 package io.fabric8.openshift.api.model.hive.v1;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.Test;
+
 import java.io.IOException;
 import java.util.Collections;
 import java.util.Scanner;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.junit.jupiter.api.Test;
-
 import static org.assertj.core.api.Assertions.assertThat;
 
 class ClusterDeploymentTest {
@@ -31,8 +31,8 @@ class ClusterDeploymentTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-clusterdeployment.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final ClusterDeployment clusterDeployment = mapper.readValue(originalJson, ClusterDeployment.class);
@@ -42,66 +42,66 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(clusterDeployment)
-      .isNotNull()
-      .isEqualTo(clusterDeploymentFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.annotations", Collections.singletonMap("hive.openshift.io/delete-after", "8h"))
-      .hasFieldOrPropertyWithValue("metadata.name", "foo")
-      .hasFieldOrPropertyWithValue("spec.clusterName", "foo")
-      .hasFieldOrPropertyWithValue("spec.preserveOnDelete", false)
-      .hasFieldOrPropertyWithValue("spec.baseDomain", "bar.baz")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "foo-aws-creds")
-      .hasFieldOrPropertyWithValue("spec.provisioning.installConfigSecretRef.name", "foo-install-config")
-      .hasFieldOrPropertyWithValue("spec.provisioning.imageSetRef.name", "clusterimageset-sample")
-      .hasFieldOrPropertyWithValue("spec.pullSecretRef.name", "foo-pull-secret");
+        .isNotNull()
+        .isEqualTo(clusterDeploymentFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.annotations", Collections.singletonMap("hive.openshift.io/delete-after", "8h"))
+        .hasFieldOrPropertyWithValue("metadata.name", "foo")
+        .hasFieldOrPropertyWithValue("spec.clusterName", "foo")
+        .hasFieldOrPropertyWithValue("spec.preserveOnDelete", false)
+        .hasFieldOrPropertyWithValue("spec.baseDomain", "bar.baz")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "foo-aws-creds")
+        .hasFieldOrPropertyWithValue("spec.provisioning.installConfigSecretRef.name", "foo-install-config")
+        .hasFieldOrPropertyWithValue("spec.provisioning.imageSetRef.name", "clusterimageset-sample")
+        .hasFieldOrPropertyWithValue("spec.pullSecretRef.name", "foo-pull-secret");
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     ClusterDeploymentBuilder clusterDeploymentBuilder = new ClusterDeploymentBuilder()
-      .withNewMetadata()
-      .addToAnnotations(Collections.singletonMap("hive.openshift.io/delete-after", "8h"))
-      .withName("foo")
-      .endMetadata()
-      .withNewSpec()
-      .withPreserveOnDelete(false)
-      .withClusterName("foo")
-      .withBaseDomain("bar.baz")
-      .withNewPlatform()
-      .withNewAws()
-      .withRegion("us-east-1")
-      .withNewCredentialsSecretRef().withName("foo-aws-creds").endCredentialsSecretRef()
-      .endAws()
-      .endPlatform()
-      .withNewProvisioning()
-      .withNewInstallConfigSecretRef()
-      .withName("foo-install-config")
-      .endInstallConfigSecretRef()
-      .withNewImageSetRef()
-      .withName("clusterimageset-sample")
-      .endImageSetRef()
-      .endProvisioning()
-      .withNewPullSecretRef()
-      .withName("foo-pull-secret")
-      .endPullSecretRef()
-      .endSpec();
+        .withNewMetadata()
+        .addToAnnotations(Collections.singletonMap("hive.openshift.io/delete-after", "8h"))
+        .withName("foo")
+        .endMetadata()
+        .withNewSpec()
+        .withPreserveOnDelete(false)
+        .withClusterName("foo")
+        .withBaseDomain("bar.baz")
+        .withNewPlatform()
+        .withNewAws()
+        .withRegion("us-east-1")
+        .withNewCredentialsSecretRef().withName("foo-aws-creds").endCredentialsSecretRef()
+        .endAws()
+        .endPlatform()
+        .withNewProvisioning()
+        .withNewInstallConfigSecretRef()
+        .withName("foo-install-config")
+        .endInstallConfigSecretRef()
+        .withNewImageSetRef()
+        .withName("clusterimageset-sample")
+        .endImageSetRef()
+        .endProvisioning()
+        .withNewPullSecretRef()
+        .withName("foo-pull-secret")
+        .endPullSecretRef()
+        .endSpec();
 
     // When
     ClusterDeployment clusterDeployment = clusterDeploymentBuilder.build();
 
     // Then
     assertThat(clusterDeployment)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.annotations", Collections.singletonMap("hive.openshift.io/delete-after", "8h"))
-      .hasFieldOrPropertyWithValue("metadata.name", "foo")
-      .hasFieldOrPropertyWithValue("spec.clusterName", "foo")
-      .hasFieldOrPropertyWithValue("spec.preserveOnDelete", false)
-      .hasFieldOrPropertyWithValue("spec.baseDomain", "bar.baz")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "foo-aws-creds")
-      .hasFieldOrPropertyWithValue("spec.provisioning.installConfigSecretRef.name", "foo-install-config")
-      .hasFieldOrPropertyWithValue("spec.provisioning.imageSetRef.name", "clusterimageset-sample")
-      .hasFieldOrPropertyWithValue("spec.pullSecretRef.name", "foo-pull-secret");
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.annotations", Collections.singletonMap("hive.openshift.io/delete-after", "8h"))
+        .hasFieldOrPropertyWithValue("metadata.name", "foo")
+        .hasFieldOrPropertyWithValue("spec.clusterName", "foo")
+        .hasFieldOrPropertyWithValue("spec.preserveOnDelete", false)
+        .hasFieldOrPropertyWithValue("spec.baseDomain", "bar.baz")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "foo-aws-creds")
+        .hasFieldOrPropertyWithValue("spec.provisioning.installConfigSecretRef.name", "foo-install-config")
+        .hasFieldOrPropertyWithValue("spec.provisioning.imageSetRef.name", "clusterimageset-sample")
+        .hasFieldOrPropertyWithValue("spec.pullSecretRef.name", "foo-pull-secret");
   }
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterDeprovisionTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterDeprovisionTest.java
index 6205b2e8bec..53fe2534d3d 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterDeprovisionTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterDeprovisionTest.java
@@ -30,8 +30,8 @@ class ClusterDeprovisionTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-clusterdeprovision.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final ClusterDeprovision clusterDeprovision = mapper.readValue(originalJson, ClusterDeprovision.class);
@@ -41,40 +41,40 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(clusterDeprovision)
-      .isNotNull()
-      .isEqualTo(clusterDeprovisionFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "clusterdeprovision-sample")
-      .hasFieldOrPropertyWithValue("spec.infraID", "cluster-infra-id")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "cluster-aws-creds");
+        .isNotNull()
+        .isEqualTo(clusterDeprovisionFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "clusterdeprovision-sample")
+        .hasFieldOrPropertyWithValue("spec.infraID", "cluster-infra-id")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "cluster-aws-creds");
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     ClusterDeprovisionBuilder clusterDeprovisionBuilder = new ClusterDeprovisionBuilder()
-      .withNewMetadata()
-      .withName("clusterdeprovision-sample")
-      .endMetadata()
-      .withNewSpec()
-      .withInfraID("cluster-infra-id")
-      .withNewPlatform()
-      .withNewAws()
-      .withNewCredentialsSecretRef().withName("cluster-aws-creds").endCredentialsSecretRef()
-      .withRegion("us-east-1")
-      .endAws()
-      .endPlatform()
-      .endSpec();
+        .withNewMetadata()
+        .withName("clusterdeprovision-sample")
+        .endMetadata()
+        .withNewSpec()
+        .withInfraID("cluster-infra-id")
+        .withNewPlatform()
+        .withNewAws()
+        .withNewCredentialsSecretRef().withName("cluster-aws-creds").endCredentialsSecretRef()
+        .withRegion("us-east-1")
+        .endAws()
+        .endPlatform()
+        .endSpec();
 
     // When
     ClusterDeprovision clusterDeprovision = clusterDeprovisionBuilder.build();
 
     // Then
     assertThat(clusterDeprovision)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "clusterdeprovision-sample")
-      .hasFieldOrPropertyWithValue("spec.infraID", "cluster-infra-id")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "cluster-aws-creds");
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "clusterdeprovision-sample")
+        .hasFieldOrPropertyWithValue("spec.infraID", "cluster-infra-id")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "cluster-aws-creds");
   }
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterImageSetTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterImageSetTest.java
index 062677ab10a..517f1db600d 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterImageSetTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterImageSetTest.java
@@ -30,8 +30,8 @@ class ClusterImageSetTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-clusterimageset.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final ClusterImageSet clusterImageSet = mapper.readValue(originalJson, ClusterImageSet.class);
@@ -41,30 +41,30 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(clusterImageSet)
-      .isNotNull()
-      .isEqualTo(clusterImageSetFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "clusterimageset-sample")
-      .hasFieldOrPropertyWithValue("spec.releaseImage", "quay.io/openshift-release-dev/ocp-release:4.0.0-0.6");
+        .isNotNull()
+        .isEqualTo(clusterImageSetFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "clusterimageset-sample")
+        .hasFieldOrPropertyWithValue("spec.releaseImage", "quay.io/openshift-release-dev/ocp-release:4.0.0-0.6");
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     ClusterImageSetBuilder clusterImageSetBuilder = new ClusterImageSetBuilder()
-      .withNewMetadata()
-      .withName("clusterimageset-sample")
-      .endMetadata()
-      .withNewSpec()
-      .withReleaseImage("quay.io/openshift-release-dev/ocp-release:4.0.0-0.6")
-      .endSpec();
+        .withNewMetadata()
+        .withName("clusterimageset-sample")
+        .endMetadata()
+        .withNewSpec()
+        .withReleaseImage("quay.io/openshift-release-dev/ocp-release:4.0.0-0.6")
+        .endSpec();
 
     // When
     ClusterImageSet clusterImageSet = clusterImageSetBuilder.build();
 
     // Then
     assertThat(clusterImageSet)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "clusterimageset-sample")
-      .hasFieldOrPropertyWithValue("spec.releaseImage", "quay.io/openshift-release-dev/ocp-release:4.0.0-0.6");
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "clusterimageset-sample")
+        .hasFieldOrPropertyWithValue("spec.releaseImage", "quay.io/openshift-release-dev/ocp-release:4.0.0-0.6");
   }
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterPoolTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterPoolTest.java
index 7580ea6e70c..1b32cde8d91 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterPoolTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterPoolTest.java
@@ -30,8 +30,8 @@ class ClusterPoolTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-clusterpool.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final ClusterPool clusterPool = mapper.readValue(originalJson, ClusterPool.class);
@@ -41,59 +41,59 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(clusterPool)
-      .isNotNull()
-      .isEqualTo(clusterPoolFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "openshift-46-aws-us-east-1")
-      .hasFieldOrPropertyWithValue("metadata.namespace", "my-project")
-      .hasFieldOrPropertyWithValue("spec.baseDomain", "new-installer.openshift.com")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "hive-team-aws-creds")
-      .hasFieldOrPropertyWithValue("spec.pullSecretRef.name", "hive-team-pull-secret")
-      .hasFieldOrPropertyWithValue("spec.runningCount", 1)
-      .hasFieldOrPropertyWithValue("spec.size", 3);
+        .isNotNull()
+        .isEqualTo(clusterPoolFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "openshift-46-aws-us-east-1")
+        .hasFieldOrPropertyWithValue("metadata.namespace", "my-project")
+        .hasFieldOrPropertyWithValue("spec.baseDomain", "new-installer.openshift.com")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "hive-team-aws-creds")
+        .hasFieldOrPropertyWithValue("spec.pullSecretRef.name", "hive-team-pull-secret")
+        .hasFieldOrPropertyWithValue("spec.runningCount", 1)
+        .hasFieldOrPropertyWithValue("spec.size", 3);
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     ClusterPoolBuilder clusterPoolBuilder = new ClusterPoolBuilder()
-      .withNewMetadata()
-      .withName("openshift-46-aws-us-east-1")
-      .withNamespace("my-project")
-      .endMetadata()
-      .withNewSpec()
-      .withBaseDomain("new-installer.openshift.com")
-      .withNewImageSetRef()
-      .withName("openshift-4-6")
-      .endImageSetRef()
-      .withNewPlatform()
-      .withNewAws()
-      .withNewCredentialsSecretRef()
-      .withName("hive-team-aws-creds")
-      .endCredentialsSecretRef()
-      .withRegion("us-east-1")
-      .endAws()
-      .endPlatform()
-      .withNewPullSecretRef()
-      .withName("hive-team-pull-secret")
-      .endPullSecretRef()
-      .withRunningCount(1)
-      .withSize(3)
-      .endSpec();
+        .withNewMetadata()
+        .withName("openshift-46-aws-us-east-1")
+        .withNamespace("my-project")
+        .endMetadata()
+        .withNewSpec()
+        .withBaseDomain("new-installer.openshift.com")
+        .withNewImageSetRef()
+        .withName("openshift-4-6")
+        .endImageSetRef()
+        .withNewPlatform()
+        .withNewAws()
+        .withNewCredentialsSecretRef()
+        .withName("hive-team-aws-creds")
+        .endCredentialsSecretRef()
+        .withRegion("us-east-1")
+        .endAws()
+        .endPlatform()
+        .withNewPullSecretRef()
+        .withName("hive-team-pull-secret")
+        .endPullSecretRef()
+        .withRunningCount(1)
+        .withSize(3)
+        .endSpec();
 
     // When
     ClusterPool clusterPool = clusterPoolBuilder.build();
 
     // Then
     assertThat(clusterPool)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "openshift-46-aws-us-east-1")
-      .hasFieldOrPropertyWithValue("metadata.namespace", "my-project")
-      .hasFieldOrPropertyWithValue("spec.baseDomain", "new-installer.openshift.com")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "hive-team-aws-creds")
-      .hasFieldOrPropertyWithValue("spec.pullSecretRef.name", "hive-team-pull-secret")
-      .hasFieldOrPropertyWithValue("spec.runningCount", 1)
-      .hasFieldOrPropertyWithValue("spec.size", 3);
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "openshift-46-aws-us-east-1")
+        .hasFieldOrPropertyWithValue("metadata.namespace", "my-project")
+        .hasFieldOrPropertyWithValue("spec.baseDomain", "new-installer.openshift.com")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.region", "us-east-1")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.credentialsSecretRef.name", "hive-team-aws-creds")
+        .hasFieldOrPropertyWithValue("spec.pullSecretRef.name", "hive-team-pull-secret")
+        .hasFieldOrPropertyWithValue("spec.runningCount", 1)
+        .hasFieldOrPropertyWithValue("spec.size", 3);
   }
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterRelocateTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterRelocateTest.java
index 6bd4df74ad3..184a376b0fd 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterRelocateTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/ClusterRelocateTest.java
@@ -31,8 +31,8 @@ class ClusterRelocateTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-clusterrelocate.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final ClusterRelocate clusterRelocate = mapper.readValue(originalJson, ClusterRelocate.class);
@@ -42,40 +42,42 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(clusterRelocate)
-      .isNotNull()
-      .isEqualTo(clusterRelocateFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "hive2-cluster-relocator")
-      .hasFieldOrPropertyWithValue("spec.kubeconfigSecretRef.name", "hive2-remote-kubeconfig-secret")
-      .hasFieldOrPropertyWithValue("spec.kubeconfigSecretRef.namespace", "hive")
-      .hasFieldOrPropertyWithValue("spec.clusterDeploymentSelector.matchLabels", Collections.singletonMap("hive-instance", "hive2"));
+        .isNotNull()
+        .isEqualTo(clusterRelocateFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "hive2-cluster-relocator")
+        .hasFieldOrPropertyWithValue("spec.kubeconfigSecretRef.name", "hive2-remote-kubeconfig-secret")
+        .hasFieldOrPropertyWithValue("spec.kubeconfigSecretRef.namespace", "hive")
+        .hasFieldOrPropertyWithValue("spec.clusterDeploymentSelector.matchLabels",
+            Collections.singletonMap("hive-instance", "hive2"));
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     ClusterRelocateBuilder clusterRelocateBuilder = new ClusterRelocateBuilder()
-      .withNewMetadata()
-      .withName("hive2-cluster-relocator")
-      .endMetadata()
-      .withNewSpec()
-      .withNewKubeconfigSecretRef()
-      .withName("hive2-remote-kubeconfig-secret")
-      .withNamespace("hive")
-      .endKubeconfigSecretRef()
-      .withNewClusterDeploymentSelector()
-      .addToMatchLabels("hive-instance", "hive2")
-      .endClusterDeploymentSelector()
-      .endSpec();
+        .withNewMetadata()
+        .withName("hive2-cluster-relocator")
+        .endMetadata()
+        .withNewSpec()
+        .withNewKubeconfigSecretRef()
+        .withName("hive2-remote-kubeconfig-secret")
+        .withNamespace("hive")
+        .endKubeconfigSecretRef()
+        .withNewClusterDeploymentSelector()
+        .addToMatchLabels("hive-instance", "hive2")
+        .endClusterDeploymentSelector()
+        .endSpec();
 
     // When
     ClusterRelocate clusterRelocate = clusterRelocateBuilder.build();
 
     // Then
     assertThat(clusterRelocate)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "hive2-cluster-relocator")
-      .hasFieldOrPropertyWithValue("spec.kubeconfigSecretRef.name", "hive2-remote-kubeconfig-secret")
-      .hasFieldOrPropertyWithValue("spec.kubeconfigSecretRef.namespace", "hive")
-      .hasFieldOrPropertyWithValue("spec.clusterDeploymentSelector.matchLabels", Collections.singletonMap("hive-instance", "hive2"));
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "hive2-cluster-relocator")
+        .hasFieldOrPropertyWithValue("spec.kubeconfigSecretRef.name", "hive2-remote-kubeconfig-secret")
+        .hasFieldOrPropertyWithValue("spec.kubeconfigSecretRef.namespace", "hive")
+        .hasFieldOrPropertyWithValue("spec.clusterDeploymentSelector.matchLabels",
+            Collections.singletonMap("hive-instance", "hive2"));
   }
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/DNSZoneTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/DNSZoneTest.java
index a3c9fc22f23..a3f0185d478 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/DNSZoneTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/DNSZoneTest.java
@@ -31,8 +31,8 @@ class DNSZoneTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-dnszone.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final DNSZone dnsZone = mapper.readValue(originalJson, DNSZone.class);
@@ -42,37 +42,37 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(dnsZone)
-      .isNotNull()
-      .isEqualTo(dnsZoneFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "dnszone-sample")
-      .hasFieldOrPropertyWithValue("spec.zone", "testzone.testdomain.com")
-      .hasFieldOrPropertyWithValue("spec.aws.credentialsSecretRef.name", "route53-creds-secret");
+        .isNotNull()
+        .isEqualTo(dnsZoneFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "dnszone-sample")
+        .hasFieldOrPropertyWithValue("spec.zone", "testzone.testdomain.com")
+        .hasFieldOrPropertyWithValue("spec.aws.credentialsSecretRef.name", "route53-creds-secret");
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     DNSZoneBuilder dnsZoneBuilder = new DNSZoneBuilder()
-      .withNewMetadata()
-      .addToAnnotations(Collections.singletonMap("hive.openshift.io/delete-after", "8h"))
-      .withName("dnszone-sample")
-      .endMetadata()
-      .withNewSpec()
-      .withPreserveOnDelete(false)
-      .withZone("testzone.testdomain.com")
-      .withNewAws()
-      .withNewCredentialsSecretRef().withName("route53-creds-secret").endCredentialsSecretRef()
-      .endAws()
-      .endSpec();
+        .withNewMetadata()
+        .addToAnnotations(Collections.singletonMap("hive.openshift.io/delete-after", "8h"))
+        .withName("dnszone-sample")
+        .endMetadata()
+        .withNewSpec()
+        .withPreserveOnDelete(false)
+        .withZone("testzone.testdomain.com")
+        .withNewAws()
+        .withNewCredentialsSecretRef().withName("route53-creds-secret").endCredentialsSecretRef()
+        .endAws()
+        .endSpec();
 
     // When
     DNSZone dnsZone = dnsZoneBuilder.build();
 
     // Then
     assertThat(dnsZone)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "dnszone-sample")
-      .hasFieldOrPropertyWithValue("spec.zone", "testzone.testdomain.com")
-      .hasFieldOrPropertyWithValue("spec.aws.credentialsSecretRef.name", "route53-creds-secret");
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "dnszone-sample")
+        .hasFieldOrPropertyWithValue("spec.zone", "testzone.testdomain.com")
+        .hasFieldOrPropertyWithValue("spec.aws.credentialsSecretRef.name", "route53-creds-secret");
   }
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/HiveConfigTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/HiveConfigTest.java
index 744ffd8d208..b260f3fb2e8 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/HiveConfigTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/HiveConfigTest.java
@@ -31,8 +31,8 @@ class HiveConfigTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-hiveconfig.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final HiveConfig hiveConfig = mapper.readValue(originalJson, HiveConfig.class);
@@ -42,43 +42,44 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(hiveConfig)
-      .isNotNull()
-      .isEqualTo(hiveConfigFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "hive")
-      .extracting("spec.managedDomains").asList()
-      .hasSize(1)
-      .first()
-      .hasFieldOrPropertyWithValue("gcp.credentialsSecretRef.name", "gcp-creds")
-      .hasFieldOrPropertyWithValue("domains", Collections.singletonList("hive.example.com"));
+        .isNotNull()
+        .isEqualTo(hiveConfigFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "hive")
+        .extracting("spec.managedDomains").asList()
+        .hasSize(1)
+        .first()
+        .hasFieldOrPropertyWithValue("gcp.credentialsSecretRef.name", "gcp-creds")
+        .hasFieldOrPropertyWithValue("domains", Collections.singletonList("hive.example.com"));
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     HiveConfigBuilder hiveConfigBuilder = new HiveConfigBuilder()
-      .withNewMetadata()
-      .withName("hive")
-      .endMetadata()
-      .withNewSpec()
-      .addNewManagedDomain()
-      .withNewGcp()
-      .withNewCredentialsSecretRef("gcp-creds")
-      .endGcp()
-      .addToDomains("hive.example.com")
-      .endManagedDomain()
-      .endSpec();
+        .withNewMetadata()
+        .withName("hive")
+        .endMetadata()
+        .withNewSpec()
+        .addNewManagedDomain()
+        .withNewGcp()
+        .withNewCredentialsSecretRef("gcp-creds")
+        .endGcp()
+        .addToDomains("hive.example.com")
+        .endManagedDomain()
+        .endSpec();
 
     // When
     HiveConfig hiveConfig = hiveConfigBuilder.build();
 
     // Then
     assertThat(hiveConfig)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "hive")
-      .extracting("spec.managedDomains").asList()
-      .hasSize(1)
-      .first()
-      .hasFieldOrPropertyWithValue("gcp.credentialsSecretRef.name", "gcp-creds")
-      .hasFieldOrPropertyWithValue("domains", Collections.singletonList("hive.example.com"));;
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "hive")
+        .extracting("spec.managedDomains").asList()
+        .hasSize(1)
+        .first()
+        .hasFieldOrPropertyWithValue("gcp.credentialsSecretRef.name", "gcp-creds")
+        .hasFieldOrPropertyWithValue("domains", Collections.singletonList("hive.example.com"));
+    ;
   }
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/MachinePoolTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/MachinePoolTest.java
index fd38798a7cb..028e16a261e 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/MachinePoolTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/MachinePoolTest.java
@@ -15,12 +15,12 @@
  */
 package io.fabric8.openshift.api.model.hive.v1;
 
-import java.io.IOException;
-import java.util.Scanner;
-
 import com.fasterxml.jackson.databind.ObjectMapper;
 import org.junit.jupiter.api.Test;
 
+import java.io.IOException;
+import java.util.Scanner;
+
 import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
 
 class MachinePoolTest {
@@ -30,8 +30,8 @@ class MachinePoolTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-machinepool.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final MachinePool machinePool = mapper.readValue(originalJson, MachinePool.class);
@@ -41,57 +41,57 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(machinePool)
-      .isNotNull()
-      .isEqualTo(machinePoolFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "foo-worker")
-      .hasFieldOrPropertyWithValue("spec.clusterDeploymentRef.name", "foo")
-      .hasFieldOrPropertyWithValue("spec.name", "worker")
-      .hasFieldOrPropertyWithValue("spec.replicas", 3L)
-      .hasFieldOrPropertyWithValue("spec.platform.aws.type", "m4.large")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.iops", 100)
-      .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.size", 22)
-      .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.type", "gp2");
+        .isNotNull()
+        .isEqualTo(machinePoolFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "foo-worker")
+        .hasFieldOrPropertyWithValue("spec.clusterDeploymentRef.name", "foo")
+        .hasFieldOrPropertyWithValue("spec.name", "worker")
+        .hasFieldOrPropertyWithValue("spec.replicas", 3L)
+        .hasFieldOrPropertyWithValue("spec.platform.aws.type", "m4.large")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.iops", 100)
+        .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.size", 22)
+        .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.type", "gp2");
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     MachinePoolBuilder machinePoolBuilder = new MachinePoolBuilder()
-      .withNewMetadata()
-      .withName("foo-worker")
-      .endMetadata()
-      .withNewSpec()
-      .withNewClusterDeploymentRef()
-      .withName("foo")
-      .endClusterDeploymentRef()
-      .withName("worker")
-      .withReplicas(3L)
-      .withNewPlatform()
-      .withNewAws()
-      .withType("m4.large")
-      .withNewRootVolume()
-      .withIops(100)
-      .withSize(22)
-      .withType("gp2")
-      .endRootVolume()
-      .endAws()
-      .endPlatform()
-      .endSpec();
+        .withNewMetadata()
+        .withName("foo-worker")
+        .endMetadata()
+        .withNewSpec()
+        .withNewClusterDeploymentRef()
+        .withName("foo")
+        .endClusterDeploymentRef()
+        .withName("worker")
+        .withReplicas(3L)
+        .withNewPlatform()
+        .withNewAws()
+        .withType("m4.large")
+        .withNewRootVolume()
+        .withIops(100)
+        .withSize(22)
+        .withType("gp2")
+        .endRootVolume()
+        .endAws()
+        .endPlatform()
+        .endSpec();
 
     // When
     MachinePool machinePool = machinePoolBuilder.build();
 
     // Then
     assertThat(machinePool)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "foo-worker")
-      .hasFieldOrPropertyWithValue("spec.clusterDeploymentRef.name", "foo")
-      .hasFieldOrPropertyWithValue("spec.name", "worker")
-      .hasFieldOrPropertyWithValue("spec.replicas", 3L)
-      .hasFieldOrPropertyWithValue("spec.platform.aws.type", "m4.large")
-      .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.iops", 100)
-      .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.size", 22)
-      .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.type", "gp2");
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "foo-worker")
+        .hasFieldOrPropertyWithValue("spec.clusterDeploymentRef.name", "foo")
+        .hasFieldOrPropertyWithValue("spec.name", "worker")
+        .hasFieldOrPropertyWithValue("spec.replicas", 3L)
+        .hasFieldOrPropertyWithValue("spec.platform.aws.type", "m4.large")
+        .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.iops", 100)
+        .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.size", 22)
+        .hasFieldOrPropertyWithValue("spec.platform.aws.rootVolume.type", "gp2");
   }
 
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/SelectorSyncSetTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/SelectorSyncSetTest.java
index 3e439a136b6..9d3cdb8be4f 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/SelectorSyncSetTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/SelectorSyncSetTest.java
@@ -34,8 +34,8 @@ class SelectorSyncSetTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-selectorsyncset.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final SelectorSyncSet selectorSyncSet = mapper.readValue(originalJson, SelectorSyncSet.class);
@@ -45,42 +45,44 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(selectorSyncSet)
-      .isNotNull()
-      .isEqualTo(selectorSyncSetFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "mygroup")
-      .hasFieldOrPropertyWithValue("spec.clusterDeploymentSelector.matchLabels", Collections.singletonMap("cluster-group", "abutcher"))
-      .extracting("spec.resources").asList()
-      .hasSize(1);
+        .isNotNull()
+        .isEqualTo(selectorSyncSetFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "mygroup")
+        .hasFieldOrPropertyWithValue("spec.clusterDeploymentSelector.matchLabels",
+            Collections.singletonMap("cluster-group", "abutcher"))
+        .extracting("spec.resources").asList()
+        .hasSize(1);
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     Group group = new GroupBuilder()
-      .withNewMetadata().withName("mygroup").endMetadata()
-      .addToUsers("abutcher")
-      .build();
+        .withNewMetadata().withName("mygroup").endMetadata()
+        .addToUsers("abutcher")
+        .build();
     Map groupResource = mapper.convertValue(group, Map.class);
     SelectorSyncSetBuilder selectorSyncSetBuilder = new SelectorSyncSetBuilder()
-      .withNewMetadata()
-      .withName("mygroup")
-      .endMetadata()
-      .withNewSpec()
-      .withNewClusterDeploymentSelector()
-      .addToMatchLabels("cluster-group", "abutcher")
-      .endClusterDeploymentSelector()
-      .withResources(Collections.singletonList(groupResource))
-      .endSpec();
+        .withNewMetadata()
+        .withName("mygroup")
+        .endMetadata()
+        .withNewSpec()
+        .withNewClusterDeploymentSelector()
+        .addToMatchLabels("cluster-group", "abutcher")
+        .endClusterDeploymentSelector()
+        .withResources(Collections.singletonList(groupResource))
+        .endSpec();
 
     // When
     SelectorSyncSet selectorSyncSet = selectorSyncSetBuilder.build();
 
     // Then
     assertThat(selectorSyncSet)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "mygroup")
-      .hasFieldOrPropertyWithValue("spec.clusterDeploymentSelector.matchLabels", Collections.singletonMap("cluster-group", "abutcher"))
-      .extracting("spec.resources").asList()
-      .hasSize(1);
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "mygroup")
+        .hasFieldOrPropertyWithValue("spec.clusterDeploymentSelector.matchLabels",
+            Collections.singletonMap("cluster-group", "abutcher"))
+        .extracting("spec.resources").asList()
+        .hasSize(1);
   }
 }
diff --git a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/SyncSetTest.java b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/SyncSetTest.java
index f4953b9d000..236a71af12d 100644
--- a/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/SyncSetTest.java
+++ b/kubernetes-model-generator/openshift-model-hive/src/test/java/io/fabric8/openshift/api/model/hive/v1/SyncSetTest.java
@@ -30,8 +30,8 @@ class SyncSetTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-syncset.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final SyncSet syncSet = mapper.readValue(originalJson, SyncSet.class);
@@ -41,10 +41,10 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(syncSet)
-      .isNotNull()
-      .isEqualTo(syncSetFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "mygroup")
-      .hasFieldOrPropertyWithValue("spec.resourceApplyMode", "Upsert");
+        .isNotNull()
+        .isEqualTo(syncSetFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "mygroup")
+        .hasFieldOrPropertyWithValue("spec.resourceApplyMode", "Upsert");
     assertThat(syncSet.getSpec().getClusterDeploymentRefs()).hasSize(1);
     assertThat(syncSet.getSpec().getResources()).hasSize(1);
     assertThat(syncSet.getSpec().getPatches()).hasSize(1);
@@ -55,34 +55,34 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
   void builderShouldCreateObject() {
     // Given
     SyncSetBuilder syncSetBuilder = new SyncSetBuilder()
-      .withNewMetadata()
-      .withName("mygroup")
-      .endMetadata()
-      .withNewSpec()
-      .withResourceApplyMode("Upsert")
-      .addNewClusterDeploymentRef()
-      .withName("ClusterName")
-      .endClusterDeploymentRef()
-      .addNewSecretMapping()
-      .withNewSourceRef()
-      .withName("ad-bind-password")
-      .withNamespace("default")
-      .endSourceRef()
-      .withNewTargetRef()
-      .withName("ad-bind-password")
-      .withNamespace("openshift-config")
-      .endTargetRef()
-      .endSecretMapping()
-      .endSpec();
+        .withNewMetadata()
+        .withName("mygroup")
+        .endMetadata()
+        .withNewSpec()
+        .withResourceApplyMode("Upsert")
+        .addNewClusterDeploymentRef()
+        .withName("ClusterName")
+        .endClusterDeploymentRef()
+        .addNewSecretMapping()
+        .withNewSourceRef()
+        .withName("ad-bind-password")
+        .withNamespace("default")
+        .endSourceRef()
+        .withNewTargetRef()
+        .withName("ad-bind-password")
+        .withNamespace("openshift-config")
+        .endTargetRef()
+        .endSecretMapping()
+        .endSpec();
 
     // When
     SyncSet syncSet = syncSetBuilder.build();
 
     // Then
     assertThat(syncSet)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "mygroup")
-      .hasFieldOrPropertyWithValue("spec.resourceApplyMode", "Upsert");
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "mygroup")
+        .hasFieldOrPropertyWithValue("spec.resourceApplyMode", "Upsert");
     assertThat(syncSet.getSpec().getClusterDeploymentRefs()).hasSize(1);
     assertThat(syncSet.getSpec().getSecretMappings()).hasSize(1);
   }
diff --git a/kubernetes-model-generator/openshift-model-installer/src/test/java/io/fabric8/openshift/api/model/installer/v1/InstallConfigTest.java b/kubernetes-model-generator/openshift-model-installer/src/test/java/io/fabric8/openshift/api/model/installer/v1/InstallConfigTest.java
index 5de3b7fa334..6b477619ad2 100644
--- a/kubernetes-model-generator/openshift-model-installer/src/test/java/io/fabric8/openshift/api/model/installer/v1/InstallConfigTest.java
+++ b/kubernetes-model-generator/openshift-model-installer/src/test/java/io/fabric8/openshift/api/model/installer/v1/InstallConfigTest.java
@@ -30,8 +30,8 @@ class InstallConfigTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-installconfig.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final InstallConfig installConfig = mapper.readValue(originalJson, InstallConfig.class);
@@ -41,106 +41,106 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Then
     assertThat(serializedJson).isNotNull();
     assertThat(installConfig)
-      .isNotNull()
-      .isEqualTo(installConfigFromSerializedJson)
-      .hasFieldOrPropertyWithValue("metadata.name", "mycluster")
-      .hasFieldOrPropertyWithValue("pullSecret", "sample-pull-secret")
-      .hasFieldOrPropertyWithValue("sshKey", "sample-ssh-key")
-      .hasFieldOrPropertyWithValue("platform.aws.region", "us-east-1")
-      .hasFieldOrPropertyWithValue("controlPlane.name", "master")
-      .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.type", "gp2")
-      .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.iops", 100)
-      .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.size", 22)
-      .hasFieldOrPropertyWithValue("controlPlane.platform.aws.type", "m4.xlarge")
-      .hasFieldOrPropertyWithValue("networking.machineCIDR", "10.0.0.0/16")
-      .hasFieldOrPropertyWithValue("networking.networkType",  "OpenShiftSDN");
+        .isNotNull()
+        .isEqualTo(installConfigFromSerializedJson)
+        .hasFieldOrPropertyWithValue("metadata.name", "mycluster")
+        .hasFieldOrPropertyWithValue("pullSecret", "sample-pull-secret")
+        .hasFieldOrPropertyWithValue("sshKey", "sample-ssh-key")
+        .hasFieldOrPropertyWithValue("platform.aws.region", "us-east-1")
+        .hasFieldOrPropertyWithValue("controlPlane.name", "master")
+        .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.type", "gp2")
+        .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.iops", 100)
+        .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.size", 22)
+        .hasFieldOrPropertyWithValue("controlPlane.platform.aws.type", "m4.xlarge")
+        .hasFieldOrPropertyWithValue("networking.machineCIDR", "10.0.0.0/16")
+        .hasFieldOrPropertyWithValue("networking.networkType", "OpenShiftSDN");
     assertThat(installConfig.getCompute()).asList()
-      .hasSize(1)
-      .first()
-      .hasFieldOrPropertyWithValue("name", "worker")
-      .hasFieldOrPropertyWithValue("platform.aws.rootVolume.iops", 100)
-      .hasFieldOrPropertyWithValue("platform.aws.rootVolume.size", 22)
-      .hasFieldOrPropertyWithValue("platform.aws.rootVolume.type", "gp2")
-      .hasFieldOrPropertyWithValue("platform.aws.type", "m4.xlarge")
-      .hasFieldOrPropertyWithValue("replicas", 3L);
+        .hasSize(1)
+        .first()
+        .hasFieldOrPropertyWithValue("name", "worker")
+        .hasFieldOrPropertyWithValue("platform.aws.rootVolume.iops", 100)
+        .hasFieldOrPropertyWithValue("platform.aws.rootVolume.size", 22)
+        .hasFieldOrPropertyWithValue("platform.aws.rootVolume.type", "gp2")
+        .hasFieldOrPropertyWithValue("platform.aws.type", "m4.xlarge")
+        .hasFieldOrPropertyWithValue("replicas", 3L);
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     InstallConfigBuilder installConfigBuilder = new InstallConfigBuilder()
-      .withNewMetadata()
-      .withName("mycluster")
-      .endMetadata()
-      .withPullSecret("sample-pull-secret")
-      .withSshKey("sample-ssh-key")
-      .withNewControlPlane()
-      .withName("master")
-      .withNewPlatform()
-      .withAws(new io.fabric8.openshift.api.model.installer.aws.v1.MachinePoolBuilder()
-        .withNewRootVolume()
-        .withIops(100)
-        .withSize(22)
-        .withType("gp2")
-        .endRootVolume()
-        .withType("m4.xlarge")
-        .build())
-      .endPlatform()
-      .endControlPlane()
-      .addNewCompute()
-      .withName("worker")
-      .withNewPlatform()
-      .withAws(new io.fabric8.openshift.api.model.installer.aws.v1.MachinePoolBuilder()
-        .withNewRootVolume()
-        .withIops(100)
-        .withSize(22)
-        .withType("gp2")
-        .endRootVolume()
-        .withType("m4.xlarge")
-        .build())
-      .endPlatform()
-      .withReplicas(3L)
-      .endCompute()
-      .withNewNetworking()
-      .addNewClusterNetwork()
-      .withCidr("10.128.0.0/14")
-      .withHostPrefix(23)
-      .endClusterNetwork()
-      .withMachineCIDR("10.0.0.0/16")
-      .withNetworkType("OpenShiftSDN")
-      .addToServiceNetwork("172.30.0.0/16")
-      .endNetworking()
-      .withNewPlatform()
-      .withAws(new io.fabric8.openshift.api.model.installer.aws.v1.PlatformBuilder()
-        .withRegion("us-east-1")
-        .build())
-      .endPlatform();
+        .withNewMetadata()
+        .withName("mycluster")
+        .endMetadata()
+        .withPullSecret("sample-pull-secret")
+        .withSshKey("sample-ssh-key")
+        .withNewControlPlane()
+        .withName("master")
+        .withNewPlatform()
+        .withAws(new io.fabric8.openshift.api.model.installer.aws.v1.MachinePoolBuilder()
+            .withNewRootVolume()
+            .withIops(100)
+            .withSize(22)
+            .withType("gp2")
+            .endRootVolume()
+            .withType("m4.xlarge")
+            .build())
+        .endPlatform()
+        .endControlPlane()
+        .addNewCompute()
+        .withName("worker")
+        .withNewPlatform()
+        .withAws(new io.fabric8.openshift.api.model.installer.aws.v1.MachinePoolBuilder()
+            .withNewRootVolume()
+            .withIops(100)
+            .withSize(22)
+            .withType("gp2")
+            .endRootVolume()
+            .withType("m4.xlarge")
+            .build())
+        .endPlatform()
+        .withReplicas(3L)
+        .endCompute()
+        .withNewNetworking()
+        .addNewClusterNetwork()
+        .withCidr("10.128.0.0/14")
+        .withHostPrefix(23)
+        .endClusterNetwork()
+        .withMachineCIDR("10.0.0.0/16")
+        .withNetworkType("OpenShiftSDN")
+        .addToServiceNetwork("172.30.0.0/16")
+        .endNetworking()
+        .withNewPlatform()
+        .withAws(new io.fabric8.openshift.api.model.installer.aws.v1.PlatformBuilder()
+            .withRegion("us-east-1")
+            .build())
+        .endPlatform();
 
     // When
     InstallConfig installConfig = installConfigBuilder.build();
 
     // Then
     assertThat(installConfig)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "mycluster")
-      .hasFieldOrPropertyWithValue("pullSecret", "sample-pull-secret")
-      .hasFieldOrPropertyWithValue("sshKey", "sample-ssh-key")
-      .hasFieldOrPropertyWithValue("platform.aws.region", "us-east-1")
-      .hasFieldOrPropertyWithValue("controlPlane.name", "master")
-      .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.type", "gp2")
-      .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.iops", 100)
-      .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.size", 22)
-      .hasFieldOrPropertyWithValue("controlPlane.platform.aws.type", "m4.xlarge")
-      .hasFieldOrPropertyWithValue("networking.machineCIDR", "10.0.0.0/16")
-      .hasFieldOrPropertyWithValue("networking.networkType",  "OpenShiftSDN");
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "mycluster")
+        .hasFieldOrPropertyWithValue("pullSecret", "sample-pull-secret")
+        .hasFieldOrPropertyWithValue("sshKey", "sample-ssh-key")
+        .hasFieldOrPropertyWithValue("platform.aws.region", "us-east-1")
+        .hasFieldOrPropertyWithValue("controlPlane.name", "master")
+        .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.type", "gp2")
+        .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.iops", 100)
+        .hasFieldOrPropertyWithValue("controlPlane.platform.aws.rootVolume.size", 22)
+        .hasFieldOrPropertyWithValue("controlPlane.platform.aws.type", "m4.xlarge")
+        .hasFieldOrPropertyWithValue("networking.machineCIDR", "10.0.0.0/16")
+        .hasFieldOrPropertyWithValue("networking.networkType", "OpenShiftSDN");
     assertThat(installConfig.getCompute()).asList()
-      .hasSize(1)
-      .first()
-      .hasFieldOrPropertyWithValue("name", "worker")
-      .hasFieldOrPropertyWithValue("platform.aws.rootVolume.iops", 100)
-      .hasFieldOrPropertyWithValue("platform.aws.rootVolume.size", 22)
-      .hasFieldOrPropertyWithValue("platform.aws.rootVolume.type", "gp2")
-      .hasFieldOrPropertyWithValue("platform.aws.type", "m4.xlarge")
-      .hasFieldOrPropertyWithValue("replicas", 3L);
+        .hasSize(1)
+        .first()
+        .hasFieldOrPropertyWithValue("name", "worker")
+        .hasFieldOrPropertyWithValue("platform.aws.rootVolume.iops", 100)
+        .hasFieldOrPropertyWithValue("platform.aws.rootVolume.size", 22)
+        .hasFieldOrPropertyWithValue("platform.aws.rootVolume.type", "gp2")
+        .hasFieldOrPropertyWithValue("platform.aws.type", "m4.xlarge")
+        .hasFieldOrPropertyWithValue("replicas", 3L);
   }
 }
diff --git a/kubernetes-model-generator/openshift-model-miscellaneous/src/test/java/io/fabric8/openshift/api/model/miscellaneous/apiserver/v1/APIRequestCountTest.java b/kubernetes-model-generator/openshift-model-miscellaneous/src/test/java/io/fabric8/openshift/api/model/miscellaneous/apiserver/v1/APIRequestCountTest.java
index 08e6abe01d3..cb12b2b0290 100644
--- a/kubernetes-model-generator/openshift-model-miscellaneous/src/test/java/io/fabric8/openshift/api/model/miscellaneous/apiserver/v1/APIRequestCountTest.java
+++ b/kubernetes-model-generator/openshift-model-miscellaneous/src/test/java/io/fabric8/openshift/api/model/miscellaneous/apiserver/v1/APIRequestCountTest.java
@@ -31,8 +31,8 @@ class APIRequestCountTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     String originalJson = new Scanner(getClass().getResourceAsStream("/valid-apirequestcount.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final APIRequestCount apiRequestCount = mapper.readValue(originalJson, APIRequestCount.class);
@@ -44,7 +44,8 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     assertNotNull(serializedJson);
     assertNotNull(apiRequestCountFromSerializedJson);
     assertEquals(apiRequestCount.getMetadata().getName(), apiRequestCountFromSerializedJson.getMetadata().getName());
-    assertEquals(apiRequestCount.getSpec().getNumberOfUsersToReport(), apiRequestCountFromSerializedJson.getSpec().getNumberOfUsersToReport());
+    assertEquals(apiRequestCount.getSpec().getNumberOfUsersToReport(),
+        apiRequestCountFromSerializedJson.getSpec().getNumberOfUsersToReport());
     assertEquals(apiRequestCount.getStatus().getCurrentHour(), apiRequestCountFromSerializedJson.getStatus().getCurrentHour());
     assertEquals(apiRequestCount.getStatus().getLast24h(), apiRequestCountFromSerializedJson.getStatus().getLast24h());
   }
@@ -53,30 +54,30 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
   void builderShouldCreateObject() {
     // Given
     APIRequestCountBuilder apiRequestCountBuilder = new APIRequestCountBuilder()
-      .withNewMetadata().withName("users.v1.user.openshift.io").endMetadata()
-      .withNewSpec().withNumberOfUsersToReport(10L).endSpec()
-      .withNewStatus()
-      .withNewCurrentHour()
-      .addNewByNode()
-      .addNewByUser()
-      .addNewByVerb()
-      .withRequestCount(4L)
-      .withVerb("get")
-      .endByVerb()
-      .withRequestCount(4L)
-      .withUserAgent("oc/v1.11.0+d4cacc0")
-      .withUsername("kubeadmin")
-      .endByUser()
-      .endByNode()
-      .endCurrentHour()
-      .addNewLast24h()
-      .addNewByNode()
-      .withNodeName("192.168.126.11")
-      .withRequestCount(0L)
-      .endByNode()
-      .withRequestCount(0L)
-      .endLast24h()
-      .endStatus();
+        .withNewMetadata().withName("users.v1.user.openshift.io").endMetadata()
+        .withNewSpec().withNumberOfUsersToReport(10L).endSpec()
+        .withNewStatus()
+        .withNewCurrentHour()
+        .addNewByNode()
+        .addNewByUser()
+        .addNewByVerb()
+        .withRequestCount(4L)
+        .withVerb("get")
+        .endByVerb()
+        .withRequestCount(4L)
+        .withUserAgent("oc/v1.11.0+d4cacc0")
+        .withUsername("kubeadmin")
+        .endByUser()
+        .endByNode()
+        .endCurrentHour()
+        .addNewLast24h()
+        .addNewByNode()
+        .withNodeName("192.168.126.11")
+        .withRequestCount(0L)
+        .endByNode()
+        .withRequestCount(0L)
+        .endLast24h()
+        .endStatus();
 
     // When
     APIRequestCount apiRequestCount = apiRequestCountBuilder.build();
diff --git a/kubernetes-model-generator/openshift-model-miscellaneous/src/test/java/io/fabric8/openshift/api/model/miscellaneous/network/operator/v1/EgressRouterTest.java b/kubernetes-model-generator/openshift-model-miscellaneous/src/test/java/io/fabric8/openshift/api/model/miscellaneous/network/operator/v1/EgressRouterTest.java
index 3c94e7e6357..5d4fb719b40 100644
--- a/kubernetes-model-generator/openshift-model-miscellaneous/src/test/java/io/fabric8/openshift/api/model/miscellaneous/network/operator/v1/EgressRouterTest.java
+++ b/kubernetes-model-generator/openshift-model-miscellaneous/src/test/java/io/fabric8/openshift/api/model/miscellaneous/network/operator/v1/EgressRouterTest.java
@@ -35,8 +35,8 @@ class EgressRouterTest {
   void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
     // Given
     final String originalJson = new Scanner(getClass().getResourceAsStream("/valid-egressrouter.json"))
-      .useDelimiter("\\A")
-      .next();
+        .useDelimiter("\\A")
+        .next();
 
     // When
     final EgressRouter egressRouter = mapper.readValue(originalJson, EgressRouter.class);
@@ -44,29 +44,29 @@ void deserializationAndSerializationShouldWorkAsExpected() throws IOException {
 
     // then
     assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-      .isEqualTo(originalJson);
+        .isEqualTo(originalJson);
   }
 
   @Test
   void builderShouldCreateObject() {
     // Given
     EgressRouterBuilder egressRouterBuilder = new EgressRouterBuilder()
-      .withNewMetadata().withName("test-er").endMetadata()
-      .withNewSpec()
-      .addNewAddress()
-      .withGateway("192.168.3.1")
-      .withIp("192.168.3.10/24")
-      .endAddress()
-      .withMode("Redirect")
-      .withNewNetworkInterface()
-      .withNewMacvlan()
-      .withMode("Bridge")
-      .endMacvlan()
-      .endNetworkInterface()
-      .withNewRedirect()
-      .withFallbackIP("203.0.113.25")
-      .endRedirect()
-      .endSpec();
+        .withNewMetadata().withName("test-er").endMetadata()
+        .withNewSpec()
+        .addNewAddress()
+        .withGateway("192.168.3.1")
+        .withIp("192.168.3.10/24")
+        .endAddress()
+        .withMode("Redirect")
+        .withNewNetworkInterface()
+        .withNewMacvlan()
+        .withMode("Bridge")
+        .endMacvlan()
+        .endNetworkInterface()
+        .withNewRedirect()
+        .withFallbackIP("203.0.113.25")
+        .endRedirect()
+        .endSpec();
 
     // When
     final EgressRouter egressRouter = egressRouterBuilder.build();
diff --git a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/BuildConfigTest.java b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/BuildConfigTest.java
index 660cc1d61e7..3daeb3e800c 100644
--- a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/BuildConfigTest.java
+++ b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/BuildConfigTest.java
@@ -15,14 +15,6 @@
  */
 package io.fabric8.kubernetes.api.model;
 
-import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
-import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS;
-import static net.javacrumbs.jsonunit.core.Option.TREATING_NULL_AS_ABSENT;
-import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
 import com.fasterxml.jackson.databind.ObjectMapper;
 import io.fabric8.openshift.api.model.BinaryBuildSourceBuilder;
 import io.fabric8.openshift.api.model.BuildConfig;
@@ -39,349 +31,339 @@
 import io.fabric8.openshift.api.model.SourceBuildStrategyBuilder;
 import io.fabric8.openshift.api.model.SourceControlUserBuilder;
 import io.fabric8.openshift.api.model.WebHookTriggerBuilder;
-import java.util.HashMap;
 import org.junit.jupiter.api.Test;
 
+import java.util.HashMap;
+
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS;
+import static net.javacrumbs.jsonunit.core.Option.TREATING_NULL_AS_ABSENT;
+import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
 public class BuildConfigTest {
 
-    private final ObjectMapper mapper = new ObjectMapper();
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @Test
-    public void buildConfigTest() throws Exception {
-        // given
-        final String originalJson = Helper.loadJson("/valid-buildConfig.json");
+  @Test
+  public void buildConfigTest() throws Exception {
+    // given
+    final String originalJson = Helper.loadJson("/valid-buildConfig.json");
 
-        // when
-        final BuildConfig buildConfig = mapper.readValue(originalJson, BuildConfig.class);
-        final String serializedJson = mapper.writeValueAsString(buildConfig);
+    // when
+    final BuildConfig buildConfig = mapper.readValue(originalJson, BuildConfig.class);
+    final String serializedJson = mapper.writeValueAsString(buildConfig);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
-    }
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
+  }
 
-    @Test
-    public void buildConfigBuilderTest() {
+  @Test
+  public void buildConfigBuilderTest() {
 
-        BuildConfig buildConfig = new BuildConfigBuilder()
-                .withNewMetadata()
-                    .withName("ruby-sample-build")
-                .endMetadata()
-                .withNewSpec()
-                    .addToTriggers(0,
-                            new BuildTriggerPolicyBuilder()
-                                    .withType("Github")
-                                    .withGithub(new WebHookTriggerBuilder()
-                                            .withSecret("secret101")
-                                            .build()
-                                            )
-                                    .build())
-                    .addToTriggers(1,
-                            new BuildTriggerPolicyBuilder()
-                                    .withType("Generic")
-                                    .withGithub(new WebHookTriggerBuilder()
-                                            .withSecret("secret101")
-                                            .withAllowEnv(true)
-                                            .build()
-                                            )
-                                    .build())
-                    .addToTriggers(2,
-                            new BuildTriggerPolicyBuilder()
-                                    .withType("ImageChange")
-                                    .withImageChange(new ImageChangeTriggerBuilder()
-                                            .withLastTriggeredImageID("triggeredID")
-                                            .withFrom(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
-                                                    .withKind("ImageStreamTag")
-                                                    .withName("custom-image:latest")
-                                                    .withApiVersion("v1")
-                                                    .withNamespace("default")
-                                                    .withUid("16161")
-                                                    .withFieldPath("/path/field")
-                                                    .build()
-                                            )
-                                            .build()
-                                    )
-                                    .build()
-                            )
-                .withRunPolicy("Parallel")
-                .withServiceAccount("build-ServiceAccount")
-                .withNewSource()
-                    .withType("Git")
-                    .withBinary(new BinaryBuildSourceBuilder()
-                            .withAsFile("webapp.war")
-                            .build()
-                    )
-                    .withGit(new GitBuildSourceBuilder()
-                            .withUri("https://github.com/openshift/ruby-hello-world")
-                            .withRef("master")
-                            .withHttpProxy("http://proxy.example.com")
-                            .withHttpsProxy("http://proxy.example.com")
-                            .withNoProxy("http://proxy.example2.com")
-                            .build()
-                    )
-                    .withDockerfile("FROM openshift/ruby-22-centos7\nUSER example")
-                    .withContextDir("app/dir")
-                    .withSourceSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
-                            .withName("basicsecret")
-                            .build()
-                    )
-                    .withImages(new ImageSourceBuilder()
-                                    .withFrom(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
-                                            .withNamespace("mynamespace")
-                                            .withName("myinputimage:latest")
-                                            .withKind("ImageStreamTag")
-                                            .build()
-                    ).withPaths(new ImageSourcePathBuilder()
-                                .withDestinationDir("app/dir/injected/dir")
-                                .withSourcePath("/usr/lib/somefile.jar")
-                                            .build()
-                    ).withPullSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
-                                .withName("pullsecret")
-                                .build()
-                            ).build()
-                    ).addToSecrets(0, new SecretBuildSourceBuilder()
-                        .withSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
-                                .withName("secret-npmrc")
-                                .build()
-                        )
-                        .withDestinationDir("app/dir/secret/dir")
-                        .build()
-                    )
-                .endSource()
-                .withNewRevision()
-                    .withType("Source")
-                    .withGit(new GitSourceRevisionBuilder()
-                            .withCommit("d75775")
-                            .withAuthor(new SourceControlUserBuilder()
-                                    .withName("Author")
-                                    .withEmail("author@gmail.com")
-                                    .build()
-                            )
-                            .withCommitter(new SourceControlUserBuilder()
-                                    .withName("Committer")
-                                    .withEmail("commiter@gmail.com")
-                                    .build()
-                            )
-                            .withMessage("Commit Git")
-                            .build()
-                    )
-                .endRevision()
-                .withNewStrategy()
-                    .withType("Source")
-                    .withSourceStrategy(new SourceBuildStrategyBuilder()
-                            .withFrom(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
-                                    .withKind("ImageStreamTag")
-                                    .withName("ruby-20-centos7:latest")
-                                    .build()
-                            )
-                            .withPullSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
-                                    .withName("pullsecret")
-                                    .build()
-                            )
-                            .addToEnv(0, new io.fabric8.kubernetes.api.model.EnvVarBuilder()
-                                    .withName("BUILD_LOGLEVEL")
-                                    .withValue("2")
-                                    .build()
-                            )
-                            .withScripts("/scripts")
-                            .withIncremental(true)
-                            .withForcePull(true)
-                            .build()
-                    )
-                .endStrategy()
-                .withNewOutput()
-                    .withTo(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
-                            .withKind("Docker Image")
-                            .withName("private.registry.com/org/private-image:latest")
-                            .build()
-                    )
-                    .withPushSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
-                            .withName("dockerhub")
-                            .build()
-                    )
-                    .addToImageLabels(0, new ImageLabelBuilder()
-                            .withName("imageLabelName")
-                            .withValue("imageLabelValue")
-                            .build()
-                    )
-                .endOutput()
-                .withNewResources()
-                    .withLimits(new HashMap(){{
-                        put("cpu", new io.fabric8.kubernetes.api.model.QuantityBuilder()
-                                .withAmount("100")
-                                .withFormat("m")
-                                .build()
-                        );
-                        put("memory",new io.fabric8.kubernetes.api.model.QuantityBuilder()
-                                .withAmount("256")
-                                .withFormat("Mi")
-                                .build()
-                        );
-                    }})
-                    .withRequests(new HashMap(){{
-                        put("cpu", new io.fabric8.kubernetes.api.model.QuantityBuilder()
-                                .withAmount("50")
-                                .withFormat("m")
-                                .build()
-                        );
-                        put("memory",new io.fabric8.kubernetes.api.model.QuantityBuilder()
-                                .withAmount("128")
-                                .withFormat("Mi")
-                                .build()
-                        );
-                    }})
-                .endResources()
-                .withPostCommit(new BuildPostCommitSpecBuilder()
-                        .withScript("bundle exec rake test")
-                        .addToArgs(0,"bundle")
-                        .addToArgs(1,"exec")
-                        .addToArgs(2,"rake")
-                        .addToArgs(3,"test")
-                        .addToArgs(4,"--verbose")
+    BuildConfig buildConfig = new BuildConfigBuilder()
+        .withNewMetadata()
+        .withName("ruby-sample-build")
+        .endMetadata()
+        .withNewSpec()
+        .addToTriggers(0,
+            new BuildTriggerPolicyBuilder()
+                .withType("Github")
+                .withGithub(new WebHookTriggerBuilder()
+                    .withSecret("secret101")
+                    .build())
+                .build())
+        .addToTriggers(1,
+            new BuildTriggerPolicyBuilder()
+                .withType("Generic")
+                .withGithub(new WebHookTriggerBuilder()
+                    .withSecret("secret101")
+                    .withAllowEnv(true)
+                    .build())
+                .build())
+        .addToTriggers(2,
+            new BuildTriggerPolicyBuilder()
+                .withType("ImageChange")
+                .withImageChange(new ImageChangeTriggerBuilder()
+                    .withLastTriggeredImageID("triggeredID")
+                    .withFrom(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
+                        .withKind("ImageStreamTag")
+                        .withName("custom-image:latest")
+                        .withApiVersion("v1")
+                        .withNamespace("default")
+                        .withUid("16161")
+                        .withFieldPath("/path/field")
                         .build())
-                .withCompletionDeadlineSeconds(1000L)
-                .withNodeSelector(new HashMap(){{
-                    put("key1","value1");
-                    put("key2","value2");
-                }}
-                )
-                .withSuccessfulBuildsHistoryLimit(5)
-                .withFailedBuildsHistoryLimit(5)
-                .endSpec()
-                .build();
+                    .build())
+                .build())
+        .withRunPolicy("Parallel")
+        .withServiceAccount("build-ServiceAccount")
+        .withNewSource()
+        .withType("Git")
+        .withBinary(new BinaryBuildSourceBuilder()
+            .withAsFile("webapp.war")
+            .build())
+        .withGit(new GitBuildSourceBuilder()
+            .withUri("https://github.com/openshift/ruby-hello-world")
+            .withRef("master")
+            .withHttpProxy("http://proxy.example.com")
+            .withHttpsProxy("http://proxy.example.com")
+            .withNoProxy("http://proxy.example2.com")
+            .build())
+        .withDockerfile("FROM openshift/ruby-22-centos7\nUSER example")
+        .withContextDir("app/dir")
+        .withSourceSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
+            .withName("basicsecret")
+            .build())
+        .withImages(new ImageSourceBuilder()
+            .withFrom(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
+                .withNamespace("mynamespace")
+                .withName("myinputimage:latest")
+                .withKind("ImageStreamTag")
+                .build())
+            .withPaths(new ImageSourcePathBuilder()
+                .withDestinationDir("app/dir/injected/dir")
+                .withSourcePath("/usr/lib/somefile.jar")
+                .build())
+            .withPullSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
+                .withName("pullsecret")
+                .build())
+            .build())
+        .addToSecrets(0, new SecretBuildSourceBuilder()
+            .withSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
+                .withName("secret-npmrc")
+                .build())
+            .withDestinationDir("app/dir/secret/dir")
+            .build())
+        .endSource()
+        .withNewRevision()
+        .withType("Source")
+        .withGit(new GitSourceRevisionBuilder()
+            .withCommit("d75775")
+            .withAuthor(new SourceControlUserBuilder()
+                .withName("Author")
+                .withEmail("author@gmail.com")
+                .build())
+            .withCommitter(new SourceControlUserBuilder()
+                .withName("Committer")
+                .withEmail("commiter@gmail.com")
+                .build())
+            .withMessage("Commit Git")
+            .build())
+        .endRevision()
+        .withNewStrategy()
+        .withType("Source")
+        .withSourceStrategy(new SourceBuildStrategyBuilder()
+            .withFrom(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
+                .withKind("ImageStreamTag")
+                .withName("ruby-20-centos7:latest")
+                .build())
+            .withPullSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
+                .withName("pullsecret")
+                .build())
+            .addToEnv(0, new io.fabric8.kubernetes.api.model.EnvVarBuilder()
+                .withName("BUILD_LOGLEVEL")
+                .withValue("2")
+                .build())
+            .withScripts("/scripts")
+            .withIncremental(true)
+            .withForcePull(true)
+            .build())
+        .endStrategy()
+        .withNewOutput()
+        .withTo(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
+            .withKind("Docker Image")
+            .withName("private.registry.com/org/private-image:latest")
+            .build())
+        .withPushSecret(new io.fabric8.kubernetes.api.model.LocalObjectReferenceBuilder()
+            .withName("dockerhub")
+            .build())
+        .addToImageLabels(0, new ImageLabelBuilder()
+            .withName("imageLabelName")
+            .withValue("imageLabelValue")
+            .build())
+        .endOutput()
+        .withNewResources()
+        .withLimits(new HashMap() {
+          {
+            put("cpu", new io.fabric8.kubernetes.api.model.QuantityBuilder()
+                .withAmount("100")
+                .withFormat("m")
+                .build());
+            put("memory", new io.fabric8.kubernetes.api.model.QuantityBuilder()
+                .withAmount("256")
+                .withFormat("Mi")
+                .build());
+          }
+        })
+        .withRequests(new HashMap() {
+          {
+            put("cpu", new io.fabric8.kubernetes.api.model.QuantityBuilder()
+                .withAmount("50")
+                .withFormat("m")
+                .build());
+            put("memory", new io.fabric8.kubernetes.api.model.QuantityBuilder()
+                .withAmount("128")
+                .withFormat("Mi")
+                .build());
+          }
+        })
+        .endResources()
+        .withPostCommit(new BuildPostCommitSpecBuilder()
+            .withScript("bundle exec rake test")
+            .addToArgs(0, "bundle")
+            .addToArgs(1, "exec")
+            .addToArgs(2, "rake")
+            .addToArgs(3, "test")
+            .addToArgs(4, "--verbose")
+            .build())
+        .withCompletionDeadlineSeconds(1000L)
+        .withNodeSelector(new HashMap() {
+          {
+            put("key1", "value1");
+            put("key2", "value2");
+          }
+        })
+        .withSuccessfulBuildsHistoryLimit(5)
+        .withFailedBuildsHistoryLimit(5)
+        .endSpec()
+        .build();
 
-        assertNotNull(buildConfig);
-        assertEquals("ruby-sample-build",buildConfig.getMetadata().getName());
-        assertNotNull(buildConfig.getSpec().getTriggers());
-        assertEquals(3, buildConfig.getSpec().getTriggers().size());
-        assertEquals("Github",buildConfig.getSpec().getTriggers().get(0).getType());
-        assertEquals("secret101",buildConfig.getSpec().getTriggers().get(0).getGithub().getSecret());
-        assertEquals("Generic",buildConfig.getSpec().getTriggers().get(1).getType());
-        assertEquals("secret101",buildConfig.getSpec().getTriggers().get(1).getGithub().getSecret());
-        assertTrue(buildConfig.getSpec().getTriggers().get(1).getGithub().getAllowEnv());
-        assertEquals("ImageChange",buildConfig.getSpec().getTriggers().get(2).getType());
-        assertEquals("triggeredID",
-                buildConfig.getSpec().getTriggers().get(2).getImageChange().getLastTriggeredImageID());
-        assertEquals("v1",
-                buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getApiVersion());
-        assertEquals("custom-image:latest",
-                buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getName());
-        assertEquals("default",
-                buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getNamespace());
-        assertEquals("ImageStreamTag",
-                buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getKind());
-        assertEquals("16161",
-                buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getUid());
-        assertEquals("/path/field",
-                buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getFieldPath());
-        assertEquals("Parallel",buildConfig.getSpec().getRunPolicy());
-        assertEquals("build-ServiceAccount",buildConfig.getSpec().getServiceAccount());
-        assertEquals("Git",buildConfig.getSpec().getSource().getType());
-        assertNotNull(buildConfig.getSpec().getSource().getGit());
-        assertEquals("https://github.com/openshift/ruby-hello-world",buildConfig.getSpec()
-                .getSource().getGit().getUri());
-        assertEquals("master",buildConfig.getSpec().getSource().getGit().getRef());
-        assertEquals("http://proxy.example.com",buildConfig.getSpec().getSource().getGit().getHttpProxy());
-        assertEquals("http://proxy.example.com",buildConfig.getSpec().getSource().getGit().getHttpsProxy());
-        assertEquals("http://proxy.example2.com",buildConfig.getSpec().getSource().getGit().getNoProxy());
-        assertEquals("FROM openshift/ruby-22-centos7\nUSER example",buildConfig
-                .getSpec().getSource().getDockerfile());
-        assertEquals("app/dir",buildConfig.getSpec().getSource().getContextDir());
-        assertNotNull(buildConfig.getSpec().getSource().getSourceSecret());
-        assertEquals("basicsecret",buildConfig.getSpec().getSource().getSourceSecret().getName());
-        assertNotNull(buildConfig.getSpec().getSource().getImages());
-        assertEquals(1,buildConfig.getSpec().getSource().getImages().size());
-        assertNotNull(buildConfig.getSpec().getSource().getImages().get(0).getFrom());
-        assertEquals("ImageStreamTag",buildConfig.getSpec().getSource().getImages()
-                .get(0).getFrom().getKind());
-        assertEquals("mynamespace",buildConfig.getSpec().getSource().getImages()
-                .get(0).getFrom().getNamespace());
-        assertEquals("myinputimage:latest",buildConfig.getSpec().getSource().getImages().get(0)
-                .getFrom().getName());
-        assertNotNull(buildConfig.getSpec().getSource().getImages().get(0).getPaths());
-        assertEquals(1,buildConfig.getSpec().getSource().getImages().get(0).getPaths().size());
-        assertEquals("app/dir/injected/dir",buildConfig.getSpec().getSource().getImages()
-                .get(0).getPaths().get(0).getDestinationDir());
-        assertEquals("/usr/lib/somefile.jar",buildConfig.getSpec().getSource().getImages()
-                .get(0).getPaths().get(0).getSourcePath());
-        assertNotNull(buildConfig.getSpec().getSource().getImages().get(0).getPullSecret());
-        assertEquals("pullsecret", buildConfig.getSpec().getSource().getImages()
-                .get(0).getPullSecret().getName());
-        assertNotNull(buildConfig.getSpec().getSource().getSecrets());
-        assertEquals(1,buildConfig.getSpec().getSource().getSecrets().size());
-        assertNotNull(buildConfig.getSpec().getSource().getSecrets().get(0).getSecret());
-        assertEquals("secret-npmrc", buildConfig.getSpec().getSource().getSecrets()
-                .get(0).getSecret().getName());
-        assertEquals("app/dir/secret/dir", buildConfig.getSpec().getSource()
-                .getSecrets().get(0).getDestinationDir());
-        assertNotNull(buildConfig.getSpec().getRevision());
-        assertEquals("Source", buildConfig.getSpec().getRevision().getType());
-        assertNotNull(buildConfig.getSpec().getRevision().getGit());
-        assertEquals("d75775",buildConfig.getSpec().getRevision().getGit().getCommit());
-        assertNotNull(buildConfig.getSpec().getRevision().getGit().getAuthor());
-        assertEquals("Author",buildConfig.getSpec().getRevision().getGit().getAuthor().getName());
-        assertEquals("author@gmail.com",buildConfig.getSpec().getRevision().getGit().getAuthor().getEmail());
-        assertNotNull(buildConfig.getSpec().getRevision().getGit().getCommit());
-        assertEquals("Committer",buildConfig.getSpec().getRevision().getGit().getCommitter().getName());
-        assertEquals("commiter@gmail.com",buildConfig.getSpec().getRevision().getGit()
-                .getCommitter().getEmail());
-        assertEquals("Commit Git",buildConfig.getSpec().getRevision().getGit().getMessage());
-        assertNotNull(buildConfig.getSpec().getStrategy());
-        assertEquals("Source", buildConfig.getSpec().getStrategy().getType());
-        assertNotNull(buildConfig.getSpec().getStrategy().getSourceStrategy());
-        assertNotNull(buildConfig.getSpec().getStrategy().getSourceStrategy().getFrom());
-        assertEquals("ImageStreamTag",buildConfig.getSpec().getStrategy().getSourceStrategy()
-                .getFrom().getKind());
-        assertEquals("ruby-20-centos7:latest",buildConfig.getSpec().getStrategy().getSourceStrategy()
-                .getFrom().getName());
-        assertNotNull(buildConfig.getSpec().getStrategy().getSourceStrategy().getPullSecret());
-        assertEquals("pullsecret",buildConfig.getSpec().getStrategy().getSourceStrategy().getPullSecret()
-                .getName());
-        assertNotNull(buildConfig.getSpec().getStrategy().getSourceStrategy().getEnv());
-        assertEquals(1,buildConfig.getSpec().getStrategy().getSourceStrategy().getEnv().size());
-        assertEquals("BUILD_LOGLEVEL",buildConfig.getSpec().getStrategy().getSourceStrategy().getEnv()
-                .get(0).getName());
-        assertEquals("2",buildConfig.getSpec().getStrategy().getSourceStrategy().getEnv().get(0).getValue());
-        assertEquals("/scripts",buildConfig.getSpec().getStrategy().getSourceStrategy().getScripts());
-        assertEquals(true,buildConfig.getSpec().getStrategy().getSourceStrategy().getIncremental());
-        assertEquals(true,buildConfig.getSpec().getStrategy().getSourceStrategy().getForcePull());
-        assertNotNull(buildConfig.getSpec().getOutput());
-        assertNotNull(buildConfig.getSpec().getOutput().getTo());
-        assertEquals("Docker Image",buildConfig.getSpec().getOutput().getTo().getKind());
-        assertEquals("private.registry.com/org/private-image:latest",buildConfig.getSpec()
-                .getOutput().getTo().getName());
-        assertNotNull(buildConfig.getSpec().getOutput().getPushSecret());
-        assertEquals("dockerhub", buildConfig.getSpec().getOutput().getPushSecret().getName());
-        assertNotNull(buildConfig.getSpec().getOutput().getImageLabels());
-        assertEquals(1,buildConfig.getSpec().getOutput().getImageLabels().size());
-        assertNotNull(buildConfig.getSpec().getOutput().getImageLabels().get(0));
-        assertEquals("imageLabelName",buildConfig.getSpec().getOutput().getImageLabels().get(0).getName());
-        assertEquals("imageLabelValue",buildConfig.getSpec().getOutput().getImageLabels().get(0).getValue());
-        assertNotNull(buildConfig.getSpec().getResources());
-        assertNotNull(buildConfig.getSpec().getResources().getLimits());
-        assertEquals("100",buildConfig.getSpec().getResources().getLimits().get("cpu").getAmount());
-        assertEquals("m",buildConfig.getSpec().getResources().getLimits().get("cpu").getFormat());
-        assertEquals("256",buildConfig.getSpec().getResources().getLimits().get("memory").getAmount());
-        assertEquals("Mi",buildConfig.getSpec().getResources().getLimits().get("memory").getFormat());
-        assertNotNull(buildConfig.getSpec().getResources().getRequests());
-        assertEquals("50",buildConfig.getSpec().getResources().getRequests().get("cpu").getAmount());
-        assertEquals("m",buildConfig.getSpec().getResources().getRequests().get("cpu").getFormat());
-        assertEquals("128",buildConfig.getSpec().getResources().getRequests().get("memory").getAmount());
-        assertEquals("Mi",buildConfig.getSpec().getResources().getRequests().get("memory").getFormat());
-        assertNotNull(buildConfig.getSpec().getPostCommit());
-        assertEquals("bundle exec rake test",buildConfig.getSpec().getPostCommit().getScript());
-        assertNotNull(buildConfig.getSpec().getPostCommit().getArgs());
-        assertEquals(5, buildConfig.getSpec().getPostCommit().getArgs().size());
-        assertEquals("bundle", buildConfig.getSpec().getPostCommit().getArgs().get(0));
-        assertEquals("exec", buildConfig.getSpec().getPostCommit().getArgs().get(1));
-        assertEquals("rake", buildConfig.getSpec().getPostCommit().getArgs().get(2));
-        assertEquals("test", buildConfig.getSpec().getPostCommit().getArgs().get(3));
-        assertEquals("--verbose", buildConfig.getSpec().getPostCommit().getArgs().get(4));
-        assertEquals(1000L, buildConfig.getSpec().getCompletionDeadlineSeconds().intValue());
-        assertEquals(2,buildConfig.getSpec().getNodeSelector().size());
-        assertEquals("value1", buildConfig.getSpec().getNodeSelector().get("key1"));
-        assertEquals("value2", buildConfig.getSpec().getNodeSelector().get("key2"));
-        assertEquals(5, buildConfig.getSpec().getSuccessfulBuildsHistoryLimit().intValue());
-        assertEquals(5, buildConfig.getSpec().getFailedBuildsHistoryLimit().intValue());
-    }
+    assertNotNull(buildConfig);
+    assertEquals("ruby-sample-build", buildConfig.getMetadata().getName());
+    assertNotNull(buildConfig.getSpec().getTriggers());
+    assertEquals(3, buildConfig.getSpec().getTriggers().size());
+    assertEquals("Github", buildConfig.getSpec().getTriggers().get(0).getType());
+    assertEquals("secret101", buildConfig.getSpec().getTriggers().get(0).getGithub().getSecret());
+    assertEquals("Generic", buildConfig.getSpec().getTriggers().get(1).getType());
+    assertEquals("secret101", buildConfig.getSpec().getTriggers().get(1).getGithub().getSecret());
+    assertTrue(buildConfig.getSpec().getTriggers().get(1).getGithub().getAllowEnv());
+    assertEquals("ImageChange", buildConfig.getSpec().getTriggers().get(2).getType());
+    assertEquals("triggeredID",
+        buildConfig.getSpec().getTriggers().get(2).getImageChange().getLastTriggeredImageID());
+    assertEquals("v1",
+        buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getApiVersion());
+    assertEquals("custom-image:latest",
+        buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getName());
+    assertEquals("default",
+        buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getNamespace());
+    assertEquals("ImageStreamTag",
+        buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getKind());
+    assertEquals("16161",
+        buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getUid());
+    assertEquals("/path/field",
+        buildConfig.getSpec().getTriggers().get(2).getImageChange().getFrom().getFieldPath());
+    assertEquals("Parallel", buildConfig.getSpec().getRunPolicy());
+    assertEquals("build-ServiceAccount", buildConfig.getSpec().getServiceAccount());
+    assertEquals("Git", buildConfig.getSpec().getSource().getType());
+    assertNotNull(buildConfig.getSpec().getSource().getGit());
+    assertEquals("https://github.com/openshift/ruby-hello-world", buildConfig.getSpec()
+        .getSource().getGit().getUri());
+    assertEquals("master", buildConfig.getSpec().getSource().getGit().getRef());
+    assertEquals("http://proxy.example.com", buildConfig.getSpec().getSource().getGit().getHttpProxy());
+    assertEquals("http://proxy.example.com", buildConfig.getSpec().getSource().getGit().getHttpsProxy());
+    assertEquals("http://proxy.example2.com", buildConfig.getSpec().getSource().getGit().getNoProxy());
+    assertEquals("FROM openshift/ruby-22-centos7\nUSER example", buildConfig
+        .getSpec().getSource().getDockerfile());
+    assertEquals("app/dir", buildConfig.getSpec().getSource().getContextDir());
+    assertNotNull(buildConfig.getSpec().getSource().getSourceSecret());
+    assertEquals("basicsecret", buildConfig.getSpec().getSource().getSourceSecret().getName());
+    assertNotNull(buildConfig.getSpec().getSource().getImages());
+    assertEquals(1, buildConfig.getSpec().getSource().getImages().size());
+    assertNotNull(buildConfig.getSpec().getSource().getImages().get(0).getFrom());
+    assertEquals("ImageStreamTag", buildConfig.getSpec().getSource().getImages()
+        .get(0).getFrom().getKind());
+    assertEquals("mynamespace", buildConfig.getSpec().getSource().getImages()
+        .get(0).getFrom().getNamespace());
+    assertEquals("myinputimage:latest", buildConfig.getSpec().getSource().getImages().get(0)
+        .getFrom().getName());
+    assertNotNull(buildConfig.getSpec().getSource().getImages().get(0).getPaths());
+    assertEquals(1, buildConfig.getSpec().getSource().getImages().get(0).getPaths().size());
+    assertEquals("app/dir/injected/dir", buildConfig.getSpec().getSource().getImages()
+        .get(0).getPaths().get(0).getDestinationDir());
+    assertEquals("/usr/lib/somefile.jar", buildConfig.getSpec().getSource().getImages()
+        .get(0).getPaths().get(0).getSourcePath());
+    assertNotNull(buildConfig.getSpec().getSource().getImages().get(0).getPullSecret());
+    assertEquals("pullsecret", buildConfig.getSpec().getSource().getImages()
+        .get(0).getPullSecret().getName());
+    assertNotNull(buildConfig.getSpec().getSource().getSecrets());
+    assertEquals(1, buildConfig.getSpec().getSource().getSecrets().size());
+    assertNotNull(buildConfig.getSpec().getSource().getSecrets().get(0).getSecret());
+    assertEquals("secret-npmrc", buildConfig.getSpec().getSource().getSecrets()
+        .get(0).getSecret().getName());
+    assertEquals("app/dir/secret/dir", buildConfig.getSpec().getSource()
+        .getSecrets().get(0).getDestinationDir());
+    assertNotNull(buildConfig.getSpec().getRevision());
+    assertEquals("Source", buildConfig.getSpec().getRevision().getType());
+    assertNotNull(buildConfig.getSpec().getRevision().getGit());
+    assertEquals("d75775", buildConfig.getSpec().getRevision().getGit().getCommit());
+    assertNotNull(buildConfig.getSpec().getRevision().getGit().getAuthor());
+    assertEquals("Author", buildConfig.getSpec().getRevision().getGit().getAuthor().getName());
+    assertEquals("author@gmail.com", buildConfig.getSpec().getRevision().getGit().getAuthor().getEmail());
+    assertNotNull(buildConfig.getSpec().getRevision().getGit().getCommit());
+    assertEquals("Committer", buildConfig.getSpec().getRevision().getGit().getCommitter().getName());
+    assertEquals("commiter@gmail.com", buildConfig.getSpec().getRevision().getGit()
+        .getCommitter().getEmail());
+    assertEquals("Commit Git", buildConfig.getSpec().getRevision().getGit().getMessage());
+    assertNotNull(buildConfig.getSpec().getStrategy());
+    assertEquals("Source", buildConfig.getSpec().getStrategy().getType());
+    assertNotNull(buildConfig.getSpec().getStrategy().getSourceStrategy());
+    assertNotNull(buildConfig.getSpec().getStrategy().getSourceStrategy().getFrom());
+    assertEquals("ImageStreamTag", buildConfig.getSpec().getStrategy().getSourceStrategy()
+        .getFrom().getKind());
+    assertEquals("ruby-20-centos7:latest", buildConfig.getSpec().getStrategy().getSourceStrategy()
+        .getFrom().getName());
+    assertNotNull(buildConfig.getSpec().getStrategy().getSourceStrategy().getPullSecret());
+    assertEquals("pullsecret", buildConfig.getSpec().getStrategy().getSourceStrategy().getPullSecret()
+        .getName());
+    assertNotNull(buildConfig.getSpec().getStrategy().getSourceStrategy().getEnv());
+    assertEquals(1, buildConfig.getSpec().getStrategy().getSourceStrategy().getEnv().size());
+    assertEquals("BUILD_LOGLEVEL", buildConfig.getSpec().getStrategy().getSourceStrategy().getEnv()
+        .get(0).getName());
+    assertEquals("2", buildConfig.getSpec().getStrategy().getSourceStrategy().getEnv().get(0).getValue());
+    assertEquals("/scripts", buildConfig.getSpec().getStrategy().getSourceStrategy().getScripts());
+    assertEquals(true, buildConfig.getSpec().getStrategy().getSourceStrategy().getIncremental());
+    assertEquals(true, buildConfig.getSpec().getStrategy().getSourceStrategy().getForcePull());
+    assertNotNull(buildConfig.getSpec().getOutput());
+    assertNotNull(buildConfig.getSpec().getOutput().getTo());
+    assertEquals("Docker Image", buildConfig.getSpec().getOutput().getTo().getKind());
+    assertEquals("private.registry.com/org/private-image:latest", buildConfig.getSpec()
+        .getOutput().getTo().getName());
+    assertNotNull(buildConfig.getSpec().getOutput().getPushSecret());
+    assertEquals("dockerhub", buildConfig.getSpec().getOutput().getPushSecret().getName());
+    assertNotNull(buildConfig.getSpec().getOutput().getImageLabels());
+    assertEquals(1, buildConfig.getSpec().getOutput().getImageLabels().size());
+    assertNotNull(buildConfig.getSpec().getOutput().getImageLabels().get(0));
+    assertEquals("imageLabelName", buildConfig.getSpec().getOutput().getImageLabels().get(0).getName());
+    assertEquals("imageLabelValue", buildConfig.getSpec().getOutput().getImageLabels().get(0).getValue());
+    assertNotNull(buildConfig.getSpec().getResources());
+    assertNotNull(buildConfig.getSpec().getResources().getLimits());
+    assertEquals("100", buildConfig.getSpec().getResources().getLimits().get("cpu").getAmount());
+    assertEquals("m", buildConfig.getSpec().getResources().getLimits().get("cpu").getFormat());
+    assertEquals("256", buildConfig.getSpec().getResources().getLimits().get("memory").getAmount());
+    assertEquals("Mi", buildConfig.getSpec().getResources().getLimits().get("memory").getFormat());
+    assertNotNull(buildConfig.getSpec().getResources().getRequests());
+    assertEquals("50", buildConfig.getSpec().getResources().getRequests().get("cpu").getAmount());
+    assertEquals("m", buildConfig.getSpec().getResources().getRequests().get("cpu").getFormat());
+    assertEquals("128", buildConfig.getSpec().getResources().getRequests().get("memory").getAmount());
+    assertEquals("Mi", buildConfig.getSpec().getResources().getRequests().get("memory").getFormat());
+    assertNotNull(buildConfig.getSpec().getPostCommit());
+    assertEquals("bundle exec rake test", buildConfig.getSpec().getPostCommit().getScript());
+    assertNotNull(buildConfig.getSpec().getPostCommit().getArgs());
+    assertEquals(5, buildConfig.getSpec().getPostCommit().getArgs().size());
+    assertEquals("bundle", buildConfig.getSpec().getPostCommit().getArgs().get(0));
+    assertEquals("exec", buildConfig.getSpec().getPostCommit().getArgs().get(1));
+    assertEquals("rake", buildConfig.getSpec().getPostCommit().getArgs().get(2));
+    assertEquals("test", buildConfig.getSpec().getPostCommit().getArgs().get(3));
+    assertEquals("--verbose", buildConfig.getSpec().getPostCommit().getArgs().get(4));
+    assertEquals(1000L, buildConfig.getSpec().getCompletionDeadlineSeconds().intValue());
+    assertEquals(2, buildConfig.getSpec().getNodeSelector().size());
+    assertEquals("value1", buildConfig.getSpec().getNodeSelector().get("key1"));
+    assertEquals("value2", buildConfig.getSpec().getNodeSelector().get("key2"));
+    assertEquals(5, buildConfig.getSpec().getSuccessfulBuildsHistoryLimit().intValue());
+    assertEquals(5, buildConfig.getSpec().getFailedBuildsHistoryLimit().intValue());
+  }
 }
diff --git a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/Helper.java b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/Helper.java
index 45a93656595..7490c545c7a 100644
--- a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/Helper.java
+++ b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/Helper.java
@@ -21,12 +21,12 @@
 
 public class Helper {
 
-    public static String loadJson(String path) {
-        try (InputStream resourceAsStream = Helper.class.getResourceAsStream(path)) {
-            final Scanner scanner = new Scanner(resourceAsStream).useDelimiter("\\A");
-            return scanner.hasNext() ? scanner.next() : "";
-        } catch (IOException e) {
-            throw new RuntimeException(e);
-        }
+  public static String loadJson(String path) {
+    try (InputStream resourceAsStream = Helper.class.getResourceAsStream(path)) {
+      final Scanner scanner = new Scanner(resourceAsStream).useDelimiter("\\A");
+      return scanner.hasNext() ? scanner.next() : "";
+    } catch (IOException e) {
+      throw new RuntimeException(e);
     }
+  }
 }
diff --git a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/ImageStreamImportTest.java b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/ImageStreamImportTest.java
index 96d83b8bc8f..2675c8aeb6a 100644
--- a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/ImageStreamImportTest.java
+++ b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/ImageStreamImportTest.java
@@ -29,77 +29,76 @@
 import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson;
 
 public class ImageStreamImportTest {
-    private final ObjectMapper mapper = new ObjectMapper();
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @Test
-    public void imageStreamImportTest() throws Exception {
-        // given
-        final String originalJson = Helper.loadJson("/valid-imagestreamimport.json");
+  @Test
+  public void imageStreamImportTest() throws Exception {
+    // given
+    final String originalJson = Helper.loadJson("/valid-imagestreamimport.json");
 
-        // when
-        final ImageStreamImport imageStreamImport = mapper.readValue(originalJson, ImageStreamImport.class);
-        final String serializedJson = mapper.writeValueAsString(imageStreamImport);
+    // when
+    final ImageStreamImport imageStreamImport = mapper.readValue(originalJson, ImageStreamImport.class);
+    final String serializedJson = mapper.writeValueAsString(imageStreamImport);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
-    }
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
+  }
 
-    @Test
-    public void imageStreamImportBuilderTest() throws Exception {
+  @Test
+  public void imageStreamImportBuilderTest() throws Exception {
 
-        // given
-        final String originalJson = Helper.loadJson("/valid-imagestreamimport.json");
+    // given
+    final String originalJson = Helper.loadJson("/valid-imagestreamimport.json");
 
-        // when
-        ImageStreamImport imageStreamImport = new ImageStreamImportBuilder()
-                .withNewMetadata()
-                    .withName("test-isi")
-                    .withNamespace("myproject")
-                    .withLabels(Collections.singletonMap("key","value"))
-                .endMetadata()
-                .withNewSpec()
-                    .addToImages(0, new ImageImportSpecBuilder()
-                            .withNewFrom()
-                                .withKind("DockerImage")
-                                .withName("dockerImageName")
-                            .endFrom()
-                            .withNewTo()
-                                .withName("default")
-                            .endTo()
-                            .withIncludeManifest(true)
-                            .withNewReferencePolicy()
-                                .withType("Source")
-                            .endReferencePolicy()
-                            .withNewImportPolicy()
-                                .withInsecure(true)
-                                .withScheduled(true)
-                            .endImportPolicy()
-                            .build()
-                    )
-                    .withImport(true)
-                    .withNewRepository()
-                        .withNewFrom()
-                            .withKind("DockerImage")
-                            .withName("docker.io/openshift/jenkins-slave-maven-centos7:latest")
-                        .endFrom()
-                        .withIncludeManifest(true)
-                        .withNewReferencePolicy()
-                            .withType("Source")
-                        .endReferencePolicy()
-                        .withNewImportPolicy()
-                            .withInsecure(true)
-                            .withScheduled(true)
-                        .endImportPolicy()
-                    .endRepository()
-                .endSpec()
-                .build();
+    // when
+    ImageStreamImport imageStreamImport = new ImageStreamImportBuilder()
+        .withNewMetadata()
+        .withName("test-isi")
+        .withNamespace("myproject")
+        .withLabels(Collections.singletonMap("key", "value"))
+        .endMetadata()
+        .withNewSpec()
+        .addToImages(0, new ImageImportSpecBuilder()
+            .withNewFrom()
+            .withKind("DockerImage")
+            .withName("dockerImageName")
+            .endFrom()
+            .withNewTo()
+            .withName("default")
+            .endTo()
+            .withIncludeManifest(true)
+            .withNewReferencePolicy()
+            .withType("Source")
+            .endReferencePolicy()
+            .withNewImportPolicy()
+            .withInsecure(true)
+            .withScheduled(true)
+            .endImportPolicy()
+            .build())
+        .withImport(true)
+        .withNewRepository()
+        .withNewFrom()
+        .withKind("DockerImage")
+        .withName("docker.io/openshift/jenkins-slave-maven-centos7:latest")
+        .endFrom()
+        .withIncludeManifest(true)
+        .withNewReferencePolicy()
+        .withType("Source")
+        .endReferencePolicy()
+        .withNewImportPolicy()
+        .withInsecure(true)
+        .withScheduled(true)
+        .endImportPolicy()
+        .endRepository()
+        .endSpec()
+        .build();
 
-        final String serializedJson = mapper.writeValueAsString(imageStreamImport);
+    final String serializedJson = mapper.writeValueAsString(imageStreamImport);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
 
-    }
+  }
 }
diff --git a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/ImageStreamTagTest.java b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/ImageStreamTagTest.java
index 5fc3862b48f..c6d265dfa77 100644
--- a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/ImageStreamTagTest.java
+++ b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/ImageStreamTagTest.java
@@ -29,104 +29,101 @@
 import static net.javacrumbs.jsonunit.core.Option.TREATING_NULL_AS_ABSENT;
 import static net.javacrumbs.jsonunit.fluent.JsonFluentAssert.assertThatJson;
 import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
 
 public class ImageStreamTagTest {
 
-    private final ObjectMapper mapper = new ObjectMapper();
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @Test
-    public void imageStreamTagTest() throws Exception {
-        // given
-        final String originalJson = Helper.loadJson("/valid-ist.json");
+  @Test
+  public void imageStreamTagTest() throws Exception {
+    // given
+    final String originalJson = Helper.loadJson("/valid-ist.json");
 
-        // when
-        final ImageStreamTag ist = mapper.readValue(originalJson, ImageStreamTag.class);
-        final String serializedJson = mapper.writeValueAsString(ist);
+    // when
+    final ImageStreamTag ist = mapper.readValue(originalJson, ImageStreamTag.class);
+    final String serializedJson = mapper.writeValueAsString(ist);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
-    }
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
+  }
 
-    @Test
-    public void imageStreamTagBuilderTest() {
+  @Test
+  public void imageStreamTagBuilderTest() {
 
-        ImageStreamTag ist = new ImageStreamTagBuilder()
-                .withNewMetadata()
-                        .withName("bar1:1.0.12")
-                        .withNamespace("myproject")
-                        .withCreationTimestamp("2018-04-12T09:22:41Z")
-                        .withResourceVersion("1523")
-                        .withSelfLink("/oapi/v1/namespaces/myproject/imagestreamtags/bar1%3A1.0.12")
-                .endMetadata()
-                .withLookupPolicy(new ImageLookupPolicyBuilder()
-                        .withLocal(false)
-                        .build()
-                )
-                .withGeneration(2L)
-                .withImage(new ImageBuilder()
-                        .addToDockerImageLayers(0, new ImageLayerBuilder()
-                                .withMediaType("application/vnd.docker.image.rootfs.diff.tar.gzip")
-                                .withName("sha256:8111c19639475fb11ffa928f9e5e2dc05cbbe143363889355d2fee66a9f5664c")
-                                .withSize(1160L)
-                                .build()
-                        )
-                        .withDockerImageReference("docker.io/openshift/jenkins-slave-maven-centos7@sha256:df7bb31ff8f3ae0918b2e8b5c29b3deed04c547142abbc49ad133e9451ebb660")
-                        .withDockerImageMetadataVersion("1.0")
-                        .withNewMetadata()
-                            .withName("sha256:df7bb31ff8f3ae0918b2e8b5c29b3deed04c547142abbc49ad133e9451ebb660")
-                            .withCreationTimestamp("2018-04-12T09:22:41Z")
-                        .endMetadata()
-                        .build()
-                )
-                .withTag(new TagReferenceBuilder()
-                        .withName("1.0.12")
-                        .withFrom(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
-                                .withKind("DockerImage")
-                                .withName("docker.io/openshift/jenkins-slave-maven-centos7:latest")
-                                .build()
-                        )
-                        .withGeneration(2L)
-                        .addToAnnotations("role", "jenkins-slave")
-                        .addToAnnotations("slave-label", "jenkins-slave")
-                        .withReferencePolicy(new io.fabric8.openshift.api.model.TagReferencePolicyBuilder()
-                                .withType("Source")
-                                .build()
-                        )
-                        .build()
-                ).build();
+    ImageStreamTag ist = new ImageStreamTagBuilder()
+        .withNewMetadata()
+        .withName("bar1:1.0.12")
+        .withNamespace("myproject")
+        .withCreationTimestamp("2018-04-12T09:22:41Z")
+        .withResourceVersion("1523")
+        .withSelfLink("/oapi/v1/namespaces/myproject/imagestreamtags/bar1%3A1.0.12")
+        .endMetadata()
+        .withLookupPolicy(new ImageLookupPolicyBuilder()
+            .withLocal(false)
+            .build())
+        .withGeneration(2L)
+        .withImage(new ImageBuilder()
+            .addToDockerImageLayers(0, new ImageLayerBuilder()
+                .withMediaType("application/vnd.docker.image.rootfs.diff.tar.gzip")
+                .withName("sha256:8111c19639475fb11ffa928f9e5e2dc05cbbe143363889355d2fee66a9f5664c")
+                .withSize(1160L)
+                .build())
+            .withDockerImageReference(
+                "docker.io/openshift/jenkins-slave-maven-centos7@sha256:df7bb31ff8f3ae0918b2e8b5c29b3deed04c547142abbc49ad133e9451ebb660")
+            .withDockerImageMetadataVersion("1.0")
+            .withNewMetadata()
+            .withName("sha256:df7bb31ff8f3ae0918b2e8b5c29b3deed04c547142abbc49ad133e9451ebb660")
+            .withCreationTimestamp("2018-04-12T09:22:41Z")
+            .endMetadata()
+            .build())
+        .withTag(new TagReferenceBuilder()
+            .withName("1.0.12")
+            .withFrom(new io.fabric8.kubernetes.api.model.ObjectReferenceBuilder()
+                .withKind("DockerImage")
+                .withName("docker.io/openshift/jenkins-slave-maven-centos7:latest")
+                .build())
+            .withGeneration(2L)
+            .addToAnnotations("role", "jenkins-slave")
+            .addToAnnotations("slave-label", "jenkins-slave")
+            .withReferencePolicy(new io.fabric8.openshift.api.model.TagReferencePolicyBuilder()
+                .withType("Source")
+                .build())
+            .build())
+        .build();
 
-        assertNotNull(ist);
-        assertEquals("bar1:1.0.12", ist.getMetadata().getName());
-        assertEquals("myproject", ist.getMetadata().getNamespace());
-        assertEquals("1523", ist.getMetadata().getResourceVersion());
-        assertEquals("2018-04-12T09:22:41Z", ist.getMetadata().getCreationTimestamp());
-        assertEquals("/oapi/v1/namespaces/myproject/imagestreamtags/bar1%3A1.0.12", ist.getMetadata()
-                .getSelfLink());
-        assertFalse(ist.getLookupPolicy().getLocal());
-        assertEquals(2L, ist.getGeneration().intValue());
-        assertEquals(1, ist.getImage().getDockerImageLayers().size());
-        assertEquals("application/vnd.docker.image.rootfs.diff.tar.gzip", ist.getImage()
-                .getDockerImageLayers().get(0).getMediaType());
-        assertEquals("sha256:8111c19639475fb11ffa928f9e5e2dc05cbbe143363889355d2fee66a9f5664c", ist.
-                getImage().getDockerImageLayers().get(0).getName());
-        assertEquals(1160L, ist.getImage().getDockerImageLayers().get(0).getSize().intValue());
-        assertEquals("docker.io/openshift/jenkins-slave-maven-centos7@sha256:df7bb31ff8f3ae0918b2e8b5c29b3deed04c547142abbc49ad133e9451ebb660", ist.
-                getImage().getDockerImageReference());
-        assertEquals("1.0", ist.getImage().getDockerImageMetadataVersion());
-        assertEquals("sha256:df7bb31ff8f3ae0918b2e8b5c29b3deed04c547142abbc49ad133e9451ebb660", ist.
-                getImage().getMetadata().getName());
-        assertEquals("2018-04-12T09:22:41Z", ist.getImage().getMetadata().getCreationTimestamp());
-        assertEquals("1.0.12", ist.getTag().getName());
-        assertEquals("DockerImage", ist.getTag().getFrom().getKind());
-        assertEquals("docker.io/openshift/jenkins-slave-maven-centos7:latest", ist.getTag().getFrom().getName());
-        assertEquals(2L, ist.getTag().getGeneration().intValue());
-        assertEquals("jenkins-slave", ist.getTag().getAnnotations().get("role"));
-        assertEquals("jenkins-slave", ist.getTag().getAnnotations().get("slave-label"));
-        assertEquals("Source", ist.getTag().getReferencePolicy().getType());
+    assertNotNull(ist);
+    assertEquals("bar1:1.0.12", ist.getMetadata().getName());
+    assertEquals("myproject", ist.getMetadata().getNamespace());
+    assertEquals("1523", ist.getMetadata().getResourceVersion());
+    assertEquals("2018-04-12T09:22:41Z", ist.getMetadata().getCreationTimestamp());
+    assertEquals("/oapi/v1/namespaces/myproject/imagestreamtags/bar1%3A1.0.12", ist.getMetadata()
+        .getSelfLink());
+    assertFalse(ist.getLookupPolicy().getLocal());
+    assertEquals(2L, ist.getGeneration().intValue());
+    assertEquals(1, ist.getImage().getDockerImageLayers().size());
+    assertEquals("application/vnd.docker.image.rootfs.diff.tar.gzip", ist.getImage()
+        .getDockerImageLayers().get(0).getMediaType());
+    assertEquals("sha256:8111c19639475fb11ffa928f9e5e2dc05cbbe143363889355d2fee66a9f5664c",
+        ist.getImage().getDockerImageLayers().get(0).getName());
+    assertEquals(1160L, ist.getImage().getDockerImageLayers().get(0).getSize().intValue());
+    assertEquals(
+        "docker.io/openshift/jenkins-slave-maven-centos7@sha256:df7bb31ff8f3ae0918b2e8b5c29b3deed04c547142abbc49ad133e9451ebb660",
+        ist.getImage().getDockerImageReference());
+    assertEquals("1.0", ist.getImage().getDockerImageMetadataVersion());
+    assertEquals("sha256:df7bb31ff8f3ae0918b2e8b5c29b3deed04c547142abbc49ad133e9451ebb660",
+        ist.getImage().getMetadata().getName());
+    assertEquals("2018-04-12T09:22:41Z", ist.getImage().getMetadata().getCreationTimestamp());
+    assertEquals("1.0.12", ist.getTag().getName());
+    assertEquals("DockerImage", ist.getTag().getFrom().getKind());
+    assertEquals("docker.io/openshift/jenkins-slave-maven-centos7:latest", ist.getTag().getFrom().getName());
+    assertEquals(2L, ist.getTag().getGeneration().intValue());
+    assertEquals("jenkins-slave", ist.getTag().getAnnotations().get("role"));
+    assertEquals("jenkins-slave", ist.getTag().getAnnotations().get("slave-label"));
+    assertEquals("Source", ist.getTag().getReferencePolicy().getType());
 
-    }
+  }
 
 }
diff --git a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/RouteTest.java b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/RouteTest.java
index 3d72e5416f6..9486535230f 100644
--- a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/RouteTest.java
+++ b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/RouteTest.java
@@ -30,96 +30,93 @@
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 public class RouteTest {
-    private final ObjectMapper mapper = new ObjectMapper();
+  private final ObjectMapper mapper = new ObjectMapper();
 
-    @Test
-    public void routeTest() throws Exception {
-        // given
-        final String originalJson = Helper.loadJson("/valid-route.json");
+  @Test
+  public void routeTest() throws Exception {
+    // given
+    final String originalJson = Helper.loadJson("/valid-route.json");
 
-        // when
-        final Route route = mapper.readValue(originalJson, Route.class);
-        final String serializedJson = mapper.writeValueAsString(route);
+    // when
+    final Route route = mapper.readValue(originalJson, Route.class);
+    final String serializedJson = mapper.writeValueAsString(route);
 
-        // then
-        assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
-                .isEqualTo(originalJson);
-    }
+    // then
+    assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
+        .isEqualTo(originalJson);
+  }
 
-    @Test
-    public void routeBuilderTest(){
+  @Test
+  public void routeBuilderTest() {
 
-        Route route = new RouteBuilder()
-                .withNewMetadata()
-                    .withName("fabric8-maven-sample-zero-config")
-                    .addToLabels("expose", "true")
-                    .addToLabels("app", "fabric8-maven-sample-zero-config")
-                    .addToLabels("provider", "fabric8")
-                    .addToLabels("version", "3.5-SNAPSHOT")
-                    .addToLabels("group", "io.fabric8")
-                .endMetadata()
-                .withNewSpec()
-                .withHost("www.example.com")
-                .withPath("/test")
-                .withNewPort().withNewTargetPort().withValue(8080).endTargetPort().endPort()
-                .withNewTo().withKind("Service")
-                            .withName("fabric8-maven-sample-zero-config")
-                            .withWeight(5)
-                .endTo()
-                .addToAlternateBackends(
-                        new RouteTargetReferenceBuilder().withName("test1").withKind("Service").withWeight(0).build()
-                )
-                .addToAlternateBackends(
-                        new RouteTargetReferenceBuilder().withName("test2").withKind("Service").withWeight(0).build()
-                )
-                .addToAlternateBackends(
-                        new RouteTargetReferenceBuilder().withName("test3").withKind("Service").withWeight(0).build()
-                )
-                .withNewTls()
-                    .withTermination("edge")
-                    .withKey("$(perl -pe 's/\n/\\n/' example-test.key)")
-                    .withCertificate("$(perl -pe 's/\n/\\n/' example-test.cert)")
-                    .withCaCertificate("$(perl -pe 's/\n/\\n/' example-test.cert)")
-                    .withDestinationCACertificate("$(perl -pe 's/\n/\\n/' example-test.cert)")
-                    .withInsecureEdgeTerminationPolicy("Allow")
-                .endTls()
-                .withWildcardPolicy("Subdomain")
-                .endSpec()
-                .build();
+    Route route = new RouteBuilder()
+        .withNewMetadata()
+        .withName("fabric8-maven-sample-zero-config")
+        .addToLabels("expose", "true")
+        .addToLabels("app", "fabric8-maven-sample-zero-config")
+        .addToLabels("provider", "fabric8")
+        .addToLabels("version", "3.5-SNAPSHOT")
+        .addToLabels("group", "io.fabric8")
+        .endMetadata()
+        .withNewSpec()
+        .withHost("www.example.com")
+        .withPath("/test")
+        .withNewPort().withNewTargetPort().withValue(8080).endTargetPort().endPort()
+        .withNewTo().withKind("Service")
+        .withName("fabric8-maven-sample-zero-config")
+        .withWeight(5)
+        .endTo()
+        .addToAlternateBackends(
+            new RouteTargetReferenceBuilder().withName("test1").withKind("Service").withWeight(0).build())
+        .addToAlternateBackends(
+            new RouteTargetReferenceBuilder().withName("test2").withKind("Service").withWeight(0).build())
+        .addToAlternateBackends(
+            new RouteTargetReferenceBuilder().withName("test3").withKind("Service").withWeight(0).build())
+        .withNewTls()
+        .withTermination("edge")
+        .withKey("$(perl -pe 's/\n/\\n/' example-test.key)")
+        .withCertificate("$(perl -pe 's/\n/\\n/' example-test.cert)")
+        .withCaCertificate("$(perl -pe 's/\n/\\n/' example-test.cert)")
+        .withDestinationCACertificate("$(perl -pe 's/\n/\\n/' example-test.cert)")
+        .withInsecureEdgeTerminationPolicy("Allow")
+        .endTls()
+        .withWildcardPolicy("Subdomain")
+        .endSpec()
+        .build();
 
-        assertNotNull(route);
-        assertEquals("fabric8-maven-sample-zero-config",route.getMetadata().getName());
-        assertTrue(route.getMetadata().getLabels().get("expose").equals("true"));
-        assertTrue(route.getMetadata().getLabels().get("app").equals("fabric8-maven-sample-zero-config"));
-        assertTrue(route.getMetadata().getLabels().get("provider").equals("fabric8"));
-        assertTrue(route.getMetadata().getLabels().get("version").equals("3.5-SNAPSHOT"));
-        assertTrue(route.getMetadata().getLabels().get("group").equals("io.fabric8"));
-        assertEquals("www.example.com", route.getSpec().getHost());
-        assertEquals("/test", route.getSpec().getPath());
-        assertNotNull(route.getSpec().getPort());
-        assertEquals(8080, route.getSpec().getPort().getTargetPort().getIntVal().intValue());
-        assertNotNull(route.getSpec().getTo());
-        assertEquals("Service", route.getSpec().getTo().getKind());
-        assertEquals("fabric8-maven-sample-zero-config", route.getSpec().getTo().getName());
-        assertEquals("5", route.getSpec().getTo().getWeight().toString());
-        assertNotNull(route.getSpec().getAlternateBackends());
-        assertEquals(3, route.getSpec().getAlternateBackends().size());
-        assertEquals(0, route.getSpec().getAlternateBackends().get(0).getWeight().intValue());
-        assertEquals("Service", route.getSpec().getAlternateBackends().get(0).getKind());
-        assertEquals(0, route.getSpec().getAlternateBackends().get(1).getWeight().intValue());
-        assertEquals("Service", route.getSpec().getAlternateBackends().get(1).getKind());
-        assertEquals(0, route.getSpec().getAlternateBackends().get(2).getWeight().intValue());
-        assertEquals("Service", route.getSpec().getAlternateBackends().get(2).getKind());
-        assertTrue(route.getSpec().getAlternateBackends().get(0).getName().startsWith("test"));
-        assertTrue(route.getSpec().getAlternateBackends().get(1).getName().startsWith("test"));
-        assertTrue(route.getSpec().getAlternateBackends().get(2).getName().startsWith("test"));
-        assertNotNull(route.getSpec().getTls());
-        assertEquals("edge", route.getSpec().getTls().getTermination());
-        assertEquals("$(perl -pe 's/\n/\\n/' example-test.key)", route.getSpec().getTls().getKey());
-        assertEquals("$(perl -pe 's/\n/\\n/' example-test.cert)", route.getSpec().getTls().getCertificate());
-        assertEquals("$(perl -pe 's/\n/\\n/' example-test.cert)", route.getSpec().getTls().getCaCertificate());
-        assertEquals("$(perl -pe 's/\n/\\n/' example-test.cert)", route.getSpec().getTls().getDestinationCACertificate());
-        assertEquals("Allow", route.getSpec().getTls().getInsecureEdgeTerminationPolicy());
-        assertEquals("Subdomain", route.getSpec().getWildcardPolicy());
-    }
+    assertNotNull(route);
+    assertEquals("fabric8-maven-sample-zero-config", route.getMetadata().getName());
+    assertTrue(route.getMetadata().getLabels().get("expose").equals("true"));
+    assertTrue(route.getMetadata().getLabels().get("app").equals("fabric8-maven-sample-zero-config"));
+    assertTrue(route.getMetadata().getLabels().get("provider").equals("fabric8"));
+    assertTrue(route.getMetadata().getLabels().get("version").equals("3.5-SNAPSHOT"));
+    assertTrue(route.getMetadata().getLabels().get("group").equals("io.fabric8"));
+    assertEquals("www.example.com", route.getSpec().getHost());
+    assertEquals("/test", route.getSpec().getPath());
+    assertNotNull(route.getSpec().getPort());
+    assertEquals(8080, route.getSpec().getPort().getTargetPort().getIntVal().intValue());
+    assertNotNull(route.getSpec().getTo());
+    assertEquals("Service", route.getSpec().getTo().getKind());
+    assertEquals("fabric8-maven-sample-zero-config", route.getSpec().getTo().getName());
+    assertEquals("5", route.getSpec().getTo().getWeight().toString());
+    assertNotNull(route.getSpec().getAlternateBackends());
+    assertEquals(3, route.getSpec().getAlternateBackends().size());
+    assertEquals(0, route.getSpec().getAlternateBackends().get(0).getWeight().intValue());
+    assertEquals("Service", route.getSpec().getAlternateBackends().get(0).getKind());
+    assertEquals(0, route.getSpec().getAlternateBackends().get(1).getWeight().intValue());
+    assertEquals("Service", route.getSpec().getAlternateBackends().get(1).getKind());
+    assertEquals(0, route.getSpec().getAlternateBackends().get(2).getWeight().intValue());
+    assertEquals("Service", route.getSpec().getAlternateBackends().get(2).getKind());
+    assertTrue(route.getSpec().getAlternateBackends().get(0).getName().startsWith("test"));
+    assertTrue(route.getSpec().getAlternateBackends().get(1).getName().startsWith("test"));
+    assertTrue(route.getSpec().getAlternateBackends().get(2).getName().startsWith("test"));
+    assertNotNull(route.getSpec().getTls());
+    assertEquals("edge", route.getSpec().getTls().getTermination());
+    assertEquals("$(perl -pe 's/\n/\\n/' example-test.key)", route.getSpec().getTls().getKey());
+    assertEquals("$(perl -pe 's/\n/\\n/' example-test.cert)", route.getSpec().getTls().getCertificate());
+    assertEquals("$(perl -pe 's/\n/\\n/' example-test.cert)", route.getSpec().getTls().getCaCertificate());
+    assertEquals("$(perl -pe 's/\n/\\n/' example-test.cert)", route.getSpec().getTls().getDestinationCACertificate());
+    assertEquals("Allow", route.getSpec().getTls().getInsecureEdgeTerminationPolicy());
+    assertEquals("Subdomain", route.getSpec().getWildcardPolicy());
+  }
 }
diff --git a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/TemplateTest.java b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/TemplateTest.java
index 98d19441fda..702d1b1b3ac 100644
--- a/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/TemplateTest.java
+++ b/kubernetes-model-generator/openshift-model/src/test/java/io/fabric8/kubernetes/api/model/TemplateTest.java
@@ -33,16 +33,16 @@ class TemplateTest {
   void getObjectsWithObjectsShouldReturnList() {
     // Given
     final Template template = new TemplateBuilder()
-      .addToObjects(new SecretBuilder().build())
-      .addToObjects(new ServiceBuilder().build())
-      .addToObjects(new ProjectBuilder().build())
-      .build();
+        .addToObjects(new SecretBuilder().build())
+        .addToObjects(new ServiceBuilder().build())
+        .addToObjects(new ProjectBuilder().build())
+        .build();
     // When
     final List result = template.getObjects();
     // Then
     assertThat(result)
-      .extracting("class")
-      .containsExactly(Secret.class, Service.class, Project.class);
+        .extracting("class")
+        .containsExactly(Secret.class, Service.class, Project.class);
   }
 
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/BindingTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/BindingTest.java
index 62c08223914..a1f2c043a0e 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/BindingTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/BindingTest.java
@@ -36,16 +36,16 @@ class BindingTest {
   @Test
   void createOK() {
     server.expect().post().withPath("/api/v1/namespaces/default/bindings")
-      .andReturn(201, "{\"metadata\": {\"name\": \"binding-name\"}}")
-      .once();
+        .andReturn(201, "{\"metadata\": {\"name\": \"binding-name\"}}")
+        .once();
     // When
     final Binding result = client.bindings().inNamespace("default").create(new BindingBuilder()
-      .withNewMetadata().withName("binding-name").endMetadata()
-      .withNewTarget().withKind("Node").withApiVersion("v1").withName("node-name").endTarget()
-      .build());
+        .withNewMetadata().withName("binding-name").endMetadata()
+        .withNewTarget().withKind("Node").withApiVersion("v1").withName("node-name").endTarget()
+        .build());
     // Then
     assertThat(result)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "binding-name");
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "binding-name");
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ClusterRoleTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ClusterRoleTest.java
index 41d5f5309cf..0ef9cc3219d 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ClusterRoleTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ClusterRoleTest.java
@@ -36,7 +36,8 @@ class ClusterRoleTest {
 
   @Test
   void testLoadFromFile() {
-    ClusterRole kubernetesClusterRole = client.rbac().clusterRoles().load(getClass().getResourceAsStream("/test-clusterrole.yml")).get();
+    ClusterRole kubernetesClusterRole = client.rbac().clusterRoles()
+        .load(getClass().getResourceAsStream("/test-clusterrole.yml")).get();
 
     assertNotNull(kubernetesClusterRole);
   }
@@ -44,7 +45,8 @@ void testLoadFromFile() {
   @Test
   void testHandlersLoadFromFile() {
 
-    ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable load = client.load(getClass().getResourceAsStream("/test-clusterrole.yml"));
+    ParameterNamespaceListVisitFromServerGetDeleteRecreateWaitApplicable load = client
+        .load(getClass().getResourceAsStream("/test-clusterrole.yml"));
 
     assertNotNull(load);
 
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ComponentStatusTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ComponentStatusTest.java
index 16d24ac2614..e91b7add2e3 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ComponentStatusTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ComponentStatusTest.java
@@ -34,27 +34,26 @@ class ComponentStatusTest {
   KubernetesMockServer server;
   KubernetesClient client;
 
-	ComponentStatus status = new ComponentStatusBuilder().withConditions(new ComponentCondition(null, "ok",
-			"True", "Healthy")).build();
+  ComponentStatus status = new ComponentStatusBuilder().withConditions(new ComponentCondition(null, "ok",
+      "True", "Healthy")).build();
 
-	ComponentStatusList list = new ComponentStatusListBuilder().addNewItem().addNewCondition()
-			.and().endItem().build();
+  ComponentStatusList list = new ComponentStatusListBuilder().addNewItem().addNewCondition()
+      .and().endItem().build();
 
-	@Test
-	void testComponentStatus() {
+  @Test
+  void testComponentStatus() {
     server.expect().withPath("/api/v1/componentstatuses/scheduler").andReturn(200, status).once();
 
+    ComponentStatus stat = client.componentstatuses().withName("scheduler").get();
+    assertNotNull(stat);
+    assertEquals(1, stat.getConditions().size());
+  }
 
-		ComponentStatus stat = client.componentstatuses().withName("scheduler").get();
-	    assertNotNull(stat);
-	    assertEquals(1, stat.getConditions().size());
-	}
-
-	@Test
-	void testComponentStatusList() {
+  @Test
+  void testComponentStatusList() {
     server.expect().withPath("/api/v1/componentstatuses").andReturn(200, status).once();
 
-		ComponentStatusList stats = client.componentstatuses().list();
-	    assertNotNull(stats);
-	}
+    ComponentStatusList stats = client.componentstatuses().list();
+    assertNotNull(stats);
+  }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DeploymentV1beta1Test.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DeploymentV1beta1Test.java
index b1675dfe92b..1c7a1f5512a 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DeploymentV1beta1Test.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/DeploymentV1beta1Test.java
@@ -41,38 +41,37 @@ class DeploymentV1beta1Test {
   @Test
   void testCreateOrReplace() {
     Deployment oldDeployment = new DeploymentBuilder()
-      .withApiVersion("extensions/v1beta1")
-      .withNewMetadata()
-      .withName("test-deployment")
-      .endMetadata()
-      .build();
+        .withApiVersion("extensions/v1beta1")
+        .withNewMetadata()
+        .withName("test-deployment")
+        .endMetadata()
+        .build();
 
     Deployment newDeployment = new DeploymentBuilder()
-      .withApiVersion("extensions/v1beta1")
-      .withNewMetadata()
-      .withName("test-deployment")
-      .withAnnotations(Collections.singletonMap("newAnnotation", "test"))
-      .endMetadata()
-      .build();
+        .withApiVersion("extensions/v1beta1")
+        .withNewMetadata()
+        .withName("test-deployment")
+        .withAnnotations(Collections.singletonMap("newAnnotation", "test"))
+        .endMetadata()
+        .build();
 
     server.expect()
-      .post()
-      .withPath("/apis/extensions/v1beta1/namespaces/test/deployments")
-      .andReturn(HttpURLConnection.HTTP_CONFLICT, oldDeployment)
-      .once();
+        .post()
+        .withPath("/apis/extensions/v1beta1/namespaces/test/deployments")
+        .andReturn(HttpURLConnection.HTTP_CONFLICT, oldDeployment)
+        .once();
 
     server.expect()
-      .get()
-      .withPath("/apis/extensions/v1beta1/namespaces/test/deployments/test-deployment")
-      .andReturn(HttpURLConnection.HTTP_OK, oldDeployment)
-      .times(2);
+        .get()
+        .withPath("/apis/extensions/v1beta1/namespaces/test/deployments/test-deployment")
+        .andReturn(HttpURLConnection.HTTP_OK, oldDeployment)
+        .times(2);
 
     server.expect()
-      .put()
-      .withPath("/apis/extensions/v1beta1/namespaces/test/deployments/test-deployment")
-      .andReturn(HttpURLConnection.HTTP_OK, newDeployment)
-      .once();
-
+        .put()
+        .withPath("/apis/extensions/v1beta1/namespaces/test/deployments/test-deployment")
+        .andReturn(HttpURLConnection.HTTP_OK, newDeployment)
+        .once();
 
     Deployment result = client.extensions().deployments().inNamespace("test").createOrReplace(newDeployment);
     assertNotNull(result);
@@ -82,16 +81,16 @@ void testCreateOrReplace() {
   @Test
   void testRollback() {
     DeploymentRollback deploymentRollback = new DeploymentRollbackBuilder()
-      .withName("deployment1")
-      .withNewRollbackTo().withRevision(1L).endRollbackTo()
-      .withUpdatedAnnotations(Collections.singletonMap("foo", "bar"))
-      .build();
+        .withName("deployment1")
+        .withNewRollbackTo().withRevision(1L).endRollbackTo()
+        .withUpdatedAnnotations(Collections.singletonMap("foo", "bar"))
+        .build();
 
     Status status = new StatusBuilder().build();
     server.expect()
-      .post()
-      .withPath("/apis/extensions/v1beta1/namespaces/test/deployments/deployment1/rollback")
-      .andReturn(201, status).once();
+        .post()
+        .withPath("/apis/extensions/v1beta1/namespaces/test/deployments/deployment1/rollback")
+        .andReturn(201, status).once();
 
     client.extensions().deployments().inNamespace("test").withName("deployment1").rollback(deploymentRollback);
   }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ErrorMessageTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ErrorMessageTest.java
index 530d9246dff..5a50c91101a 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ErrorMessageTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ErrorMessageTest.java
@@ -31,25 +31,25 @@ public class ErrorMessageTest {
   KubernetesMockServer server;
   KubernetesClient client;
 
-
   @Test
   public void testCustomMessage() {
 
     client.getConfiguration().getErrorMessages().put(403, "MSG");
-    server.expect().withPath("/api/v1/namespaces/test/events").andReturn(200, new io.fabric8.kubernetes.api.model.EventListBuilder()
-      .addNewItem()
-      .withNewMetadata()
-      .withName("event1")
-      .endMetadata()
-      .endItem().build()).once();
+    server.expect().withPath("/api/v1/namespaces/test/events")
+        .andReturn(200, new io.fabric8.kubernetes.api.model.EventListBuilder()
+            .addNewItem()
+            .withNewMetadata()
+            .withName("event1")
+            .endMetadata()
+            .endItem().build())
+        .once();
     server.expect().withPath("/api/v1/namespaces/test/events/event1").andReturn(403, Boolean.FALSE).once();
 
-
-    try{
+    try {
       client.v1().events().inNamespace("test").delete();
       fail();
-    } catch (Exception e){
-      System.out.println("exception: "+e);
+    } catch (Exception e) {
+      System.out.println("exception: " + e);
       Assertions.assertThat(e.getMessage().startsWith("Failure executing: DELETE"));
       Assertions.assertThat(e.getMessage().contains("Message: MSG"));
       Assertions.assertThat(not(e.getMessage().contains("Received status")));
@@ -63,17 +63,16 @@ private void fail() {
   public void testServerErrorWithStatus() {
 
     server.expect().withPath("/api/v1/namespaces/test/events").andReturn(500, new StatusBuilder()
-      .withMessage("This operation is not allowed for some reason")
-      .withReason("Some reason")
-      .withCode(500)
-      .build()).once();
-
-
+        .withMessage("This operation is not allowed for some reason")
+        .withReason("Some reason")
+        .withCode(500)
+        .build()).once();
 
-    try{
-      client.v1().events().inNamespace("test").create(new EventBuilder().withNewMetadata().withName("event1").endMetadata().build());
+    try {
+      client.v1().events().inNamespace("test")
+          .create(new EventBuilder().withNewMetadata().withName("event1").endMetadata().build());
       fail();
-    } catch( Exception e){
+    } catch (Exception e) {
       Assertions.assertThat(e.getMessage().startsWith("Failure executing: POST"));
       Assertions.assertThat(e.getMessage().contains("Received status"));
       Assertions.assertThat(not(e.getMessage().contains("Message: This operation")));
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/GenerationTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/GenerationTest.java
index 4655ec93009..6be04a002a6 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/GenerationTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/GenerationTest.java
@@ -54,7 +54,7 @@ void testUpdatedSpecIncrementsGeneration() {
         .endMetadata()
         .build();
     final ConfigMapBuilder inServer = new ConfigMapBuilder(
-      client.configMaps().inNamespace(NAMESPACE).createOrReplace(original));
+        client.configMaps().inNamespace(NAMESPACE).createOrReplace(original));
     inServer.addToData("key", "value");
 
     final ConfigMap result = client.configMaps().inNamespace(NAMESPACE).createOrReplace(inServer.build());
@@ -64,13 +64,13 @@ void testUpdatedSpecIncrementsGeneration() {
   @Test
   void testUpdatingMetadataDoesNotIncrementGeneration() {
     final ConfigMap original = new ConfigMapBuilder()
-      .withNewMetadata()
-      .withName("test-configmap-updated-metadata")
-      .withNamespace(NAMESPACE)
-      .endMetadata()
-      .build();
+        .withNewMetadata()
+        .withName("test-configmap-updated-metadata")
+        .withNamespace(NAMESPACE)
+        .endMetadata()
+        .build();
     final ConfigMapBuilder inServer = new ConfigMapBuilder(
-      client.configMaps().inNamespace(NAMESPACE).createOrReplace(original));
+        client.configMaps().inNamespace(NAMESPACE).createOrReplace(original));
 
     inServer.editMetadata().addToAnnotations("new-annotation", "new-value");
 
@@ -78,5 +78,4 @@ void testUpdatingMetadataDoesNotIncrementGeneration() {
     assertEquals(1L, result.getMetadata().getGeneration());
   }
 
-
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/HttpServerTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/HttpServerTest.java
index 7c4898f8eff..1b2ab238177 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/HttpServerTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/HttpServerTest.java
@@ -33,7 +33,7 @@ public class HttpServerTest {
 
   @Test
   public void testListWithTrustCerts() {
-   server.expect().withPath("/api/v1/namespaces/test/pods").andReturn(200, new PodListBuilder().build()).once();
+    server.expect().withPath("/api/v1/namespaces/test/pods").andReturn(200, new PodListBuilder().build()).once();
     //We override the config to create a client that doesn't trust all certs.
     Config override = new ConfigBuilder(client.getConfiguration()).build();
 
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/KeyLoadTests.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/KeyLoadTests.java
index bd5c13e8ca5..68239da77ae 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/KeyLoadTests.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/KeyLoadTests.java
@@ -32,12 +32,12 @@
 @EnableKubernetesMockClient
 public class KeyLoadTests {
   @Test
-  public void testECKeyLoad() throws InvalidKeySpecException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException {
+  public void testECKeyLoad()
+      throws InvalidKeySpecException, CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException {
     String privateKeyPath = Utils.filePath(getClass().getResource("/ssl/fabric8-ec.key"));
     String certPath = Utils.filePath(getClass().getResource("/ssl/fabric8-ec.cert"));
 
-    KeyStore trustStore =
-      CertUtils.createKeyStore(null, certPath, null, privateKeyPath, "EC", "foo", null, null);
+    KeyStore trustStore = CertUtils.createKeyStore(null, certPath, null, privateKeyPath, "EC", "foo", null, null);
 
     assertEquals(1, trustStore.size());
   }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/LabelTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/LabelTest.java
index 667d7e18608..c40762b2c20 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/LabelTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/LabelTest.java
@@ -43,37 +43,35 @@ class LabelTest {
   @BeforeEach
   void init() {
     pod1 = new PodBuilder()
-      .withNewMetadata().withName("pod1").addToLabels("foo", "bar").endMetadata()
-      .withNewSpec()
-      .addNewContainer()
-      .withName("test")
-      .withImage("nginx")
-      .addNewPort().withContainerPort(80).endPort()
-      .endContainer()
-      .endSpec()
-      .build();
+        .withNewMetadata().withName("pod1").addToLabels("foo", "bar").endMetadata()
+        .withNewSpec()
+        .addNewContainer()
+        .withName("test")
+        .withImage("nginx")
+        .addNewPort().withContainerPort(80).endPort()
+        .endContainer()
+        .endSpec()
+        .build();
 
     pod2 = new PodBuilder()
-      .withNewMetadata().withName("pod2").addToLabels("app", "busybox").endMetadata()
-      .withNewSpec()
-      .addNewContainer()
-      .withImage("busybox")
-      .withCommand("sleep", "3600")
-      .withImagePullPolicy("IfNotPresent")
-      .withName("busybox")
-      .endContainer()
-      .withRestartPolicy("Always")
-      .endSpec()
-      .build();
+        .withNewMetadata().withName("pod2").addToLabels("app", "busybox").endMetadata()
+        .withNewSpec()
+        .addNewContainer()
+        .withImage("busybox")
+        .withCommand("sleep", "3600")
+        .withImagePullPolicy("IfNotPresent")
+        .withName("busybox")
+        .endContainer()
+        .withRestartPolicy("Always")
+        .endSpec()
+        .build();
   }
 
-
   @Test
   void testBasicList() {
     server.expect().get().withPath("/api/v1/namespaces/test/pods")
-      .andReturn(200, new PodListBuilder().withItems(pod1, pod2).build())
-      .once();
-
+        .andReturn(200, new PodListBuilder().withItems(pod1, pod2).build())
+        .once();
 
     PodList list = client.pods().inNamespace("test").list();
     assertNotNull(list);
@@ -83,16 +81,16 @@ void testBasicList() {
   @Test
   void testWithLabels() {
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("foo=bar"))
-      .andReturn(200, new PodListBuilder().withItems(pod1).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod1).build())
+        .once();
 
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("app=nginx,foo=bar"))
-      .andReturn(200, new PodListBuilder().build())
-      .once();
+        .andReturn(200, new PodListBuilder().build())
+        .once();
 
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("app=nginx"))
-      .andReturn(200, new PodListBuilder().withItems(pod2).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod2).build())
+        .once();
 
     Map filterLabels = new HashMap<>();
 
@@ -115,12 +113,12 @@ void testWithLabels() {
   @Test
   void testWithLabel() {
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=foo")
-      .andReturn(200, new PodListBuilder().withItems(pod1).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod1).build())
+        .once();
 
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=app")
-      .andReturn(200, new PodListBuilder().withItems(pod2).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod2).build())
+        .once();
 
     PodList list = client.pods().inNamespace("test").withLabel("foo").list();
     assertNotNull(list);
@@ -134,16 +132,16 @@ void testWithLabel() {
   @Test
   void testWithoutLabels() {
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("foo!=bar"))
-      .andReturn(200, new PodListBuilder().withItems(pod2).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod2).build())
+        .once();
 
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("app!=nginx,foo!=bar"))
-      .andReturn(200, new PodListBuilder().build())
-      .once();
+        .andReturn(200, new PodListBuilder().build())
+        .once();
 
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("app!=nginx"))
-      .andReturn(200, new PodListBuilder().withItems(pod1).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod1).build())
+        .once();
 
     Map filterLabels = new HashMap<>();
 
@@ -166,12 +164,12 @@ void testWithoutLabels() {
   @Test
   void testWithoutLabel() {
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("!foo"))
-      .andReturn(200, new PodListBuilder().withItems(pod2).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod2).build())
+        .once();
 
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=" + Utils.toUrlEncoded("!app"))
-      .andReturn(200, new PodListBuilder().withItems(pod1).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod1).build())
+        .once();
 
     PodList list = client.pods().inNamespace("test").withoutLabel("foo").list();
     assertNotNull(list);
@@ -185,12 +183,12 @@ void testWithoutLabel() {
   @Test
   void testLabelsIn() {
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=foo%20in%20%28bar%29")
-      .andReturn(200, new PodListBuilder().withItems(pod1).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod1).build())
+        .once();
 
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=app%20in%20%28nginx%29")
-      .andReturn(200, new PodListBuilder().withItems(pod2).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod2).build())
+        .once();
 
     Map filterLabels = new HashMap<>();
 
@@ -207,12 +205,12 @@ void testLabelsIn() {
   @Test
   void testLabelsNotIn() {
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=foo%20notin%20%28bar%29")
-      .andReturn(200, new PodListBuilder().withItems(pod2).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod2).build())
+        .once();
 
     server.expect().get().withPath("/api/v1/namespaces/test/pods?labelSelector=app%20notin%20%28nginx%29")
-      .andReturn(200, new PodListBuilder().withItems(pod1).build())
-      .once();
+        .andReturn(200, new PodListBuilder().withItems(pod1).build())
+        .once();
 
     Map filterLabels = new HashMap<>();
 
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/MetricsTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/MetricsTest.java
index 8b165ee5aef..78cd6a5aeab 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/MetricsTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/MetricsTest.java
@@ -48,8 +48,7 @@ class MetricsTest {
   @Test
   void testPodMetricsAllNamespace() throws Exception {
     server.expect().get().withPath("/apis/metrics.k8s.io/v1beta1/pods")
-      .andReturn(200, new PodMetricsListBuilder().withItems(getPodMetric()).build()).once();
-
+        .andReturn(200, new PodMetricsListBuilder().withItems(getPodMetric()).build()).once();
 
     PodMetricsList podMetricsList = client.top().pods().metrics();
     assertEquals(1, podMetricsList.getItems().size());
@@ -59,8 +58,7 @@ void testPodMetricsAllNamespace() throws Exception {
   @Test
   void testPodMetricsNamespace() throws Exception {
     server.expect().get().withPath("/apis/metrics.k8s.io/v1beta1/namespaces/test/pods")
-      .andReturn(200, new PodMetricsListBuilder().withItems(getPodMetric()).build()).once();
-
+        .andReturn(200, new PodMetricsListBuilder().withItems(getPodMetric()).build()).once();
 
     PodMetricsList podMetricsList = client.top().pods().metrics("test");
     assertEquals(1, podMetricsList.getItems().size());
@@ -70,8 +68,7 @@ void testPodMetricsNamespace() throws Exception {
   @Test
   void testPodMetricsNamespaceWithName() throws Exception {
     server.expect().get().withPath("/apis/metrics.k8s.io/v1beta1/namespaces/test/pods/test-pod")
-      .andReturn(200, getPodMetric()).once();
-
+        .andReturn(200, getPodMetric()).once();
 
     PodMetrics podMetrics = client.top().pods().metrics("test", "test-pod");
     assertEquals("foo", podMetrics.getMetadata().getName());
@@ -81,8 +78,8 @@ void testPodMetricsNamespaceWithName() throws Exception {
   void testPodMetricsInNamespace() throws Exception {
     // Given
     server.expect().get().withPath("/apis/metrics.k8s.io/v1beta1/namespaces/test/pods")
-      .andReturn(HttpURLConnection.HTTP_OK, new PodMetricsListBuilder().withItems(getPodMetric()).build())
-      .once();
+        .andReturn(HttpURLConnection.HTTP_OK, new PodMetricsListBuilder().withItems(getPodMetric()).build())
+        .once();
 
     // When
     PodMetricsList podMetricsList = client.top().pods().inNamespace("test").metrics();
@@ -96,42 +93,42 @@ void testPodMetricsInNamespace() throws Exception {
   void testPodMetricWithLabels() throws Exception {
     // Given
     server.expect().get().withPath("/apis/metrics.k8s.io/v1beta1/namespaces/ns1/pods?labelSelector=foo%3Dbar")
-      .andReturn(HttpURLConnection.HTTP_OK, new PodMetricsListBuilder().withItems(getPodMetric()).build())
-      .once();
+        .andReturn(HttpURLConnection.HTTP_OK, new PodMetricsListBuilder().withItems(getPodMetric()).build())
+        .once();
 
     // When
     PodMetricsList podMetricsList = client.top().pods().inNamespace("ns1")
-      .withLabels(Collections.singletonMap("foo", "bar"))
-      .metrics();
+        .withLabels(Collections.singletonMap("foo", "bar"))
+        .metrics();
 
     // Then
     assertThat(podMetricsList)
-      .isNotNull()
-      .extracting(PodMetricsList::getItems).asList().hasSize(1);
+        .isNotNull()
+        .extracting(PodMetricsList::getItems).asList().hasSize(1);
   }
 
   @Test
   void testPodMetricWithLabelsAllNamespaces() throws Exception {
     // Given
     server.expect().get().withPath("/apis/metrics.k8s.io/v1beta1/pods?labelSelector=foo%3Dbar")
-      .andReturn(HttpURLConnection.HTTP_OK, new PodMetricsListBuilder().withItems(getPodMetric()).build())
-      .once();
+        .andReturn(HttpURLConnection.HTTP_OK, new PodMetricsListBuilder().withItems(getPodMetric()).build())
+        .once();
 
     // When
     PodMetricsList podMetricsList = client.top().pods()
-      .withLabels(Collections.singletonMap("foo", "bar"))
-      .metrics();
+        .withLabels(Collections.singletonMap("foo", "bar"))
+        .metrics();
 
     // Then
     assertThat(podMetricsList)
-      .isNotNull()
-      .extracting(PodMetricsList::getItems).asList().hasSize(1);
+        .isNotNull()
+        .extracting(PodMetricsList::getItems).asList().hasSize(1);
   }
 
   @Test
   void testAllNodeMetrics() {
     server.expect().get().withPath("/apis/metrics.k8s.io/v1beta1/nodes")
-      .andReturn(200, new NodeMetricsListBuilder().withItems(getNodeMetric()).build()).once();
+        .andReturn(200, new NodeMetricsListBuilder().withItems(getNodeMetric()).build()).once();
 
     NodeMetricsList nodeMetricsList = client.top().nodes().metrics();
     assertEquals(1, nodeMetricsList.getItems().size());
@@ -141,7 +138,7 @@ void testAllNodeMetrics() {
   @Test
   void testNodeMetric() {
     server.expect().get().withPath("/apis/metrics.k8s.io/v1beta1/nodes/test-node")
-      .andReturn(200, getNodeMetric()).once();
+        .andReturn(200, getNodeMetric()).once();
 
     NodeMetrics nodeMetrics = client.top().nodes().metrics("test-node");
     assertEquals("foo", nodeMetrics.getMetadata().getName());
@@ -151,9 +148,9 @@ void testNodeMetric() {
   void testNodeMetricWithLabels() {
     // Given
     server.expect().get().withPath("/apis/metrics.k8s.io/v1beta1/nodes?labelSelector=" + Utils.toUrlEncoded("ss=true,cs=true"))
-      .andReturn(200, new NodeMetricsListBuilder().withItems(getNodeMetric()).build()).once();
+        .andReturn(200, new NodeMetricsListBuilder().withItems(getNodeMetric()).build()).once();
 
-    Map lablesMap = new HashMap<>();
+    Map lablesMap = new HashMap<>();
     lablesMap.put("ss", "true");
     lablesMap.put("cs", "true");
 
@@ -166,22 +163,21 @@ void testNodeMetricWithLabels() {
 
   private PodMetrics getPodMetric() throws Exception {
     return new PodMetricsBuilder()
-      .withNewMetadata().withName("foo").endMetadata()
-      .withWindow(Duration.parse("1m0s"))
-      .addNewContainer()
-      .withName("test-container")
-      .withUsage(Collections.singletonMap("cpu", new Quantity("38m")))
-      .endContainer()
-      .build();
+        .withNewMetadata().withName("foo").endMetadata()
+        .withWindow(Duration.parse("1m0s"))
+        .addNewContainer()
+        .withName("test-container")
+        .withUsage(Collections.singletonMap("cpu", new Quantity("38m")))
+        .endContainer()
+        .build();
   }
 
   private NodeMetrics getNodeMetric() {
     return new NodeMetricsBuilder()
-      .withNewMetadata().withName("foo").endMetadata()
-      .withWindow(new Duration(java.time.Duration.ofMinutes(1L)))
-      .withUsage(Collections.singletonMap("cpu", new Quantity("38m")))
-      .build();
+        .withNewMetadata().withName("foo").endMetadata()
+        .withWindow(new Duration(java.time.Duration.ofMinutes(1L)))
+        .withUsage(Collections.singletonMap("cpu", new Quantity("38m")))
+        .build();
   }
 
-
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/MixedCrudTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/MixedCrudTest.java
index 8890faf4da6..1e2c055c819 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/MixedCrudTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/MixedCrudTest.java
@@ -53,7 +53,7 @@ static void beforeAll() {
   void setUp() {
     final Map> responses = new HashMap<>();
     server = new KubernetesMockServer(new Context(Serialization.jsonMapper()),
-      new MockWebServer(), responses, new KubernetesMixedDispatcher(responses), false);
+        new MockWebServer(), responses, new KubernetesMixedDispatcher(responses), false);
     client = server.createClient();
   }
 
@@ -77,13 +77,13 @@ void versionWithNoExpectationsShouldFail() {
   void versionWithExpectationsShouldReturnVersion() {
     // Given
     server.expect().get().withPath("/version")
-      .andReturn(200, "{\"major\": \"13\", \"minor\": \"37\"}").always();
+        .andReturn(200, "{\"major\": \"13\", \"minor\": \"37\"}").always();
     // When
     final VersionInfo result = client.getKubernetesVersion();
     // Then
     assertThat(result)
-      .hasFieldOrPropertyWithValue("major", "13")
-      .hasFieldOrPropertyWithValue("minor", "37");
+        .hasFieldOrPropertyWithValue("major", "13")
+        .hasFieldOrPropertyWithValue("minor", "37");
   }
 
   @Test
@@ -91,13 +91,13 @@ void versionWithExpectationsShouldReturnVersion() {
   void crudGetWithNoExpectations() {
     // Given
     client.pods().inNamespace("ns")
-      .create(new PodBuilder().editOrNewMetadata().withName("my-pod").addToAnnotations("my", "pod").endMetadata().build());
+        .create(new PodBuilder().editOrNewMetadata().withName("my-pod").addToAnnotations("my", "pod").endMetadata().build());
     // When
     final Pod result = client.pods().inNamespace("ns").withName("my-pod").get();
     // Then
     assertThat(result)
-      .hasFieldOrPropertyWithValue("metadata.annotations.my", "pod")
-      .hasFieldOrPropertyWithValue("metadata.generation", 1L);
+        .hasFieldOrPropertyWithValue("metadata.annotations.my", "pod")
+        .hasFieldOrPropertyWithValue("metadata.generation", 1L);
   }
 
   @Test
@@ -105,14 +105,14 @@ void crudGetWithNoExpectations() {
   void crudGetWithExpectations() {
     // Given
     client.pods().inNamespace("ns")
-      .create(new PodBuilder().editOrNewMetadata().withName("my-pod").addToAnnotations("my", "pod").endMetadata().build());
+        .create(new PodBuilder().editOrNewMetadata().withName("my-pod").addToAnnotations("my", "pod").endMetadata().build());
     server.expect().get().withPath("/api/v1/namespaces/ns/pods/my-pod")
-      .andReturn(200, "{\"metadata\": {\"name\": \"override\"}}").always();
+        .andReturn(200, "{\"metadata\": {\"name\": \"override\"}}").always();
     // When
     final Pod result = client.pods().inNamespace("ns").withName("my-pod").get();
     // Then
     assertThat(result)
-      .hasFieldOrPropertyWithValue("metadata.name", "override")
-      .hasFieldOrPropertyWithValue("metadata.generation", null);
+        .hasFieldOrPropertyWithValue("metadata.name", "override")
+        .hasFieldOrPropertyWithValue("metadata.generation", null);
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/NodeMetricsTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/NodeMetricsTest.java
index 5b3804481d1..cef22aef352 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/NodeMetricsTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/NodeMetricsTest.java
@@ -39,28 +39,29 @@ class NodeMetricsTest {
   void testMetrics() {
     // Given
     server.expect().withPath("/apis/metrics.k8s.io/v1beta1/nodes/the-node").andReturn(HTTP_OK,
-      new NodeMetricsListBuilder().addToItems(new NodeMetricsBuilder()
-          .withNewMetadata().withName("the-metric").endMetadata()
-        .build()).build()).once();
+        new NodeMetricsListBuilder().addToItems(new NodeMetricsBuilder()
+            .withNewMetadata().withName("the-metric").endMetadata()
+            .build()).build())
+        .once();
     // When
     final NodeMetricsList result = client.top().nodes().withName("the-node").metrics();
     // Then
     assertThat(result)
-      .extracting(NodeMetricsList::getItems).asList().singleElement()
-      .hasFieldOrPropertyWithValue("Kind", "NodeMetrics")
-      .hasFieldOrPropertyWithValue("metadata.name", "the-metric");
+        .extracting(NodeMetricsList::getItems).asList().singleElement()
+        .hasFieldOrPropertyWithValue("Kind", "NodeMetrics")
+        .hasFieldOrPropertyWithValue("metadata.name", "the-metric");
   }
 
   @Test
   void testInform() {
     // Given
     server.expect().withPath("/apis/metrics.k8s.io/v1beta1/nodes").andReturn(HTTP_OK,
-      new NodeMetricsListBuilder().withMetadata(new ListMeta()).build()).once();
+        new NodeMetricsListBuilder().withMetadata(new ListMeta()).build()).once();
     server.expect().withPath("/apis/metrics.k8s.io/v1beta1/nodes?allowWatchBookmarks=true&watch=true")
-      .andUpgradeToWebSocket()
-      .open()
-      .done()
-      .once();
+        .andUpgradeToWebSocket()
+        .open()
+        .done()
+        .once();
     // When
     try (SharedIndexInformer result = client.resources(NodeMetrics.class).inAnyNamespace().inform()) {
       // Then
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodMetricsTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodMetricsTest.java
index f8028b1c4dc..d55eb88ec8a 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodMetricsTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/PodMetricsTest.java
@@ -39,44 +39,46 @@ class PodMetricsTest {
   void testMetrics() {
     // Given
     server.expect().withPath("/apis/metrics.k8s.io/v1beta1/pods/the-pod").andReturn(HTTP_OK,
-      new PodMetricsListBuilder().addToItems(new PodMetricsBuilder()
-          .withNewMetadata().withName("the-metric").endMetadata()
-        .build()).build()).once();
+        new PodMetricsListBuilder().addToItems(new PodMetricsBuilder()
+            .withNewMetadata().withName("the-metric").endMetadata()
+            .build()).build())
+        .once();
     // When
     final PodMetricsList result = client.top().pods().withName("the-pod").metrics();
     // Then
     assertThat(result)
-      .extracting(PodMetricsList::getItems).asList().singleElement()
-      .hasFieldOrPropertyWithValue("Kind", "PodMetrics")
-      .hasFieldOrPropertyWithValue("metadata.name", "the-metric");
+        .extracting(PodMetricsList::getItems).asList().singleElement()
+        .hasFieldOrPropertyWithValue("Kind", "PodMetrics")
+        .hasFieldOrPropertyWithValue("metadata.name", "the-metric");
   }
 
   @Test
   void testMetricsInNamespace() {
     // Given
     server.expect().withPath("/apis/metrics.k8s.io/v1beta1/namespaces/the-namespace/pods/the-pod")
-      .andReturn(HTTP_OK, new PodMetricsListBuilder().addToItems(new PodMetricsBuilder()
-        .withNewMetadata().withName("the-metric").endMetadata()
-        .build()).build()).once();
+        .andReturn(HTTP_OK, new PodMetricsListBuilder().addToItems(new PodMetricsBuilder()
+            .withNewMetadata().withName("the-metric").endMetadata()
+            .build()).build())
+        .once();
     // When
     final PodMetricsList result = client.top().pods().inNamespace("the-namespace").withName("the-pod").metrics();
     // Then
     assertThat(result)
-      .extracting(PodMetricsList::getItems).asList().singleElement()
-      .hasFieldOrPropertyWithValue("Kind", "PodMetrics")
-      .hasFieldOrPropertyWithValue("metadata.name", "the-metric");
+        .extracting(PodMetricsList::getItems).asList().singleElement()
+        .hasFieldOrPropertyWithValue("Kind", "PodMetrics")
+        .hasFieldOrPropertyWithValue("metadata.name", "the-metric");
   }
 
   @Test
   void testInform() {
     // Given
     server.expect().withPath("/apis/metrics.k8s.io/v1beta1/pods").andReturn(HTTP_OK,
-      new PodMetricsListBuilder().withMetadata(new ListMeta()).build()).once();
+        new PodMetricsListBuilder().withMetadata(new ListMeta()).build()).once();
     server.expect().withPath("/apis/metrics.k8s.io/v1beta1/pods?allowWatchBookmarks=true&watch=true")
-      .andUpgradeToWebSocket()
-      .open()
-      .done()
-      .once();
+        .andUpgradeToWebSocket()
+        .open()
+        .done()
+        .once();
     // When
     try (SharedIndexInformer result = client.resources(PodMetrics.class).inAnyNamespace().inform()) {
       // Then
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ReplicaSetV1beta1Test.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ReplicaSetV1beta1Test.java
index 7ee1165a9b3..4d985005fed 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ReplicaSetV1beta1Test.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/ReplicaSetV1beta1Test.java
@@ -37,38 +37,37 @@ class ReplicaSetV1beta1Test {
   @Test
   void testCreateOrReplace() {
     ReplicaSet oldReplicaSet = new ReplicaSetBuilder()
-      .withApiVersion("extensions/v1beta1")
-      .withNewMetadata()
-      .withName("test-replicaset")
-      .endMetadata()
-      .build();
+        .withApiVersion("extensions/v1beta1")
+        .withNewMetadata()
+        .withName("test-replicaset")
+        .endMetadata()
+        .build();
 
     ReplicaSet newReplicaSet = new ReplicaSetBuilder()
-      .withApiVersion("extensions/v1beta1")
-      .withNewMetadata()
-      .withName("test-deployment")
-      .withAnnotations(Collections.singletonMap("newAnnotation", "test"))
-      .endMetadata()
-      .build();
+        .withApiVersion("extensions/v1beta1")
+        .withNewMetadata()
+        .withName("test-deployment")
+        .withAnnotations(Collections.singletonMap("newAnnotation", "test"))
+        .endMetadata()
+        .build();
 
     server.expect()
-      .post()
-      .withPath("/apis/extensions/v1beta1/namespaces/test/replicasets")
-      .andReturn(HttpURLConnection.HTTP_CONFLICT, oldReplicaSet)
-      .once();
+        .post()
+        .withPath("/apis/extensions/v1beta1/namespaces/test/replicasets")
+        .andReturn(HttpURLConnection.HTTP_CONFLICT, oldReplicaSet)
+        .once();
 
     server.expect()
-      .get()
-      .withPath("/apis/extensions/v1beta1/namespaces/test/replicasets/test-deployment")
-      .andReturn(HttpURLConnection.HTTP_OK, oldReplicaSet)
-      .times(2);
+        .get()
+        .withPath("/apis/extensions/v1beta1/namespaces/test/replicasets/test-deployment")
+        .andReturn(HttpURLConnection.HTTP_OK, oldReplicaSet)
+        .times(2);
 
     server.expect()
-      .put()
-      .withPath("/apis/extensions/v1beta1/namespaces/test/replicasets/test-deployment")
-      .andReturn(HttpURLConnection.HTTP_OK, newReplicaSet)
-      .once();
-
+        .put()
+        .withPath("/apis/extensions/v1beta1/namespaces/test/replicasets/test-deployment")
+        .andReturn(HttpURLConnection.HTTP_OK, newReplicaSet)
+        .once();
 
     ReplicaSet result = client.extensions().replicaSets().inNamespace("test").createOrReplace(newReplicaSet);
     assertNotNull(result);
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/TokenReviewTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/TokenReviewTest.java
index 25111f1668a..a74d2ea86e1 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/TokenReviewTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/TokenReviewTest.java
@@ -43,26 +43,26 @@ class TokenReviewTest {
   void testCreate() {
     // Given
     TokenReview tokenReview = new TokenReviewBuilder()
-      .withNewSpec()
-      .withToken("eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJhdWQiOlsidmF1bHQiXSwiZXhwIjoxNTUyNjc1")
-      .endSpec()
-      .build();
+        .withNewSpec()
+        .withToken("eyJhbGciOiJSUzI1NiIsImtpZCI6IiJ9.eyJhdWQiOlsidmF1bHQiXSwiZXhwIjoxNTUyNjc1")
+        .endSpec()
+        .build();
     server.expect().post().withPath("/apis/authentication.k8s.io/v1/tokenreviews")
-      .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
-        TokenReview tokenReviewReq = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), TokenReview.class);
-        tokenReviewReq.setStatus(new TokenReviewStatusBuilder()
-          .withAuthenticated(true)
-          .withNewUser()
-          .withUsername("system:serviceaccount:dev:http-svc-test")
-          .withUid("4afdf4d0-46d2-11e9-8716-005056bf4b40")
-          .withGroups("system:serviceaccounts", "system:serviceaccounts:dev", "system:authenticated")
-          .endUser()
-          .addToAudiences("factors")
-          .build());
-
-        return tokenReviewReq;
-      }).once();
+        .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
+          TokenReview tokenReviewReq = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()),
+              TokenReview.class);
+          tokenReviewReq.setStatus(new TokenReviewStatusBuilder()
+              .withAuthenticated(true)
+              .withNewUser()
+              .withUsername("system:serviceaccount:dev:http-svc-test")
+              .withUid("4afdf4d0-46d2-11e9-8716-005056bf4b40")
+              .withGroups("system:serviceaccounts", "system:serviceaccounts:dev", "system:authenticated")
+              .endUser()
+              .addToAudiences("factors")
+              .build());
 
+          return tokenReviewReq;
+        }).once();
 
     // When
     tokenReview = client.tokenReviews().create(tokenReview);
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/UntrustedCertTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/UntrustedCertTest.java
index 0c548a3331f..28816fe25a5 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/UntrustedCertTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/UntrustedCertTest.java
@@ -41,8 +41,8 @@ public void testList() {
       server.expect().withPath("/api/v1/namespaces/test/pods").andReturn(200, new PodListBuilder().build()).once();
       //We override the config to create a client that doesn't trust all certs.
       Config override = new ConfigBuilder(client.getConfiguration())
-        .withTrustCerts(false)
-        .build();
+          .withTrustCerts(false)
+          .build();
 
       KubernetesClient client = new DefaultKubernetesClient(override);
       client.pods().list();
@@ -55,9 +55,9 @@ public void testListWithCaCerts() {
       server.expect().withPath("/api/v1/namespaces/test/pods").andReturn(200, new PodListBuilder().build()).once();
       //We override the config to create a client that doesn't trust all certs.
       Config override = new ConfigBuilder(client.getConfiguration())
-        .withTrustCerts(false)
-        .withCaCertData(CA_CERT_DATA)
-        .build();
+          .withTrustCerts(false)
+          .withCaCertData(CA_CERT_DATA)
+          .build();
 
       KubernetesClient client = new DefaultKubernetesClient(override);
       client.pods().list();
@@ -66,12 +66,12 @@ public void testListWithCaCerts() {
 
   @Test
   public void testListWithTrustCerts() {
-   server.expect().withPath("/api/v1/namespaces/test/pods").andReturn(200, new PodListBuilder().build()).once();
+    server.expect().withPath("/api/v1/namespaces/test/pods").andReturn(200, new PodListBuilder().build()).once();
     //We override the config to create a client that doesn't trust all certs.
     Config override = new ConfigBuilder(client.getConfiguration())
-            .withTrustCerts(true)
-            .withCaCertData(CA_CERT_DATA)
-            .build();
+        .withTrustCerts(true)
+        .withCaCertData(CA_CERT_DATA)
+        .build();
 
     KubernetesClient client = new DefaultKubernetesClient(override);
     client.pods().list();
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1SubjectAccessReviewAuthTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1SubjectAccessReviewAuthTest.java
index 6ecca344dbe..85e3a916357 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1SubjectAccessReviewAuthTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1SubjectAccessReviewAuthTest.java
@@ -57,22 +57,23 @@ class V1SubjectAccessReviewAuthTest {
   void createSubjectAccessReviewTest() {
     // Given
     SubjectAccessReview review = new SubjectAccessReviewBuilder()
-      .withNewSpec()
-      .withUser("admin-user")
-      .withNewResourceAttributes()
-      .withResource("pod")
-      .withVerb("create")
-      .endResourceAttributes()
-      .endSpec()
-      .build();
+        .withNewSpec()
+        .withUser("admin-user")
+        .withNewResourceAttributes()
+        .withResource("pod")
+        .withVerb("create")
+        .endResourceAttributes()
+        .endSpec()
+        .build();
 
     server.expect().post().withPath("/apis/authorization.k8s.io/v1/subjectaccessreviews")
-      .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
-        LocalSubjectAccessReview reviewResponse = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), LocalSubjectAccessReview.class);
-        reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
+        .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
+          LocalSubjectAccessReview reviewResponse = Serialization
+              .unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), LocalSubjectAccessReview.class);
+          reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
 
-        return reviewResponse;
-      }).once();
+          return reviewResponse;
+        }).once();
 
     // When
     SubjectAccessReview reviewResponse = client.authorization().v1().subjectAccessReview().create(review);
@@ -87,33 +88,34 @@ void createSubjectAccessReviewTest() {
   void createLocalSubjectAccessReviewTest() {
     // Given
     LocalSubjectAccessReview review = new LocalSubjectAccessReviewBuilder().withNewSpec()
-      .withUser("admin-user")
-      .withNewResourceAttributes()
-      .withResource("pod")
-      .withNamespace("test")
-      .withVerb("create")
-      .endResourceAttributes()
-      .endSpec()
-      .build();
+        .withUser("admin-user")
+        .withNewResourceAttributes()
+        .withResource("pod")
+        .withNamespace("test")
+        .withVerb("create")
+        .endResourceAttributes()
+        .endSpec()
+        .build();
 
     server.expect().post().withPath("/apis/authorization.k8s.io/v1/namespaces/test/localsubjectaccessreviews")
-      .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
-        LocalSubjectAccessReview reviewResponse = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), LocalSubjectAccessReview.class);
-        reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
+        .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
+          LocalSubjectAccessReview reviewResponse = Serialization
+              .unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), LocalSubjectAccessReview.class);
+          reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
 
-        return reviewResponse;
-      }).once();
+          return reviewResponse;
+        }).once();
 
     // When
     LocalSubjectAccessReview reviewResponse = client.authorization().v1()
-      .localSubjectAccessReview()
-      .inNamespace("test")
-      .create(review);
+        .localSubjectAccessReview()
+        .inNamespace("test")
+        .create(review);
 
     // Then
     assertNotNull(reviewResponse);
     assertEquals("test", reviewResponse.getSpec().getResourceAttributes().getNamespace());
-    assertTrue( reviewResponse.getStatus().getAllowed());
+    assertTrue(reviewResponse.getStatus().getAllowed());
   }
 
   @Test
@@ -121,48 +123,49 @@ void createLocalSubjectAccessReviewTest() {
   void testCreateSelfSubjectRulesReview() {
     // Given
     SelfSubjectRulesReview selfSubjectRulesReview = new SelfSubjectRulesReviewBuilder()
-      .withNewMetadata().withName("foo").endMetadata()
-      .withNewSpec()
-      .withNamespace("test")
-      .endSpec()
-      .build();
+        .withNewMetadata().withName("foo").endMetadata()
+        .withNewSpec()
+        .withNamespace("test")
+        .endSpec()
+        .build();
 
     server.expect().post().withPath("/apis/authorization.k8s.io/v1/selfsubjectrulesreviews")
-      .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
-        SelfSubjectRulesReview reviewResponse = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), SelfSubjectRulesReview.class);
-        List nonResourceRuleList = new ArrayList<>();
-        nonResourceRuleList.add(new NonResourceRuleBuilder().withNonResourceURLs("*").withVerbs("*").build());
-        nonResourceRuleList.add(new NonResourceRuleBuilder()
-          .withNonResourceURLs("/healthz", "/livez", "/readyz", "/version", "/version/")
-          .withVerbs("get")
-          .build());
-        nonResourceRuleList.add(new NonResourceRuleBuilder()
-          .withNonResourceURLs("/api", "/api/*", "/apis", "/apis/*", "/healthz", "/livez", "/openapi", "/openapi/*", "/readyz", "/version", "/version/")
-          .withVerbs("get")
-          .build());
-
-        List resourceRuleList = new ArrayList<>();
-        resourceRuleList.add(new ResourceRuleBuilder().withApiGroups("*").withResources("*").withVerbs("*").build());
-        resourceRuleList.add(new ResourceRuleBuilder()
-          .withApiGroups("authorization.k8s.io")
-          .withResources("selfsubjectaccessreviews", "selfsubjectrulesreviews")
-          .withVerbs("create")
-          .build());
-
-
-        reviewResponse.setStatus(new SubjectRulesReviewStatusBuilder()
-          .withIncomplete(false)
-          .withNonResourceRules(nonResourceRuleList)
-          .withResourceRules(resourceRuleList)
-          .build());
-
-        return reviewResponse;
-      }).once();
+        .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
+          SelfSubjectRulesReview reviewResponse = Serialization
+              .unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), SelfSubjectRulesReview.class);
+          List nonResourceRuleList = new ArrayList<>();
+          nonResourceRuleList.add(new NonResourceRuleBuilder().withNonResourceURLs("*").withVerbs("*").build());
+          nonResourceRuleList.add(new NonResourceRuleBuilder()
+              .withNonResourceURLs("/healthz", "/livez", "/readyz", "/version", "/version/")
+              .withVerbs("get")
+              .build());
+          nonResourceRuleList.add(new NonResourceRuleBuilder()
+              .withNonResourceURLs("/api", "/api/*", "/apis", "/apis/*", "/healthz", "/livez", "/openapi", "/openapi/*",
+                  "/readyz", "/version", "/version/")
+              .withVerbs("get")
+              .build());
+
+          List resourceRuleList = new ArrayList<>();
+          resourceRuleList.add(new ResourceRuleBuilder().withApiGroups("*").withResources("*").withVerbs("*").build());
+          resourceRuleList.add(new ResourceRuleBuilder()
+              .withApiGroups("authorization.k8s.io")
+              .withResources("selfsubjectaccessreviews", "selfsubjectrulesreviews")
+              .withVerbs("create")
+              .build());
+
+          reviewResponse.setStatus(new SubjectRulesReviewStatusBuilder()
+              .withIncomplete(false)
+              .withNonResourceRules(nonResourceRuleList)
+              .withResourceRules(resourceRuleList)
+              .build());
+
+          return reviewResponse;
+        }).once();
 
     // When
     SelfSubjectRulesReview reviewResponse = client.authorization().v1()
-      .selfSubjectRulesReview()
-      .create(selfSubjectRulesReview);
+        .selfSubjectRulesReview()
+        .create(selfSubjectRulesReview);
 
     // Then
     assertNotNull(reviewResponse);
@@ -178,28 +181,29 @@ void testCreateSelfSubjectRulesReview() {
   void testCreateSelfSubjectAccessReview() {
     // Given
     SelfSubjectAccessReview ssar = new SelfSubjectAccessReviewBuilder()
-      .withNewSpec()
-      .withNewResourceAttributes()
-      .withGroup("apps")
-      .withResource("deployments")
-      .withVerb("create")
-      .withNamespace("test")
-      .endResourceAttributes()
-      .endSpec()
-      .build();
+        .withNewSpec()
+        .withNewResourceAttributes()
+        .withGroup("apps")
+        .withResource("deployments")
+        .withVerb("create")
+        .withNamespace("test")
+        .endResourceAttributes()
+        .endSpec()
+        .build();
 
     server.expect().post().withPath("/apis/authorization.k8s.io/v1/selfsubjectaccessreviews")
-      .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
-        SelfSubjectAccessReview reviewResponse = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), SelfSubjectAccessReview.class);
-        reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
+        .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
+          SelfSubjectAccessReview reviewResponse = Serialization
+              .unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), SelfSubjectAccessReview.class);
+          reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
 
-        return reviewResponse;
-      }).once();
+          return reviewResponse;
+        }).once();
 
     // When
     SelfSubjectAccessReview reviewResponse = client.authorization().v1()
-      .selfSubjectAccessReview()
-      .create(ssar);
+        .selfSubjectAccessReview()
+        .create(ssar);
 
     // Then
     assertNotNull(reviewResponse);
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1beta1SubjectAccessReviewAuthTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1beta1SubjectAccessReviewAuthTest.java
index d4fdec2ed2c..191c4b9a734 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1beta1SubjectAccessReviewAuthTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/V1beta1SubjectAccessReviewAuthTest.java
@@ -57,22 +57,23 @@ class V1beta1SubjectAccessReviewAuthTest {
   void createSubjectAccessReviewTest() {
     // Given
     SubjectAccessReview review = new SubjectAccessReviewBuilder()
-      .withNewSpec()
-      .withUser("admin-user")
-      .withNewResourceAttributes()
-      .withResource("pod")
-      .withVerb("create")
-      .endResourceAttributes()
-      .endSpec()
-      .build();
+        .withNewSpec()
+        .withUser("admin-user")
+        .withNewResourceAttributes()
+        .withResource("pod")
+        .withVerb("create")
+        .endResourceAttributes()
+        .endSpec()
+        .build();
 
     server.expect().post().withPath("/apis/authorization.k8s.io/v1beta1/subjectaccessreviews")
-      .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
-        LocalSubjectAccessReview reviewResponse = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), LocalSubjectAccessReview.class);
-        reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
+        .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
+          LocalSubjectAccessReview reviewResponse = Serialization
+              .unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), LocalSubjectAccessReview.class);
+          reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
 
-        return reviewResponse;
-      }).once();
+          return reviewResponse;
+        }).once();
 
     // When
     SubjectAccessReview reviewResponse = client.authorization().v1beta1().subjectAccessReview().create(review);
@@ -87,28 +88,29 @@ void createSubjectAccessReviewTest() {
   void createLocalSubjectAccessReviewTest() {
     // Given
     LocalSubjectAccessReview review = new LocalSubjectAccessReviewBuilder().withNewSpec()
-      .withUser("admin-user")
-      .withNewResourceAttributes()
-      .withResource("pod")
-      .withNamespace("test")
-      .withVerb("create")
-      .endResourceAttributes()
-      .endSpec()
-      .build();
+        .withUser("admin-user")
+        .withNewResourceAttributes()
+        .withResource("pod")
+        .withNamespace("test")
+        .withVerb("create")
+        .endResourceAttributes()
+        .endSpec()
+        .build();
 
     server.expect().post().withPath("/apis/authorization.k8s.io/v1beta1/namespaces/test/localsubjectaccessreviews")
-      .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
-        LocalSubjectAccessReview reviewResponse = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), LocalSubjectAccessReview.class);
-        reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
+        .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
+          LocalSubjectAccessReview reviewResponse = Serialization
+              .unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), LocalSubjectAccessReview.class);
+          reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
 
-        return reviewResponse;
-      }).once();
+          return reviewResponse;
+        }).once();
 
     // When
     LocalSubjectAccessReview reviewResponse = client.authorization().v1beta1()
-      .localSubjectAccessReview()
-      .inNamespace("test")
-      .create(review);
+        .localSubjectAccessReview()
+        .inNamespace("test")
+        .create(review);
 
     // Then
     assertNotNull(reviewResponse);
@@ -120,48 +122,49 @@ void createLocalSubjectAccessReviewTest() {
   void testCreateSelfSubjectRulesReview() {
     // Given
     SelfSubjectRulesReview selfSubjectRulesReview = new SelfSubjectRulesReviewBuilder()
-      .withNewMetadata().withName("foo").endMetadata()
-      .withNewSpec()
-      .withNamespace("test")
-      .endSpec()
-      .build();
+        .withNewMetadata().withName("foo").endMetadata()
+        .withNewSpec()
+        .withNamespace("test")
+        .endSpec()
+        .build();
 
     server.expect().post().withPath("/apis/authorization.k8s.io/v1beta1/selfsubjectrulesreviews")
-      .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
-        SelfSubjectRulesReview reviewResponse = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), SelfSubjectRulesReview.class);
-        List nonResourceRuleList = new ArrayList<>();
-        nonResourceRuleList.add(new NonResourceRuleBuilder().withNonResourceURLs("*").withVerbs("*").build());
-        nonResourceRuleList.add(new NonResourceRuleBuilder()
-          .withNonResourceURLs("/healthz", "/livez", "/readyz", "/version", "/version/")
-          .withVerbs("get")
-          .build());
-        nonResourceRuleList.add(new NonResourceRuleBuilder()
-          .withNonResourceURLs("/api", "/api/*", "/apis", "/apis/*", "/healthz", "/livez", "/openapi", "/openapi/*", "/readyz", "/version", "/version/")
-          .withVerbs("get")
-          .build());
-
-        List resourceRuleList = new ArrayList<>();
-        resourceRuleList.add(new ResourceRuleBuilder().withApiGroups("*").withResources("*").withVerbs("*").build());
-        resourceRuleList.add(new ResourceRuleBuilder()
-          .withApiGroups("authorization.k8s.io")
-          .withResources("selfsubjectaccessreviews", "selfsubjectrulesreviews")
-          .withVerbs("create")
-          .build());
-
-
-        reviewResponse.setStatus(new SubjectRulesReviewStatusBuilder()
-          .withIncomplete(false)
-          .withNonResourceRules(nonResourceRuleList)
-          .withResourceRules(resourceRuleList)
-          .build());
-
-        return reviewResponse;
-      }).once();
+        .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
+          SelfSubjectRulesReview reviewResponse = Serialization
+              .unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), SelfSubjectRulesReview.class);
+          List nonResourceRuleList = new ArrayList<>();
+          nonResourceRuleList.add(new NonResourceRuleBuilder().withNonResourceURLs("*").withVerbs("*").build());
+          nonResourceRuleList.add(new NonResourceRuleBuilder()
+              .withNonResourceURLs("/healthz", "/livez", "/readyz", "/version", "/version/")
+              .withVerbs("get")
+              .build());
+          nonResourceRuleList.add(new NonResourceRuleBuilder()
+              .withNonResourceURLs("/api", "/api/*", "/apis", "/apis/*", "/healthz", "/livez", "/openapi", "/openapi/*",
+                  "/readyz", "/version", "/version/")
+              .withVerbs("get")
+              .build());
+
+          List resourceRuleList = new ArrayList<>();
+          resourceRuleList.add(new ResourceRuleBuilder().withApiGroups("*").withResources("*").withVerbs("*").build());
+          resourceRuleList.add(new ResourceRuleBuilder()
+              .withApiGroups("authorization.k8s.io")
+              .withResources("selfsubjectaccessreviews", "selfsubjectrulesreviews")
+              .withVerbs("create")
+              .build());
+
+          reviewResponse.setStatus(new SubjectRulesReviewStatusBuilder()
+              .withIncomplete(false)
+              .withNonResourceRules(nonResourceRuleList)
+              .withResourceRules(resourceRuleList)
+              .build());
+
+          return reviewResponse;
+        }).once();
 
     // When
     SelfSubjectRulesReview reviewResponse = client.authorization().v1beta1()
-      .selfSubjectRulesReview()
-      .create(selfSubjectRulesReview);
+        .selfSubjectRulesReview()
+        .create(selfSubjectRulesReview);
 
     // Then
     assertNotNull(reviewResponse);
@@ -177,28 +180,29 @@ void testCreateSelfSubjectRulesReview() {
   void testCreateSelfAccessRulesReview() {
     // Given
     SelfSubjectAccessReview ssar = new SelfSubjectAccessReviewBuilder()
-      .withNewSpec()
-      .withNewResourceAttributes()
-      .withGroup("apps")
-      .withResource("deployments")
-      .withVerb("create")
-      .withNamespace("test")
-      .endResourceAttributes()
-      .endSpec()
-      .build();
+        .withNewSpec()
+        .withNewResourceAttributes()
+        .withGroup("apps")
+        .withResource("deployments")
+        .withVerb("create")
+        .withNamespace("test")
+        .endResourceAttributes()
+        .endSpec()
+        .build();
 
     server.expect().post().withPath("/apis/authorization.k8s.io/v1beta1/selfsubjectaccessreviews")
-      .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
-        SelfSubjectAccessReview reviewResponse = Serialization.unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), SelfSubjectAccessReview.class);
-        reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
+        .andReply(HttpURLConnection.HTTP_OK, recordedRequest -> {
+          SelfSubjectAccessReview reviewResponse = Serialization
+              .unmarshal(recordedRequest.getBody().readString(Charset.defaultCharset()), SelfSubjectAccessReview.class);
+          reviewResponse.setStatus(new SubjectAccessReviewStatus(true, false, "", ""));
 
-        return reviewResponse;
-      }).once();
+          return reviewResponse;
+        }).once();
 
     // When
     SelfSubjectAccessReview reviewResponse = client.authorization().v1beta1()
-      .selfSubjectAccessReview()
-      .create(ssar);
+        .selfSubjectAccessReview()
+        .create(ssar);
 
     // Then
     assertNotNull(reviewResponse);
@@ -206,4 +210,3 @@ void testCreateSelfAccessRulesReview() {
     assertTrue(reviewResponse.getStatus().getAllowed());
   }
 }
-
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/VersionInfoTest.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/VersionInfoTest.java
index 72422a27074..c130b08e7a5 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/VersionInfoTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/VersionInfoTest.java
@@ -43,12 +43,12 @@ void setUp() {
   @Test
   void testClusterVersioning() throws ParseException {
     server.expect().withPath("/version").andReturn(200, "{" +
-      "    \"buildDate\": \"2018-03-01T14:27:17Z\"," +
-      "    \"gitCommit\": \"e6301f88a8\"," +
-      "    \"gitVersion\": \"v1.6.1+5115d708d7\"," +
-      "    \"major\": \"3\"," +
-      "    \"minor\": \"6\"" +
-      "}").always();
+        "    \"buildDate\": \"2018-03-01T14:27:17Z\"," +
+        "    \"gitCommit\": \"e6301f88a8\"," +
+        "    \"gitVersion\": \"v1.6.1+5115d708d7\"," +
+        "    \"major\": \"3\"," +
+        "    \"minor\": \"6\"" +
+        "}").always();
 
     assertEquals("v1.6.1+5115d708d7", client.getVersion().getGitVersion());
     assertEquals("e6301f88a8", client.getVersion().getGitCommit());
@@ -56,17 +56,17 @@ void testClusterVersioning() throws ParseException {
     assertEquals("6", client.getVersion().getMinor());
     assertEquals(118, client.getVersion().getBuildDate().getYear());
     assertEquals(new SimpleDateFormat(VersionInfo.VersionKeys.BUILD_DATE_FORMAT).parse("2018-03-01T14:27:17Z").getTime(),
-      client.getVersion().getBuildDate().getTime());
+        client.getVersion().getBuildDate().getTime());
   }
 
   @Test
   void testClusterVersioningWithMissingBuildDate() {
     server.expect().withPath("/version").andReturn(200, "{" +
-      "    \"gitCommit\": \"e6301f88a8\"," +
-      "    \"gitVersion\": \"v1.6.1+5115d708d7\"," +
-      "    \"major\": \"3\"," +
-      "    \"minor\": \"6\"" +
-      "}").always();
+        "    \"gitCommit\": \"e6301f88a8\"," +
+        "    \"gitVersion\": \"v1.6.1+5115d708d7\"," +
+        "    \"major\": \"3\"," +
+        "    \"minor\": \"6\"" +
+        "}").always();
 
     assertEquals("v1.6.1+5115d708d7", client.getVersion().getGitVersion());
     assertEquals("e6301f88a8", client.getVersion().getGitCommit());
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/CronTabSpec.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/CronTabSpec.java
index 5734dddb45d..c024ab73bd1 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/CronTabSpec.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/CronTabSpec.java
@@ -16,40 +16,40 @@
 package io.fabric8.kubernetes.client.mock.crd;
 
 public class CronTabSpec {
-    public String getCronSpec() {
-        return cronSpec;
-    }
-
-    public void setCronSpec(String cronSpec) {
-        this.cronSpec = cronSpec;
-    }
-
-    public String getImage() {
-        return image;
-    }
-
-    public void setImage(String image) {
-        this.image = image;
-    }
-
-    public int getReplicas() {
-        return replicas;
-    }
-
-    public void setReplicas(int replicas) {
-        this.replicas = replicas;
-    }
-
-    private String cronSpec;
-    private String image;
-    private int replicas;
-
-    @Override
-    public String toString() {
-        return "CronTabSpec{" +
-                "replicas=" + replicas  +
-                ", cronSpec='" + cronSpec + "'" +
-                ", image='" + image + "'" +
-                "}";
-    }
+  public String getCronSpec() {
+    return cronSpec;
+  }
+
+  public void setCronSpec(String cronSpec) {
+    this.cronSpec = cronSpec;
+  }
+
+  public String getImage() {
+    return image;
+  }
+
+  public void setImage(String image) {
+    this.image = image;
+  }
+
+  public int getReplicas() {
+    return replicas;
+  }
+
+  public void setReplicas(int replicas) {
+    this.replicas = replicas;
+  }
+
+  private String cronSpec;
+  private String image;
+  private int replicas;
+
+  @Override
+  public String toString() {
+    return "CronTabSpec{" +
+        "replicas=" + replicas +
+        ", cronSpec='" + cronSpec + "'" +
+        ", image='" + image + "'" +
+        "}";
+  }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/CronTabStatus.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/CronTabStatus.java
index 44dec4d92ea..c15868d5d5e 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/CronTabStatus.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/CronTabStatus.java
@@ -16,31 +16,31 @@
 package io.fabric8.kubernetes.client.mock.crd;
 
 public class CronTabStatus {
-    public int getReplicas() {
-        return replicas;
-    }
+  public int getReplicas() {
+    return replicas;
+  }
 
-    public void setReplicas(int replicas) {
-        this.replicas = replicas;
-    }
+  public void setReplicas(int replicas) {
+    this.replicas = replicas;
+  }
 
-    private int replicas;
+  private int replicas;
 
-    public String getLabelSelector() {
-        return labelSelector;
-    }
+  public String getLabelSelector() {
+    return labelSelector;
+  }
 
-    public void setLabelSelector(String labelSelector) {
-        this.labelSelector = labelSelector;
-    }
+  public void setLabelSelector(String labelSelector) {
+    this.labelSelector = labelSelector;
+  }
 
-    private String labelSelector;
+  private String labelSelector;
 
-    @Override
-    public String toString() {
-        return "CronTabStatus{" +
-                " replicas=" + replicas +
-                " , labelSelector='" + labelSelector + "'" +
-                "}";
-    }
+  @Override
+  public String toString() {
+    return "CronTabStatus{" +
+        " replicas=" + replicas +
+        " , labelSelector='" + labelSelector + "'" +
+        "}";
+  }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/EntandoBundleReleaseSpec.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/EntandoBundleReleaseSpec.java
index bbb1a04b968..9a199c41ccd 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/EntandoBundleReleaseSpec.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/EntandoBundleReleaseSpec.java
@@ -29,7 +29,7 @@ public void setDatabaseType(String databaseType) {
   @Override
   public String toString() {
     return "EntandoBundleReleaseSpec{" +
-      " type='" + databaseType + "'" +
-      "}";
+        " type='" + databaseType + "'" +
+        "}";
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSet.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSet.java
index 3aa6f33daff..3608e59df89 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSet.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSet.java
@@ -22,5 +22,5 @@
 
 @Group("demo.k8s.io")
 @Version("v1alpha1")
-public class PodSet extends CustomResource implements Namespaced {   
+public class PodSet extends CustomResource implements Namespaced {
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSetSpec.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSetSpec.java
index 9b8e96b38ba..e1f38f83f9d 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSetSpec.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSetSpec.java
@@ -16,18 +16,18 @@
 package io.fabric8.kubernetes.client.mock.crd;
 
 public class PodSetSpec {
-    public int getReplicas() {
-        return replicas;
-    }
+  public int getReplicas() {
+    return replicas;
+  }
 
-    @Override
-    public String toString() {
-        return "PodSetSpec{replicas=" + replicas + "}";
-    }
+  @Override
+  public String toString() {
+    return "PodSetSpec{replicas=" + replicas + "}";
+  }
 
-    public void setReplicas(int replicas) {
-        this.replicas = replicas;
-    }
+  public void setReplicas(int replicas) {
+    this.replicas = replicas;
+  }
 
-    private int replicas;
+  private int replicas;
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSetStatus.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSetStatus.java
index b36a341eb35..f29ed056de6 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSetStatus.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/PodSetStatus.java
@@ -16,18 +16,18 @@
 package io.fabric8.kubernetes.client.mock.crd;
 
 public class PodSetStatus {
-    public int getAvailableReplicas() {
-        return availableReplicas;
-    }
+  public int getAvailableReplicas() {
+    return availableReplicas;
+  }
 
-    public void setAvailableReplicas(int availableReplicas) {
-        this.availableReplicas = availableReplicas;
-    }
+  public void setAvailableReplicas(int availableReplicas) {
+    this.availableReplicas = availableReplicas;
+  }
 
-    @Override
-    public String toString() {
-        return "PodSetStatus{ availableReplicas=" + availableReplicas + "}";
-    }
+  @Override
+  public String toString() {
+    return "PodSetStatus{ availableReplicas=" + availableReplicas + "}";
+  }
 
-    private int availableReplicas;
+  private int availableReplicas;
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/StarSpec.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/StarSpec.java
index fc17fc5ac96..03e38022017 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/StarSpec.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/StarSpec.java
@@ -39,8 +39,8 @@ public void setLocation(String location) {
   @Override
   public String toString() {
     return "StarSpec{" +
-      "type=" + type +
-      ", location='" + location + "'" +
-      "}";
+        "type=" + type +
+        ", location='" + location + "'" +
+        "}";
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/StarStatus.java b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/StarStatus.java
index 808004c59c9..83cdb58fb10 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/StarStatus.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/crd/StarStatus.java
@@ -29,7 +29,7 @@ public void setLocation(String location) {
   @Override
   public String toString() {
     return "StarStatus{" +
-      " location=" + location +
-      "}";
+        " location=" + location +
+        "}";
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/AdaptTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/AdaptTest.java
index c177b319538..9402b6c0ff9 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/AdaptTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/AdaptTest.java
@@ -41,15 +41,15 @@ class AdaptTest {
   @Test
   void testSharedClient() {
     server.expect().withPath("/apis").andReturn(200, new APIGroupListBuilder()
-      .addNewGroup()
-      .withApiVersion("v1")
-      .withName("autoscaling.k8s.io")
-      .endGroup()
-      .addNewGroup()
-      .withApiVersion("v1")
-      .withName("security.openshift.io")
-      .endGroup()
-      .build()).once();
+        .addNewGroup()
+        .withApiVersion("v1")
+        .withName("autoscaling.k8s.io")
+        .endGroup()
+        .addNewGroup()
+        .withApiVersion("v1")
+        .withName("security.openshift.io")
+        .endGroup()
+        .build()).once();
 
     OpenShiftClient oclient = client.adapt(OpenShiftClient.class);
     assertNotNull(client.getHttpClient());
@@ -62,29 +62,35 @@ void testCheckIfAvailableAPIGroupsContainOpenShiftOpenShift4() {
     String authorizationEndpoint = client.getMasterUrl() + "oauth/authorize";
     server.expect().withPath("/apis").andReturn(HttpURLConnection.HTTP_UNAUTHORIZED, null).once();
     server.expect().get().withPath("/.well-known/oauth-authorization-server")
-      .andReturn(HttpURLConnection.HTTP_OK, "{\"authorization_endpoint\":\"" + authorizationEndpoint + "\"}")
-      .once();
+        .andReturn(HttpURLConnection.HTTP_OK, "{\"authorization_endpoint\":\"" + authorizationEndpoint + "\"}")
+        .once();
     server.expect().get().withPath("/oauth/authorize?response_type=token&client_id=openshift-challenging-client")
-      .andReply(new ResponseProvider() {
-        @Override
-        public Object getBody(RecordedRequest recordedRequest) { return null; }
+        .andReply(new ResponseProvider() {
+          @Override
+          public Object getBody(RecordedRequest recordedRequest) {
+            return null;
+          }
 
-        @Override
-        public int getStatusCode(RecordedRequest recordedRequest) { return HttpURLConnection.HTTP_MOVED_TEMP; }
+          @Override
+          public int getStatusCode(RecordedRequest recordedRequest) {
+            return HttpURLConnection.HTTP_MOVED_TEMP;
+          }
 
-        @Override
-        public Headers getHeaders() {
-          return new Headers.Builder()
-            .add("Location", client.getMasterUrl() + "oauth/token/implicit#access_token=sha256~UkDpAaw0AARKGVvJ0nypSjIDGGLMyxuS9ORWVyMQ2F8&expires_in=86400&scope=user%3Afull&token_type=Bearer")
-            .build();
-        }
+          @Override
+          public Headers getHeaders() {
+            return new Headers.Builder()
+                .add("Location", client.getMasterUrl()
+                    + "oauth/token/implicit#access_token=sha256~UkDpAaw0AARKGVvJ0nypSjIDGGLMyxuS9ORWVyMQ2F8&expires_in=86400&scope=user%3Afull&token_type=Bearer")
+                .build();
+          }
 
-        @Override
-        public void setHeaders(Headers headers) { }
-      }).once();
+          @Override
+          public void setHeaders(Headers headers) {
+          }
+        }).once();
     server.expect().withPath("/apis").andReturn(HttpURLConnection.HTTP_OK, new APIGroupListBuilder()
-      .addToGroups(new APIGroupBuilder().withName("security.internal.openshift.io").build()))
-      .once();
+        .addToGroups(new APIGroupBuilder().withName("security.internal.openshift.io").build()))
+        .once();
 
     client.getConfiguration().setUsername("foo");
     client.getConfiguration().setPassword("foo-pwd");
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildConfigCrudTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildConfigCrudTest.java
index 22e114a1cfb..ac42ac1f637 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildConfigCrudTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildConfigCrudTest.java
@@ -33,11 +33,11 @@ class BuildConfigCrudTest {
   @Test
   void testCrud() {
     BuildConfig buildConfig = new BuildConfigBuilder()
-      .withNewMetadata()
+        .withNewMetadata()
         .withName("bc2")
-        .withLabels(Collections.singletonMap("key","value"))
-      .endMetadata()
-      .build();
+        .withLabels(Collections.singletonMap("key", "value"))
+        .endMetadata()
+        .build();
 
     client.buildConfigs().create(buildConfig);
 
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildTest.java
index 951556a4d96..3ee77748677 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/BuildTest.java
@@ -27,7 +27,8 @@ class BuildTest {
 
   @Test
   void testLogWithoutTimestamps() {
-    server.expect().withPath("/apis/build.openshift.io/v1/namespaces/ns1/builds/test-build/log?pretty=false").andReturn(200, "test build output").times(2);
+    server.expect().withPath("/apis/build.openshift.io/v1/namespaces/ns1/builds/test-build/log?pretty=false")
+        .andReturn(200, "test build output").times(2);
 
     String log = openShiftClient.builds().inNamespace("ns1").withName("test-build").getLog();
     assertEquals("test build output", log);
@@ -35,7 +36,8 @@ void testLogWithoutTimestamps() {
 
   @Test
   void testLogWithTimestamps() {
-    server.expect().withPath("/apis/build.openshift.io/v1/namespaces/ns1/builds/test-build/log?pretty=false×tamps=true").andReturn(200, "test build output").times(2);
+    server.expect().withPath("/apis/build.openshift.io/v1/namespaces/ns1/builds/test-build/log?pretty=false×tamps=true")
+        .andReturn(200, "test build output").times(2);
 
     String log = openShiftClient.builds().inNamespace("ns1").withName("test-build").usingTimestamps().getLog();
     assertEquals("test build output", log);
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ClusterServiceVersionTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ClusterServiceVersionTest.java
index 812e5a28d2b..4e3a8961393 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ClusterServiceVersionTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ClusterServiceVersionTest.java
@@ -28,12 +28,13 @@ class ClusterServiceVersionTest {
 
   @Test
   void testLoad() {
-    ClusterServiceVersion clusterServiceVersion = client.operatorHub().clusterServiceVersions().load(getClass().getResourceAsStream("/test-clusterserviceversion.yml"))
-      .get();
+    ClusterServiceVersion clusterServiceVersion = client.operatorHub().clusterServiceVersions()
+        .load(getClass().getResourceAsStream("/test-clusterserviceversion.yml"))
+        .get();
 
     assertThat(clusterServiceVersion)
-      .isNotNull()
-      .hasFieldOrPropertyWithValue("metadata.name", "memcached-operator.v0.0.1")
-      .hasFieldOrPropertyWithValue("spec.version", "0.0.1");
+        .isNotNull()
+        .hasFieldOrPropertyWithValue("metadata.name", "memcached-operator.v0.0.1")
+        .hasFieldOrPropertyWithValue("spec.version", "0.0.1");
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamImageTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamImageTest.java
index bf01d1bf2cb..924cc4d3b46 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamImageTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamImageTest.java
@@ -15,7 +15,6 @@
  */
 package io.fabric8.openshift.client.server.mock;
 
-
 import io.fabric8.openshift.api.model.ImageStreamImage;
 import io.fabric8.openshift.api.model.ImageStreamImageBuilder;
 import io.fabric8.openshift.client.OpenShiftClient;
@@ -34,9 +33,9 @@ class ImageStreamImageTest {
   void get() {
     // Given
     server.expect().get().withPath("/apis/image.openshift.io/v1/namespaces/ns1/imagestreamimages/isi1")
-      .andReturn(HttpURLConnection.HTTP_CREATED, createImageStreamImageBuilder("isi1")
-        .build())
-      .once();
+        .andReturn(HttpURLConnection.HTTP_CREATED, createImageStreamImageBuilder("isi1")
+            .build())
+        .once();
 
     // When
     ImageStreamImage result = client.imageStreamImages().inNamespace("ns1").withName("isi1").get();
@@ -47,6 +46,6 @@ void get() {
 
   private ImageStreamImageBuilder createImageStreamImageBuilder(String name) {
     return new ImageStreamImageBuilder()
-      .withNewMetadata().withName(name).endMetadata();
+        .withNewMetadata().withName(name).endMetadata();
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamImportTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamImportTest.java
index 90ab2c05727..aa24316e29a 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamImportTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamImportTest.java
@@ -18,11 +18,10 @@
 import io.fabric8.openshift.api.model.ImageStreamImport;
 import io.fabric8.openshift.api.model.ImageStreamImportBuilder;
 import io.fabric8.openshift.client.OpenShiftClient;
+import org.junit.jupiter.api.Test;
 
 import java.net.HttpURLConnection;
 
-import org.junit.jupiter.api.Test;
-
 import static org.assertj.core.api.Assertions.assertThat;
 
 @EnableOpenShiftMockClient
@@ -35,9 +34,9 @@ void create() {
     // Given
     ImageStreamImport isi1 = createImageStreamImportBuilder("isi1").build();
     server.expect().post().withPath("/apis/image.openshift.io/v1/namespaces/ns1/imagestreamimports")
-      .andReturn(HttpURLConnection.HTTP_CREATED, createImageStreamImportBuilder("isi1")
-        .build())
-      .once();
+        .andReturn(HttpURLConnection.HTTP_CREATED, createImageStreamImportBuilder("isi1")
+            .build())
+        .once();
 
     // When
     ImageStreamImport result = client.imageStreamImports().inNamespace("ns1").create(isi1);
@@ -47,19 +46,19 @@ void create() {
   }
 
   private ImageStreamImportBuilder createImageStreamImportBuilder(String name) {
-      return new ImageStreamImportBuilder()
-          .withNewMetadata().withName(name).endMetadata()
-          .withNewSpec()
-          .addNewImage()
-          .withNewFrom()
-          .withName("registry.example.dk:5000/spilbraet/fafnir-sso:1.0.84")
-          .withKind("DockerImage")
-          .endFrom()
-          .withNewTo()
-          .withName("latest")
-          .endTo()
-          .withNewReferencePolicy("Source")
-          .endImage()
-          .endSpec();
+    return new ImageStreamImportBuilder()
+        .withNewMetadata().withName(name).endMetadata()
+        .withNewSpec()
+        .addNewImage()
+        .withNewFrom()
+        .withName("registry.example.dk:5000/spilbraet/fafnir-sso:1.0.84")
+        .withKind("DockerImage")
+        .endFrom()
+        .withNewTo()
+        .withName("latest")
+        .endTo()
+        .withNewReferencePolicy("Source")
+        .endImage()
+        .endSpec();
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamMappingTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamMappingTest.java
index 3363c307946..a15e8ea5820 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamMappingTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/ImageStreamMappingTest.java
@@ -24,7 +24,6 @@
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-
 @EnableOpenShiftMockClient
 class ImageStreamMappingTest {
   private OpenShiftClient client;
@@ -35,9 +34,10 @@ void create() {
     // Given
     ImageStreamMapping isi1 = createImageStreamMappingBuilder("isi1").build();
     server.expect().post().withPath("/apis/image.openshift.io/v1/namespaces/ns1/imagestreammappings")
-      .andReturn(HttpURLConnection.HTTP_CREATED, createImageStreamMappingBuilder("sha256:c5c25414687677f55e897e1e06cf79b93e58c2324b1531dadcd5b159bdf42b75")
-        .build())
-      .once();
+        .andReturn(HttpURLConnection.HTTP_CREATED,
+            createImageStreamMappingBuilder("sha256:c5c25414687677f55e897e1e06cf79b93e58c2324b1531dadcd5b159bdf42b75")
+                .build())
+        .once();
 
     // When
     ImageStreamMapping result = client.imageStreamMappings().inNamespace("ns1").create(isi1);
@@ -47,16 +47,16 @@ void create() {
   }
 
   private ImageStreamMappingBuilder createImageStreamMappingBuilder(String name) {
-      return new ImageStreamMappingBuilder()
-          .withNewMetadata().withName(name).endMetadata()
-          .withTag("latest123")
-          .withNewImage()
-          .withDockerImageReference("image-registry.openshift-image-registry.svc:5000/openshift/ubi8-openjdk-8")
-          .addNewDockerImageLayer()
-          .withName("sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef")
-          .withSize(0L)
-          .endDockerImageLayer()
-          .withNewMetadata().withName(name).endMetadata()
-          .endImage();
+    return new ImageStreamMappingBuilder()
+        .withNewMetadata().withName(name).endMetadata()
+        .withTag("latest123")
+        .withNewImage()
+        .withDockerImageReference("image-registry.openshift-image-registry.svc:5000/openshift/ubi8-openjdk-8")
+        .addNewDockerImageLayer()
+        .withName("sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef")
+        .withSize(0L)
+        .endDockerImageLayer()
+        .withNewMetadata().withName(name).endMetadata()
+        .endImage();
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/LoadAsTemplateTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/LoadAsTemplateTest.java
index 930d9c73445..8cf4bec5221 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/LoadAsTemplateTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/LoadAsTemplateTest.java
@@ -56,7 +56,8 @@ void tearDown() {
 
   @Test
   void shouldLoadPodAsTemplate() {
-    KubernetesList list = client.templates().load(getClass().getResourceAsStream("/test-pod-create-from-load.yml")).processLocally();
+    KubernetesList list = client.templates().load(getClass().getResourceAsStream("/test-pod-create-from-load.yml"))
+        .processLocally();
     assertNotNull(list);
     assertNotNull(list.getItems());
     assertEquals(1, list.getItems().size());
@@ -68,14 +69,15 @@ void shouldProcessLocally() {
     map.put("USERNAME", "root");
     map.put("REQUIRED", "requiredValue");
 
-    KubernetesList list = client.templates().load(getClass().getResourceAsStream("/template-with-params.yml")).processLocally(map);
+    KubernetesList list = client.templates().load(getClass().getResourceAsStream("/template-with-params.yml"))
+        .processLocally(map);
     assertListIsProcessed(list);
   }
 
   @Test
   void shouldProcessLocallyWithParametersInYaml() {
     KubernetesList list = client.templates().load(getClass().getResourceAsStream("/template-with-params.yml"))
-      .processLocally(new File(getClass().getResource("/parameters.yml").getFile()));
+        .processLocally(new File(getClass().getResource("/parameters.yml").getFile()));
     assertListIsProcessed(list);
   }
 
@@ -89,14 +91,14 @@ void shouldProcessLocallyDoubleBracedParameters() {
     localRequiredParameters.put("REQUIRED_BOOLEAN", "true");
     // When
     final KubernetesList result = client.templates().withParameters(nonStringParamsToBeAbleToLoad)
-      .load(getClass().getResourceAsStream("/template-with-json-params.yml"))
-      .processLocally(localRequiredParameters);
+        .load(getClass().getResourceAsStream("/template-with-json-params.yml"))
+        .processLocally(localRequiredParameters);
     // Then
-    final Container containerToAssert = ((Pod)result.getItems().get(0)).getSpec().getContainers().get(0);
+    final Container containerToAssert = ((Pod) result.getItems().get(0)).getSpec().getContainers().get(0);
     assertTrue(containerToAssert.getEnv().stream()
-      .anyMatch(e -> e.getName().equals("USERNAME") && e.getValue().equals("notTheOneInYaml")));
+        .anyMatch(e -> e.getName().equals("USERNAME") && e.getValue().equals("notTheOneInYaml")));
     assertTrue(containerToAssert.getEnv().stream()
-      .anyMatch(e -> e.getName().equals("REQUIRED_BOOLEAN") && e.getValue().equals("true")));
+        .anyMatch(e -> e.getName().equals("REQUIRED_BOOLEAN") && e.getValue().equals("true")));
     assertTrue(containerToAssert.getPorts().stream().allMatch(p -> p.getContainerPort() == 8080));
   }
 
@@ -106,13 +108,13 @@ void shouldProcessLocallyWithDoubleBracedParametersAndParametersInYaml() {
     final Map nonStringParamsToBeAbleToLoad = Collections.singletonMap("CONTAINER_PORT", "8080");
     // When
     final KubernetesList result = client.templates().withParameters(nonStringParamsToBeAbleToLoad)
-      .load(getClass().getResourceAsStream("/template-with-json-params.yml"))
-      .processLocally(getClass().getResourceAsStream("/parameters.yml"));
+        .load(getClass().getResourceAsStream("/template-with-json-params.yml"))
+        .processLocally(getClass().getResourceAsStream("/parameters.yml"));
     // Then
     assertListIsProcessed(result);
-    final Container containerToAssert = ((Pod)result.getItems().get(0)).getSpec().getContainers().get(0);
+    final Container containerToAssert = ((Pod) result.getItems().get(0)).getSpec().getContainers().get(0);
     assertTrue(containerToAssert.getEnv().stream()
-      .anyMatch(e -> e.getName().equals("REQUIRED_BOOLEAN") && e.getValue().equals("false")));
+        .anyMatch(e -> e.getName().equals("REQUIRED_BOOLEAN") && e.getValue().equals("false")));
   }
 
   private static DefaultOpenShiftClient createOpenShiftClientWithNoServer() {
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/OpenshiftRoleTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/OpenshiftRoleTest.java
index 7fae467ca61..7d051c18db8 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/OpenshiftRoleTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/OpenshiftRoleTest.java
@@ -36,27 +36,27 @@ class OpenshiftRoleTest {
 
   @Test
   void testList() {
-   server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/roles").andReturn(200, new RoleListBuilder().build()).once();
-   server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/ns1/roles").andReturn(200, new RoleListBuilder()
-      .addNewItem().and()
-      .addNewItem().and().build()).once();
-   server.expect().withPath("/apis").andReturn(200, new APIGroupListBuilder()
-      .addNewGroup()
-      .withApiVersion("v1")
-      .withName("autoscaling.k8s.io")
-      .endGroup()
-      .addNewGroup()
-      .withApiVersion("v1")
-      .withName("security.openshift.io")
-      .endGroup()
-      .build()).always();
-
-   server.expect().withPath("/apis/authorization.openshift.io/v1/roles").andReturn(200, new RoleListBuilder()
-      .addNewItem().and()
-      .addNewItem().and()
-      .addNewItem()
-      .and().build()).once();
-
+    server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/roles")
+        .andReturn(200, new RoleListBuilder().build()).once();
+    server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/ns1/roles").andReturn(200, new RoleListBuilder()
+        .addNewItem().and()
+        .addNewItem().and().build()).once();
+    server.expect().withPath("/apis").andReturn(200, new APIGroupListBuilder()
+        .addNewGroup()
+        .withApiVersion("v1")
+        .withName("autoscaling.k8s.io")
+        .endGroup()
+        .addNewGroup()
+        .withApiVersion("v1")
+        .withName("security.openshift.io")
+        .endGroup()
+        .build()).always();
+
+    server.expect().withPath("/apis/authorization.openshift.io/v1/roles").andReturn(200, new RoleListBuilder()
+        .addNewItem().and()
+        .addNewItem().and()
+        .addNewItem()
+        .and().build()).once();
 
     RoleList roleList = client.roles().list();
     assertNotNull(roleList);
@@ -73,14 +73,13 @@ void testList() {
 
   @Test
   void testGet() {
-   server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/roles/role1").andReturn(200, new RoleBuilder()
-      .withNewMetadata().withName("role1").endMetadata()
-      .build()).once();
-
-   server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/ns1/roles/role2").andReturn(200, new RoleBuilder()
-      .withNewMetadata().withName("role2").endMetadata()
-      .build()).once();
+    server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/roles/role1").andReturn(200, new RoleBuilder()
+        .withNewMetadata().withName("role1").endMetadata()
+        .build()).once();
 
+    server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/ns1/roles/role2").andReturn(200, new RoleBuilder()
+        .withNewMetadata().withName("role2").endMetadata()
+        .build()).once();
 
     Role role = client.roles().withName("role1").get();
     assertNotNull(role);
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PackageManifestTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PackageManifestTest.java
index 6674b716e1b..6e60fa2fd8a 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PackageManifestTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PackageManifestTest.java
@@ -15,7 +15,6 @@
  */
 package io.fabric8.openshift.client.server.mock;
 
-import io.fabric8.kubernetes.api.model.ConditionBuilder;
 import io.fabric8.openshift.api.model.operatorhub.lifecyclemanager.v1.PackageManifest;
 import io.fabric8.openshift.api.model.operatorhub.lifecyclemanager.v1.PackageManifestBuilder;
 import io.fabric8.openshift.api.model.operatorhub.lifecyclemanager.v1.PackageManifestList;
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicyReviewTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicyReviewTest.java
index 7a1b9d5f931..26b2885cff5 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicyReviewTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicyReviewTest.java
@@ -18,10 +18,10 @@
 import io.fabric8.openshift.api.model.PodSecurityPolicyReview;
 import io.fabric8.openshift.api.model.PodSecurityPolicyReviewBuilder;
 import io.fabric8.openshift.client.OpenShiftClient;
+import org.junit.jupiter.api.Test;
 
 import java.net.HttpURLConnection;
 
-import org.junit.jupiter.api.Test;
 import static org.assertj.core.api.Assertions.assertThat;
 
 @EnableOpenShiftMockClient
@@ -34,13 +34,13 @@ void create() {
     // Given
     PodSecurityPolicyReview pspr = createPodSecurityPolicyReviewBuilder().build();
     server.expect().post().withPath("/apis/security.openshift.io/v1/namespaces/ns1/podsecuritypolicyreviews")
-      .andReturn(HttpURLConnection.HTTP_CREATED, createPodSecurityPolicyReviewBuilder()
-        .withNewStatus()
-        .addNewAllowedServiceAccount()
-        .withName("test")
-        .endAllowedServiceAccount()
-        .endStatus().build())
-      .once();
+        .andReturn(HttpURLConnection.HTTP_CREATED, createPodSecurityPolicyReviewBuilder()
+            .withNewStatus()
+            .addNewAllowedServiceAccount()
+            .withName("test")
+            .endAllowedServiceAccount()
+            .endStatus().build())
+        .once();
 
     // When
     PodSecurityPolicyReview createdPspr = client.podSecurityPolicyReviews().inNamespace("ns1").create(pspr);
@@ -53,18 +53,18 @@ void create() {
 
   private PodSecurityPolicyReviewBuilder createPodSecurityPolicyReviewBuilder() {
     return new PodSecurityPolicyReviewBuilder()
-      .withNewSpec()
-      .withNewTemplate()
-      .withNewMetadata()
-      .addToAnnotations("foo", "bar")
-      .endMetadata()
-      .withNewSpec()
-      .addNewContainer()
-      .withImage("nginx:perl-stable")
-      .withName("test")
-      .endContainer()
-      .endSpec()
-      .endTemplate()
-      .endSpec();
+        .withNewSpec()
+        .withNewTemplate()
+        .withNewMetadata()
+        .addToAnnotations("foo", "bar")
+        .endMetadata()
+        .withNewSpec()
+        .addNewContainer()
+        .withImage("nginx:perl-stable")
+        .withName("test")
+        .endContainer()
+        .endSpec()
+        .endTemplate()
+        .endSpec();
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicySelfSubjectReviewTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicySelfSubjectReviewTest.java
index 7b14479daa6..051342a0fca 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicySelfSubjectReviewTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicySelfSubjectReviewTest.java
@@ -34,44 +34,45 @@ void create() {
     // Given
     PodSecurityPolicySelfSubjectReview pspr = createPodSecurityPolicySelfSubjectReviewBuilder().build();
     server.expect().post().withPath("/apis/security.openshift.io/v1/namespaces/ns1/podsecuritypolicyselfsubjectreviews")
-      .andReturn(HttpURLConnection.HTTP_CREATED, createPodSecurityPolicySelfSubjectReviewBuilder()
-        .withNewStatus()
-        .withNewAllowedBy()
-        .withName("anyuid")
-        .withUid("xyz")
-        .withApiVersion("security.openshift.io/v1")
-        .withKind("SecurityContextConstraint")
-        .endAllowedBy()
-        .endStatus().build())
-      .once();
+        .andReturn(HttpURLConnection.HTTP_CREATED, createPodSecurityPolicySelfSubjectReviewBuilder()
+            .withNewStatus()
+            .withNewAllowedBy()
+            .withName("anyuid")
+            .withUid("xyz")
+            .withApiVersion("security.openshift.io/v1")
+            .withKind("SecurityContextConstraint")
+            .endAllowedBy()
+            .endStatus().build())
+        .once();
 
     // When
-    PodSecurityPolicySelfSubjectReview createdPspr = client.podSecurityPolicySelfSubjectReviews().inNamespace("ns1").create(pspr);
+    PodSecurityPolicySelfSubjectReview createdPspr = client.podSecurityPolicySelfSubjectReviews().inNamespace("ns1")
+        .create(pspr);
 
     // Then
     assertThat(createdPspr).isNotNull();
     assertThat(createdPspr.getStatus().getAllowedBy()).isNotNull();
     assertThat(createdPspr.getStatus().getAllowedBy())
-      .hasFieldOrPropertyWithValue("name", "anyuid")
-      .hasFieldOrPropertyWithValue("uid", "xyz")
-      .hasFieldOrPropertyWithValue("kind", "SecurityContextConstraint")
-      .hasFieldOrPropertyWithValue("apiVersion", "security.openshift.io/v1");
+        .hasFieldOrPropertyWithValue("name", "anyuid")
+        .hasFieldOrPropertyWithValue("uid", "xyz")
+        .hasFieldOrPropertyWithValue("kind", "SecurityContextConstraint")
+        .hasFieldOrPropertyWithValue("apiVersion", "security.openshift.io/v1");
   }
 
   private PodSecurityPolicySelfSubjectReviewBuilder createPodSecurityPolicySelfSubjectReviewBuilder() {
     return new PodSecurityPolicySelfSubjectReviewBuilder()
-      .withNewSpec()
-      .withNewTemplate()
-      .withNewMetadata()
-      .addToAnnotations("foo", "bar")
-      .endMetadata()
-      .withNewSpec()
-      .addNewContainer()
-      .withImage("nginx:perl-stable")
-      .withName("test")
-      .endContainer()
-      .endSpec()
-      .endTemplate()
-      .endSpec();
+        .withNewSpec()
+        .withNewTemplate()
+        .withNewMetadata()
+        .addToAnnotations("foo", "bar")
+        .endMetadata()
+        .withNewSpec()
+        .addNewContainer()
+        .withImage("nginx:perl-stable")
+        .withName("test")
+        .endContainer()
+        .endSpec()
+        .endTemplate()
+        .endSpec();
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicySubjectReviewTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicySubjectReviewTest.java
index 892be769954..cbec37eec4b 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicySubjectReviewTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/PodSecurityPolicySubjectReviewTest.java
@@ -34,16 +34,16 @@ void create() {
     // Given
     PodSecurityPolicySubjectReview pspr = createPodSecurityPolicySubjectReviewBuilder().build();
     server.expect().post().withPath("/apis/security.openshift.io/v1/namespaces/ns1/podsecuritypolicysubjectreviews")
-      .andReturn(HttpURLConnection.HTTP_CREATED, createPodSecurityPolicySubjectReviewBuilder()
-        .withNewStatus()
-        .withNewAllowedBy()
-        .withName("anyuid")
-        .withUid("xyz")
-        .withApiVersion("security.openshift.io/v1")
-        .withKind("SecurityContextConstraint")
-        .endAllowedBy()
-        .endStatus().build())
-      .once();
+        .andReturn(HttpURLConnection.HTTP_CREATED, createPodSecurityPolicySubjectReviewBuilder()
+            .withNewStatus()
+            .withNewAllowedBy()
+            .withName("anyuid")
+            .withUid("xyz")
+            .withApiVersion("security.openshift.io/v1")
+            .withKind("SecurityContextConstraint")
+            .endAllowedBy()
+            .endStatus().build())
+        .once();
 
     // When
     PodSecurityPolicySubjectReview createdPspr = client.podSecurityPolicySubjectReviews().inNamespace("ns1").create(pspr);
@@ -52,26 +52,26 @@ void create() {
     assertThat(createdPspr).isNotNull();
     assertThat(createdPspr.getStatus().getAllowedBy()).isNotNull();
     assertThat(createdPspr.getStatus().getAllowedBy())
-      .hasFieldOrPropertyWithValue("name", "anyuid")
-      .hasFieldOrPropertyWithValue("uid", "xyz")
-      .hasFieldOrPropertyWithValue("kind", "SecurityContextConstraint")
-      .hasFieldOrPropertyWithValue("apiVersion", "security.openshift.io/v1");
+        .hasFieldOrPropertyWithValue("name", "anyuid")
+        .hasFieldOrPropertyWithValue("uid", "xyz")
+        .hasFieldOrPropertyWithValue("kind", "SecurityContextConstraint")
+        .hasFieldOrPropertyWithValue("apiVersion", "security.openshift.io/v1");
   }
 
   private PodSecurityPolicySubjectReviewBuilder createPodSecurityPolicySubjectReviewBuilder() {
     return new PodSecurityPolicySubjectReviewBuilder()
-      .withNewSpec()
-      .withNewTemplate()
-      .withNewMetadata()
-      .addToAnnotations("foo", "bar")
-      .endMetadata()
-      .withNewSpec()
-      .addNewContainer()
-      .withImage("nginx:perl-stable")
-      .withName("test")
-      .endContainer()
-      .endSpec()
-      .endTemplate()
-      .endSpec();
+        .withNewSpec()
+        .withNewTemplate()
+        .withNewMetadata()
+        .addToAnnotations("foo", "bar")
+        .endMetadata()
+        .withNewSpec()
+        .addNewContainer()
+        .withImage("nginx:perl-stable")
+        .withName("test")
+        .endContainer()
+        .endSpec()
+        .endTemplate()
+        .endSpec();
   }
 }
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/SubjectAccessReviewTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/SubjectAccessReviewTest.java
index ea81a723d89..3c82a108869 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/SubjectAccessReviewTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/SubjectAccessReviewTest.java
@@ -44,61 +44,69 @@ class SubjectAccessReviewTest {
   NamespacedOpenShiftClient client;
 
   @BeforeEach
-  void setUp() { client = server.createOpenShiftClient(); }
+  void setUp() {
+    client = server.createOpenShiftClient();
+  }
 
   @Test
   void testCreate() {
-    server.expect().withPath("/apis/authorization.openshift.io/v1/subjectaccessreviews").andReturn(201, new SubjectAccessReviewResponseBuilder()
-      .withReason("r1")
-      .build()).once();
-    SubjectAccessReviewResponse response = client.inAnyNamespace().subjectAccessReviews().create(new SubjectAccessReviewBuilder()
-      .build());
+    server.expect().withPath("/apis/authorization.openshift.io/v1/subjectaccessreviews")
+        .andReturn(201, new SubjectAccessReviewResponseBuilder()
+            .withReason("r1")
+            .build())
+        .once();
+    SubjectAccessReviewResponse response = client.inAnyNamespace().subjectAccessReviews()
+        .create(new SubjectAccessReviewBuilder()
+            .build());
     assertNotNull(response);
     assertEquals("r1", response.getReason());
   }
 
-
   @Test
   void testCreateInLine() {
-    server.expect().withPath("/apis/authorization.openshift.io/v1/subjectaccessreviews").andReturn(201, new SubjectAccessReviewResponseBuilder()
-      .withReason("r2")
-      .build()).once();
+    server.expect().withPath("/apis/authorization.openshift.io/v1/subjectaccessreviews")
+        .andReturn(201, new SubjectAccessReviewResponseBuilder()
+            .withReason("r2")
+            .build())
+        .once();
 
     SubjectAccessReviewResponse response = client.inAnyNamespace().subjectAccessReviews()
-      .create(new SubjectAccessReviewBuilder().build());
+        .create(new SubjectAccessReviewBuilder().build());
     assertNotNull(response);
     assertEquals("r2", response.getReason());
   }
 
-
   @Test
   void testCreateLocal() {
-   server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/localsubjectaccessreviews").andReturn(201, new SubjectAccessReviewResponseBuilder()
-      .withReason("r1")
-      .build()).once();
-
-
-    SubjectAccessReviewResponse response = client.localSubjectAccessReviews().inNamespace("test").create(new LocalSubjectAccessReviewBuilder()
-      .withNamespace("test")
-      .withVerb("get")
-      .withGroups("test.fabric8.io")
-      .build());
+    server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/localsubjectaccessreviews")
+        .andReturn(201, new SubjectAccessReviewResponseBuilder()
+            .withReason("r1")
+            .build())
+        .once();
+
+    SubjectAccessReviewResponse response = client.localSubjectAccessReviews().inNamespace("test")
+        .create(new LocalSubjectAccessReviewBuilder()
+            .withNamespace("test")
+            .withVerb("get")
+            .withGroups("test.fabric8.io")
+            .build());
     assertNotNull(response);
     assertEquals("r1", response.getReason());
   }
 
-
   @Test
   void testCreateLocalInLine() {
-   server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/localsubjectaccessreviews").andReturn( 201, new SubjectAccessReviewResponseBuilder()
-      .withReason("r2")
-      .build()).once();
-
-
-    SubjectAccessReviewResponse response = client.localSubjectAccessReviews().inNamespace("test").create(new LocalSubjectAccessReviewBuilder()
-      .withUser("user")
-      .withVerb("verb")
-      .build());
+    server.expect().withPath("/apis/authorization.openshift.io/v1/namespaces/test/localsubjectaccessreviews")
+        .andReturn(201, new SubjectAccessReviewResponseBuilder()
+            .withReason("r2")
+            .build())
+        .once();
+
+    SubjectAccessReviewResponse response = client.localSubjectAccessReviews().inNamespace("test")
+        .create(new LocalSubjectAccessReviewBuilder()
+            .withUser("user")
+            .withVerb("verb")
+            .build());
     assertNotNull(response);
     assertEquals("r2", response.getReason());
   }
@@ -107,65 +115,70 @@ void testCreateLocalInLine() {
   void createResourceAccessReview() {
     // Given
     server.expect().post().withPath("/apis/authorization.openshift.io/v1/resourceaccessreviews")
-      .andReturn( HTTP_CREATED, new ResourceAccessReviewResponseBuilder()
-        .addToGroups("system:cluster-admins", "system:masters")
-        .addToUsers("kubeadmin", "system:admin")
-      .build()).once();
+        .andReturn(HTTP_CREATED, new ResourceAccessReviewResponseBuilder()
+            .addToGroups("system:cluster-admins", "system:masters")
+            .addToUsers("kubeadmin", "system:admin")
+            .build())
+        .once();
 
     // When
     ResourceAccessReviewResponse response = client.resourceAccessReviews().create(new ResourceAccessReviewBuilder()
-      .withVerb("create")
-      .withResourceName("ConfigMap")
-      .build());
+        .withVerb("create")
+        .withResourceName("ConfigMap")
+        .build());
 
     // Then
     assertNotNull(response);
-    assertArrayEquals(new String[] {"kubeadmin", "system:admin"}, response.getUsers().toArray());
-    assertArrayEquals(new String[] {"system:cluster-admins", "system:masters"}, response.getGroups().toArray());
+    assertArrayEquals(new String[] { "kubeadmin", "system:admin" }, response.getUsers().toArray());
+    assertArrayEquals(new String[] { "system:cluster-admins", "system:masters" }, response.getGroups().toArray());
   }
 
   @Test
   void createLocalResourceAccessReview() {
     // Given
     server.expect().post().withPath("/apis/authorization.openshift.io/v1/namespaces/ns1/localresourceaccessreviews")
-      .andReturn( HTTP_CREATED, new ResourceAccessReviewResponseBuilder()
-        .withNamespace("ns1")
-        .addToGroups("system:cluster-admins", "system:masters")
-        .addToUsers("kubeadmin", "system:admin")
-        .build()).once();
+        .andReturn(HTTP_CREATED, new ResourceAccessReviewResponseBuilder()
+            .withNamespace("ns1")
+            .addToGroups("system:cluster-admins", "system:masters")
+            .addToUsers("kubeadmin", "system:admin")
+            .build())
+        .once();
 
     // When
-    ResourceAccessReviewResponse response = client.localResourceAccessReviews().inNamespace("ns1").create(new LocalResourceAccessReviewBuilder()
-      .withVerb("create")
-      .withResourceName("ConfigMap")
-      .build());
+    ResourceAccessReviewResponse response = client.localResourceAccessReviews().inNamespace("ns1")
+        .create(new LocalResourceAccessReviewBuilder()
+            .withVerb("create")
+            .withResourceName("ConfigMap")
+            .build());
 
     // Then
     assertNotNull(response);
-    assertArrayEquals(new String[] {"kubeadmin", "system:admin"}, response.getUsers().toArray());
-    assertArrayEquals(new String[] {"system:cluster-admins", "system:masters"}, response.getGroups().toArray());
+    assertArrayEquals(new String[] { "kubeadmin", "system:admin" }, response.getUsers().toArray());
+    assertArrayEquals(new String[] { "system:cluster-admins", "system:masters" }, response.getGroups().toArray());
   }
 
   @Test
   void createSelfSubjectRulesReviews() {
     // Given
     server.expect().post().withPath("/apis/authorization.openshift.io/v1/namespaces/test/selfsubjectrulesreviews")
-      .andReturn( HTTP_CREATED, new SelfSubjectRulesReviewBuilder()
-        .withNewSpec()
-        .endSpec()
-        .withNewStatus()
-        .addNewRule()
-        .withVerbs("create", "get")
-        .withApiGroups("")
-        .withResources("buildconfigs/webhooks")
-        .endRule()
-        .endStatus()
-        .build()).once();
+        .andReturn(HTTP_CREATED, new SelfSubjectRulesReviewBuilder()
+            .withNewSpec()
+            .endSpec()
+            .withNewStatus()
+            .addNewRule()
+            .withVerbs("create", "get")
+            .withApiGroups("")
+            .withResources("buildconfigs/webhooks")
+            .endRule()
+            .endStatus()
+            .build())
+        .once();
 
     // When
-    SelfSubjectRulesReview response = client.selfSubjectRulesReviews().inNamespace("test").create(new SelfSubjectRulesReviewBuilder()
-      .withNewSpec().endSpec()
-      .build());
+    SelfSubjectRulesReview response = client.selfSubjectRulesReviews().inNamespace("test")
+        .create(new SelfSubjectRulesReviewBuilder()
+            .withNewSpec().endSpec()
+            .build());
 
     // Then
     assertNotNull(response);
@@ -177,24 +190,25 @@ void createSelfSubjectRulesReviews() {
   void createSubjectRulesReviews() {
     // Given
     server.expect().post().withPath("/apis/authorization.openshift.io/v1/namespaces/test/subjectrulesreviews")
-      .andReturn( HTTP_CREATED, new SubjectRulesReviewBuilder()
-        .withNewSpec()
-        .endSpec()
-        .withNewStatus()
-        .addNewRule()
-        .withVerbs("create","delete","deletecollection","get","list","patch","update","watch")
-        .withApiGroups("")
-        .withResources("imagestreams")
-        .endRule()
-        .endStatus()
-        .build()).once();
+        .andReturn(HTTP_CREATED, new SubjectRulesReviewBuilder()
+            .withNewSpec()
+            .endSpec()
+            .withNewStatus()
+            .addNewRule()
+            .withVerbs("create", "delete", "deletecollection", "get", "list", "patch", "update", "watch")
+            .withApiGroups("")
+            .withResources("imagestreams")
+            .endRule()
+            .endStatus()
+            .build())
+        .once();
 
     // When
     SubjectRulesReview response = client.subjectRulesReviews().inNamespace("test").create(new SubjectRulesReviewBuilder()
-      .withNewSpec()
-      .withUser("developer")
-      .endSpec()
-      .build());
+        .withNewSpec()
+        .withUser("developer")
+        .endSpec()
+        .build());
 
     // Then
     assertNotNull(response);
diff --git a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/UserIdentityMappingTest.java b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/UserIdentityMappingTest.java
index 0c629229287..086960259b2 100644
--- a/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/UserIdentityMappingTest.java
+++ b/kubernetes-tests/src/test/java/io/fabric8/openshift/client/server/mock/UserIdentityMappingTest.java
@@ -33,8 +33,8 @@ void create() {
     // Given
     UserIdentityMapping userIdentityMapping = createNewUserIdentityMapping("ldap_provider:foo_s", "foo");
     server.expect().post().withPath("/apis/user.openshift.io/v1/useridentitymappings")
-      .andReturn(HTTP_CREATED, userIdentityMapping)
-      .once();
+        .andReturn(HTTP_CREATED, userIdentityMapping)
+        .once();
 
     // When
     UserIdentityMapping userIdentityMappingCreated = client.userIdentityMappings().create(userIdentityMapping);
@@ -45,13 +45,13 @@ void create() {
 
   private UserIdentityMapping createNewUserIdentityMapping(String name, String userName) {
     return new UserIdentityMappingBuilder()
-      .withNewMetadata().withName(name).endMetadata()
-      .withNewIdentity()
-      .withName(name)
-      .endIdentity()
-      .withNewUser()
-      .withName(userName)
-      .endUser()
-      .build();
+        .withNewMetadata().withName(name).endMetadata()
+        .withNewIdentity()
+        .withName(name)
+        .endIdentity()
+        .withNewUser()
+        .withName(userName)
+        .endUser()
+        .build();
   }
 }
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/NamespacedOpenShiftClient.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/NamespacedOpenShiftClient.java
index 87f67ccc124..2f5748be875 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/NamespacedOpenShiftClient.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/NamespacedOpenShiftClient.java
@@ -23,6 +23,7 @@ public interface NamespacedOpenShiftClient extends OpenShiftClient, NamespacedKu
 
   @Override
   NamespacedOpenShiftClient inAnyNamespace();
+
   @Override
   NamespacedOpenShiftClient inNamespace(String namespace);
 
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftAPIGroups.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftAPIGroups.java
index d031f2c1e49..a6c1f2b1086 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftAPIGroups.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/OpenShiftAPIGroups.java
@@ -22,6 +22,7 @@ public class OpenShiftAPIGroups {
   private OpenShiftAPIGroups() {
     throw new IllegalStateException("Utility class");
   }
+
   public static final String AUTHORIZATION = "authorization.openshift.io";
   public static final String BUILD = "build.openshift.io";
   public static final String APPS = "apps.openshift.io";
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/NameableCreateOrDeleteable.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/NameableCreateOrDeleteable.java
index ada70b34df3..aa3dfc91d8f 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/NameableCreateOrDeleteable.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/NameableCreateOrDeleteable.java
@@ -19,6 +19,7 @@
 import io.fabric8.kubernetes.client.dsl.Nameable;
 import io.fabric8.openshift.api.model.ImageSignature;
 
-public interface NameableCreateOrDeleteable extends Nameable>, CreateOrDeleteable {
+public interface NameableCreateOrDeleteable
+    extends Nameable>, CreateOrDeleteable {
 
 }
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftClusterAutoscalingAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftClusterAutoscalingAPIGroupDSL.java
index 2e7c1974f53..ec72b64ce50 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftClusterAutoscalingAPIGroupDSL.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftClusterAutoscalingAPIGroupDSL.java
@@ -19,5 +19,6 @@
 
 public interface OpenShiftClusterAutoscalingAPIGroupDSL extends Client {
   V1ClusterAutoscalingAPIGroupDSL v1();
+
   V1beta1ClusterAutoscalingAPIGroupDSL v1beta1();
 }
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftConsoleAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftConsoleAPIGroupDSL.java
index 37bca2e4ac9..5700306d18c 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftConsoleAPIGroupDSL.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftConsoleAPIGroupDSL.java
@@ -40,24 +40,28 @@ public interface OpenShiftConsoleAPIGroupDSL extends Client {
    * @return NonNamespaceOperation object for ConsoleCLIDownload type
    */
   NonNamespaceOperation> consoleCLIDownloads();
+
   /**
    * API entrypoint for ConsoleExternalLogLink related operations(console.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for ConsoleExternalLogLink type
    */
   NonNamespaceOperation> consoleExternalLogLinks();
+
   /**
    * API entrypoint for ConsoleLink related operations(console.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for ConsoleLink type
    */
   NonNamespaceOperation> consoleLinks();
+
   /**
    * API entrypoint for ConsoleNotification related operations(console.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for ConsoleNotification type
    */
   NonNamespaceOperation> consoleNotifications();
+
   /**
    * API entrypoint for ConsoleYAMLSample related operations(console.openshift.io/v1)
    *
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftHiveAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftHiveAPIGroupDSL.java
index c14b972d385..0f85bb19f1b 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftHiveAPIGroupDSL.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftHiveAPIGroupDSL.java
@@ -56,20 +56,36 @@
 
 public interface OpenShiftHiveAPIGroupDSL extends Client {
   MixedOperation> checkpoints();
+
   MixedOperation> clusterClaims();
+
   MixedOperation> clusterDeployments();
+
   MixedOperation> clusterDeprovisions();
+
   MixedOperation> clusterProvisions();
+
   NonNamespaceOperation> clusterImageSets();
+
   MixedOperation> clusterPools();
+
   MixedOperation> clusterRelocates();
+
   MixedOperation> clusterStates();
+
   MixedOperation> dnsZones();
+
   NonNamespaceOperation> hiveConfigs();
+
   MixedOperation> machinePoolNameLeases();
+
   MixedOperation> machinePools();
+
   NonNamespaceOperation> selectorSyncIdentityProviders();
+
   NonNamespaceOperation> selectorSyncSets();
+
   MixedOperation> syncIdentityProviders();
+
   MixedOperation> syncSets();
 }
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftMonitoringAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftMonitoringAPIGroupDSL.java
index 98c2d2b209d..200a30e523f 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftMonitoringAPIGroupDSL.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftMonitoringAPIGroupDSL.java
@@ -42,12 +42,14 @@ public interface OpenShiftMonitoringAPIGroupDSL extends Client {
    * @return {@link MixedOperation} object for AlertmanagerConfig
    */
   MixedOperation> alertmanagerConfigs();
+
   /**
    * API entrypoint for Prometheus related operations(monitoring.coreos.com/v1)
    *
    * @return MixedOperation object for Prometheus type
    */
   MixedOperation> prometheuses();
+
   /**
    * API entrypoint for PodMonitor related operations(monitoring.coreos.com/v1)
    *
@@ -61,18 +63,21 @@ public interface OpenShiftMonitoringAPIGroupDSL extends Client {
    * @return {@link MixedOperation} for Probe
    */
   MixedOperation> probes();
+
   /**
    * API entrypoint for Alertmanager related operations(monitoring.coreos.com/v1)
    *
    * @return MixedOperation object for Alertmanager type
    */
   MixedOperation> alertmanagers();
+
   /**
    * API entrypoint for PrometheusRule related operations(monitoring.coreos.com/v1)
    *
    * @return MixedOperation object for PrometheusRule type
    */
   MixedOperation> prometheusRules();
+
   /**
    * API entrypoint for ServiceMonitor related operations(monitoring.coreos.com/v1)
    *
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorAPIGroupDSL.java
index a47b32b2be3..d5bf919537b 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorAPIGroupDSL.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorAPIGroupDSL.java
@@ -88,96 +88,112 @@ public interface OpenShiftOperatorAPIGroupDSL extends Client {
    * @return NonNamespaceOperation object for Etcd type
    */
   NonNamespaceOperation> etcds();
+
   /**
    * API entrypoint for KubeStorageVersionMigrator related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for KubeStorageVersionMigrator type
    */
   NonNamespaceOperation> kubeStorageVersionMigrators();
+
   /**
    * API entrypoint for KubeControllerManager related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for KubeControllerManager type
    */
   NonNamespaceOperation> kubeControllerManagers();
+
   /**
    * API entrypoint for CSISnapshotController related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for CSISnapshotController type
    */
   NonNamespaceOperation> csiSnapshotControllers();
+
   /**
    * API entrypoint for Network related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for Network type
    */
   NonNamespaceOperation> networks();
+
   /**
    * API entrypoint for KubeScheduler related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for KubeScheduler type
    */
   NonNamespaceOperation> kubeSchedulers();
+
   /**
    * API entrypoint for Console related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for Console type
    */
   NonNamespaceOperation> consoles();
+
   /**
    * API entrypoint for ServiceCatalogControllerManager related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for ServiceCatalogControllerManager type
    */
   NonNamespaceOperation> serviceCatalogControllerManagers();
+
   /**
    * API entrypoint for ServiceCA related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for ServiceCA type
    */
   NonNamespaceOperation> serviceCAs();
+
   /**
    * API entrypoint for ImageContentSourcePolicy related operations(operator.openshift.io/v1alpha1)
    *
    * @return NonNamespaceOperation object for ImageContentSourcePolicy type
    */
   NonNamespaceOperation> imageContentSourcePolicies();
+
   /**
    * API entrypoint for DNS related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for DNS type
    */
   NonNamespaceOperation> dnses();
+
   /**
    * API entrypoint for DNSRecord related operations(operator.openshift.io/v1)
    *
    * @return MixedOperation object for DNSRecord type
    */
   MixedOperation> dnsRecords();
+
   /**
    * API entrypoint for OpenShiftControllerManager related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for OpenShiftControllerManager type
    */
   NonNamespaceOperation> openShiftControllerManagers();
+
   /**
    * API entrypoint for OpenShiftAPIServer related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for OpenShiftAPIServer type
    */
   NonNamespaceOperation> openShiftAPIServers();
+
   /**
    * API entrypoint for KubeAPIServer related operations(operator.openshift.io/v1)
    *
    * @return NonNamespaceOperation object for KubeAPIServer type
    */
   NonNamespaceOperation> kubeAPIServers();
+
   /**
    * API entrypoint for IngressController related operations(operator.openshift.io/v1)
    *
    * @return MixedOperation object for IngressController type
    */
   MixedOperation> ingressControllers();
+
   /**
    * API entrypoint for ImagePruner related operations(imageregistry.operator.openshift.io/v1)
    *
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorHubAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorHubAPIGroupDSL.java
index 9599846ce6f..0a2a6e2fe1e 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorHubAPIGroupDSL.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftOperatorHubAPIGroupDSL.java
@@ -43,24 +43,28 @@ public interface OpenShiftOperatorHubAPIGroupDSL extends Client {
    * @return MixedOperation object for CatalogSource type
    */
   MixedOperation> catalogSources();
+
   /**
    * API entrypoint for OperatorGroup related operations(operators.coreos.com/v1)
    *
    * @return MixedOperation object for OperatorGroup type
    */
   MixedOperation> operatorGroups();
+
   /**
    * API entrypoint for Subscription related operations(operators.coreos.com/v1alpha1)
    *
    * @return MixedOperation object for Subscription type
    */
   MixedOperation> subscriptions();
+
   /**
    * API entrypoint for InstallPlan related operations(operators.coreos.com/v1alpha1)
    *
    * @return MixedOperation object for InstallPlan type
    */
   MixedOperation> installPlans();
+
   /**
    * API entrypoint for CatalogSource related ClusterServiceVersion(operators.coreos.com/v1alpha1)
    *
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftQuotaAPIGroupDSL.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftQuotaAPIGroupDSL.java
index b05b6ad54cc..07e25b9d82f 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftQuotaAPIGroupDSL.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/OpenShiftQuotaAPIGroupDSL.java
@@ -25,5 +25,6 @@
 
 public interface OpenShiftQuotaAPIGroupDSL extends Client {
   MixedOperation> appliedClusterResourceQuotas();
+
   MixedOperation> clusterResourceQuotas();
 }
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/ProjectOperation.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/ProjectOperation.java
index 1c3890d437d..5526fa61d3f 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/ProjectOperation.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/ProjectOperation.java
@@ -34,5 +34,6 @@ public interface ProjectOperation extends NonNamespaceOperation createProjectAndRoleBindings(String name, String description, String displayName, String adminUser, String requestingUser);
+  List createProjectAndRoleBindings(String name, String description, String displayName, String adminUser,
+      String requestingUser);
 }
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/TimeoutInputStreamable.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/TimeoutInputStreamable.java
index b73dc92dc10..42562fc1be1 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/TimeoutInputStreamable.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/dsl/TimeoutInputStreamable.java
@@ -19,6 +19,6 @@
 import io.fabric8.kubernetes.client.dsl.Timeoutable;
 
 public interface TimeoutInputStreamable extends
-  Timeoutable>,
-  InputStreamable {
+    Timeoutable>,
+    InputStreamable {
 }
diff --git a/openshift-client-api/src/main/java/io/fabric8/openshift/client/readiness/OpenShiftReadiness.java b/openshift-client-api/src/main/java/io/fabric8/openshift/client/readiness/OpenShiftReadiness.java
index 92cac320927..ceb9ab1c095 100644
--- a/openshift-client-api/src/main/java/io/fabric8/openshift/client/readiness/OpenShiftReadiness.java
+++ b/openshift-client-api/src/main/java/io/fabric8/openshift/client/readiness/OpenShiftReadiness.java
@@ -25,7 +25,7 @@
 public class OpenShiftReadiness extends Readiness {
 
   private static final String OPENSHIFT_READINESS_APPLICABLE_RESOURCES = READINESS_APPLICABLE_RESOURCES +
-    ", " + "DeploymentConfig";
+      ", " + "DeploymentConfig";
 
   private static class OpenShiftReadinessHolder {
     public static final OpenShiftReadiness INSTANCE = new OpenShiftReadiness();
@@ -38,8 +38,7 @@ public static OpenShiftReadiness getInstance() {
   @Override
   protected boolean isReadinessApplicable(HasMetadata item) {
     return super.isReadinessApplicable(item) ||
-      item instanceof DeploymentConfig
-      ;
+        item instanceof DeploymentConfig;
   }
 
   @Override
@@ -70,7 +69,7 @@ public static boolean isDeploymentConfigReady(DeploymentConfig d) {
     }
 
     return spec.getReplicas().intValue() == status.getReplicas() &&
-      spec.getReplicas() <= status.getAvailableReplicas();
+        spec.getReplicas() <= status.getAvailableReplicas();
   }
 
 }
diff --git a/openshift-client-api/src/test/java/io/fabric8/openshift/client/dsl/base/TestUnmarshal.java b/openshift-client-api/src/test/java/io/fabric8/openshift/client/dsl/base/TestUnmarshal.java
index c3637294efa..45db1603e2c 100644
--- a/openshift-client-api/src/test/java/io/fabric8/openshift/client/dsl/base/TestUnmarshal.java
+++ b/openshift-client-api/src/test/java/io/fabric8/openshift/client/dsl/base/TestUnmarshal.java
@@ -31,7 +31,7 @@ void testUnmarshalJSONTemplate() {
 
   @Test
   void testUnmarshalYAMLTemplate() {
-   Template t = Serialization.unmarshal(getClass().getResourceAsStream("/test-template.yml"), Template.class);
+    Template t = Serialization.unmarshal(getClass().getResourceAsStream("/test-template.yml"), Template.class);
     assertEquals("eap6-basic-sti", t.getMetadata().getName());
   }
 
diff --git a/openshift-client-api/src/test/java/io/fabric8/openshift/client/readiness/OpenShiftReadinessTest.java b/openshift-client-api/src/test/java/io/fabric8/openshift/client/readiness/OpenShiftReadinessTest.java
index 849b5bf046b..721df174c91 100644
--- a/openshift-client-api/src/test/java/io/fabric8/openshift/client/readiness/OpenShiftReadinessTest.java
+++ b/openshift-client-api/src/test/java/io/fabric8/openshift/client/readiness/OpenShiftReadinessTest.java
@@ -37,9 +37,9 @@ void setUp() {
   @Test
   void testOpenShiftReadinessWithDeploymentConfig() {
     DeploymentConfig dc = new DeploymentConfigBuilder()
-      .withNewSpec().withReplicas(2).endSpec()
-      .withNewStatus().withAvailableReplicas(2).withReplicas(2).endStatus()
-      .build();
+        .withNewSpec().withReplicas(2).endSpec()
+        .withNewStatus().withAvailableReplicas(2).withReplicas(2).endStatus()
+        .build();
 
     assertTrue(readiness.isReady(dc));
   }
diff --git a/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/BuildConfigOperationContext.java b/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/BuildConfigOperationContext.java
index c39e251b80a..68c0a69b47a 100644
--- a/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/BuildConfigOperationContext.java
+++ b/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/BuildConfigOperationContext.java
@@ -36,7 +36,9 @@ public class BuildConfigOperationContext {
   public BuildConfigOperationContext() {
   }
 
-  public BuildConfigOperationContext(String secret, String triggerType, String authorName, String authorEmail, String committerName, String committerEmail, String commit, String message, String asFile, Long timeout, TimeUnit timeUnit) {
+  public BuildConfigOperationContext(String secret, String triggerType, String authorName, String authorEmail,
+      String committerName, String committerEmail, String commit, String message, String asFile, Long timeout,
+      TimeUnit timeUnit) {
     this.secret = secret;
     this.triggerType = triggerType;
     this.authorName = authorName;
@@ -95,47 +97,58 @@ public TimeUnit getTimeoutUnit() {
   }
 
   public BuildConfigOperationContext withSecret(String secret) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withTriggerType(String triggerType) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withAuthorName(String authorName) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withAuthorEmail(String authorEmail) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withCommitterName(String committerName) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withCommitterEmail(String committerEmail) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withCommit(String commit) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withMessage(String message) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withAsFile(String asFile) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withTimeout(long timeout) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
   public BuildConfigOperationContext withTimeoutUnit(TimeUnit timeoutUnit) {
-    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit, message,asFile, timeout, timeoutUnit);
+    return new BuildConfigOperationContext(secret, triggerType, authorName, authorEmail, committerName, committerEmail, commit,
+        message, asFile, timeout, timeoutUnit);
   }
 
 }
diff --git a/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/apps/DeploymentConfigOperationsImpl.java b/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/apps/DeploymentConfigOperationsImpl.java
index a54eb4f717a..d63fc271144 100644
--- a/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/apps/DeploymentConfigOperationsImpl.java
+++ b/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/apps/DeploymentConfigOperationsImpl.java
@@ -32,7 +32,6 @@
 import io.fabric8.kubernetes.client.dsl.internal.OperationContext;
 import io.fabric8.kubernetes.client.dsl.internal.RollingOperationContext;
 import io.fabric8.kubernetes.client.utils.URLUtils;
-import io.fabric8.kubernetes.client.utils.URLUtils.URLBuilder;
 import io.fabric8.kubernetes.client.utils.internal.PodOperationUtil;
 import io.fabric8.openshift.api.model.DeploymentConfig;
 import io.fabric8.openshift.api.model.DeploymentConfigList;
diff --git a/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/core/TemplateOperationsImpl.java b/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/core/TemplateOperationsImpl.java
index e4e1f6e1046..9830a76f651 100644
--- a/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/core/TemplateOperationsImpl.java
+++ b/openshift-client/src/main/java/io/fabric8/openshift/client/dsl/internal/core/TemplateOperationsImpl.java
@@ -29,7 +29,6 @@
 import io.fabric8.kubernetes.client.dsl.internal.OperationContext;
 import io.fabric8.kubernetes.client.http.HttpRequest;
 import io.fabric8.kubernetes.client.utils.Serialization;
-import io.fabric8.kubernetes.client.utils.URLUtils;
 import io.fabric8.kubernetes.client.utils.Utils;
 import io.fabric8.openshift.api.model.Parameter;
 import io.fabric8.openshift.api.model.Template;
diff --git a/openshift-client/src/main/java/io/fabric8/openshift/client/internal/OpenShiftOAuthInterceptor.java b/openshift-client/src/main/java/io/fabric8/openshift/client/internal/OpenShiftOAuthInterceptor.java
index f7cb0f31229..95c67ba016d 100644
--- a/openshift-client/src/main/java/io/fabric8/openshift/client/internal/OpenShiftOAuthInterceptor.java
+++ b/openshift-client/src/main/java/io/fabric8/openshift/client/internal/OpenShiftOAuthInterceptor.java
@@ -39,7 +39,6 @@
 import io.fabric8.openshift.api.model.SelfSubjectRulesReview;
 import io.fabric8.openshift.api.model.SubjectAccessReview;
 import io.fabric8.openshift.api.model.SubjectRulesReview;
-import io.fabric8.openshift.client.OpenShiftConfig;
 
 import java.net.MalformedURLException;
 import java.net.URL;
diff --git a/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/base/TestUnmarshal.java b/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/base/TestUnmarshal.java
index c3637294efa..45db1603e2c 100644
--- a/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/base/TestUnmarshal.java
+++ b/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/base/TestUnmarshal.java
@@ -31,7 +31,7 @@ void testUnmarshalJSONTemplate() {
 
   @Test
   void testUnmarshalYAMLTemplate() {
-   Template t = Serialization.unmarshal(getClass().getResourceAsStream("/test-template.yml"), Template.class);
+    Template t = Serialization.unmarshal(getClass().getResourceAsStream("/test-template.yml"), Template.class);
     assertEquals("eap6-basic-sti", t.getMetadata().getName());
   }
 
diff --git a/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/internal/apps/OpenShiftDeploymentConfigPodOperationTest.java b/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/internal/apps/OpenShiftDeploymentConfigPodOperationTest.java
index f984355a984..7d960e12634 100644
--- a/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/internal/apps/OpenShiftDeploymentConfigPodOperationTest.java
+++ b/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/internal/apps/OpenShiftDeploymentConfigPodOperationTest.java
@@ -15,17 +15,12 @@
  */
 package io.fabric8.openshift.client.dsl.internal.apps;
 
-import io.fabric8.openshift.api.model.Build;
-import io.fabric8.openshift.api.model.BuildBuilder;
 import io.fabric8.openshift.api.model.DeploymentConfig;
 import io.fabric8.openshift.api.model.DeploymentConfigBuilder;
-import io.fabric8.openshift.client.dsl.internal.apps.DeploymentConfigOperationsImpl;
-import io.fabric8.openshift.client.dsl.internal.build.BuildOperationsImpl;
 import org.junit.jupiter.api.Test;
 
 import java.util.Map;
 
-import static io.fabric8.openshift.client.dsl.internal.build.BuildOperationsImpl.OPENSHIFT_IO_BUILD_NAME;
 import static io.fabric8.openshift.client.dsl.internal.apps.DeploymentConfigOperationsImpl.OPENSHIFT_IO_DEPLOYMENT_CONFIG_NAME;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -35,8 +30,8 @@ class OpenShiftDeploymentConfigPodOperationTest {
   void testDeploymentConfigSelectorLabels() {
     // Given
     DeploymentConfig deploymentConfig = new DeploymentConfigBuilder()
-      .withNewMetadata().withName("dc1").endMetadata()
-      .build();
+        .withNewMetadata().withName("dc1").endMetadata()
+        .build();
 
     // When
     Map labels = DeploymentConfigOperationsImpl.getDeploymentConfigPodLabels(deploymentConfig);
diff --git a/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/internal/build/OpenShiftBuildPodOperationTest.java b/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/internal/build/OpenShiftBuildPodOperationTest.java
index 0bd34563ac4..d8344a614f5 100644
--- a/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/internal/build/OpenShiftBuildPodOperationTest.java
+++ b/openshift-client/src/test/java/io/fabric8/openshift/client/dsl/internal/build/OpenShiftBuildPodOperationTest.java
@@ -30,8 +30,8 @@ public class OpenShiftBuildPodOperationTest {
   void testBuildSelectorLabels() {
     // Given
     Build build = new BuildBuilder()
-      .withNewMetadata().withName("dc1").endMetadata()
-      .build();
+        .withNewMetadata().withName("dc1").endMetadata()
+        .build();
 
     // When
     Map labels = BuildOperationsImpl.getBuildPodLabels(build);
diff --git a/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/FeatureInstallationTest.java b/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/FeatureInstallationTest.java
index 08b63f71c6f..c17b607e528 100644
--- a/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/FeatureInstallationTest.java
+++ b/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/FeatureInstallationTest.java
@@ -25,44 +25,42 @@
 import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
 import org.ops4j.pax.exam.spi.reactors.PerClass;
 
-import javax.inject.Inject;
 import java.util.Collections;
 import java.util.stream.Stream;
 
+import javax.inject.Inject;
+
 import static org.junit.Assert.assertTrue;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfigurationFilePut;
 
-
 @RunWith(PaxExam.class)
 @ExamReactorStrategy(PerClass.class)
 public class FeatureInstallationTest extends TestBase {
 
-    @Inject
-    FeaturesService featuresService;
+  @Inject
+  FeaturesService featuresService;
 
-    @Test
-    public void testKubernetesClientFeature() throws Exception {
-        featuresService.addRepository(getFeaturesFile().toURI());
-        featuresService.installFeature("kubernetes-client");
-        assertTrue(Stream.of(featuresService.listInstalledFeatures())
-          .map(Feature::getName).anyMatch(name -> name.equals("kubernetes-client")));
-    }
+  @Test
+  public void testKubernetesClientFeature() throws Exception {
+    featuresService.addRepository(getFeaturesFile().toURI());
+    featuresService.installFeature("kubernetes-client");
+    assertTrue(Stream.of(featuresService.listInstalledFeatures())
+        .map(Feature::getName).anyMatch(name -> name.equals("kubernetes-client")));
+  }
 
-    @Test
-    public void testOpenshiftClient() throws Exception {
-        featuresService.addRepository(getFeaturesFile().toURI());
-        featuresService.installFeature("openshift-client");
-        assertTrue(Stream.of(featuresService.listInstalledFeatures())
-          .map(Feature::getName).anyMatch(name -> name.equals("openshift-client")));
-    }
+  @Test
+  public void testOpenshiftClient() throws Exception {
+    featuresService.addRepository(getFeaturesFile().toURI());
+    featuresService.installFeature("openshift-client");
+    assertTrue(Stream.of(featuresService.listInstalledFeatures())
+        .map(Feature::getName).anyMatch(name -> name.equals("openshift-client")));
+  }
 
-    @Configuration
-    public Option[] config() {
-      return baseConfiguration(
+  @Configuration
+  public Option[] config() {
+    return baseConfiguration(
         null,
         Collections.singletonList(
-          editConfigurationFilePut("etc/system.properties", "features.xml", System.getProperty("features.xml"))
-        )
-      );
-    }
+            editConfigurationFilePut("etc/system.properties", "features.xml", System.getProperty("features.xml"))));
+  }
 }
diff --git a/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/PropertiesOverrideTest.java b/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/PropertiesOverrideTest.java
index 1cbbce5565c..13fc81596cb 100644
--- a/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/PropertiesOverrideTest.java
+++ b/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/PropertiesOverrideTest.java
@@ -31,10 +31,10 @@
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
 
-import javax.inject.Inject;
-
 import java.util.Arrays;
 
+import javax.inject.Inject;
+
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
 import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features;
 
@@ -42,46 +42,43 @@
 @ExamReactorStrategy(PerClass.class)
 public class PropertiesOverrideTest extends TestBase {
 
-    @Inject
-    protected BundleContext bundleContext;
-
-    @Inject
-    NamespacedKubernetesClient kubernetesClient;
+  @Inject
+  protected BundleContext bundleContext;
 
-    @Inject
-    NamespacedOpenShiftClient openShiftClient;
+  @Inject
+  NamespacedKubernetesClient kubernetesClient;
 
-    //Need to check this for class loading errors
-    @Test
-    public void testNamespacedClients() {
-        Assert.assertNotNull(kubernetesClient);
-        Assert.assertNotNull(openShiftClient);
+  @Inject
+  NamespacedOpenShiftClient openShiftClient;
 
-        Assert.assertEquals("my-namespace", kubernetesClient.getNamespace());
-        Assert.assertEquals("my.kube.master", kubernetesClient.getMasterUrl().getHost());
-        Assert.assertEquals(8443, kubernetesClient.getMasterUrl().getPort());
+  //Need to check this for class loading errors
+  @Test
+  public void testNamespacedClients() {
+    Assert.assertNotNull(kubernetesClient);
+    Assert.assertNotNull(openShiftClient);
 
-        Assert.assertEquals("my-namespace", openShiftClient.getNamespace());
-        Assert.assertEquals("my.kube.master", openShiftClient.getMasterUrl().getHost());
-        Assert.assertEquals(8443, openShiftClient.getMasterUrl().getPort());
-    }
+    Assert.assertEquals("my-namespace", kubernetesClient.getNamespace());
+    Assert.assertEquals("my.kube.master", kubernetesClient.getMasterUrl().getHost());
+    Assert.assertEquals(8443, kubernetesClient.getMasterUrl().getPort());
 
+    Assert.assertEquals("my-namespace", openShiftClient.getNamespace());
+    Assert.assertEquals("my.kube.master", openShiftClient.getMasterUrl().getHost());
+    Assert.assertEquals(8443, openShiftClient.getMasterUrl().getPort());
+  }
 
-    @ProbeBuilder
-    public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
-        probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional");
-        return probe;
-    }
+  @ProbeBuilder
+  public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
+    probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional");
+    return probe;
+  }
 
-    @Configuration
-    public Option[] config() {
-        return baseConfiguration(
-          features(getFeaturesFile().toURI().toString(), "scr", "openshift-client"),
-          Arrays.asList(
+  @Configuration
+  public Option[] config() {
+    return baseConfiguration(
+        features(getFeaturesFile().toURI().toString(), "scr", "openshift-client"),
+        Arrays.asList(
             systemProperty("kubernetes.namespace").value("my-namespace"),
             systemProperty("kubernetes.master").value("http://my.kube.master:8443"),
-            systemProperty("kubernetes.auth.tryKubeConfig").value("false")
-          )
-        );
-    }
+            systemProperty("kubernetes.auth.tryKubeConfig").value("false")));
+  }
 }
diff --git a/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/ServiceTest.java b/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/ServiceTest.java
index 9254f9da70d..0ddae8e8ed9 100644
--- a/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/ServiceTest.java
+++ b/platforms/karaf/itests/src/test/java/io/fabric8/kubernetes/karaf/itests/ServiceTest.java
@@ -39,44 +39,43 @@
 @ExamReactorStrategy(PerClass.class)
 public class ServiceTest extends TestBase {
 
-    @Inject
-    protected BundleContext bundleContext;
+  @Inject
+  protected BundleContext bundleContext;
 
-    @Inject
-    NamespacedKubernetesClient kubernetesClient;
+  @Inject
+  NamespacedKubernetesClient kubernetesClient;
 
-    @Inject
-    NamespacedOpenShiftClient openShiftClient;
+  @Inject
+  NamespacedOpenShiftClient openShiftClient;
 
-    @Test
-    public void testServiceAvailability() {
-        Assert.assertNotNull(kubernetesClient);
-        Assert.assertNotNull(openShiftClient);
-    }
+  @Test
+  public void testServiceAvailability() {
+    Assert.assertNotNull(kubernetesClient);
+    Assert.assertNotNull(openShiftClient);
+  }
 
-    //Need to check this for class loading errors
-    @Test
-    public void testNamespacedClients() {
-        Assert.assertNotNull(kubernetesClient);
-        Assert.assertNotNull(openShiftClient);
+  //Need to check this for class loading errors
+  @Test
+  public void testNamespacedClients() {
+    Assert.assertNotNull(kubernetesClient);
+    Assert.assertNotNull(openShiftClient);
 
-        NamespacedKubernetesClient knc = kubernetesClient.inNamespace("mytest1");
-        Assert.assertEquals("mytest1", knc.getNamespace());
+    NamespacedKubernetesClient knc = kubernetesClient.inNamespace("mytest1");
+    Assert.assertEquals("mytest1", knc.getNamespace());
 
-        NamespacedOpenShiftClient onc = openShiftClient.inNamespace("mytest2");
-        Assert.assertEquals("mytest2", onc.getNamespace());
-    }
+    NamespacedOpenShiftClient onc = openShiftClient.inNamespace("mytest2");
+    Assert.assertEquals("mytest2", onc.getNamespace());
+  }
 
-    @ProbeBuilder
-    public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
-        probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional");
-        return probe;
-    }
+  @ProbeBuilder
+  public TestProbeBuilder probeConfiguration(TestProbeBuilder probe) {
+    probe.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "*,org.apache.felix.service.*;status=provisional");
+    return probe;
+  }
 
-    @Configuration
-    public Option[] config() {
-        return baseConfiguration(
-          features(getFeaturesFile().toURI().toString(), "scr", "openshift-client")
-        );
-    }
+  @Configuration
+  public Option[] config() {
+    return baseConfiguration(
+        features(getFeaturesFile().toURI().toString(), "scr", "openshift-client"));
+  }
 }
diff --git a/pom.xml b/pom.xml
index e63882cb54b..895fc2616cf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1068,7 +1068,6 @@
         spotless-maven-plugin
         ${spotless-maven-plugin.version}
         
-          origin/master
           
             
               ide-config/eclipse-format.xml
@@ -1076,6 +1075,7 @@
             
               ide-config/eclipse.importorder
             
+