You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ga...@apache.org on 2015/09/01 14:30:01 UTC
[23/50] [abbrv] stratos git commit: Upgrading fabric8 kubernetes api
version to 2.2.16 and removing forked code
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/main/resources/log4j.properties b/dependencies/fabric8/kubernetes-api/src/main/resources/log4j.properties
deleted file mode 100644
index 393e087..0000000
--- a/dependencies/fabric8/kubernetes-api/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-# Root logger option
-log4j.rootLogger=INFO, stdout
-
-# Direct log messages to stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Apply.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Apply.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Apply.java
deleted file mode 100644
index 4f19fb7..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Apply.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import java.io.File;
-
-/**
- * Applies the given JSON file to the kubernetes environment
- */
-public class Apply {
- public static void main(String... args) {
- if (args.length < 1) {
- System.out.println("Usage jsonFileToApply");
- return;
- }
- try {
- KubernetesClient kube = new KubernetesClient();
- System.out.println("Connecting to kubernetes on: " + kube.getAddress());
-
- File file = new File(args[0]);
- System.out.println("Applying file: " + file);
- if (!file.exists() || !file.isFile()) {
- System.out.println("File does not exist! " + file.getAbsolutePath());
- return;
- }
- Controller controller = new Controller(kube);
- String answer = controller.apply(file);
-
- System.out.println("Applied!: " + answer);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- e.printStackTrace();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigComparePodTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigComparePodTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigComparePodTest.java
deleted file mode 100644
index 80ae51a..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigComparePodTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- * <p/>
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.Pod;
-import io.fabric8.kubernetes.api.model.PodBuilder;
-import io.fabric8.kubernetes.api.model.PodStatus;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static io.fabric8.kubernetes.api.ConfigCompareServiceTest.assertCompareConfig;
-
-public class ConfigComparePodTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ConfigComparePodTest.class);
-
- @Test
- public void testPodsEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testPodsEqualWithDifferentStatus() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- PodStatus status2 = new PodStatus();
- status2.setHostIP("abc");
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- withStatus(status2).
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testPodsLabelsNotEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "notSame").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testPodsAnnotationsNotEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "notSame").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testPodsImageEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("notSame").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
- @Test
- public void testPodsContainerEnvEqual() throws Exception {
- Pod entity1 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- Pod entity2 = new PodBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("notSame").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareReplicationControllerTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareReplicationControllerTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareReplicationControllerTest.java
deleted file mode 100644
index 24ef845..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareReplicationControllerTest.java
+++ /dev/null
@@ -1,530 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- * <p/>
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.ReplicationController;
-import io.fabric8.kubernetes.api.model.ReplicationControllerBuilder;
-import io.fabric8.kubernetes.api.model.ReplicationControllerStatus;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static io.fabric8.kubernetes.api.ConfigCompareServiceTest.assertCompareConfig;
-
-public class ConfigCompareReplicationControllerTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ConfigCompareReplicationControllerTest.class);
-
- @Test
- public void testReplicationControllersEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testReplicationControllersEqualWithDifferentStatus() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationControllerStatus status = new ReplicationControllerStatus();
- status.setReplicas(7);
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- withStatus(status).
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testReplicationControllersLabelsNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("notSame", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersSelectorNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "notSame").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersReplicasNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(4).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersAnnotationsNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "notEqual").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersImageEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("notEqual").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersContainerEnvEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("notEqual").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testReplicationControllersAddVolumeNotEqual() throws Exception {
- ReplicationController entity1 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewVolumeMount().withName("cheese").withMountPath("/foo/cheese").endVolumeMount().
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- ReplicationController entity2 = new ReplicationControllerBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- withReplicas(2).
- withNewTemplate().withNewMetadata().
- addToLabels("podLabel1", "podValue1").
- addToLabels("podLabel2", "podValue2").
- addToAnnotations("podAnnotation1", "podAnnValue1").
- endMetadata().
- withNewSpec().
- addNewContainer().
- withImage("fabric8/jenkins").
- addNewEnv().withName("foo").withValue("bar").endEnv().
- // TODO....
- // addNewPort().endPort().
- endContainer().
- endSpec().
- endTemplate().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareServiceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareServiceTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareServiceTest.java
deleted file mode 100644
index 1c90d3d..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigCompareServiceTest.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- * <p/>
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.Service;
-import io.fabric8.kubernetes.api.model.ServiceBuilder;
-import io.fabric8.kubernetes.api.model.util.IntOrString;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.junit.Assert.assertEquals;
-
-public class ConfigCompareServiceTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ConfigCompareServiceTest.class);
-
- @Test
- public void testServicesEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
- @Test
-
- public void testServicesEqualWithStatusdifferences() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- withResourceVersion("1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- withResourceVersion("2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, true);
- }
-
- @Test
- public void testServicesPortNotEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(456).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testServicesContainerPortNotEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(555)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testServicesLabelsNotEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("notSame", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- @Test
- public void testServicesSelectorNotEqual() throws Exception {
- Service entity1 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label1", "value1").
- addToLabels("label2", "value2").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("label2", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- Service entity2 = new ServiceBuilder().withNewMetadata().withName("foo").
- addToLabels("label2", "value2").
- addToLabels("label1", "value1").
- endMetadata().
- withNewSpec().
- addToSelector("label1", "value1").
- addToSelector("notSame", "value2").
- addNewPort().
- withPort(123).
- withTargetPort(new IntOrString(456)).
- endPort().
- endSpec().
- build();
-
- assertCompareConfig(entity1, entity2, false);
- }
-
- public static void assertCompareConfig(Object entity1, Object entity2, boolean expected) {
- boolean actual = UserConfigurationCompare.configEqual(entity1, entity2);
- assertEquals("Configuration compare for " + entity1 + " and " + entity2, expected, actual);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigFileParseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigFileParseTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigFileParseTest.java
deleted file mode 100644
index 07aa012..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ConfigFileParseTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.config.Config;
-import io.fabric8.kubernetes.api.extensions.Configs;
-import io.fabric8.kubernetes.api.model.config.Context;
-import org.junit.Test;
-
-import java.io.File;
-
-import static io.fabric8.kubernetes.api.extensions.Configs.getOpenShiftConfigFile;
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ConfigFileParseTest {
- @Test
- public void testParseConfig() throws Exception {
- FindOpenShiftNamespaceTest.setOPenShfitConfigFileProperty();
-
- File file = getOpenShiftConfigFile();
- assertThat(file).isFile().exists();
-
- Config config = Configs.parseConfigs();
- assertThat(config).isNotNull();
-
- String currentContextName = config.getCurrentContext();
- assertThat(currentContextName).describedAs("currentContext").isEqualTo("default/localhost:8443/admin");
- System.out.println("Found current context name: " + currentContextName);
-
- Context context = Configs.getCurrentContext(config);
- assertThat(context).describedAs("currentContext").isNotNull();
-
- assertThat(context.getNamespace()).describedAs("namespace").isEqualTo("jimmi-does-rock");
- assertThat(context.getUser()).describedAs("user").isEqualTo("admin/localhost:8443");
- assertThat(context.getCluster()).describedAs("cluster").isEqualTo("172-28-128-4:8443");
-
- String token = Configs.getUserToken(config, context);
- assertThat(token).describedAs("token").isEqualTo("ExpectedToken");
-
- System.out.println("User " + context.getUser() + " has token: " + token);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Example.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Example.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Example.java
deleted file mode 100644
index 56cbaaa..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/Example.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.*;
-
-import java.util.*;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.getPorts;
-import static io.fabric8.kubernetes.api.KubernetesHelper.getSelector;
-
-/**
- * A simple example program testing out the REST API
- */
-public class Example {
- public static void main(String... args) {
- KubernetesFactory kubeFactory = new KubernetesFactory();
- if (args.length > 0) {
- kubeFactory.setAddress(args[0]);
- }
- System.out.println("Connecting to kubernetes on: " + kubeFactory.getAddress());
-
- try {
- Kubernetes kube = kubeFactory.createKubernetes();
- listPods(kube);
- listServices(kube);
- listReplicationControllers(kube);
- createPod(kube, kubeFactory);
- listPods(kube);
- } catch (Exception e) {
- System.out.println("FAILED: " + e);
- e.printStackTrace();
- }
- }
-
- protected static void createPod(Kubernetes kubernetes, KubernetesFactory kubernetesFactory) throws Exception {
- String name = "console2";
- String image = "fabric8/hawtio";
-
- Pod pod = new Pod();
- pod.getMetadata().setName(name);
-
- Map<String, String> labels = new HashMap<>();
- labels.put("fabric8", "true");
- labels.put("container", name);
-
- pod.getMetadata().setLabels(labels);
- PodSpec podSpec = new PodSpec();
- pod.setSpec(podSpec);
-
- Container manifestContainer = new Container();
- manifestContainer.setName(name);
- manifestContainer.setImage(image);
-
- List<Container> containers = new ArrayList<>();
- containers.add(manifestContainer);
- podSpec.setContainers(containers);
-
- System.out.println("About to create pod on " + kubernetesFactory.getAddress() + " with " + pod);
- kubernetes.createPod(pod, "mynamespace");
- System.out.println("Created pod: " + name);
- System.out.println();
- }
-
- protected static void listPods(Kubernetes kube) {
- System.out.println("Looking up pods");
- PodList pods = kube.getPods(Kubernetes.NAMESPACE_ALL);
- //System.out.println("Got pods: " + pods);
- List<Pod> items = pods.getItems();
- for (Pod item : items) {
- System.out.println("Pod " + KubernetesHelper.getName(item) + " created: " + item.getMetadata().getCreationTimestamp());
- PodSpec spec = item.getSpec();
- if (spec != null) {
- List<Container> containers = spec.getContainers();
- if (containers != null) {
- for (Container container : containers) {
- System.out.println("Container " + container.getImage() + " " + container.getCommand() + " ports: " + container.getPorts());
- }
- }
- }
- Map<String, ContainerStatus> currentContainers = KubernetesHelper.getCurrentContainers(item);
- System.out.println("Has " + currentContainers.size() + " container(s)");
- Set<Map.Entry<String, ContainerStatus>> entries = currentContainers.entrySet();
- for (Map.Entry<String, ContainerStatus> entry : entries) {
- String id = entry.getKey();
- ContainerStatus info = entry.getValue();
- System.out.println("Current container: " + id + " info: " + info);
- }
- }
- System.out.println();
-
- }
-
- protected static void listServices(Kubernetes kube) {
- System.out.println("Looking up services");
- ServiceList services = kube.getServices(Kubernetes.NAMESPACE_ALL);
- List<Service> serviceItems = services.getItems();
- for (Service service : serviceItems) {
- System.out.println("Service " + KubernetesHelper.getName(service) + " labels: " + service.getMetadata().getLabels() + " selector: " + getSelector(service) + " ports: " + getPorts(service));
- }
- System.out.println();
-
- }
-
- protected static void listReplicationControllers(Kubernetes kube) {
- System.out.println("Looking up replicationControllers");
- ReplicationControllerList replicationControllers = kube.getReplicationControllers(Kubernetes.NAMESPACE_ALL);
- List<ReplicationController> items = replicationControllers.getItems();
- for (ReplicationController item : items) {
- ReplicationControllerSpec replicationControllerSpec = item.getSpec();
- if (replicationControllerSpec != null) {
- System.out.println("ReplicationController " + KubernetesHelper.getName(item) + " labels: " + item.getMetadata().getLabels()
- + " replicas: " + replicationControllerSpec.getReplicas() + " replicatorSelector: " + replicationControllerSpec.getSelector() + " podTemplate: " + replicationControllerSpec.getTemplate());
- } else {
- System.out.println("ReplicationController " + KubernetesHelper.getName(item) + " labels: " + item.getMetadata().getLabels() + " no replicationControllerSpec");
- }
- }
- System.out.println();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/FindOpenShiftNamespaceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/FindOpenShiftNamespaceTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/FindOpenShiftNamespaceTest.java
deleted file mode 100644
index 28abff8..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/FindOpenShiftNamespaceTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.extensions.Configs;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-
-public class FindOpenShiftNamespaceTest {
-
- @Test
- public void testFindsCorrectOpenShiftNamespace() throws Exception {
- setOPenShfitConfigFileProperty();
- String namespace = KubernetesClient.findDefaultOpenShiftNamespace();
-
- assertEquals("default namespace", "jimmi-does-rock", namespace);
- }
-
- public static void setOPenShfitConfigFileProperty() {
- String basedir = System.getProperty("basedir", ".");
- String configFile = basedir + "/src/test/resources/config.yml";
-
- System.setProperty(Configs.OPENSHIFT_CONFIG_FILE_PROPERTY, configFile);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/KubernetesHelperTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/KubernetesHelperTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/KubernetesHelperTest.java
deleted file mode 100644
index 4a23a8b..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/KubernetesHelperTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.ObjectMeta;
-import io.fabric8.kubernetes.api.model.Pod;
-import io.fabric8.kubernetes.api.model.PodList;
-import org.junit.Test;
-
-import java.util.HashMap;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-
-public class KubernetesHelperTest {
-
- @Test
- public void testRemoveEmptyPods() throws Exception {
-
- Pod pod1 = new Pod();
- pod1.setMetadata(new ObjectMeta());
- pod1.getMetadata().setName("test1");
-
- Pod pod2 = new Pod();
- pod2.setMetadata(new ObjectMeta());
-
- PodList podSchema = new PodList();
- podSchema.getItems().add(pod1);
- podSchema.getItems().add(pod2);
-
- KubernetesHelper.removeEmptyPods(podSchema);
-
- assertNotNull(podSchema);
- assertEquals(1, podSchema.getItems().size());
- }
-
- @Test
- public void testfilterMatchesIdOrLabels() throws Exception {
- String text = "container=java,name=foo,food=cheese";
- String id = "foo";
- HashMap<String, String> map = new HashMap<>();
- map.put("container", "java");
- map.put("name", "foo");
- map.put("food", "cheese");
- assertTrue(text + " should = " + map, KubernetesHelper.filterMatchesIdOrLabels(text, id, map));
- }
-
- @Test
- public void testfilterMatchesIdOrLabelsNoLabels() throws Exception {
- String text = "container=java,name=foo,food=cheese";
- String id = "foo";
- HashMap<String, String> map = null;
- assertFalse(text + " should not = " + map, KubernetesHelper.filterMatchesIdOrLabels(text, id, map));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseDateTimeTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseDateTimeTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseDateTimeTest.java
deleted file mode 100644
index b0207bf..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseDateTimeTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Date;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ParseDateTimeTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ParseDateTimeTest.class);
-
- @Test
- public void testParseDateTime() throws Exception {
- Date date = KubernetesHelper.parseDate("2015-03-26T17:11:55Z");
- assertThat(date).isNotNull();
- System.out.println("Parsed date: " + date);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseExamplesTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseExamplesTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseExamplesTest.java
deleted file mode 100644
index b963c0e..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseExamplesTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.fabric8.kubernetes.api.model.*;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.List;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.getContainerPorts;
-import static io.fabric8.utils.Files.assertDirectoryExists;
-import static io.fabric8.utils.Files.assertFileExists;
-import static org.junit.Assert.*;
-
-/**
- * Parses the example JSON
- */
-public class ParseExamplesTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ParseExamplesTest.class);
-
- public static final String SYSTEM_PROPERTY_KUBE_DIR = "kube.dir";
-
- @Test
- public void testParsePodList() throws Exception {
- KubernetesList podList = assertParseExampleFile("pod-list.json", KubernetesList.class);
- List<HasMetadata> items = podList.getItems();
- assertNotEmpty("items", items);
-
- Pod pod = (Pod) items.get(0);
- assertNotNull("pod1", pod);
- assertEquals("pod1.name", "my-pod-1", KubernetesHelper.getName(pod));
- PodSpec podSpec = pod.getSpec();
- assertNotNull("pod1.podSpec", podSpec);
- List<Container> containers = podSpec.getContainers();
- assertNotEmpty("pod1.podSpec.containers", containers);
- Container container = containers.get(0);
- assertNotNull("pod1.podSpec.container[0]", container);
- assertEquals("pod1.podSpec.container[0].name", "nginx", container.getName());
- assertEquals("pod1.podSpec.container[0].image", "dockerfile/nginx", container.getImage());
-
- LOG.info("pod1 container1 " + container);
-
- String json = KubernetesHelper.toJson(podList);
- LOG.info("Got JSON: " + json);
- }
-
- @Test
- public void testParsePodListEmptyResults() throws Exception {
- PodList podList = assertParseExampleFile("pod-list-empty-results.json", PodList.class);
- List<Pod> items = podList.getItems();
- assertNotEmpty("items", items);
-
- Pod pod = items.get(0);
- assertNotNull("pod1", pod);
- assertEquals("127.0.0.1", pod.getStatus().getHostIP());
- }
-
- @Test
- public void testParseService() throws Exception {
- Service service = assertParseExampleFile("service.json", Service.class);
-
- assertEquals("Service", service.getKind());
-
- Integer expectedPort = 9090;
- assertEquals(expectedPort, getContainerPorts(service).iterator().next());
-
- ObjectMapper mapper = KubernetesFactory.createObjectMapper();
-
- //mapper.writer().writeValue(System.out, service);
- }
-
- @Test
- public void testParsePod() throws Exception {
- assertParseExampleFile("pod.json", Pod.class);
- }
-
- public static void assertNotEmpty(String name, Collection collection) {
- assertNotNull(name + " is null!", collection);
- assertFalse(name + " should not be empty!", collection.isEmpty());
- }
-
- public static <T> T assertParseExampleFile(String fileName, Class<T> clazz) throws Exception {
- ObjectMapper mapper = KubernetesFactory.createObjectMapper();
- File exampleFile = new File(getKubernetesExamplesDir(), fileName);
- assertFileExists(exampleFile);
- T answer = mapper.reader(clazz).readValue(exampleFile);
- assertNotNull("Null returned while unmarshalling " + exampleFile, answer);
- LOG.info("Parsed: " + fileName + " as: " + answer);
- return answer;
- }
-
- public static File getKubernetesSourceDir() {
- //String path = System.getProperty(SYSTEM_PROPERTY_KUBE_DIR, "../../../kubernetes");
- String basedir = System.getProperty("basedir", ".");
- String kubeSourceDir = basedir + "/src/main/kubernetes";
- String path = System.getProperty(SYSTEM_PROPERTY_KUBE_DIR, kubeSourceDir);
- File kubeDir = new File(path);
- assertTrue("Kube directory " + kubeDir
- + " does not exist! Please supply the correct value in the " + SYSTEM_PROPERTY_KUBE_DIR + " system property value",
- kubeDir.exists());
- return kubeDir;
- }
-
- public static File getKubernetesExamplesDir() {
- File answer = new File(getKubernetesSourceDir(), "api/examples");
- assertDirectoryExists(answer);
- return answer;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseServiceTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseServiceTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseServiceTest.java
deleted file mode 100644
index 96b99b4..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseServiceTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.Service;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Set;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.getContainerPorts;
-import static io.fabric8.kubernetes.api.KubernetesHelper.getPorts;
-import static io.fabric8.utils.Files.assertFileExists;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Parses the example JSON
- */
-public class ParseServiceTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ParseServiceTest.class);
-
- @Test
- public void testParseFabric8MQService() throws Exception {
- Service service = assertParseTestFile("fmq-service.json", Service.class);
- Set<Integer> ports = getPorts(service);
- assertNotNull("ports", ports);
- Set<Integer> containerPorts = getContainerPorts(service);
- assertTrue("containerPorts " + containerPorts, containerPorts.iterator().next().intValue() > 0);
-
- String json = KubernetesHelper.toJson(service);
- LOG.info("Got JSON: " + json);
- }
-
- public <T> T assertParseTestFile(String relativePath, Class<T> clazz) throws IOException {
- String baseDirPath = System.getProperty("basedir", ".");
- File baseDir = new File(baseDirPath);
- File json = new File(baseDirPath, "target/test-classes/" + relativePath);
- assertFileExists(json);
-
- Object answer = KubernetesHelper.loadJson(json);
- assertNotNull("Null returned while unmarshalling " + json, answer);
- LOG.info("Parsed: " + json + " as: " + answer);
- assertTrue("Result " + answer + " is not an instance of " + clazz.getName() + " but was " + (answer == null ? "null" : answer.getClass().getName()),
- clazz.isInstance(answer));
- return clazz.cast(answer);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseTest.java
deleted file mode 100644
index 7df3ffc..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ParseTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.fabric8.kubernetes.api.model.*;
-import io.fabric8.openshift.api.model.template.Template;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.util.List;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.getContainerPorts;
-import static io.fabric8.kubernetes.api.KubernetesHelper.toJson;
-import static io.fabric8.kubernetes.api.ParseExamplesTest.assertNotEmpty;
-import static io.fabric8.utils.Files.assertDirectoryExists;
-import static io.fabric8.utils.Files.assertFileExists;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.Assert.*;
-
-/**
- * Parses the example JSON
- */
-public class ParseTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(ParseTest.class);
-
- public static final String SYSTEM_PROPERTY_KUBE_DIR = "kube.dir";
-
- @Test
- public void testParsePodList() throws Exception {
- KubernetesList podList = assertParseExampleFile("pod-list.json", KubernetesList.class);
- List<HasMetadata> items = podList.getItems();
- assertNotEmpty("items", items);
-
- Pod pod = (Pod) items.get(0);
- assertNotNull("pod1", pod);
- assertEquals("pod1.id", "my-pod-1", KubernetesHelper.getName(pod));
- PodSpec podSpec = pod.getSpec();
- assertNotNull("pod1.podSpec", podSpec);
- List<Container> containers = podSpec.getContainers();
- assertNotEmpty("pod1.podSpec.manifest.containers", containers);
- Container container = containers.get(0);
- assertNotNull("pod1.podSpec.container[0]", container);
- assertEquals("pod1.podSpec.container[0].name", "nginx", container.getName());
- assertEquals("pod1.podSpec.container[0].image", "dockerfile/nginx", container.getImage());
-
- LOG.info("pod1 container1 " + container);
-
- String json = toJson(podList);
- LOG.info("Got JSON: " + json);
- }
-
- @Test
- public void testParsePodListEmptyResults() throws Exception {
- PodList podList = assertParseExampleFile("pod-list-empty-results.json", PodList.class);
- List<Pod> items = podList.getItems();
- assertNotEmpty("items", items);
-
- Pod pod = items.get(0);
- assertNotNull("pod1", pod);
- assertEquals("127.0.0.1", pod.getStatus().getHostIP());
- }
-
- @Test
- public void testParseService() throws Exception {
- Service service = assertParseExampleFile("service.json", Service.class);
-
- assertEquals("Service", service.getKind());
-
- Integer expectedPort = 9090;
- assertEquals(expectedPort, getContainerPorts(service).iterator().next());
-
- ObjectMapper mapper = KubernetesFactory.createObjectMapper();
-
- //mapper.writer().writeValue(System.out, service);
- }
-
- @Test
- public void testParsePod() throws Exception {
- assertParseExampleFile("pod.json", Pod.class);
- }
-
- @Test
- public void testParseTemplate() throws Exception {
- Template template = assertParseExampleFile("template.json", Template.class);
- List<HasMetadata> objects = template.getObjects();
- assertNotEmpty("objects", objects);
- assertTrue("size is " + objects.size(), objects.size() == 2);
- Object service = objects.get(0);
- assertThat(service).isInstanceOf(Service.class);
-
- Object rc = objects.get(1);
- assertThat(rc).isInstanceOf(ReplicationController.class);
-
- System.out.println("Generated JSON: " + toJson(template));
- }
-
- @Test
- public void testParseList() throws Exception {
- KubernetesList list = assertParseExampleFile("list.json", KubernetesList.class);
- List<HasMetadata> objects = list.getItems();
- assertNotEmpty("objects", objects);
- assertEquals("size", 2, objects.size());
- Object service = objects.get(0);
- assertThat(service).isInstanceOf(Service.class);
-
- Object rc = objects.get(1);
- assertThat(rc).isInstanceOf(ReplicationController.class);
-
- System.out.println("Generated JSON: " + toJson(list));
- }
-
- public static <T> T assertParseExampleFile(String fileName, Class<T> clazz) throws Exception {
- ObjectMapper mapper = KubernetesFactory.createObjectMapper();
- File exampleFile = new File(getKubernetesExamplesDir(), fileName);
- assertFileExists(exampleFile);
- Object answer = mapper.reader(clazz).readValue(exampleFile);
- assertNotNull("Null returned while unmarshalling " + exampleFile, answer);
- LOG.info("Parsed: " + fileName + " as: " + answer);
- assertTrue("Is not an instance of " + clazz.getSimpleName() + " was: "+ answer.getClass().getName(), clazz.isInstance(answer));
- return clazz.cast(answer);
- }
-
- public static File getKubernetesSourceDir() {
- //String path = System.getProperty(SYSTEM_PROPERTY_KUBE_DIR, "../../../kubernetes");
- String basedir = System.getProperty("basedir", ".");
- String kubeSourceDir = basedir + "/src/main/kubernetes";
- String path = System.getProperty(SYSTEM_PROPERTY_KUBE_DIR, kubeSourceDir);
- File kubeDir = new File(path);
- assertTrue("Kube directory " + kubeDir
- + " does not exist! Please supply the correct value in the " + SYSTEM_PROPERTY_KUBE_DIR + " system property value",
- kubeDir.exists());
- return kubeDir;
- }
-
- public static File getKubernetesExamplesDir() {
- File answer = new File(getKubernetesSourceDir(), "api/examples");
- assertDirectoryExists(answer);
- return answer;
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/PodIdToReplicationControllerIDExample.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/PodIdToReplicationControllerIDExample.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/PodIdToReplicationControllerIDExample.java
deleted file mode 100644
index 45a1d61..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/PodIdToReplicationControllerIDExample.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.model.ReplicationController;
-
-/**
- */
-public class PodIdToReplicationControllerIDExample {
- public static void main(String[] args) {
- if (args.length < 2) {
- System.out.println("Arguments: kuberneteMasterUrl podID");
- return;
- }
- String kuberneteMasterUrl = args[0];
- String podID = args[1];
- System.out.println("Looking up ReplicationController for pod ID: " + podID);
- KubernetesClient client = new KubernetesClient(kuberneteMasterUrl);
- ReplicationController replicationController = client.getReplicationControllerForPod(podID);
- if (replicationController != null) {
- String id = KubernetesHelper.getName(replicationController);
- System.out.println("Found replication controller: " + id);
- } else {
- System.out.println("Could not find replication controller!");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ProcessTemplateLocallyTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ProcessTemplateLocallyTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ProcessTemplateLocallyTest.java
deleted file mode 100644
index 18c0044..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/ProcessTemplateLocallyTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- *
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.extensions.Templates;
-import io.fabric8.kubernetes.api.model.HasMetadata;
-import io.fabric8.kubernetes.api.model.KubernetesList;
-import io.fabric8.openshift.api.model.template.Template;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-
-import static io.fabric8.kubernetes.api.KubernetesHelper.toJson;
-import static io.fabric8.kubernetes.api.ParseExamplesTest.assertNotEmpty;
-import static io.fabric8.kubernetes.api.ParseTest.assertParseExampleFile;
-import static org.assertj.core.api.Assertions.assertThat;
-
-/**
- * Parses the example JSON
- */
-public class ProcessTemplateLocallyTest {
- private static final transient Logger LOG = LoggerFactory.getLogger(ProcessTemplateLocallyTest.class);
-
- @Test
- public void testProcessTemplateLocally() throws Exception {
- Template template = assertParseExampleFile("template.json", Template.class);
- List<HasMetadata> objects = template.getObjects();
- assertNotEmpty("objects", objects);
-
-
- KubernetesList list = Templates.processTemplatesLocally(template);
- assertThat(list).describedAs("results").isNotNull();
- List<HasMetadata> items = list.getItems();
- assertThat(items).describedAs("items").isNotNull();
-
- System.out.println("Created JSON: " + toJson(list));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/12c0ea00/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TemplatesTest.java
----------------------------------------------------------------------
diff --git a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TemplatesTest.java b/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TemplatesTest.java
deleted file mode 100644
index 8dc8c19..0000000
--- a/dependencies/fabric8/kubernetes-api/src/test/java/io/fabric8/kubernetes/api/TemplatesTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright 2005-2014 Red Hat, Inc.
- * <p/>
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-package io.fabric8.kubernetes.api;
-
-import io.fabric8.kubernetes.api.extensions.Templates;
-import io.fabric8.kubernetes.api.model.KubernetesList;
-import io.fabric8.kubernetes.api.model.KubernetesListBuilder;
-import io.fabric8.kubernetes.api.model.Service;
-import io.fabric8.kubernetes.api.model.ServiceBuilder;
-import io.fabric8.openshift.api.model.template.Template;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class TemplatesTest {
-
- private static final transient Logger LOG = LoggerFactory.getLogger(TemplatesTest.class);
-
- @Test
- public void testCombineResourcesIntoTemplate() throws Exception {
- Service templateService = new ServiceBuilder().withNewMetadata().withName("templateService").endMetadata().build();
-
- KubernetesList list = new KubernetesListBuilder().
- addNewServiceItem().withNewMetadata().withName("service1").endMetadata().endServiceItem().
- addNewTemplateItem().
- addNewParameter().withName("PARAM1").withValue("ABC").endParameter().
- addToObjects(templateService).endTemplateItem().
- addNewServiceItem().withNewMetadata().withName("service2").endMetadata().endServiceItem().build();
-
- Object result = Templates.combineTemplates(list);
- System.out.println("Combined as " + KubernetesHelper.toJson(result));
- assertThat(result).isInstanceOf(Template.class);
-
- }
-}