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-09-19 19:00:11 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
202175ad4a5c21641abe17688d98280b3bcfcda4
202175ad
1 parent
be98831f
Renaming all Simple*Manager to just *Manager.
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
46 additions
and
199 deletions
core/api/src/main/java/org/onlab/onos/GreetService.java
core/net/src/main/java/org/onlab/onos/event/impl/SimpleEventDispatcher.java → core/net/src/main/java/org/onlab/onos/event/impl/CoreEventDispatcher.java
core/net/src/main/java/org/onlab/onos/net/DeleteMe.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/device/impl/package-info.java → core/net/src/main/java/org/onlab/onos/net/device/impl/package-info.java
core/net/src/main/java/org/onlab/onos/net/flow/impl/SimpleFlowRuleManager.java → core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
core/net/src/main/java/org/onlab/onos/net/host/impl/SimpleHostManager.java → core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
core/net/src/main/java/org/onlab/onos/net/host/impl/SimpleHostMonitor.java → core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/link/impl/package-info.java → core/net/src/main/java/org/onlab/onos/net/link/impl/package-info.java
core/net/src/main/java/org/onlab/onos/net/packet/impl/SimplePacketManager.java → core/net/src/main/java/org/onlab/onos/net/packet/impl/PacketManager.java
core/net/src/test/java/org/onlab/onos/event/impl/SimpleEventDispatcherTest.java → core/net/src/test/java/org/onlab/onos/event/impl/CoreEventDispatcherTest.java
core/net/src/test/java/org/onlab/onos/net/device/impl/DeviceManagerTest.java
core/net/src/test/java/org/onlab/onos/net/flow/impl/SimpleFlowRuleManagerTest.java → core/net/src/test/java/org/onlab/onos/net/flow/impl/FlowRuleManagerTest.java
core/net/src/test/java/org/onlab/onos/net/host/impl/SimpleHostManagerTest.java → core/net/src/test/java/org/onlab/onos/net/host/impl/HostManagerTest.java
core/net/src/test/java/org/onlab/onos/net/link/impl/LinkManagerTest.java
core/net/src/test/java/org/onlab/onos/net/topology/impl/TopologyManagerTest.java
core/trivial/src/main/java/org/onlab/onos/impl/GreetManager.java
core/trivial/src/main/java/org/onlab/onos/impl/SomeOtherComponent.java
core/trivial/src/main/java/org/onlab/onos/impl/package-info.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/topology/impl/DefaultTopology.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/DefaultTopology.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/topology/impl/DefaultTopologyGraph.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/DefaultTopologyGraph.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/topology/impl/PathKey.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/PathKey.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/device/impl/SimpleDeviceStore.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/flow/impl/SimpleFlowRuleStore.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleFlowRuleStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/host/impl/SimpleHostStore.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/link/impl/SimpleLinkStore.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/topology/impl/SimpleTopologyStore.java → core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyStore.java
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/package-info.java
core/trivial/src/test/java/org/onlab/onos/impl/GreetManagerTest.java
core/trivial/src/test/java/org/onlab/onos/net/trivial/topology/impl/DefaultTopologyTest.java → core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/DefaultTopologyTest.java
pom.xml
web/api/src/main/java/org/onlab/onos/rest/GreetResource.java
web/api/src/test/java/org/onlab/onos/rest/GreetResourceTest.java
web/gui/src/main/java/org/onlab/onos/gui/GreetResource.java
core/api/src/main/java/org/onlab/onos/GreetService.java
deleted
100644 → 0
View file @
be98831
package
org
.
onlab
.
onos
;
/**
* Example of a simple service that provides greetings and it
* remembers the names which were greeted.
*/
public
interface
GreetService
{
/**
* Returns a greeting tailored to the specified name.
*
* @param name some name
* @return greeting
*/
String
yo
(
String
name
);
/**
* Returns an iterable of names encountered thus far.
*
* @return iterable of names
*/
Iterable
<
String
>
names
();
}
core/net/src/main/java/org/onlab/onos/event/impl/
Simpl
eEventDispatcher.java
→
core/net/src/main/java/org/onlab/onos/event/impl/
Cor
eEventDispatcher.java
View file @
202175a
...
...
@@ -24,7 +24,7 @@ import static org.slf4j.LoggerFactory.getLogger;
*/
@Component
(
immediate
=
true
)
@Service
public
class
Simpl
eEventDispatcher
extends
DefaultEventSinkRegistry
public
class
Cor
eEventDispatcher
extends
DefaultEventSinkRegistry
implements
EventDeliveryService
{
private
final
Logger
log
=
getLogger
(
getClass
());
...
...
core/net/src/main/java/org/onlab/onos/net/DeleteMe.java
deleted
100644 → 0
View file @
be98831
package
org
.
onlab
.
onos
.
net
;
/**
* Created by tom on 9/19/14.
*/
public
class
DeleteMe
{
}
core/
trivial/src/main/java/org/onlab/onos/net/trivial
/device/impl/package-info.java
→
core/
net/src/main/java/org/onlab/onos/net
/device/impl/package-info.java
View file @
202175a
/**
* Core subsystem for tracking global inventory of infrastructure devices.
*/
package
org
.
onlab
.
onos
.
net
.
trivial
.
device
.
impl
;
package
org
.
onlab
.
onos
.
net
.
device
.
impl
;
...
...
core/net/src/main/java/org/onlab/onos/net/flow/impl/
Simple
FlowRuleManager.java
→
core/net/src/main/java/org/onlab/onos/net/flow/impl/FlowRuleManager.java
View file @
202175a
...
...
@@ -31,7 +31,7 @@ import org.slf4j.Logger;
@Component
(
immediate
=
true
)
@Service
public
class
Simple
FlowRuleManager
public
class
FlowRuleManager
extends
AbstractProviderRegistry
<
FlowRuleProvider
,
FlowRuleProviderService
>
implements
FlowRuleService
,
FlowRuleProviderRegistry
{
...
...
core/net/src/main/java/org/onlab/onos/net/host/impl/
Simple
HostManager.java
→
core/net/src/main/java/org/onlab/onos/net/host/impl/HostManager.java
View file @
202175a
...
...
@@ -38,7 +38,7 @@ import org.slf4j.Logger;
*/
@Component
(
immediate
=
true
)
@Service
public
class
Simple
HostManager
public
class
HostManager
extends
AbstractProviderRegistry
<
HostProvider
,
HostProviderService
>
implements
HostService
,
HostAdminService
,
HostProviderRegistry
{
...
...
core/net/src/main/java/org/onlab/onos/net/host/impl/
Simple
HostMonitor.java
→
core/net/src/main/java/org/onlab/onos/net/host/impl/HostMonitor.java
View file @
202175a
...
...
@@ -17,7 +17,7 @@ import org.onlab.onos.net.topology.TopologyService;
import
org.onlab.packet.IpPrefix
;
import
org.onlab.util.Timer
;
public
class
Simple
HostMonitor
implements
TimerTask
{
public
class
HostMonitor
implements
TimerTask
{
private
final
HostService
hostService
;
private
final
TopologyService
topologyService
;
...
...
@@ -31,9 +31,9 @@ public class SimpleHostMonitor implements TimerTask {
private
Timeout
timeout
;
public
Simple
HostMonitor
(
HostService
hostService
,
TopologyService
topologyService
,
DeviceService
deviceService
,
HostProvider
hostProvider
,
PacketProvider
packetProvider
)
{
public
HostMonitor
(
HostService
hostService
,
TopologyService
topologyService
,
DeviceService
deviceService
,
HostProvider
hostProvider
,
PacketProvider
packetProvider
)
{
this
.
hostService
=
hostService
;
this
.
topologyService
=
topologyService
;
this
.
deviceService
=
deviceService
;
...
...
core/
trivial/src/main/java/org/onlab/onos/net/trivial
/link/impl/package-info.java
→
core/
net/src/main/java/org/onlab/onos/net
/link/impl/package-info.java
View file @
202175a
/**
* Core subsystem for tracking global inventory of infrastructure links.
*/
package
org
.
onlab
.
onos
.
net
.
trivial
.
link
.
impl
;
package
org
.
onlab
.
onos
.
net
.
link
.
impl
;
...
...
core/net/src/main/java/org/onlab/onos/net/packet/impl/
Simple
PacketManager.java
→
core/net/src/main/java/org/onlab/onos/net/packet/impl/PacketManager.java
View file @
202175a
...
...
@@ -30,7 +30,7 @@ import org.slf4j.Logger;
*/
@Component
(
immediate
=
true
)
@Service
public
class
Simple
PacketManager
public
class
PacketManager
extends
AbstractProviderRegistry
<
PacketProvider
,
PacketProviderService
>
implements
PacketService
,
PacketProviderRegistry
{
...
...
core/net/src/test/java/org/onlab/onos/event/impl/
Simpl
eEventDispatcherTest.java
→
core/net/src/test/java/org/onlab/onos/event/impl/
Cor
eEventDispatcherTest.java
View file @
202175a
...
...
@@ -16,9 +16,9 @@ import static org.junit.Assert.assertEquals;
/**
* Test of the even dispatcher mechanism.
*/
public
class
Simpl
eEventDispatcherTest
{
public
class
Cor
eEventDispatcherTest
{
private
final
SimpleEventDispatcher
dispatcher
=
new
Simpl
eEventDispatcher
();
private
final
CoreEventDispatcher
dispatcher
=
new
Cor
eEventDispatcher
();
private
final
PrickleSink
prickleSink
=
new
PrickleSink
();
private
final
GooSink
gooSink
=
new
GooSink
();
...
...
core/net/src/test/java/org/onlab/onos/net/device/impl/DeviceManagerTest.java
View file @
202175a
...
...
@@ -23,7 +23,7 @@ import org.onlab.onos.net.device.PortDescription;
import
org.onlab.onos.net.provider.AbstractProvider
;
import
org.onlab.onos.net.provider.ProviderId
;
import
org.onlab.onos.event.impl.TestEventDispatcher
;
import
org.onlab.onos.net.trivial.
device.
impl.SimpleDeviceStore
;
import
org.onlab.onos.net.trivial.impl.SimpleDeviceStore
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
...
...
core/net/src/test/java/org/onlab/onos/net/flow/impl/
Simple
FlowRuleManagerTest.java
→
core/net/src/test/java/org/onlab/onos/net/flow/impl/FlowRuleManagerTest.java
View file @
202175a
...
...
@@ -40,19 +40,19 @@ import org.onlab.onos.net.provider.ProviderId;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Sets
;
import
org.onlab.onos.net.trivial.
flow.
impl.SimpleFlowRuleStore
;
import
org.onlab.onos.net.trivial.impl.SimpleFlowRuleStore
;
/**
* Test codifying the flow rule service & flow rule provider service contracts.
*/
public
class
Simple
FlowRuleManagerTest
{
public
class
FlowRuleManagerTest
{
private
static
final
ProviderId
PID
=
new
ProviderId
(
"of"
,
"foo"
);
private
static
final
DeviceId
DID
=
DeviceId
.
deviceId
(
"of:001"
);
private
static
final
Device
DEV
=
new
DefaultDevice
(
PID
,
DID
,
Type
.
SWITCH
,
""
,
""
,
""
,
""
);
private
Simple
FlowRuleManager
mgr
;
private
FlowRuleManager
mgr
;
protected
FlowRuleService
service
;
protected
FlowRuleProviderRegistry
registry
;
...
...
@@ -62,7 +62,7 @@ public class SimpleFlowRuleManagerTest {
@Before
public
void
setUp
()
{
mgr
=
new
Simple
FlowRuleManager
();
mgr
=
new
FlowRuleManager
();
mgr
.
store
=
new
SimpleFlowRuleStore
();
mgr
.
eventDispatcher
=
new
TestEventDispatcher
();
mgr
.
deviceService
=
new
TestDeviceService
();
...
...
core/net/src/test/java/org/onlab/onos/net/host/impl/
Simple
HostManagerTest.java
→
core/net/src/test/java/org/onlab/onos/net/host/impl/HostManagerTest.java
View file @
202175a
...
...
@@ -28,7 +28,7 @@ import org.onlab.onos.net.host.HostProviderRegistry;
import
org.onlab.onos.net.host.HostProviderService
;
import
org.onlab.onos.net.provider.AbstractProvider
;
import
org.onlab.onos.net.provider.ProviderId
;
import
org.onlab.onos.net.trivial.
host.
impl.SimpleHostStore
;
import
org.onlab.onos.net.trivial.impl.SimpleHostStore
;
import
org.onlab.packet.IpPrefix
;
import
org.onlab.packet.MacAddress
;
import
org.onlab.packet.VlanId
;
...
...
@@ -41,7 +41,7 @@ import static org.onlab.onos.net.host.HostEvent.Type.*;
/**
* Test codifying the host service & host provider service contracts.
*/
public
class
Simple
HostManagerTest
{
public
class
HostManagerTest
{
private
static
final
ProviderId
PID
=
new
ProviderId
(
"of"
,
"foo"
);
...
...
@@ -64,7 +64,7 @@ public class SimpleHostManagerTest {
private
static
final
HostLocation
LOC1
=
new
HostLocation
(
DID1
,
P1
,
123L
);
private
static
final
HostLocation
LOC2
=
new
HostLocation
(
DID1
,
P2
,
123L
);
private
Simple
HostManager
mgr
;
private
HostManager
mgr
;
protected
TestListener
listener
=
new
TestListener
();
protected
HostProviderRegistry
registry
;
...
...
@@ -73,7 +73,7 @@ public class SimpleHostManagerTest {
@Before
public
void
setUp
()
{
mgr
=
new
Simple
HostManager
();
mgr
=
new
HostManager
();
mgr
.
store
=
new
SimpleHostStore
();
mgr
.
eventDispatcher
=
new
TestEventDispatcher
();
registry
=
mgr
;
...
...
core/net/src/test/java/org/onlab/onos/net/link/impl/LinkManagerTest.java
View file @
202175a
...
...
@@ -23,7 +23,7 @@ import org.onlab.onos.net.provider.AbstractProvider;
import
org.onlab.onos.net.provider.ProviderId
;
import
org.onlab.onos.event.impl.TestEventDispatcher
;
import
org.onlab.onos.net.device.impl.DeviceManager
;
import
org.onlab.onos.net.trivial.
link.
impl.SimpleLinkStore
;
import
org.onlab.onos.net.trivial.impl.SimpleLinkStore
;
import
java.util.ArrayList
;
import
java.util.Iterator
;
...
...
core/net/src/test/java/org/onlab/onos/net/topology/impl/TopologyManagerTest.java
View file @
202175a
...
...
@@ -27,7 +27,7 @@ import org.onlab.onos.net.topology.TopologyProvider;
import
org.onlab.onos.net.topology.TopologyProviderRegistry
;
import
org.onlab.onos.net.topology.TopologyProviderService
;
import
org.onlab.onos.net.topology.TopologyService
;
import
org.onlab.onos.net.trivial.
topology.
impl.SimpleTopologyStore
;
import
org.onlab.onos.net.trivial.impl.SimpleTopologyStore
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
core/trivial/src/main/java/org/onlab/onos/impl/GreetManager.java
deleted
100644 → 0
View file @
be98831
package
org
.
onlab
.
onos
.
impl
;
import
com.google.common.collect.ImmutableSet
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
import
org.apache.felix.scr.annotations.Deactivate
;
import
org.apache.felix.scr.annotations.Service
;
import
org.onlab.onos.GreetService
;
import
org.slf4j.Logger
;
import
java.util.HashSet
;
import
java.util.Set
;
import
static
com
.
google
.
common
.
base
.
Preconditions
.
checkNotNull
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
* Trivial implementation of the seed service to demonstrate component and
* service annotations.
*/
@Component
(
immediate
=
true
)
@Service
public
class
GreetManager
implements
GreetService
{
private
final
Logger
log
=
getLogger
(
getClass
());
private
final
Set
<
String
>
names
=
new
HashSet
<>();
@Override
public
synchronized
String
yo
(
String
name
)
{
checkNotNull
(
name
,
"Name cannot be null"
);
names
.
add
(
name
);
log
.
info
(
"Greeted '{}'"
,
name
);
return
"Whazup "
+
name
+
"?"
;
}
@Override
public
synchronized
Iterable
<
String
>
names
()
{
return
ImmutableSet
.
copyOf
(
names
);
}
@Activate
public
void
activate
()
{
log
.
info
(
"SeedManager started"
);
}
@Deactivate
public
void
deactivate
()
{
log
.
info
(
"SeedManager stopped"
);
}
}
core/trivial/src/main/java/org/onlab/onos/impl/SomeOtherComponent.java
deleted
100644 → 0
View file @
be98831
package
org
.
onlab
.
onos
.
impl
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
import
org.apache.felix.scr.annotations.Deactivate
;
import
org.apache.felix.scr.annotations.Reference
;
import
org.apache.felix.scr.annotations.ReferenceCardinality
;
import
org.onlab.onos.GreetService
;
import
org.slf4j.Logger
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
* Example of a component that does not provide any service, but consumes one.
*/
@Component
(
immediate
=
true
)
public
class
SomeOtherComponent
{
private
final
Logger
log
=
getLogger
(
getClass
());
@Reference
(
cardinality
=
ReferenceCardinality
.
MANDATORY_UNARY
)
protected
GreetService
service
;
// protected to allow injection for testing;
// alternative is to write bindSeedService and unbindSeedService, which is more code
@Activate
public
void
activate
()
{
log
.
info
(
"SomeOtherComponent started"
);
service
.
yo
(
"neighbour"
);
}
@Deactivate
public
void
deactivate
()
{
log
.
info
(
"SomeOtherComponent stopped"
);
}
}
core/trivial/src/main/java/org/onlab/onos/impl/package-info.java
deleted
100644 → 0
View file @
be98831
/**
* Core infrastructure implementations.
*/
package
org
.
onlab
.
onos
.
impl
;
core/trivial/src/main/java/org/onlab/onos/net/trivial/
topology/
impl/DefaultTopology.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/DefaultTopology.java
View file @
202175a
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.ImmutableSet
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/
topology/
impl/DefaultTopologyGraph.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/DefaultTopologyGraph.java
View file @
202175a
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
org.onlab.graph.AdjacencyListsGraph
;
import
org.onlab.onos.net.topology.TopologyEdge
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/
topology/
impl/PathKey.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/PathKey.java
View file @
202175a
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
org.onlab.onos.net.DeviceId
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/
device/
impl/SimpleDeviceStore.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleDeviceStore.java
View file @
202175a
package
org
.
onlab
.
onos
.
net
.
trivial
.
device
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.felix.scr.annotations.Activate
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/
flow/
impl/SimpleFlowRuleStore.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleFlowRuleStore.java
View file @
202175a
package
org
.
onlab
.
onos
.
net
.
trivial
.
flow
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
com.google.common.collect.HashMultimap
;
import
com.google.common.collect.ImmutableSet
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/
host/
impl/SimpleHostStore.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleHostStore.java
View file @
202175a
package
org
.
onlab
.
onos
.
net
.
trivial
.
host
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_ADDED
;
import
static
org
.
onlab
.
onos
.
net
.
host
.
HostEvent
.
Type
.
HOST_MOVED
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/
link/
impl/SimpleLinkStore.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleLinkStore.java
View file @
202175a
package
org
.
onlab
.
onos
.
net
.
trivial
.
link
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
com.google.common.collect.HashMultimap
;
import
com.google.common.collect.ImmutableSet
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/
topology/
impl/SimpleTopologyStore.java
→
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/SimpleTopologyStore.java
View file @
202175a
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
org.apache.felix.scr.annotations.Activate
;
import
org.apache.felix.scr.annotations.Component
;
...
...
core/trivial/src/main/java/org/onlab/onos/net/trivial/impl/package-info.java
0 → 100644
View file @
202175a
/**
* Implementations of in-memory stores suitable for unit testing and
* experimentation; not for production use.
*/
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
\ No newline at end of file
core/trivial/src/test/java/org/onlab/onos/impl/GreetManagerTest.java
deleted
100644 → 0
View file @
be98831
package
org
.
onlab
.
onos
.
impl
;
import
org.junit.Test
;
import
org.onlab.onos.GreetService
;
import
java.util.Iterator
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
/**
* Example of a component & service implementation unit test.
*/
public
class
GreetManagerTest
{
@Test
public
void
basics
()
{
GreetService
service
=
new
GreetManager
();
assertEquals
(
"incorrect greeting"
,
"Whazup dude?"
,
service
.
yo
(
"dude"
));
Iterator
<
String
>
names
=
service
.
names
().
iterator
();
assertEquals
(
"incorrect name"
,
"dude"
,
names
.
next
());
assertFalse
(
"no more names expected"
,
names
.
hasNext
());
}
@Test
(
expected
=
NullPointerException
.
class
)
public
void
nullArg
()
{
new
GreetManager
().
yo
(
null
);
}
}
core/trivial/src/test/java/org/onlab/onos/net/trivial/
topology/
impl/DefaultTopologyTest.java
→
core/trivial/src/test/java/org/onlab/onos/net/trivial/impl/DefaultTopologyTest.java
View file @
202175a
package
org
.
onlab
.
onos
.
net
.
trivial
.
topology
.
impl
;
package
org
.
onlab
.
onos
.
net
.
trivial
.
impl
;
import
org.junit.Before
;
import
org.junit.Test
;
...
...
pom.xml
View file @
202175a
...
...
@@ -350,13 +350,13 @@
<group>
<title>
Network Model
&
Services
</title>
<packages>
org.onlab.onos:org.onlab.onos.*
org.onlab.onos:org.onlab.onos.*
:
</packages>
</group>
<group>
<title>
Core Subsystems
</title>
<packages>
org.onlab.onos.net.trivial.*:org.onlab.onos.net.*.impl:org.onlab.onos.impl:org.onlab.onos.event.impl:org.onlab.onos.store.*
org.onlab.onos.net.
device.impl:org.onlab.onos.net.link.impl:org.onlab.onos.net.host.impl:org.onlab.onos.net.topology.impl:org.onlab.onos.net.packet.impl:org.onlab.onos.net.flow.impl:org.onlab.onos.net.
trivial.*:org.onlab.onos.net.*.impl:org.onlab.onos.impl:org.onlab.onos.event.impl:org.onlab.onos.store.*
</packages>
</group>
<group>
...
...
web/api/src/main/java/org/onlab/onos/rest/GreetResource.java
View file @
202175a
...
...
@@ -2,7 +2,6 @@ package org.onlab.onos.rest;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
org.onlab.onos.GreetService
;
import
org.onlab.rest.BaseResource
;
import
javax.ws.rs.DefaultValue
;
...
...
@@ -24,7 +23,7 @@ public class GreetResource extends BaseResource {
public
Response
yo
(
@QueryParam
(
"name"
)
@DefaultValue
(
"dude"
)
String
name
)
{
ObjectMapper
mapper
=
new
ObjectMapper
();
ObjectNode
root
=
mapper
.
createObjectNode
();
root
.
put
(
"greeting"
,
get
(
GreetService
.
class
).
yo
(
name
)
);
root
.
put
(
"greeting"
,
"Yo!!!!"
);
return
Response
.
ok
(
root
.
toString
()).
build
();
}
...
...
web/api/src/test/java/org/onlab/onos/rest/GreetResourceTest.java
View file @
202175a
...
...
@@ -3,11 +3,8 @@ package org.onlab.onos.rest;
import
com.sun.jersey.api.client.WebResource
;
import
com.sun.jersey.test.framework.JerseyTest
;
import
org.junit.BeforeClass
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
org.onlab.onos.GreetService
;
import
org.onlab.onos.impl.GreetManager
;
import
org.onlab.osgi.ServiceDirectory
;
import
org.onlab.osgi.TestServiceDirectory
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
...
...
@@ -23,11 +20,12 @@ public class GreetResourceTest extends JerseyTest {
@BeforeClass
public
static
void
classSetUp
()
{
ServiceDirectory
testDirectory
=
new
TestServiceDirectory
().
add
(
GreetService
.
class
,
new
GreetManager
());
GreetResource
.
setServiceDirectory
(
testDirectory
);
//
ServiceDirectory testDirectory =
//
new TestServiceDirectory().add(GreetService.class, new GreetManager());
//
GreetResource.setServiceDirectory(testDirectory);
}
@Ignore
@Test
public
void
basics
()
{
WebResource
rs
=
resource
();
...
...
web/gui/src/main/java/org/onlab/onos/gui/GreetResource.java
View file @
202175a
package
org
.
onlab
.
onos
.
gui
;
import
org.onlab.onos.GreetService
;
import
org.onlab.rest.BaseResource
;
import
javax.ws.rs.DefaultValue
;
...
...
@@ -17,7 +16,7 @@ public class GreetResource extends BaseResource {
@GET
public
Response
yo
(
@QueryParam
(
"name"
)
@DefaultValue
(
"dude"
)
String
name
)
{
return
Response
.
ok
(
get
(
GreetService
.
class
).
yo
(
name
)
).
build
();
return
Response
.
ok
(
"Yo!!!"
).
build
();
}
}
...
...
Please
register
or
login
to post a comment