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 #355 from poorva1209/master
Updated log manager and related docs
- Loading branch information
Showing
30 changed files
with
653 additions
and
316 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
{"id":"vvo","description":"VVO app","creator":"pnnl","inputs":["/topic/goss.gridappsd.fncs.output"],"outputs":["/topic/goss.gridappsd.fncs.input"],"options":"SIMULATION_ID","execution_path":"app/vvoapp.py","type":"PYTHON","launch_on_startup":false,"prereqs":["fncs-goss-bridge"],"multiple_instances":true} | ||
{ | ||
"id":"vvo", | ||
"description":"VVO app", | ||
"creator":"pnnl", | ||
"inputs":["/topic/goss.gridappsd.fncs.output"], | ||
"outputs":["/topic/goss.gridappsd.fncs.input"] | ||
,"options":"SIMULATION_ID", | ||
"execution_path":"app/vvoapp.py", | ||
"type":"PYTHON", | ||
"launch_on_startup":false, | ||
"prereqs":["fncs-goss-bridge"], | ||
"multiple_instances":true | ||
} |
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 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>docs</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
</buildSpec> | ||
<natures> | ||
</natures> | ||
</projectDescription> |
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,45 @@ | ||
|
||
Supported Application Types | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
- Python | ||
- Java (Jar) | ||
|
||
Registering Application With Platform | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
Assumptions: GOSS-GridAPPS-D repository (https://github.com/GRIDAPPSD/GOSS-GridAPPS-D.git) is cloned under [ROOT_DIR] | ||
|
||
1. Create a [app_name].config file in JSON format with keys and values as described below. where app_name should be unique for the application. | ||
|
||
:: | ||
{ | ||
"id":"app_name", | ||
"description":"This is desxription of the app", | ||
"creator":"orgnization name", | ||
"inputs":["topic.goss.gridappsd.input1", "topic.goss.gridappsd.input2", ..], | ||
"outputs":["topic.goss.gridappsd.output1", "topic.goss.gridappsd.output2", ..], | ||
"options":"space saperated command line input options", | ||
"execution_path":"absolute/execution/path", | ||
"type":"PYTHON|JAVA", | ||
"launch_on_startup":true|false, | ||
"prereqs":["other_app","other_service",..], | ||
"multiple_instances":true|false | ||
} | ||
|
||
2. Put [app_name].config file in applications folder under cloned repository location | ||
|
||
3. Put your application under applications/[app_name] folder under cloned repository location as shown below. | ||
|
||
:: | ||
applications | ||
[app_name] | ||
app | ||
Your application goes here | ||
test | ||
Test scripts for your application goes here. | ||
|
||
See Using GridAPPSD section for details on starting a simulation from an application and communicating with plaform. | ||
It also has an example in Python and Java to start a simulation. |
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
67 changes: 67 additions & 0 deletions
67
gov.pnnl.goss.gridappsd.test/src/gov/pnnl/goss/gridappsd/test/LogManagerTest.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,67 @@ | ||
package gov.pnnl.goss.gridappsd.test; | ||
|
||
import gov.pnnl.goss.gridappsd.dto.LogMessage; | ||
import gov.pnnl.goss.gridappsd.dto.LogMessage.LogLevel; | ||
import gov.pnnl.goss.gridappsd.dto.LogMessage.ProcessStatus; | ||
|
||
import java.io.Serializable; | ||
|
||
import javax.jms.JMSException; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
|
||
import org.apache.http.auth.Credentials; | ||
import org.apache.http.auth.UsernamePasswordCredentials; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.mockito.runners.MockitoJUnitRunner; | ||
|
||
import pnnl.goss.core.Client; | ||
import pnnl.goss.core.Client.PROTOCOL; | ||
import pnnl.goss.core.ClientFactory; | ||
import pnnl.goss.core.DataResponse; | ||
import pnnl.goss.core.GossResponseEvent; | ||
import pnnl.goss.core.client.ClientServiceFactory; | ||
|
||
@RunWith(MockitoJUnitRunner.class) | ||
public class LogManagerTest { | ||
|
||
Client client; | ||
|
||
@Before | ||
public void setup() throws Exception{ | ||
ClientFactory clientFactory = new ClientServiceFactory(); | ||
Credentials credentials = new UsernamePasswordCredentials( | ||
"system", "manager"); | ||
client = clientFactory.create(PROTOCOL.STOMP, credentials); | ||
} | ||
|
||
@Test | ||
public void sendLogMessage() throws JMSException{ | ||
|
||
String destination = "goss.gridappsd.process.log"; | ||
|
||
String process_id = "test"; | ||
long timestamp = System.currentTimeMillis(); | ||
String log_message = "this is a test"; | ||
LogLevel log_level = LogLevel.DEBUG; | ||
ProcessStatus process_status = ProcessStatus.RUNNING; | ||
Boolean storeToDB = true; | ||
LogMessage logMessage = new LogMessage(process_id, timestamp, log_message, log_level, process_status, storeToDB); | ||
|
||
String id = client.getResponse(logMessage, destination, null).toString(); | ||
|
||
client.subscribe("goss.gridappsd.response.data."+id, new GossResponseEvent() { | ||
|
||
@Override | ||
public void onMessage(Serializable message) { | ||
DataResponse response = (DataResponse)message; | ||
assertNotNull(response.getData()); | ||
|
||
} | ||
}); | ||
|
||
} | ||
|
||
} |
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
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
Oops, something went wrong.