Committed by
Gerrit Code Review
Unit tests for packet processing the the AAA app
Change-Id: I51149fdf9ce5bfe4ee8d67564165b94f3e39e379
Showing
5 changed files
with
62 additions
and
15 deletions
... | @@ -44,31 +44,36 @@ | ... | @@ -44,31 +44,36 @@ |
44 | 44 | ||
45 | <dependency> | 45 | <dependency> |
46 | <groupId>org.onosproject</groupId> | 46 | <groupId>org.onosproject</groupId> |
47 | - <artifactId>onlab-junit</artifactId> | 47 | + <artifactId>onos-api</artifactId> |
48 | - <scope>test</scope> | 48 | + <version>${project.version}</version> |
49 | </dependency> | 49 | </dependency> |
50 | 50 | ||
51 | <dependency> | 51 | <dependency> |
52 | <groupId>org.onosproject</groupId> | 52 | <groupId>org.onosproject</groupId> |
53 | - <artifactId>onos-api</artifactId> | 53 | + <artifactId>onos-app-xos-integration</artifactId> |
54 | <version>${project.version}</version> | 54 | <version>${project.version}</version> |
55 | </dependency> | 55 | </dependency> |
56 | 56 | ||
57 | <dependency> | 57 | <dependency> |
58 | <groupId>org.onosproject</groupId> | 58 | <groupId>org.onosproject</groupId> |
59 | - <artifactId>onlab-osgi</artifactId> | 59 | + <artifactId>onlab-junit</artifactId> |
60 | - <version>${project.version}</version> | 60 | + <scope>test</scope> |
61 | </dependency> | 61 | </dependency> |
62 | 62 | ||
63 | <dependency> | 63 | <dependency> |
64 | - <groupId>org.apache.felix</groupId> | 64 | + <groupId>org.onosproject</groupId> |
65 | - <artifactId>org.apache.felix.scr.annotations</artifactId> | 65 | + <artifactId>onlab-osgi</artifactId> |
66 | + <version>${project.version}</version> | ||
67 | + <classifier>tests</classifier> | ||
68 | + <scope>test</scope> | ||
66 | </dependency> | 69 | </dependency> |
67 | 70 | ||
68 | <dependency> | 71 | <dependency> |
69 | <groupId>org.onosproject</groupId> | 72 | <groupId>org.onosproject</groupId> |
70 | - <artifactId>onos-app-xos-integration</artifactId> | 73 | + <artifactId>onos-api</artifactId> |
71 | <version>${project.version}</version> | 74 | <version>${project.version}</version> |
75 | + <classifier>tests</classifier> | ||
76 | + <scope>test</scope> | ||
72 | </dependency> | 77 | </dependency> |
73 | </dependencies> | 78 | </dependencies> |
74 | 79 | ... | ... |
... | @@ -136,23 +136,23 @@ public class AAA { | ... | @@ -136,23 +136,23 @@ public class AAA { |
136 | 136 | ||
137 | @Property(name = "radiusIpAddress", value = DEFAULT_RADIUS_IP, | 137 | @Property(name = "radiusIpAddress", value = DEFAULT_RADIUS_IP, |
138 | label = "RADIUS IP Address") | 138 | label = "RADIUS IP Address") |
139 | - private String radiusIpAddress = DEFAULT_RADIUS_IP; | 139 | + protected String radiusIpAddress = DEFAULT_RADIUS_IP; |
140 | 140 | ||
141 | @Property(name = "nasIpAddress", value = DEFAULT_NAS_IP, | 141 | @Property(name = "nasIpAddress", value = DEFAULT_NAS_IP, |
142 | label = "NAS IP Address") | 142 | label = "NAS IP Address") |
143 | - private String nasIpAddress = DEFAULT_NAS_IP; | 143 | + protected String nasIpAddress = DEFAULT_NAS_IP; |
144 | 144 | ||
145 | @Property(name = "radiusMacAddress", value = RADIUS_MAC_ADDRESS, | 145 | @Property(name = "radiusMacAddress", value = RADIUS_MAC_ADDRESS, |
146 | label = "RADIUS MAC Address") | 146 | label = "RADIUS MAC Address") |
147 | - private String radiusMacAddress = RADIUS_MAC_ADDRESS; | 147 | + protected String radiusMacAddress = RADIUS_MAC_ADDRESS; |
148 | 148 | ||
149 | @Property(name = "nasMacAddress", value = NAS_MAC_ADDRESS, | 149 | @Property(name = "nasMacAddress", value = NAS_MAC_ADDRESS, |
150 | label = "NAS MAC Address") | 150 | label = "NAS MAC Address") |
151 | - private String nasMacAddress = NAS_MAC_ADDRESS; | 151 | + protected String nasMacAddress = NAS_MAC_ADDRESS; |
152 | 152 | ||
153 | @Property(name = "radiusSecret", value = DEFAULT_RADIUS_SECRET, | 153 | @Property(name = "radiusSecret", value = DEFAULT_RADIUS_SECRET, |
154 | label = "RADIUS shared secret") | 154 | label = "RADIUS shared secret") |
155 | - private String radiusSecret = DEFAULT_RADIUS_SECRET; | 155 | + protected String radiusSecret = DEFAULT_RADIUS_SECRET; |
156 | 156 | ||
157 | @Property(name = "radiusSwitchId", value = DEFAULT_RADIUS_SWITCH, | 157 | @Property(name = "radiusSwitchId", value = DEFAULT_RADIUS_SWITCH, |
158 | label = "Radius switch") | 158 | label = "Radius switch") | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -17,10 +17,13 @@ package org.onosproject.cfg; | ... | @@ -17,10 +17,13 @@ package org.onosproject.cfg; |
17 | 17 | ||
18 | import java.util.Set; | 18 | import java.util.Set; |
19 | 19 | ||
20 | +import com.google.common.collect.ImmutableSet; | ||
21 | + | ||
20 | /** | 22 | /** |
21 | * Adapter for testing against component configuration service. | 23 | * Adapter for testing against component configuration service. |
22 | */ | 24 | */ |
23 | public class ComponentConfigAdapter implements ComponentConfigService { | 25 | public class ComponentConfigAdapter implements ComponentConfigService { |
26 | + | ||
24 | @Override | 27 | @Override |
25 | public Set<String> getComponentNames() { | 28 | public Set<String> getComponentNames() { |
26 | return null; | 29 | return null; |
... | @@ -38,7 +41,7 @@ public class ComponentConfigAdapter implements ComponentConfigService { | ... | @@ -38,7 +41,7 @@ public class ComponentConfigAdapter implements ComponentConfigService { |
38 | 41 | ||
39 | @Override | 42 | @Override |
40 | public Set<ConfigProperty> getProperties(String componentName) { | 43 | public Set<ConfigProperty> getProperties(String componentName) { |
41 | - return null; | 44 | + return ImmutableSet.of(); |
42 | } | 45 | } |
43 | 46 | ||
44 | @Override | 47 | @Override | ... | ... |
... | @@ -22,17 +22,56 @@ import org.osgi.service.component.ComponentContext; | ... | @@ -22,17 +22,56 @@ import org.osgi.service.component.ComponentContext; |
22 | import org.osgi.service.component.ComponentInstance; | 22 | import org.osgi.service.component.ComponentInstance; |
23 | 23 | ||
24 | import java.util.Dictionary; | 24 | import java.util.Dictionary; |
25 | +import java.util.Enumeration; | ||
25 | 26 | ||
26 | /** | 27 | /** |
27 | * Adapter implementation of OSGI component context. | 28 | * Adapter implementation of OSGI component context. |
28 | */ | 29 | */ |
29 | public class ComponentContextAdapter implements ComponentContext { | 30 | public class ComponentContextAdapter implements ComponentContext { |
31 | + private static class MockDictionary extends Dictionary { | ||
32 | + | ||
30 | @Override | 33 | @Override |
31 | - public Dictionary getProperties() { | 34 | + public int size() { |
35 | + return 0; | ||
36 | + } | ||
37 | + | ||
38 | + @Override | ||
39 | + public boolean isEmpty() { | ||
40 | + return false; | ||
41 | + } | ||
42 | + | ||
43 | + @Override | ||
44 | + public Enumeration keys() { | ||
32 | return null; | 45 | return null; |
33 | } | 46 | } |
34 | 47 | ||
35 | @Override | 48 | @Override |
49 | + public Enumeration elements() { | ||
50 | + return null; | ||
51 | + } | ||
52 | + | ||
53 | + @Override | ||
54 | + public Object get(Object key) { | ||
55 | + return null; | ||
56 | + } | ||
57 | + | ||
58 | + @Override | ||
59 | + public Object put(Object key, Object value) { | ||
60 | + return null; | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public Object remove(Object key) { | ||
65 | + return null; | ||
66 | + } | ||
67 | + } | ||
68 | + | ||
69 | + @Override | ||
70 | + public Dictionary getProperties() { | ||
71 | + return new MockDictionary(); | ||
72 | + } | ||
73 | + | ||
74 | + @Override | ||
36 | public Object locateService(String name) { | 75 | public Object locateService(String name) { |
37 | return null; | 76 | return null; |
38 | } | 77 | } | ... | ... |
-
Please register or login to post a comment