HIGUCHI Yuta

Fixes for Persistent{Map, Set}

- Remove unnecessary repository in pom
- Move Tests to appropriate path/package
- cosmetic fixes

Change-Id: I017293837626a976fe64f811583bb6e314edbd65
...@@ -18,18 +18,6 @@ ...@@ -18,18 +18,6 @@
18 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 18 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 19 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
20 <modelVersion>4.0.0</modelVersion> 20 <modelVersion>4.0.0</modelVersion>
21 - <repositories>
22 - <repository>
23 - <id>repository.springsource.com.release</id>
24 - <name>SpringSource OBR - Release</name>
25 - <url>http://repository.springsource.com/maven/bundles/release</url>
26 - </repository>
27 - <repository>
28 - <id>repository.springsource.com.external</id>
29 - <name>SpringSource OBR - External</name>
30 - <url>http://repository.springsource.com/maven/bundles/external</url>
31 - </repository>
32 - </repositories>
33 21
34 <parent> 22 <parent>
35 <groupId>org.onosproject</groupId> 23 <groupId>org.onosproject</groupId>
...@@ -46,16 +34,14 @@ ...@@ -46,16 +34,14 @@
46 34
47 35
48 <dependencies> 36 <dependencies>
49 - <!--<dependency> 37 +
50 - <groupId>org.onosproject</groupId>
51 - <artifactId>onos-api</artifactId>
52 - </dependency>-->
53 <dependency> 38 <dependency>
54 <groupId>org.onosproject</groupId> 39 <groupId>org.onosproject</groupId>
55 <artifactId>onos-api</artifactId> 40 <artifactId>onos-api</artifactId>
56 <classifier>tests</classifier> 41 <classifier>tests</classifier>
57 <scope>test</scope> 42 <scope>test</scope>
58 </dependency> 43 </dependency>
44 +
59 <dependency> 45 <dependency>
60 <groupId>org.mapdb</groupId> 46 <groupId>org.mapdb</groupId>
61 <artifactId>mapdb</artifactId> 47 <artifactId>mapdb</artifactId>
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 -package test; 17 +package org.onosproject.persistence.impl;
18 18
19 import com.google.common.collect.Maps; 19 import com.google.common.collect.Maps;
20 import org.junit.After; 20 import org.junit.After;
...@@ -22,7 +22,6 @@ import org.junit.Before; ...@@ -22,7 +22,6 @@ import org.junit.Before;
22 import org.junit.Test; 22 import org.junit.Test;
23 import org.mapdb.DB; 23 import org.mapdb.DB;
24 import org.mapdb.DBMaker; 24 import org.mapdb.DBMaker;
25 -import org.onosproject.persistence.impl.PersistentMap;
26 import org.onosproject.store.service.Serializer; 25 import org.onosproject.store.service.Serializer;
27 26
28 import java.nio.file.Paths; 27 import java.nio.file.Paths;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 -package test; 17 +package org.onosproject.persistence.impl;
18 18
19 import com.google.common.collect.Sets; 19 import com.google.common.collect.Sets;
20 import org.junit.After; 20 import org.junit.After;
...@@ -22,7 +22,6 @@ import org.junit.Before; ...@@ -22,7 +22,6 @@ import org.junit.Before;
22 import org.junit.Test; 22 import org.junit.Test;
23 import org.mapdb.DB; 23 import org.mapdb.DB;
24 import org.mapdb.DBMaker; 24 import org.mapdb.DBMaker;
25 -import org.onosproject.persistence.impl.PersistentSet;
26 import org.onosproject.store.service.Serializer; 25 import org.onosproject.store.service.Serializer;
27 26
28 import java.nio.file.Paths; 27 import java.nio.file.Paths;
...@@ -34,6 +33,7 @@ import static org.junit.Assert.assertEquals; ...@@ -34,6 +33,7 @@ import static org.junit.Assert.assertEquals;
34 import static org.junit.Assert.assertFalse; 33 import static org.junit.Assert.assertFalse;
35 import static org.junit.Assert.assertNotEquals; 34 import static org.junit.Assert.assertNotEquals;
36 import static org.junit.Assert.assertNull; 35 import static org.junit.Assert.assertNull;
36 +import static org.junit.Assert.assertSame;
37 import static org.junit.Assert.assertTrue; 37 import static org.junit.Assert.assertTrue;
38 38
39 /** 39 /**
...@@ -143,7 +143,7 @@ public class PersistentSetTest { ...@@ -143,7 +143,7 @@ public class PersistentSetTest {
143 Object[] arr = set.toArray(); 143 Object[] arr = set.toArray();
144 assertEquals("The array should be of length 10.", 10, arr.length); 144 assertEquals("The array should be of length 10.", 10, arr.length);
145 for (int i = 0; i < 10; i++) { 145 for (int i = 0; i < 10; i++) {
146 - assertTrue("All elements of the array should be in the set.", set.contains((Integer) arr[i])); 146 + assertTrue("All elements of the array should be in the set.", set.contains(arr[i]));
147 } 147 }
148 } 148 }
149 149
...@@ -154,7 +154,7 @@ public class PersistentSetTest { ...@@ -154,7 +154,7 @@ public class PersistentSetTest {
154 fillSet(9, set); 154 fillSet(9, set);
155 //Test the case where the array and set match in size 155 //Test the case where the array and set match in size
156 Object[] retArray = set.toArray(originalArray); 156 Object[] retArray = set.toArray(originalArray);
157 - assertEquals("If the set can fit the array should be the one passed in.", originalArray, retArray); 157 + assertSame("If the set can fit the array should be the one passed in.", originalArray, retArray);
158 //Test the case where the passe array is too small to fit the set 158 //Test the case where the passe array is too small to fit the set
159 set.add(9); 159 set.add(9);
160 assertNotEquals("A new set should be generated if the contents will not fit in the passed set", 160 assertNotEquals("A new set should be generated if the contents will not fit in the passed set",
......