Skip to content

Commit

Permalink
fix persistence code to handle empty refId values; remove dud applica…
Browse files Browse the repository at this point in the history
…tion properties test class; re-loadchanged webapp
  • Loading branch information
js1972 committed Mar 17, 2014
1 parent 6ca5e87 commit 156a38a
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 89 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ Contributing
------------
Contributions are very welcome. Pimon is light years ahead of SAP's standard toolset in usability and performance, but there is still allot to do to make this the best way to monitor your PI systems. The code base needs work... There are still exceptions that raise "oh shit". Test coverage is poor! ;-)

To setup NWDS for editing the source and contributing via Github there is a little bit of painful setup that needs to be done first. It all to do with SAP's antiquated NWDS and Development Component model. Maybe there are better ways, but the below seems to work:
To setup NWDS for editing the source and contributing via Github there is a little bit of painful setup that needs to be done first. It's all to do with SAP's antiquated NWDS and Development Component model. Maybe there are better ways, but the below seems to work:

1. Download the sca file from the GitHub releases page
2. Import the sca into NWDS. Switch the the Development Component perspective and right-click the LocalDevelopment folder and choose Import.
3. Create Eclipse projects. Right-click each Development Component and choose "Sync / Create Project"
4. Close NWDS
5. In Windows Explorer, navigate to the Development Component Workspace -> LocalDevelopment. If your NWDS Workspace is called "myworkspace", then the folder is myworkspace.jdi. Therefore the path would be /myworkspace.jdi/LocalDevelopment/. Rename the ZPIMON SC to something else
6. While still in /myworkspace.jdi/LocalDevelopment/ use git to clone this repo
7. Open NWDS again and manage your changes with git and send pull requests.
7. Open NWDS again and manage your changes with git and send pull requests
8. If JUnit tests are not working then ensure your project -> Java Build Path -> Libraries includes: mockito (mockito-all-1.9.5.jar) as an external JAR and JUnit 4 as a Library. For some reason these settings seem to get lost when setting up a new development environment (another one of the mysteries of NWDS).


URL: http://<host>:<port>/zpimonui/index.html
Expand Down
2 changes: 1 addition & 1 deletion jaylin.com.au/zpi_dict/_comp/dependencies.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Metamodel Dependencies
#Tue Jan 21 09:00:10 WST 2014
#Wed Mar 12 08:33:46 WST 2014
@0@//DtDictionary/DtDbTable\:.Z_PIMESSAGE=//DtDictionary/DtSimpleType\:com.sap.dictionary.timestamp
@1@//DtDictionary/DtDbTable\:.Z_PIMESSAGE=//DtDictionary/DtSimpleType\:com.sap.dictionary.string
Original file line number Diff line number Diff line change
Expand Up @@ -262,18 +262,17 @@ private void setupWSFilterParams() {
* retrieve the message payload.
* Also scan the payload to determine the refId field which is what
* we use to group together messages.
* Save any sycn message conversation id's for later processing.
* Save any sync message conversation id's for later processing.
*
* @param msgKey
* @param msgId
* @return MessageDetails - an object containing the refId and
* payload as Strings.
* @return MessageDetails - an object containing the refId and payload as Strings.
*/
private MessageDetails callMessageDetailsWS(String msgKey, String msgId) {
MessageDetails md = new MessageDetails();
byte[] byteArray = null;

if (msgKey == null || msgKey == "") {
if (msgKey == null || msgKey.equals("")) {
return md;
}

Expand Down Expand Up @@ -425,6 +424,9 @@ private void groupAndStoreMessages(List<AdapterFrameworkData> msgs) {

private void persistMessageEntities() {
for (PIMessage m : messagesToStore) {
if (m.getRef_id() == null || m.getRef_id().equals("")) {
m.setRef_id("*** NO REF ID ***");
}
piMessageFacade.update(m); //actually performs an upsert!
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import javax.xml.ws.BindingProvider;
import javax.xml.ws.WebServiceRef;

import com.sap.tc.logging.Location;

import adaptermessagemonitoringwsd.AdapterMessageMonitoring;
import adaptermessagemonitoringwsd.AdapterMessageMonitoringVi;

Expand All @@ -21,6 +23,7 @@ public class WebServiceEndPoint implements WebServiceEndPointLocal {
private AdapterMessageMonitoring webServiceReference;

AdapterMessageMonitoringVi port;
private Location logger = Location.getLocation("pimon.application.ejb");


public WebServiceEndPoint() {
Expand All @@ -31,6 +34,9 @@ public void postInjectionConstructor() {
port = webServiceReference.getBasicPort();
BindingProvider bp = (BindingProvider)port;

// log properties
logger.infoT("WS Endpoint - Application Properties host: " + properties.getHostUrl() + "/AdapterMessageMonitoring/basic?style=document");

bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, properties.getUsername());
bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, properties.getPassword());
bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, properties.getHostUrl() + "/AdapterMessageMonitoring/basic?style=document");
Expand Down

This file was deleted.

2 changes: 2 additions & 0 deletions jaylin.com.au/zpi_html/_comp/WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<!--
<login-config>
<auth-method>FORM</auth-method>
</login-config>
-->
<!-- This role is mapped to a SAP UME role via web-j2ee-engine.xml -->
<security-role>
<role-name>ZPIMON_UI</role-name>
Expand Down
4 changes: 2 additions & 2 deletions jaylin.com.au/zpi_html/_comp/WebContent/css/pimon.css

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions jaylin.com.au/zpi_html/_comp/WebContent/css/pimonstats.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion jaylin.com.au/zpi_html/_comp/WebContent/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</a>
<ul class="dropdown-menu pimon-notifications" role="menu">
<li class="dropdown-header">
<i class="icon-bell"></i> Notifications
<i class="icon-bell"></i> Notifications (last 30-days)
</li>
<li>
<a href="javascript:;" tabindex="-1" role="menuitem">You have no notifications.</a>
Expand Down
2 changes: 1 addition & 1 deletion jaylin.com.au/zpi_html/_comp/WebContent/js/pimon.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions jaylin.com.au/zpi_html/_comp/WebContent/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h1>pimon dashboard</h1>

<div class="col-sm-8">
<div class="row">

<h3 class="stats-tabs-header">30-day history:</h3>
<!-- TABS -->
<ul class="nav nav-tabs pimon-tab-panel">
<li class="active"><a href="#tab-iflow-guages" data-toggle="tab">iFlows</a></li>
Expand All @@ -113,7 +113,6 @@ <h1>pimon dashboard</h1>
<div id="gaugeMessageOutstandingErrorsPerDay" class="js-guage"></div>
</div>
</div>

</div> <!-- end of row -->

<div class="row">
Expand Down
3 changes: 3 additions & 0 deletions jaylin.com.au/zpi_web/_comp/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
<classpath>
<classpathentry kind="src" path=".apt_generated"/>
<classpathentry kind="src" path="source"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="com.sap.ide.dii.jdt.requiredDcs"/>
<classpathentry kind="lib" path="C:/MyScratchFolder/jars/mockito/mockito-all-1.9.5.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<wb-resource deploy-path="/" source-path="/WebContent"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/.apt_generated"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/source"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/test"/>
<property name="context-root" value="LocalDevelopment~zpi_web~jaylin.com.au"/>
<property name="java-output-path" value="/LocalDevelopment~zpi_web~jaylin.com.au/bin"/>
</wb-module>
Expand Down

0 comments on commit 156a38a

Please sign in to comment.