Code Clean up: remove type from <>
[neutron.git] / neutron-spi / src / test / java / org / opendaylight / neutron / spi / NeutronLoadBalancerHealthMonitorJAXBTest.java
1 /*
2  * Copyright (c) 2015 Tata Consultancy Services.  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.ArrayList;
12 import java.util.List;
13 import javax.xml.bind.JAXBException;
14 import org.junit.Assert;
15 import org.junit.Test;
16
17 public class NeutronLoadBalancerHealthMonitorJAXBTest {
18
19     private static final String NEUTRON_LOAD_BALANCER_HEALTH_MONITOR_SOURCE_JSON = "{"
20             + "\"id\": \"2f245a7b-796b-4f26-9cf9-9e82d248fda7\", " + "\"type\": \"HTTP\", " + "\"delay\": 1, "
21             + "\"timeout\": 1, " + "\"admin_state_up\": \"false\", " + "\"max_retries\": 5, "
22             + "\"http_method\": \"get\", " + "\"url_path\": \"/index.html\", " + "\"expected_codes\": \"200,201,202\", "
23             + "\"tenant_id\": \"00045a7b-796b-4f26-9cf9-9e82d248fda7\" }";
24
25     @Test
26     public void test_NeutronLoadBalancerHealthMonitor_JAXB() throws JAXBException {
27         NeutronLoadBalancerHealthMonitor dummyObject = new NeutronLoadBalancerHealthMonitor();
28
29         NeutronLoadBalancerHealthMonitor testObject = (NeutronLoadBalancerHealthMonitor) JaxbTestHelper
30                 .jaxbUnmarshall(dummyObject, NEUTRON_LOAD_BALANCER_HEALTH_MONITOR_SOURCE_JSON);
31         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 1: Testing id failed",
32                 "2f245a7b-796b-4f26-9cf9-9e82d248fda7", testObject.getID());
33
34         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 2: Testing  Type failed", "HTTP",
35                 testObject.getLoadBalancerHealthMonitorType());
36
37         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 3: Testing  delay failed", 1,
38                 (long) testObject.getLoadBalancerHealthMonitorDelay());
39
40         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 4: Testing  timeout failed", 1,
41                 (long) testObject.getLoadBalancerHealthMonitorTimeout());
42
43         Assert.assertFalse("NeutronLoadBalancerHealthMonitor JAXB Test 5: Testing  admin_state_up failed",
44                 testObject.getLoadBalancerHealthMonitorAdminStateIsUp());
45
46         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 6: Testing  max_retries  failed", 5,
47                 (long) testObject.getLoadBalancerHealthMonitorMaxRetries());
48
49         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 7: Testing  http_methods failed", "get",
50                 testObject.getLoadBalancerHealthMonitorHttpMethod());
51
52         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 8: Testing  url_path failed", "/index.html",
53                 testObject.getLoadBalancerHealthMonitorUrlPath());
54
55         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 9: Testing  expected_codes failed",
56                 "200,201,202", testObject.getLoadBalancerHealthMonitorExpectedCodes());
57
58         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 10: Testing tenant_id failed",
59                 "00045a7b-796b-4f26-9cf9-9e82d248fda7", testObject.getTenantID());
60
61         NeutronID neutronId = new NeutronID();
62         neutronId.setID("2f245a7b-0000-4f26-9cf9-9e82d248fda7");
63         List<NeutronID> loadBalancerHealthMonitorPool = new ArrayList<>();
64         loadBalancerHealthMonitorPool.add(neutronId);
65         testObject.setLoadBalancerHealthMonitorPools(loadBalancerHealthMonitorPool);
66         Assert.assertEquals("NeutronLoadBalancerHealthMonitor JAXB Test 11: Testing Pools failed",
67                 "2f245a7b-0000-4f26-9cf9-9e82d248fda7",
68                 testObject.getLoadBalancerHealthMonitorPools().get(0).getID());
69     }
70 }