-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from KPMP/KPMP-1829_RefactorStateMessages
Kpmp 1829 refactor state messages
- Loading branch information
Showing
8 changed files
with
134 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package org.kpmp.stateManager; | ||
|
||
import org.bson.Document; | ||
import org.springframework.data.annotation.Id; | ||
|
||
@org.springframework.data.mongodb.core.mapping.Document(collection = "stateDisplay") | ||
public class StateDisplay { | ||
|
||
@Id | ||
private String id; | ||
private String state; | ||
private Document apps; | ||
|
||
public String getState() { | ||
return state; | ||
} | ||
|
||
public void setState(String state) { | ||
this.state = state; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public Document getApps() { | ||
return apps; | ||
} | ||
|
||
public void setApps(Document apps) { | ||
this.apps = apps; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/org/kpmp/stateManager/StateDisplayRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package org.kpmp.stateManager; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.mongodb.repository.MongoRepository; | ||
|
||
public interface StateDisplayRepository extends MongoRepository<StateDisplay, String> { | ||
|
||
public List<StateDisplay> findAll(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.kpmp.stateManager; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.mockito.Mockito.mock; | ||
|
||
import org.bson.Document; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mockito.MockitoAnnotations; | ||
|
||
public class StateDisplayTest { | ||
|
||
private StateDisplay stateDisplay; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
MockitoAnnotations.initMocks(this); | ||
stateDisplay = new StateDisplay(); | ||
} | ||
|
||
@After | ||
public void tearDown() throws Exception { | ||
stateDisplay = null; | ||
} | ||
|
||
@Test | ||
public void testSetState() { | ||
stateDisplay.setState("state"); | ||
assertEquals("state", stateDisplay.getState()); | ||
} | ||
|
||
@Test | ||
public void testSetId() { | ||
stateDisplay.setId("displayId"); | ||
assertEquals("displayId", stateDisplay.getId()); | ||
} | ||
|
||
@Test | ||
public void testSetApps() throws Exception { | ||
Document apps = mock(Document.class); | ||
stateDisplay.setApps(apps); | ||
|
||
assertEquals(apps, stateDisplay.getApps()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters