clean up: remove unused import
[neutron.git] / neutron-spi / src / test / java / org / opendaylight / neutron / spi / NeutronLoadBalancerPoolJAXBTest.java
1 /*
2  * Copyright Tata Consultancy Services, 2015.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.neutron.spi;
10
11 import java.util.List;
12
13 import org.junit.Assert;
14 import org.junit.Test;
15
16 public class NeutronLoadBalancerPoolJAXBTest {
17
18     private static final String NeutronLoadBalancerPool_sourceJson = "{ " +
19         "\"admin_state_up\": true, " +
20         "\"description\": \"simple pool\", " +
21         "\"healthmonitor_id\": \"00066a7b-796b-4f26-9cf9-9e82d248fda7\", " +
22         "\"id\": \"12ff63af-4127-4074-a251-bcb2ecc53ebe\", " +
23         "\"lb_algorithm\": \"ROUND_ROBIN\", " +
24         "\"listeners\": [ " +
25         "{ " +
26         "\"id\": \"39de4d56-d663-46e5-85a1-5b9d5fa17829\" " +
27         "} " +
28         "], " +
29         "\"members\": [], " +
30         "\"name\": \"pool1\", " +
31         "\"protocol\": \"HTTP\", " +
32         "\"session_persistence\": { " +
33         "\"cookie_name\": \"my_cookie\", " +
34         "\"type\": \"APP_COOKIE\" " +
35         "}, " +
36         "\"tenant_id\": \"1a3e005cf9ce40308c900bcb08e5320c\" " +
37         "} ";
38
39     @Test
40     public void test_NeutronLoadBalancerPool_JAXB() {
41         NeutronLoadBalancerPool dummyObject = new NeutronLoadBalancerPool();
42         try {
43             NeutronLoadBalancerPool testObject = (NeutronLoadBalancerPool) JaxbTestHelper.jaxbUnmarshall(dummyObject,
44                     NeutronLoadBalancerPool_sourceJson);
45             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 1: Testing id failed",
46                     "12ff63af-4127-4074-a251-bcb2ecc53ebe", testObject.getID());
47
48             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 2: Testing name failed", "pool1",
49                     testObject.getLoadBalancerPoolName());
50
51             Assert.assertTrue("NeutronLoadBalancerPool JAXB Test 3: Testing admin_state_up failed",
52                     testObject.getLoadBalancerPoolAdminIsStateIsUp());
53
54             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 5: Testing LbAlgorithm failed", "ROUND_ROBIN",
55                     testObject.getLoadBalancerPoolLbAlgorithm());
56
57             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 6: Testing Protocol failed", "HTTP",
58                     testObject.getLoadBalancerPoolProtocol());
59
60             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 7: Testing Tenant_id failed",
61                     "1a3e005cf9ce40308c900bcb08e5320c", testObject.getTenantID());
62
63             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 8: Testing HealthMonitorID failed",
64                     "00066a7b-796b-4f26-9cf9-9e82d248fda7", testObject.getNeutronLoadBalancerPoolHealthMonitorID());
65
66             List<Neutron_ID> testListeners = testObject.getLoadBalancerPoolListeners();
67             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 9.1: Testing Listeners failed",
68                     1, testListeners.size());
69
70             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 9.2: Testing Listeners failed",
71                     "39de4d56-d663-46e5-85a1-5b9d5fa17829", testObject.getLoadBalancerPoolListeners().get(0).getID());
72
73             List<NeutronLoadBalancerPoolMember> testMembers = testObject.getLoadBalancerPoolMembers();
74             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 10.1: Testing Listeners failed",
75                     0, testMembers.size());
76
77             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 11: Testing session_persistence cookie_name failed",
78                     "my_cookie", testObject.getLoadBalancerPoolSessionPersistence().getCookieName());
79
80             Assert.assertEquals("NeutronLoadBalancerPool JAXB Test 12: Testing session_persistence type failed",
81                     "APP_COOKIE", testObject.getLoadBalancerPoolSessionPersistence().getType());
82
83         } catch (Exception e) {
84             Assert.fail("Tests failed");
85         }
86     }
87 }