Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
CTF
Project
Project
Details
Activity
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grzegorz
CTF
Commits
6bfef99d
Commit
6bfef99d
authored
Feb 08, 2017
by
Grzegorz Pietrusza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add lightcouch db test
parent
c943dd11
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
15 deletions
+66
-15
pom.xml
service/pom.xml
+32
-5
CTFApplication.java
.../java/com/telephoners/krakyournet/ctf/CTFApplication.java
+4
-0
Immutable.java
...lephoners/krakyournet/ctf/beans/immutables/Immutable.java
+10
-9
LightCouchTest.java
.../java/com.telephoners.krakyournet.ctf/LightCouchTest.java
+20
-1
No files found.
service/pom.xml
View file @
6bfef99d
...
...
@@ -166,11 +166,38 @@
<groupId>
org.immutables
</groupId>
<artifactId>
value
</artifactId>
<version>
2.4.3
</version>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
org.lightcouch
</groupId>
<artifactId>
lightcouch
</artifactId>
<version>
0.1.8
</version>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.mockito
</groupId>
<artifactId>
mockito-core
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.assertj
</groupId>
<artifactId>
assertj-core
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.awaitility
</groupId>
<artifactId>
awaitility
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
4.12
</version>
<scope>
test
</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.immutables</groupId>-->
<!--<artifactId>value</artifactId>-->
<!--<version>2.4.1</version>-->
<!--</dependency>-->
</dependencies>
</project>
\ No newline at end of file
service/src/main/java/com/telephoners/krakyournet/ctf/CTFApplication.java
View file @
6bfef99d
...
...
@@ -7,6 +7,7 @@ import com.google.inject.Guice;
import
com.google.inject.Injector
;
import
com.telephoners.krakyournet.ctf.auth.UserAuthenticator
;
import
com.telephoners.krakyournet.ctf.beans.User
;
import
com.telephoners.krakyournet.ctf.beans.immutables.TestBean
;
import
com.telephoners.krakyournet.ctf.commands.PurgeDatabaseCommand
;
import
com.telephoners.krakyournet.ctf.commands.RegisterTasksCommand
;
import
com.telephoners.krakyournet.ctf.commands.RegisterTeamsCommand
;
...
...
@@ -69,6 +70,9 @@ public class CTFApplication extends Application<ApplicationConfiguration>
@Override
public
void
run
(
ApplicationConfiguration
applicationConfiguration
,
Environment
environment
)
throws
Exception
{
TestBean
asdf
=
TestBean
.
of
(
"asdf"
);
injector
=
createInjector
(
applicationConfiguration
);
registerAdmins
(
applicationConfiguration
);
...
...
service/src/main/java/com/telephoners/krakyournet/ctf/beans/immutables/Immutable.java
View file @
6bfef99d
...
...
@@ -9,15 +9,16 @@ import java.lang.annotation.RetentionPolicy;
import
java.lang.annotation.Target
;
@Target
({
ElementType
.
PACKAGE
,
ElementType
.
TYPE
})
@Retention
(
RetentionPolicy
.
CLASS
)
// Make it class retention for incremental compilation
@Value
.
Style
(
get
=
{
"is*"
,
"get*"
},
// Detect 'get' and 'is' prefixes in accessor methods
init
=
"set*"
,
// Builder initialization methods will have 'set' prefix
typeAbstract
=
{
"Abstract*"
},
// 'Abstract' prefix will be detected and trimmed
typeImmutable
=
"*"
,
// No prefix or suffix for generated immutable type
builder
=
"new"
,
// construct builder using 'new' instead of factory method
build
=
"create"
,
// rename 'build' method on builder to 'create'
visibility
=
Value
.
Style
.
ImplementationVisibility
.
PUBLIC
,
// Generated class will be always public
defaults
=
@Value
.
Immutable
(
copy
=
false
))
// Disable copy methods by default
allParameters
=
true
,
get
=
{
"is*"
,
"get*"
},
init
=
"with*"
,
typeAbstract
=
{
"Abstract*"
},
typeImmutable
=
"*"
,
depluralize
=
true
,
defaults
=
@Value
.
Immutable
(
copy
=
false
)
)
public
@interface
Immutable
{}
\ No newline at end of file
service/src/test/java/com.telephoners.krakyournet.ctf/LightCouchTest.java
View file @
6bfef99d
package
com
.
telephoners
.
krakyournet
.
ctf
;
import
com.telephoners.krakyournet.ctf.beans.immutables.TestBean
;
import
org.junit.Test
;
import
org.lightcouch.CouchDbClient
;
import
java.util.List
;
import
java.util.stream.Stream
;
public
class
LightCouchTest
{
// CouchDbClient dbClient = new CouchDbClient();
@Test
public
void
test
()
{
CouchDbClient
dbClient
=
new
CouchDbClient
(
"testdb"
,
true
,
"http"
,
"127.0.0.1"
,
5984
,
"admin"
,
"password"
);
Stream
.
of
(
"1"
,
"2"
,
"3"
,
"4"
,
"5"
)
.
map
(
TestBean:
:
of
)
.
forEach
(
dbClient:
:
save
);
List
<
TestBean
>
all_docs
=
dbClient
.
view
(
"_all_docs"
).
query
(
TestBean
.
class
);
int
size
=
all_docs
.
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