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
c98d954e
Commit
c98d954e
authored
Oct 11, 2019
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tests
parent
c0a478f8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
154 additions
and
10 deletions
+154
-10
pom.xml
drip-manager/pom.xml
+10
-8
MongoConfig.java
.../main/java/nl/uva/sne/drip/configuration/MongoConfig.java
+0
-1
ToscaTemplate.java
...er/src/main/java/nl/uva/sne/drip/model/ToscaTemplate.java
+0
-1
MongoConfig.java
.../test/java/nl/uva/sne/drip/configuration/MongoConfig.java
+48
-0
ToscaTemplateServiceTest.java
...ava/nl/uva/sne/drip/service/ToscaTemplateServiceTest.java
+96
-0
No files found.
drip-manager/pom.xml
View file @
c98d954e
...
@@ -65,15 +65,10 @@
...
@@ -65,15 +65,10 @@
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-data-mongodb
</artifactId>
<artifactId>
spring-boot-starter-data-mongodb
</artifactId>
<type>
jar
</type>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-mongodb
</artifactId>
<type>
jar
</type>
</dependency>
</dependency>
<!-- Bean Validation API support -->
<!-- Bean Validation API support -->
<dependency>
<dependency>
<groupId>
javax.validation
</groupId>
<groupId>
javax.validation
</groupId>
...
@@ -96,5 +91,12 @@
...
@@ -96,5 +91,12 @@
<version>
1.0-SNAPSHOT
</version>
<version>
1.0-SNAPSHOT
</version>
<type>
jar
</type>
<type>
jar
</type>
</dependency>
</dependency>
<dependency>
<groupId>
de.flapdoodle.embed
</groupId>
<artifactId>
de.flapdoodle.embed.mongo
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
drip-manager/src/main/java/nl/uva/sne/drip/configuration/MongoConfig.java
View file @
c98d954e
...
@@ -15,7 +15,6 @@
...
@@ -15,7 +15,6 @@
*/
*/
package
nl
.
uva
.
sne
.
drip
.
configuration
;
package
nl
.
uva
.
sne
.
drip
.
configuration
;
import
com.mongodb.Mongo
;
import
com.mongodb.MongoClient
;
import
com.mongodb.MongoClient
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.ComponentScan
;
...
...
drip-manager/src/main/java/nl/uva/sne/drip/model/ToscaTemplate.java
View file @
c98d954e
...
@@ -20,7 +20,6 @@ import org.springframework.data.annotation.Id;
...
@@ -20,7 +20,6 @@ import org.springframework.data.annotation.Id;
* ToscaTemplate
* ToscaTemplate
*/
*/
@Validated
@Validated
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
ToscaTemplate
{
public
class
ToscaTemplate
{
@Id
@Id
...
...
drip-manager/src/test/java/nl/uva/sne/drip/configuration/MongoConfig.java
0 → 100644
View file @
c98d954e
/*
* Copyright 2017 S. Koulouzis, Wang Junchao, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
nl
.
uva
.
sne
.
drip
.
configuration
;
import
com.mongodb.MongoClient
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.mongodb.config.AbstractMongoConfiguration
;
/**
*
* @author S. Koulouzis
*/
@Configuration
@ComponentScan
(
basePackages
=
{
"nl.uva.sne.drip"
,
"nl.uva.sne.drip.api"
,
"nl.uva.sne.drip.configuration"
,
"nl.uva.sne.drip.dao"
,
"nl.uva.sne.drip.model"
,
"nl.uva.sne.drip.service"
})
public
class
MongoConfig
extends
AbstractMongoConfiguration
{
@Override
protected
String
getDatabaseName
()
{
return
"test-db"
;
}
@Override
protected
String
getMappingBasePackage
()
{
return
"nl.uva.sne.drip"
;
}
@Override
public
MongoClient
mongoClient
()
{
String
bindIp
=
"localhost"
;
int
port
=
12345
;
return
new
MongoClient
(
bindIp
,
port
);
}
}
drip-manager/src/test/java/nl/uva/sne/drip/service/ToscaTemplateServiceTest.java
0 → 100644
View file @
c98d954e
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package
nl
.
uva
.
sne
.
drip
.
service
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
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
;
import
org.junit.BeforeClass
;
import
de.flapdoodle.embed.mongo.MongodExecutable
;
import
de.flapdoodle.embed.mongo.MongodProcess
;
import
de.flapdoodle.embed.mongo.MongodStarter
;
import
de.flapdoodle.embed.mongo.config.MongodConfigBuilder
;
import
de.flapdoodle.embed.mongo.config.Net
;
import
de.flapdoodle.embed.mongo.distribution.Version
;
import
de.flapdoodle.embed.process.runtime.Network
;
import
java.io.IOException
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
nl.uva.sne.drip.Swagger2SpringBoot
;
import
org.springframework.test.context.web.WebAppConfiguration
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
org.springframework.web.context.WebApplicationContext
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@WebAppConfiguration
@ContextConfiguration
(
classes
=
{
Swagger2SpringBoot
.
class
})
public
class
ToscaTemplateServiceTest
{
@Autowired
ToscaTemplateService
ml
;
@Autowired
private
WebApplicationContext
wac
;
private
MockMvc
mockMvc
;
private
static
final
MongodStarter
starter
=
MongodStarter
.
getDefaultInstance
();
private
static
MongodExecutable
_mongodExe
;
private
static
MongodProcess
_mongod
;
@BeforeClass
public
static
void
setUpClass
()
{
try
{
_mongodExe
=
starter
.
prepare
(
new
MongodConfigBuilder
()
.
version
(
Version
.
Main
.
PRODUCTION
)
.
net
(
new
Net
(
"localhost"
,
12345
,
Network
.
localhostIsIPv6
()))
.
build
());
_mongod
=
_mongodExe
.
start
();
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
ToscaTemplateServiceTest
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
@AfterClass
public
static
void
tearDownClass
()
{
_mongodExe
.
stop
();
}
@Before
public
void
setUp
()
{
DefaultMockMvcBuilder
builder
=
MockMvcBuilders
.
webAppContextSetup
(
this
.
wac
);
mockMvc
=
builder
.
build
();
}
@After
public
void
tearDown
()
{
}
@Test
public
void
test_ml_always_return_true
()
{
//assert correct type/impl
assertThat
(
ml
,
instanceOf
(
ToscaTemplateService
.
class
));
//assert true
assertThat
(
true
,
is
(
true
));
}
}
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