Checkstyle formatting issues fix (SPI)
[neutron.git] / neutron-spi / src / test / java / org / opendaylight / neutron / spi / NeutronSecurityGroupJAXBTest.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 org.junit.Assert;
12 import org.junit.Test;
13
14 public class NeutronSecurityGroupJAXBTest {
15     private static final String NeutronSecurityGroup_sourceJson = "{"
16             + "\"id\": \"2076db17-a522-4506-91de-c6dd8e837028\", " + "\"name\": \"new-webservers\", "
17             + "\"description\": \"security group for webservers\", "
18             + "\"tenant_id\": \"b4f50856753b4dc6afee5fa6b9b6c550\", "
19             + "\"security_group_rules\": [ { \"id\": \"2bc0accf-312e-429a-956e-e4407625eb62\" , "
20             + "\"direction\": \"ingress\" , " + "\"protocol\": \"tcp\" , " + "\"port_range_min\": 80 , "
21             + "\"port_range_max\": 80 , " + "\"ethertype\": \"IPv4\" ," + "\"remote_ip_prefix\": \"0.0.0.0/0\" , "
22             + "\"remote_group_id\": \"85cc3048-abc3-43cc-89b3-377341426ac5\" , "
23             + "\"security_group_id\": \"a7734e61-b545-452d-a3cd-0189cbd9747a\" , "
24             + "\"tenant_id\": \"e4f50856753b4dc6afee5fa6b9b6c550\" } ]" + "}";
25
26     @Test
27     public void test_NeutronSecurityGroup_JAXB() {
28         NeutronSecurityGroup dummyObject = new NeutronSecurityGroup();
29         try {
30             NeutronSecurityGroup testObject = (NeutronSecurityGroup) JaxbTestHelper.jaxbUnmarshall(dummyObject,
31                     NeutronSecurityGroup_sourceJson);
32             Assert.assertEquals("NeutronSecurityGroup JAXB Test 1: Testing id failed",
33                     "2076db17-a522-4506-91de-c6dd8e837028", testObject.getID());
34
35             Assert.assertEquals("NeutronSecurityGroup JAXB Test 2: Testing direction failed", "new-webservers",
36                     testObject.getSecurityGroupName());
37
38             Assert.assertEquals("NeutronSecurityGroup JAXB Test 4: Testing port range min failed",
39                     "b4f50856753b4dc6afee5fa6b9b6c550", testObject.getTenantID());
40         } catch (Exception e) {
41             Assert.fail("Tests failed");
42         }
43     }
44 }