2 * Copyright Tata Consultancy Services, 2015. 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 import org.opendaylight.neutron.spi.NeutronVPNIKEPolicy;
16 public class NeutronVPNIKEPolicyJAXBTest {
17 private static final String NeutronVPNIKEPolicy_sourceJson = "{" +
18 "\"id\": \"5522aff7-1b3c-48dd-9c3c-b50f016b73db\", " +
19 "\"tenant_id\": \"ccb81365fe36411a9011e90491fe1330\", " +
20 "\"name\": \"ikepolicy1\", " +
21 "\"description\": \"updated description\", " +
22 "\"auth_algorithm\": \"sha1\", " +
23 "\"encryption_algorithm\": \"aes-256\", " +
24 "\"phase1_negotiation_mode\": \"main\", " +
25 "\"ike_version\": \"v1\", " +
26 "\"pfs\": \"group5\", " +
27 "\"lifetime\": { " + "\"units\": \"seconds\", " + "\"value\": 3600 " + "} }";
30 public void test_NeutronVPNIKEPolicy_JAXB() {
31 NeutronVPNIKEPolicy dummyObject = new NeutronVPNIKEPolicy();
33 NeutronVPNIKEPolicy testObject = (NeutronVPNIKEPolicy) JaxbTestHelper.jaxbUnmarshall(dummyObject, NeutronVPNIKEPolicy_sourceJson);
34 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 1: Testing id failed",
35 "5522aff7-1b3c-48dd-9c3c-b50f016b73db", testObject.getID());
37 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 2: Testing tenant id failed",
38 "ccb81365fe36411a9011e90491fe1330", testObject.getTenantID());
40 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 3: Testing name failed",
41 "ikepolicy1", testObject.getName());
43 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 5: Testing auth algorithm failed",
44 "sha1", testObject.getAuthAlgorithm());
46 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 6: Testing Encryption algorithm failed",
47 "aes-256", testObject.getEncryptionAlgorithm());
49 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 7: Testing phase1 negotiation mode failed",
50 "main", testObject.getPhase1NegotiationMode());
52 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 8: Testing ike version failed",
53 "v1", testObject.getIkeVersion());
55 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 9: Testing pfs failed",
56 "group5", testObject.getPerfectForwardSecrecy());
58 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 10.1: Testing lifetime units value failed",
59 "seconds", testObject.getLifetime().getUnits());
61 Assert.assertEquals("NeutronVPNIKEPolicy JAXB Test 10.2: Testing lifetime values failed",
62 new Integer(3600), testObject.getLifetime().getValue());
63 } catch (Exception e) {
64 Assert.fail("Tests failed");