@@ -0,0 +1,2914 @@
+/**%0A * Copyright (C) 2015 Red Hat, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *         http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage io.fabric8.kubernetes.client.mock;%0A%0Aimport io.fabric8.kubernetes.api.model.Service;%0Aimport io.fabric8.kubernetes.api.model.ServiceBuilder;%0Aimport io.fabric8.kubernetes.api.model.ServiceList;%0Aimport io.fabric8.kubernetes.client.KubernetesClient;%0Aimport io.fabric8.kubernetes.client.server.mock.KubernetesServer;%0Aimport org.junit.Rule;%0Aimport org.junit.Test;%0A%0Aimport java.util.Collections;%0A%0Aimport static junit.framework.TestCase.assertNotNull;%0Aimport static org.junit.Assert.assertEquals;%0A%0Apublic class ServiceCrudTest %7B%0A  @Rule%0A  public KubernetesServer server = new KubernetesServer(true, true);%0A%0A  @Test%0A  public void testCrud() %7B%0A    KubernetesClient client = server.getClient();%0A%0A    Service service1 = new ServiceBuilder().withNewMetadata().withName(%22svc1%22).and().build();%0A    Service service2 = new ServiceBuilder().withNewMetadata().withName(%22svc2%22).addToLabels(%22foo%22, %22bar%22).and().build();%0A    Service service3 = new ServiceBuilder().withNewMetadata().withName(%22svc3%22).addToLabels(%22foo%22, %22bar%22).and().build();%0A%0A    client.services().inNamespace(%22ns1%22).create(service1);%0A    client.services().inNamespace(%22ns2%22).create(service2);%0A    client.services().inNamespace(%22ns1%22).create(service3);%0A%0A    ServiceList aServiceList = client.services().list();%0A    assertNotNull(aServiceList);%0A    assertEquals(0, aServiceList.getItems().size());%0A%0A    aServiceList = client.services().inAnyNamespace().list();%0A    assertNotNull(aServiceList);%0A    assertEquals(3, aServiceList.getItems().size());%0A%0A    aServiceList = client.services().inNamespace(%22ns1%22).list();%0A    assertNotNull(aServiceList);%0A    assertEquals(2, aServiceList.getItems().size());%0A%0A    client.services().inNamespace(%22ns1%22).withName(%22svc1%22).delete();%0A    aServiceList = client.services().inNamespace(%22ns1%22).list();%0A    assertNotNull(aServiceList);%0A    assertEquals(1, aServiceList.getItems().size());%0A%0A    aServiceList = client.services().inAnyNamespace().withLabels(Collections.singletonMap(%22foo%22, %22bar%22)).list();%0A    assertNotNull(aServiceList);%0A    assertEquals(2, aServiceList.getItems().size());%0A%0A    //service2 = client.services().inNamespace(%22ns2%22).withName(%22svc2%22).edit().editMetadata().withName(%22service2%22).endMetadata().done();%0A    //assertNotNull(service2);%0A    //assertEquals(%22service2%22, service2.getMetadata().getName());%0A  %7D%0A%7D%0A

Fix #923 Added ServiceCrudTest