2 * Copyright (c) 2015 Tata Consultancy Services. All rights reserved.
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
9 package org.opendaylight.neutron.spi;
11 import javax.xml.bind.JAXBException;
12 import org.junit.Assert;
13 import org.junit.Test;
15 public class NeutronVPNIKEPolicyJAXBTest {
16 private static final String NeutronVPNIKEPolicy_sourceJson = "{"
17 + "\"id\": \"5522aff7-1b3c-48dd-9c3c-b50f016b73db\", "
18 + "\"tenant_id\": \"ccb81365fe36411a9011e90491fe1330\", " + "\"name\": \"ikepolicy1\", "
19 + "\"description\": \"updated description\", " + "\"auth_algorithm\": \"sha1\", "
20 + "\"encryption_algorithm\": \"aes-256\", " + "\"phase1_negotiation_mode\": \"main\", "
21 + "\"ike_version\": \"v1\", " + "\"pfs\": \"group5\", " + "\"lifetime\": { " + "\"units\": \"seconds\", "
22 + "\"value\": 3600 " + "} }";
25 public void test_NeutronVPNIKEPolicy_JAXB() throws JAXBException {
26 NeutronVPNIKEPolicy dummyObject = new NeutronVPNIKEPolicy();
28 NeutronVPNIKEPolicy testObject = (NeutronVPNIKEPolicy) JaxbTestHelper.jaxbUnmarshall(dummyObject,
29 NeutronVPNIKEPolicy_sourceJson);
30 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 1: Testing id failed",
31 "5522aff7-1b3c-48dd-9c3c-b50f016b73db", testObject.getID());
33 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 2: Testing tenant id failed",
34 "ccb81365fe36411a9011e90491fe1330", testObject.getTenantID());
36 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 3: Testing name failed", "ikepolicy1",
37 testObject.getName());
39 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 5: Testing auth algorithm failed", "sha1",
40 testObject.getAuthAlgorithm());
42 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 6: Testing Encryption algorithm failed", "aes-256",
43 testObject.getEncryptionAlgorithm());
45 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 7: Testing phase1 negotiation mode failed", "main",
46 testObject.getPhase1NegotiationMode());
48 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 8: Testing ike version failed", "v1",
49 testObject.getIkeVersion());
51 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 9: Testing pfs failed", "group5",
52 testObject.getPerfectForwardSecrecy());
54 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 10.1: Testing lifetime units value failed", "seconds",
55 testObject.getLifetime().getUnits());
57 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 10.2: Testing lifetime values failed", new Integer(3600),
58 testObject.getLifetime().getValue());