Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-boot-admin
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
spring-boot-admin
Commits
ea5b25de
Commit
ea5b25de
authored
Apr 20, 2016
by
Johannes Edmeier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish Application
parent
272633e1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
39 additions
and
30 deletions
+39
-30
ApplicationRegistry.java
.../codecentric/boot/admin/registry/ApplicationRegistry.java
+1
-1
JournalControllerTest.java
...ecentric/boot/admin/controller/JournalControllerTest.java
+2
-2
ClientApplicationEventTest.java
...ecentric/boot/admin/event/ClientApplicationEventTest.java
+3
-3
ApplicationEventJournalTest.java
...ntric/boot/admin/journal/ApplicationEventJournalTest.java
+1
-1
HazelcastJournaledEventStoreTest.java
...admin/journal/store/HazelcastJournaledEventStoreTest.java
+2
-1
SimpleJournaledEventStoreTest.java
...ot/admin/journal/store/SimpleJournaledEventStoreTest.java
+4
-2
Application.java
...ain/java/de/codecentric/boot/admin/model/Application.java
+24
-18
ApplicationTest.java
...java/de/codecentric/boot/admin/model/ApplicationTest.java
+2
-2
No files found.
spring-boot-admin-server/src/main/java/de/codecentric/boot/admin/registry/ApplicationRegistry.java
View file @
ea5b25de
...
...
@@ -95,7 +95,7 @@ public class ApplicationRegistry implements ApplicationEventPublisherAware {
if
(
existing
!=
null
)
{
return
existing
.
getStatusInfo
();
}
return
null
;
return
StatusInfo
.
ofUnknown
()
;
}
/**
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/controller/JournalControllerTest.java
View file @
ea5b25de
...
...
@@ -40,7 +40,7 @@ public class JournalControllerTest {
@Test
public
void
test_getJournal
()
{
ClientApplicationEvent
emittedEvent
=
new
ClientApplicationRegisteredEvent
(
Application
.
create
(
"foo"
).
withId
(
"bar"
).
build
());
Application
.
create
(
"foo"
).
withId
(
"bar"
).
withHealthUrl
(
"http://health"
).
build
());
journal
.
onClientApplicationEvent
(
emittedEvent
);
Collection
<
ClientApplicationEvent
>
history
=
controller
.
getJournal
();
...
...
@@ -54,7 +54,7 @@ public class JournalControllerTest {
@Test
public
void
test_getJournal_sse
()
{
ClientApplicationEvent
emittedEvent
=
new
ClientApplicationRegisteredEvent
(
Application
.
create
(
"foo"
).
withId
(
"bar"
).
build
());
Application
.
create
(
"foo"
).
withId
(
"bar"
).
withHealthUrl
(
"http://health"
).
build
());
SseEmitter
emitter
=
controller
.
getJournalEvents
();
journal
.
onClientApplicationEvent
(
emittedEvent
);
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/event/ClientApplicationEventTest.java
View file @
ea5b25de
...
...
@@ -35,7 +35,7 @@ public class ClientApplicationEventTest {
@Test
public
void
hashCode_equals
()
throws
Exception
{
ClientApplicationEvent
event1
=
new
ClientApplicationRegisteredEvent
(
Application
.
create
(
"test"
).
build
());
Application
.
create
(
"test"
).
withHealthUrl
(
"http://health"
).
build
());
ClientApplicationEvent
event2
=
cloneBySerialization
(
event1
);
assertThat
(
event1
.
hashCode
(),
is
(
event2
.
hashCode
()));
...
...
@@ -45,9 +45,9 @@ public class ClientApplicationEventTest {
@Test
public
void
equals
()
throws
Exception
{
ClientApplicationEvent
event1
=
new
ClientApplicationRegisteredEvent
(
Application
.
create
(
"test"
).
build
());
Application
.
create
(
"test"
).
withHealthUrl
(
"http://health"
).
build
());
ClientApplicationEvent
event2
=
new
ClientApplicationDeregisteredEvent
(
Application
.
create
(
"test"
).
build
());
Application
.
create
(
"test"
).
withHealthUrl
(
"http://health"
).
build
());
assertThat
(
event1
,
not
(
is
(
event2
)));
}
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/journal/ApplicationEventJournalTest.java
View file @
ea5b25de
...
...
@@ -35,7 +35,7 @@ public class ApplicationEventJournalTest {
@Test
public
void
test_registration
()
{
ClientApplicationEvent
emittedEvent
=
new
ClientApplicationRegisteredEvent
(
Application
.
create
(
"foo"
).
withId
(
"bar"
).
build
());
.
create
(
"foo"
).
withId
(
"bar"
).
withHealthUrl
(
"http://health"
).
build
());
journal
.
onClientApplicationEvent
(
emittedEvent
);
Collection
<
ClientApplicationEvent
>
events
=
journal
.
getEvents
();
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/journal/store/HazelcastJournaledEventStoreTest.java
View file @
ea5b25de
...
...
@@ -49,7 +49,8 @@ public class HazelcastJournaledEventStoreTest {
@Test
public
void
test_store
()
{
Application
application
=
Application
.
create
(
"foo"
).
withId
(
"bar"
).
build
();
Application
application
=
Application
.
create
(
"foo"
).
withId
(
"bar"
)
.
withHealthUrl
(
"http://health"
).
build
();
List
<
ClientApplicationEvent
>
events
=
Arrays
.
asList
(
new
ClientApplicationRegisteredEvent
(
application
),
new
ClientApplicationDeregisteredEvent
(
application
));
...
...
spring-boot-admin-server/src/test/java/de/codecentric/boot/admin/journal/store/SimpleJournaledEventStoreTest.java
View file @
ea5b25de
...
...
@@ -34,7 +34,8 @@ public class SimpleJournaledEventStoreTest {
@Test
public
void
test_store
()
{
SimpleJournaledEventStore
store
=
new
SimpleJournaledEventStore
();
Application
application
=
Application
.
create
(
"foo"
).
withId
(
"bar"
).
build
();
Application
application
=
Application
.
create
(
"foo"
).
withId
(
"bar"
)
.
withHealthUrl
(
"http://health"
).
build
();
List
<
ClientApplicationEvent
>
events
=
Arrays
.
asList
(
new
ClientApplicationRegisteredEvent
(
application
),
new
ClientApplicationDeregisteredEvent
(
application
));
...
...
@@ -52,7 +53,8 @@ public class SimpleJournaledEventStoreTest {
SimpleJournaledEventStore
store
=
new
SimpleJournaledEventStore
();
store
.
setCapacity
(
2
);
Application
application
=
Application
.
create
(
"foo"
).
withId
(
"bar"
).
build
();
Application
application
=
Application
.
create
(
"foo"
).
withId
(
"bar"
)
.
withHealthUrl
(
"http://health"
).
build
();
List
<
ClientApplicationEvent
>
events
=
Arrays
.
asList
(
new
ClientApplicationRegisteredEvent
(
application
),
new
ClientApplicationDeregisteredEvent
(
application
),
...
...
spring-boot-admin-starter-client/src/main/java/de/codecentric/boot/admin/model/Application.java
View file @
ea5b25de
...
...
@@ -36,32 +36,38 @@ public class Application implements Serializable {
private
final
String
serviceUrl
;
private
final
StatusInfo
statusInfo
;
protected
Application
(
String
healthUrl
,
String
managementUrl
,
String
serviceUrl
,
String
name
,
String
id
,
StatusInfo
statusInfo
)
{
this
.
healthUrl
=
healthUrl
;
this
.
managementUrl
=
managementUrl
;
this
.
serviceUrl
=
serviceUrl
;
this
.
name
=
name
;
this
.
id
=
id
;
this
.
statusInfo
=
statusInfo
!=
null
?
statusInfo
:
StatusInfo
.
ofUnknown
();
protected
Application
(
Builder
builder
)
{
Assert
.
hasText
(
builder
.
name
,
"name must not be empty!"
);
Assert
.
hasText
(
builder
.
healthUrl
,
"healthUrl must not be empty!"
);
Assert
.
notNull
(
builder
.
statusInfo
,
"statusInfo must not be null!"
);
this
.
healthUrl
=
builder
.
healthUrl
;
this
.
managementUrl
=
builder
.
managementUrl
;
this
.
serviceUrl
=
builder
.
serviceUrl
;
this
.
name
=
builder
.
name
;
this
.
id
=
builder
.
id
;
this
.
statusInfo
=
builder
.
statusInfo
;
}
@JsonCreator
public
static
Application
create
(
@JsonProperty
(
"url"
)
String
url
,
public
static
Application
fromJson
(
@JsonProperty
(
"url"
)
String
url
,
@JsonProperty
(
"managementUrl"
)
String
managementUrl
,
@JsonProperty
(
"healthUrl"
)
String
healthUrl
,
@JsonProperty
(
"serviceUrl"
)
String
serviceUrl
,
@JsonProperty
(
"name"
)
String
name
,
@JsonProperty
(
"id"
)
String
id
,
@JsonProperty
(
"statusInfo"
)
StatusInfo
statusInfo
)
{
Assert
.
hasText
(
name
,
"name must not be empty!"
);
Builder
builder
=
create
(
name
).
withId
(
id
);
if
(
statusInfo
!=
null
)
{
builder
.
withStatusInfo
(
statusInfo
);
}
if
(
StringUtils
.
hasText
(
url
))
{
// old format
return
new
Application
(
url
.
replaceFirst
(
"/+$"
,
""
)
+
"/health"
,
url
,
null
,
name
,
id
,
statusInfo
);
builder
.
withHealthUrl
(
url
.
replaceFirst
(
"/+$"
,
""
)
+
"/health"
).
withManagementUrl
(
url
);
}
else
{
Assert
.
hasText
(
healthUrl
,
"healthUrl must not be empty!"
);
return
new
Application
(
healthUrl
,
managementUrl
,
serviceUrl
,
name
,
id
,
statusInfo
);
builder
.
withHealthUrl
(
healthUrl
).
withManagementUrl
(
managementUrl
)
.
withServiceUrl
(
serviceUrl
);
}
return
builder
.
build
();
}
public
static
Builder
create
(
String
name
)
{
...
...
@@ -78,7 +84,7 @@ public class Application implements Serializable {
private
String
managementUrl
;
private
String
healthUrl
;
private
String
serviceUrl
;
private
StatusInfo
statusInfo
;
private
StatusInfo
statusInfo
=
StatusInfo
.
ofUnknown
()
;
private
Builder
(
String
name
)
{
this
.
name
=
name
;
...
...
@@ -124,7 +130,7 @@ public class Application implements Serializable {
}
public
Application
build
()
{
return
new
Application
(
healthUrl
,
managementUrl
,
serviceUrl
,
name
,
id
,
statusInfo
);
return
new
Application
(
this
);
}
}
...
...
@@ -154,8 +160,8 @@ public class Application implements Serializable {
@Override
public
String
toString
()
{
return
"Application [id="
+
id
+
", name="
+
name
+
", managementUrl="
+
managementUrl
+
", healthUrl="
+
healthUrl
+
", serviceUrl="
+
serviceUrl
+
"]"
;
return
"Application [id="
+
id
+
", name="
+
name
+
", managementUrl="
+
managementUrl
+
", healthUrl="
+
healthUrl
+
", serviceUrl="
+
serviceUrl
+
"]"
;
}
@Override
...
...
spring-boot-admin-starter-client/src/test/java/de/codecentric/boot/admin/model/ApplicationTest.java
View file @
ea5b25de
...
...
@@ -45,12 +45,12 @@ public class ApplicationTest {
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
test_name_expected
()
throws
JsonProcessingException
,
IOException
{
Application
.
create
(
"http://url"
,
""
,
""
,
""
,
""
,
null
,
null
);
Application
.
fromJson
(
"http://url"
,
""
,
""
,
""
,
""
,
null
,
null
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
test_healthUrl_expected
()
throws
JsonProcessingException
,
IOException
{
Application
.
create
(
""
,
""
,
""
,
""
,
"name"
,
null
,
null
);
Application
.
fromJson
(
""
,
""
,
""
,
""
,
"name"
,
null
,
null
);
}
@Test
...
...
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