Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍길동
/
onos
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
tom
2014-08-27 01:11:43 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
de8d96843845e1fb76ffc3e67477d08fccca0e1c
de8d9684
1 parent
b36046e2
Added unit tests; including guava-testlib.
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
0 deletions
net/api/pom.xml
net/api/src/main/java/org/onlab/onos/net/DeviceId.java
net/api/src/test/java/org/onlab/onos/net/DeviceIdTest.java
net/api/src/test/java/org/onlab/onos/net/ElementIdTest.java
net/api/src/test/java/org/onlab/onos/net/provider/AbstractProviderTest.java
net/api/src/test/java/org/onlab/onos/net/provider/ProviderIdTest.java
net/api/src/test/java/org/onlab/onos/net/provider/TestProvider.java
pom.xml
net/api/pom.xml
View file @
de8d968
...
...
@@ -16,4 +16,11 @@
<description>
ONOS network control API
</description>
<dependencies>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava-testlib
</artifactId>
</dependency>
</dependencies>
</project>
...
...
net/api/src/main/java/org/onlab/onos/net/DeviceId.java
View file @
de8d968
...
...
@@ -7,6 +7,7 @@ import java.net.URI;
*/
public
class
DeviceId
extends
ElementId
{
// TODO: Discuss whether we should just use ElementId for Device and Host alike
/**
* Creates a device id using the supplied URI.
*
...
...
net/api/src/test/java/org/onlab/onos/net/DeviceIdTest.java
0 → 100644
View file @
de8d968
package
org
.
onlab
.
onos
.
net
;
import
com.google.common.testing.EqualsTester
;
import
org.junit.Test
;
/**
* Test of the provider identifier.
*/
public
class
DeviceIdTest
extends
ElementIdTest
{
@Test
public
void
basics
()
{
new
EqualsTester
()
.
addEqualityGroup
(
new
DeviceId
(
uri
(
"of:foo"
)),
new
DeviceId
(
uri
(
"of:foo"
)))
.
addEqualityGroup
(
new
DeviceId
(
uri
(
"of:bar"
)))
.
testEquals
();
}
}
net/api/src/test/java/org/onlab/onos/net/ElementIdTest.java
0 → 100644
View file @
de8d968
package
org
.
onlab
.
onos
.
net
;
import
com.google.common.testing.EqualsTester
;
import
org.junit.Test
;
import
java.net.URI
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
/**
* Test of the provider identifier.
*/
public
class
ElementIdTest
{
public
static
URI
uri
(
String
str
)
{
return
URI
.
create
(
str
);
}
@Test
public
void
basics
()
{
new
EqualsTester
()
.
addEqualityGroup
(
new
ElementId
(
uri
(
"of:foo"
)),
new
ElementId
(
uri
(
"of:foo"
)))
.
addEqualityGroup
(
new
ElementId
(
uri
(
"of:bar"
)))
.
testEquals
();
assertEquals
(
"wrong uri"
,
uri
(
"ofcfg:foo"
),
new
ElementId
(
uri
(
"ofcfg:foo"
)).
uri
());
}
}
net/api/src/test/java/org/onlab/onos/net/provider/AbstractProviderTest.java
0 → 100644
View file @
de8d968
package
org
.
onlab
.
onos
.
net
.
provider
;
import
org.junit.Test
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
/**
* Test of the base provider implementation.
*/
public
class
AbstractProviderTest
{
@Test
public
void
basics
()
{
ProviderId
id
=
new
ProviderId
(
"foo.bar"
);
TestProvider
provider
=
new
TestProvider
(
id
);
assertEquals
(
"incorrect id"
,
id
,
provider
.
id
());
}
}
net/api/src/test/java/org/onlab/onos/net/provider/ProviderIdTest.java
0 → 100644
View file @
de8d968
package
org
.
onlab
.
onos
.
net
.
provider
;
import
com.google.common.testing.EqualsTester
;
import
org.junit.Test
;
/**
* Test of the provider identifier.
*/
public
class
ProviderIdTest
{
@Test
public
void
basics
()
{
new
EqualsTester
()
.
addEqualityGroup
(
new
ProviderId
(
"foo"
),
new
ProviderId
(
"foo"
))
.
addEqualityGroup
(
new
ProviderId
(
"bar"
))
.
testEquals
();
}
}
net/api/src/test/java/org/onlab/onos/net/provider/TestProvider.java
0 → 100644
View file @
de8d968
package
org
.
onlab
.
onos
.
net
.
provider
;
/**
* Test provider fixture.
*/
public
class
TestProvider
extends
AbstractProvider
{
/**
* Creates a provider with the supplier identifier.
*
* @param id provider id
*/
protected
TestProvider
(
ProviderId
id
)
{
super
(
id
);
}
}
pom.xml
View file @
de8d968
...
...
@@ -61,6 +61,14 @@
<version>
17.0
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava-testlib
</artifactId>
<version>
17.0
</version>
<scope>
test
</scope>
</dependency>
<!-- Web related -->
<dependency>
<groupId>
com.sun.jersey
</groupId>
...
...
Please
register
or
login
to post a comment