Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
3657f0f4
Commit
3657f0f4
authored
Oct 11, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test delete all
parent
aab6260f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
ToscaTemplateService.java
...in/java/nl/uva/sne/drip/service/ToscaTemplateService.java
+7
-1
ToscaTemplateServiceTest.java
...ava/nl/uva/sne/drip/service/ToscaTemplateServiceTest.java
+23
-4
No files found.
drip-manager/src/main/java/nl/uva/sne/drip/service/ToscaTemplateService.java
View file @
3657f0f4
...
...
@@ -85,9 +85,15 @@ public class ToscaTemplateService {
public
List
<
String
>
getAllIds
()
{
List
<
String
>
allIds
=
new
ArrayList
<>();
List
<
ToscaTemplate
>
all
=
dao
.
findAll
();
for
(
ToscaTemplate
tt
:
all
)
{
for
(
ToscaTemplate
tt
:
all
)
{
allIds
.
add
(
tt
.
getId
());
}
return
allIds
;
}
void
deleteAll
()
{
dao
.
deleteAll
();
}
}
drip-manager/src/test/java/nl/uva/sne/drip/service/ToscaTemplateServiceTest.java
View file @
3657f0f4
...
...
@@ -12,9 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
static
org
.
hamcrest
.
MatcherAssert
.
assertThat
;
import
static
org
.
hamcrest
.
Matchers
.
instanceOf
;
import
static
org
.
hamcrest
.
Matchers
.
is
;
import
org.junit.After
;
import
org.junit.AfterClass
;
import
org.junit.Before
;
...
...
@@ -31,11 +28,11 @@ import java.io.File;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.NoSuchElementException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.Swagger2SpringBoot
;
import
nl.uva.sne.drip.api.ApiException
;
import
nl.uva.sne.drip.model.ToscaTemplate
;
import
org.junit.Assert
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
...
...
@@ -213,4 +210,26 @@ public class ToscaTemplateServiceTest {
}
}
}
/**
* Test of getAllIds method, of class ToscaTemplateService.
*/
@Test
public
void
testGetAllIds
()
throws
Exception
{
Logger
.
getLogger
(
ToscaTemplateServiceTest
.
class
.
getName
()).
log
(
Level
.
INFO
,
"getAllIds"
);
testDeleteAll
();
int
numOfINst
=
3
;
for
(
int
i
=
1
;
i
<=
numOfINst
;
i
++)
{
testSaveFile
();
}
List
<
String
>
result
=
instance
.
getAllIds
();
assertEquals
(
numOfINst
,
result
.
size
());
}
@Test
public
void
testDeleteAll
()
{
instance
.
deleteAll
();
int
size
=
instance
.
getAllIds
().
size
();
assertEquals
(
0
,
size
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment