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 org.junit.Assert;
12 import org.junit.Test;
14 public class NeutronVPNIKEPolicyJAXBTest {
15 private static final String NeutronVPNIKEPolicy_sourceJson = "{"
16 + "\"id\": \"5522aff7-1b3c-48dd-9c3c-b50f016b73db\", "
17 + "\"tenant_id\": \"ccb81365fe36411a9011e90491fe1330\", " + "\"name\": \"ikepolicy1\", "
18 + "\"description\": \"updated description\", " + "\"auth_algorithm\": \"sha1\", "
19 + "\"encryption_algorithm\": \"aes-256\", " + "\"phase1_negotiation_mode\": \"main\", "
20 + "\"ike_version\": \"v1\", " + "\"pfs\": \"group5\", " + "\"lifetime\": { " + "\"units\": \"seconds\", "
21 + "\"value\": 3600 " + "} }";
24 public void test_NeutronVPNIKEPolicy_JAXB() {
25 NeutronVPNIKEPolicy dummyObject = new NeutronVPNIKEPolicy();
27 NeutronVPNIKEPolicy testObject = (NeutronVPNIKEPolicy) JaxbTestHelper.jaxbUnmarshall(dummyObject,
28 NeutronVPNIKEPolicy_sourceJson);
29 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 1: Testing id failed",
30 "5522aff7-1b3c-48dd-9c3c-b50f016b73db", testObject.getID());
32 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 2: Testing tenant id failed",
33 "ccb81365fe36411a9011e90491fe1330", testObject.getTenantID());
35 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 3: Testing name failed", "ikepolicy1",
36 testObject.getName());
38 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 5: Testing auth algorithm failed", "sha1",
39 testObject.getAuthAlgorithm());
41 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 6: Testing Encryption algorithm failed", "aes-256",
42 testObject.getEncryptionAlgorithm());
44 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 7: Testing phase1 negotiation mode failed", "main",
45 testObject.getPhase1NegotiationMode());
47 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 8: Testing ike version failed", "v1",
48 testObject.getIkeVersion());
50 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 9: Testing pfs failed", "group5",
51 testObject.getPerfectForwardSecrecy());
53 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 10.1: Testing lifetime units value failed", "seconds",
54 testObject.getLifetime().getUnits());
56 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 10.2: Testing lifetime values failed", new Integer(3600),
57 testObject.getLifetime().getValue());
58 } catch (Exception e) {
59 Assert.fail("Tests failed");