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
Sho SHIMIZU
2016-07-05 11:55:53 -0700
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
709a17930df16e89654110a68666a8c49d947f3b
709a1793
1 parent
406e264c
Improve test coverage
Change-Id: I7c9c64eed96ce8e2fc9943834d0c5b7a60686926
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
core/store/dist/src/test/java/org/onosproject/store/resource/impl/ContinuousResourceAllocationTest.java
core/store/dist/src/test/java/org/onosproject/store/resource/impl/ContinuousResourceAllocationTest.java
View file @
709a179
...
...
@@ -39,6 +39,67 @@ public class ContinuousResourceAllocationTest {
private
static
final
PortNumber
PN1
=
PortNumber
.
portNumber
(
1
);
@Test
public
void
testNoAllocationHasEnoughResource
()
{
ContinuousResource
original
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
gbps
(
1
).
bps
());
ContinuousResourceAllocation
sut
=
ContinuousResourceAllocation
.
empty
(
original
);
ContinuousResource
request
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
mbps
(
100
).
bps
());
assertThat
(
sut
.
hasEnoughResource
(
request
),
is
(
true
));
}
@Test
public
void
testHasEnoughResourceWhenSmallResourceIsRequested
()
{
ContinuousResource
original
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
gbps
(
1
).
bps
());
ContinuousResource
allocated
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
mbps
(
500
).
bps
());
ResourceConsumer
consumer
=
IntentId
.
valueOf
(
1
);
ContinuousResourceAllocation
sut
=
new
ContinuousResourceAllocation
(
original
,
ImmutableList
.
of
(
new
ResourceAllocation
(
allocated
,
consumer
)));
ContinuousResource
request
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
mbps
(
200
).
bps
());
assertThat
(
sut
.
hasEnoughResource
(
request
),
is
(
true
));
}
@Test
public
void
testHasEnoughResourceWhenLargeResourceIsRequested
()
{
ContinuousResource
original
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
gbps
(
1
).
bps
());
ContinuousResource
allocated
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
mbps
(
500
).
bps
());
ResourceConsumer
consumer
=
IntentId
.
valueOf
(
1
);
ContinuousResourceAllocation
sut
=
new
ContinuousResourceAllocation
(
original
,
ImmutableList
.
of
(
new
ResourceAllocation
(
allocated
,
consumer
)));
ContinuousResource
request
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
mbps
(
600
).
bps
());
assertThat
(
sut
.
hasEnoughResource
(
request
),
is
(
false
));
}
@Test
public
void
testHasEnoughResourceWhenExactResourceIsRequested
()
{
ContinuousResource
original
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
gbps
(
1
).
bps
());
ContinuousResource
allocated
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
mbps
(
500
).
bps
());
ResourceConsumer
consumer
=
IntentId
.
valueOf
(
1
);
ContinuousResourceAllocation
sut
=
new
ContinuousResourceAllocation
(
original
,
ImmutableList
.
of
(
new
ResourceAllocation
(
allocated
,
consumer
)));
ContinuousResource
request
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
mbps
(
500
).
bps
());
assertThat
(
sut
.
hasEnoughResource
(
request
),
is
(
true
));
}
@Test
public
void
testReleaseWhenAllocatedResourceIsRequested
()
{
ContinuousResource
original
=
Resources
.
continuous
(
DID
,
PN1
,
Bandwidth
.
class
).
resource
(
Bandwidth
.
gbps
(
1
).
bps
());
...
...
Please
register
or
login
to post a comment