Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
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
openSource
apollo
Commits
5ed45a67
Commit
5ed45a67
authored
Mar 12, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5 from yiming187/lombok_update
Portal Test Configuration update
parents
d1771497
30bade80
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
113 additions
and
23 deletions
+113
-23
.gitignore
.gitignore
+6
-1
data.sql
apollo-configserver/src/test/resources/data.sql
+0
-0
schema.sql
apollo-configserver/src/test/resources/schema.sql
+0
-0
AppController.java
...ava/com/ctrip/apollo/portal/controller/AppController.java
+7
-6
App.java
...l/src/main/java/com/ctrip/apollo/portal/entities/App.java
+56
-3
PortalApplicationTestConfiguration.java
...rip/apollo/portal/PortalApplicationTestConfiguration.java
+8
-0
AppRepositoryTest.java
...com/ctrip/apollo/portal/repository/AppRepositoryTest.java
+35
-0
data.sql
apollo-portal/src/test/resources/data.sql
+0
-0
schema.sql
apollo-portal/src/test/resources/schema.sql
+0
-0
pom.xml
pom.xml
+1
-13
No files found.
.gitignore
View file @
5ed45a67
...
...
@@ -11,8 +11,12 @@
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
# Eclipse
.classpath
.project
target
.settings
# Idea
.idea
*.iml
\ No newline at end of file
apollo-configserver/src/test/resources/data.sql
deleted
100644 → 0
View file @
d1771497
apollo-configserver/src/test/resources/schema.sql
deleted
100644 → 0
View file @
d1771497
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/AppController.java
View file @
5ed45a67
package
com
.
ctrip
.
apollo
.
portal
.
controller
;
import
java.util.Date
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.PageRequest
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.web.PageableDefault
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -19,14 +21,13 @@ public class AppController {
private
AppRepository
appRepository
;
@RequestMapping
(
""
)
public
Page
<
App
>
list
()
{
Pageable
pageable
=
new
PageRequest
(
0
,
10
);
public
Page
<
App
>
list
(
@PageableDefault
(
size
=
50
)
Pageable
pageable
)
{
return
appRepository
.
findAll
(
pageable
);
}
@RequestMapping
(
value
=
""
,
method
=
RequestMethod
.
POST
)
public
App
create
()
{
App
ramdomApp
=
new
App
(
);
return
appRepository
.
save
(
ramdomA
pp
);
public
App
create
(
App
app
)
{
app
.
setCreateTimestamp
(
new
Date
()
);
return
appRepository
.
save
(
a
pp
);
}
}
apollo-portal/src/main/java/com/ctrip/apollo/portal/entities/App.java
View file @
5ed45a67
...
...
@@ -7,10 +7,7 @@ import javax.persistence.Column;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
lombok.Data
;
@Entity
@Data
public
class
App
implements
Serializable
{
/**
...
...
@@ -38,4 +35,60 @@ public class App implements Serializable {
@Column
private
Date
lastUpdatedTimestamp
;
public
String
getId
()
{
return
id
;
}
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getOwner
()
{
return
owner
;
}
public
void
setOwner
(
String
owner
)
{
this
.
owner
=
owner
;
}
public
String
getOwnerPhone
()
{
return
ownerPhone
;
}
public
void
setOwnerPhone
(
String
ownerPhone
)
{
this
.
ownerPhone
=
ownerPhone
;
}
public
String
getOwnerMail
()
{
return
ownerMail
;
}
public
void
setOwnerMail
(
String
ownerMail
)
{
this
.
ownerMail
=
ownerMail
;
}
public
Date
getCreateTimestamp
()
{
return
createTimestamp
;
}
public
void
setCreateTimestamp
(
Date
createTimestamp
)
{
this
.
createTimestamp
=
createTimestamp
;
}
public
Date
getLastUpdatedTimestamp
()
{
return
lastUpdatedTimestamp
;
}
public
void
setLastUpdatedTimestamp
(
Date
lastUpdatedTimestamp
)
{
this
.
lastUpdatedTimestamp
=
lastUpdatedTimestamp
;
}
}
apollo-portal/src/test/java/com/ctrip/apollo/portal/PortalApplicationTestConfiguration.java
0 → 100644
View file @
5ed45a67
package
com
.
ctrip
.
apollo
.
portal
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
public
class
PortalApplicationTestConfiguration
{
}
apollo-portal/src/test/java/com/ctrip/apollo/portal/repository/AppRepositoryTest.java
0 → 100644
View file @
5ed45a67
package
com
.
ctrip
.
apollo
.
portal
.
repository
;
import
java.util.Date
;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
com.ctrip.apollo.portal.PortalApplicationTestConfiguration
;
import
com.ctrip.apollo.portal.entities.App
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
PortalApplicationTestConfiguration
.
class
)
public
class
AppRepositoryTest
{
@Autowired
AppRepository
repository
;
@Test
public
void
testCreate
()
{
Assert
.
assertEquals
(
0
,
repository
.
count
());
App
ramdomApp
=
new
App
();
ramdomApp
.
setId
(
String
.
valueOf
(
System
.
currentTimeMillis
()));
ramdomApp
.
setName
(
"new app "
+
System
.
currentTimeMillis
());
ramdomApp
.
setOwner
(
"owner "
+
System
.
currentTimeMillis
());
ramdomApp
.
setCreateTimestamp
(
new
Date
());
repository
.
save
(
ramdomApp
);
Assert
.
assertEquals
(
1
,
repository
.
count
());
}
}
apollo-portal/src/test/resources/data.sql
deleted
100644 → 0
View file @
d1771497
apollo-portal/src/test/resources/schema.sql
deleted
100644 → 0
View file @
d1771497
pom.xml
View file @
5ed45a67
...
...
@@ -15,13 +15,6 @@
<module>
apollo-portal
</module>
<module>
apollo-assembly
</module>
</modules>
<dependencies>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<optional>
true
</optional>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
...
...
@@ -47,11 +40,6 @@
<artifactId>
mysql-connector-java
</artifactId>
<version>
5.1.38
</version>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
1.16.8
</version>
</dependency>
<!--for test -->
<dependency>
<groupId>
com.h2database
</groupId>
...
...
@@ -111,7 +99,7 @@
<plugin>
<groupId>
org.eluder.coveralls
</groupId>
<artifactId>
coveralls-maven-plugin
</artifactId>
<version>
3
.1.0
</version>
<version>
4
.1.0
</version>
</plugin>
</plugins>
</build>
...
...
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