1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
* Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.restconf.restconf.modules;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import com.google.common.collect.ImmutableSet;
import java.util.Set;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev131019.RevisionIdentifier;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.YangIdentifier;
public class ModuleBuilderTest {
@Test
public void testModuleBuilder() {
final ModuleBuilder moduleBuilder = new ModuleBuilder();
final Module.Revision revision = new Module.Revision(new RevisionIdentifier("2016-10-11"));
final YangIdentifier yangIdentifierOne = new YangIdentifier("YangIdentifier1");
final YangIdentifier yangIdentifierTwo = new YangIdentifier("YangIdentifier2");
final Uri namespace = new Uri("namespace");
final Set<YangIdentifier> yangIdentifierList = ImmutableSet.of(yangIdentifierOne, yangIdentifierTwo);
final ModuleKey moduleKeyOne = new ModuleKey(yangIdentifierOne, revision);
final ModuleKey moduleKeyTwo = new ModuleKey(moduleKeyOne);
moduleBuilder.setRevision(revision);
moduleBuilder.setDeviation(yangIdentifierList);
moduleBuilder.setFeature(yangIdentifierList);
moduleBuilder.setName(yangIdentifierOne);
moduleBuilder.setNamespace(namespace);
moduleBuilder.withKey(moduleKeyOne);
final Module moduleOne = moduleBuilder.build();
final Module moduleTwo = new ModuleBuilder(moduleOne).build();
assertNotNull(moduleBuilder);
assertNotNull(revision);
assertNotNull(yangIdentifierOne);
assertNotNull(yangIdentifierTwo);
assertNotNull(namespace);
assertNotNull(yangIdentifierList);
assertNotNull(moduleKeyOne);
assertNotNull(moduleKeyOne.hashCode());
assertNotNull(moduleKeyOne.toString());
assertNotNull(moduleBuilder.toString());
assertNotNull(moduleBuilder.hashCode());
assertEquals(moduleKeyOne, moduleKeyTwo);
assertEquals(revision, moduleKeyOne.getRevision());
assertEquals(yangIdentifierOne, moduleKeyOne.getName());
assertEquals(revision, moduleBuilder.getRevision());
assertEquals(yangIdentifierList, moduleBuilder.getDeviation());
assertEquals(yangIdentifierList, moduleBuilder.getFeature());
assertEquals(yangIdentifierOne, moduleBuilder.getName());
assertEquals(namespace, moduleBuilder.getNamespace());
assertEquals(moduleKeyOne, moduleBuilder.key());
assertEquals(moduleOne.toString(), moduleTwo.toString());
assertEquals(moduleKeyOne.toString(), moduleKeyTwo.toString());
assertTrue(moduleOne.equals(moduleTwo));
assertTrue(moduleKeyOne.equals(moduleKeyTwo));
}
}
|