Skip to content
This repository was archived by the owner on Sep 16, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
243b938
:ambulance: Fix for issue #104
pmonks Mar 12, 2018
49cb70f
Updated with latest symphony-java-api 1.50.1
ftbb Mar 13, 2018
e85e8f8
Merge branch 'develop' of https://github.com/symphonyoss/symphony-jav…
pmonks Mar 13, 2018
c77d6fa
:art: Improve unit tests by properly using 'actual' and 'expected' po…
pmonks Mar 13, 2018
880c8e5
Merge pull request #105 from pmonks/develop
ftbb Mar 13, 2018
1bae48c
Excluding jackson-core and jackson-databind 2.9.1 from symphony-java-api
ftbb Mar 13, 2018
0a1c83d
Updated to assertNull from assertEquals
ftbb Mar 13, 2018
0f10b1d
:ambulance: Add deterministic rawGet method so that unit tests don't …
pmonks Mar 13, 2018
7092fcb
:ambulance: Add deterministic rawGet method so that unit tests don't …
pmonks Mar 13, 2018
db58578
:ambulance: Fix fallout from merge
pmonks Mar 13, 2018
cde9d05
Added Symphony Signals API support
Mar 13, 2018
728bcf5
Fix state-changing Unit tests which are modifying System properties.
Mar 14, 2018
81680eb
Merge pull request #107 from pmonks/develop
DovOps Mar 14, 2018
1282298
Merge branch 'develop' of https://github.com/symphonyoss/symphony-jav…
Mar 14, 2018
be0bce6
Merge pull request #108 from dovie/develop
ftbb Mar 14, 2018
d903f01
Added javadoc comments, and signals example.
Apr 1, 2018
226e180
Merge pull request #110 from dovie/develop
ftbb Apr 2, 2018
7b7727c
Improved test coverage.
Apr 3, 2018
2672600
Fixed runtime exception handling on AuthenticationClient which impact…
ftbb Apr 9, 2018
2c0eddc
Merge pull request #111 from dovie/develop
ftbb Apr 9, 2018
df48850
Add tests for client.ai.utils.AiSpellParser from Diffblue Deeptest
JohnLBergqvist Apr 13, 2018
d0d83e3
Merge pull request #114 from DiffBlue-benchmarks/Add-client.ai.utils.…
ftbb May 22, 2018
2c32705
Upgrading SJC to 1.52 spec and fixed Signals clients and objects to r…
ftbb May 22, 2018
8b59ce7
Fixed issue with AuthRefreshTask not taking into account custom http …
ftbb Jul 9, 2018
f8c28cd
1. Set a flexible timeout whilst waiting for getAllUsers() operation to
Jul 26, 2018
99edc10
Add null check.
Jul 26, 2018
8923acc
Fix indentation.
Jul 26, 2018
5b2cd53
Modify configuration for 'get all users timeout' to be managed via
Aug 22, 2018
d91f16d
Merge pull request #121 from blackrock-engineering/develop
Oct 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ The Symphony java client provides a real-time wrapper around the Symphony REST A
## Change log and notes

## V1.1.5 (SNAPSHOT)
* Updated with latest 1.50 spec. symphony-java-api v1.50.1
* Implementation of signals

## V1.1.4
* Major bug fix (1.50+) to accept real-time events that do not include event ids as this is now optional.
Expand Down
4 changes: 2 additions & 2 deletions examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.symphonyoss</groupId>
<artifactId>symphony-client-examples</artifactId>
<version>1.1.4-SNAPSHOT</version>
<version>1.1.5-SNAPSHOT</version>
<name>Symphony Client Examples</name>
<description>Symphony Client Examples</description>

Expand Down Expand Up @@ -67,7 +67,7 @@
<dependency>
<groupId>org.symphonyoss.symphony</groupId>
<artifactId>symphony-client</artifactId>
<version>1.1.3-SNAPSHOT</version>
<version>1.1.5-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.rometools</groupId>
Expand Down
139 changes: 139 additions & 0 deletions examples/signals/SignalsExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
/*
*
*
* Copyright 2018 The Symphony Software Foundation
*
* Licensed to The Symphony Software Foundation (SSF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/

package signals;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.symphonyoss.client.SymphonyClient;
import org.symphonyoss.client.SymphonyClientConfig;
import org.symphonyoss.client.SymphonyClientFactory;
import org.symphonyoss.client.SymphonyClientFactory.TYPE;
import org.symphonyoss.client.exceptions.SignalsException;
import org.symphonyoss.symphony.agent.invoker.ApiException;
import org.symphonyoss.symphony.clients.model.SymSignal;

/**
* Simple example to list signals
* <p>
* It will send a message to a call.home.user and listen/create new Chat
* sessions.
* <p>
* <p>
* <p>
* REQUIRED VM Arguments or System Properties:
* <p>
* -Dtruststore.file= -Dtruststore.password=password
* -Dsessionauth.url=https://(hostname)/sessionauth
* -Dkeyauth.url=https://(hostname)/keyauth
* -Duser.call.home=frank.tarsillo@markit.com -Duser.cert.password=password
* -Duser.cert.file=bot.user2.p12 -Duser.email=bot.user2@domain.com
* -Dpod.url=https://(pod host)/pod -Dagent.url=https://(agent server
* host)/agent -Dreceiver.email=bot.user2@markit.com or bot user email
*
* @author Dov Katz
*/
// NOSONAR
public class SignalsExample {

private final Logger logger = LoggerFactory.getLogger(SignalsExample.class);
private SymphonyClient symClient;

public SignalsExample() {

init();

}

public static void main(String[] args) {

new SignalsExample();

}

public void init() {
logger.info("Signal Client example starting...");

try {

// Create an initialized client
symClient = SymphonyClientFactory.getClient(TYPE.V4);
symClient.init(new SymphonyClientConfig(true));
logger.info("My bot email is {}", symClient.getLocalUser().getEmailAddress());
logger.info("My bot' name is {}", symClient.getLocalUser().getDisplayName());

// List Signals
List<SymSignal> signals = symClient.getSignalsClient().listSignals(0, 10);
logger.info("Found (max 10) {} signals", signals.size());
signals.forEach(signal -> {
logger.info("Signal :{}", signal);
});

// Create Signal
SymSignal signal = new SymSignal();
signal.setVisibleOnProfile(false);
signal.setName("Test Signal " + System.currentTimeMillis());
signal.setQuery("HASHTAG:testSignal AND CASHTAG:money");
signal.setCompanyWide(false);
;
logger.info("Going to create a signal : Name {}, Query: {}", signal.getName(), signal.getQuery());
;
SymSignal result = symClient.getSignalsClient().createSignal(signal);
logger.info("Created Signal ID {}, Name {}", result.getId(), result.getName());
;

// Search for the one we just created
logger.info("Let's search for our new signal");
SymSignal found = symClient.getSignalsClient().getSignal(result.getId());
logger.info("Found signal we just created by ID {} --> {} ( {} )", result.getId(), found.getName(),
found.getQuery());

// Delete Signal
logger.info("Let's delete our signal");
symClient.getSignalsClient().deleteSignal(result.getId());
logger.info("Deleted Signal {}, Let's prove it", result.getId());

// Search for the one we just deleted
try {
found = symClient.getSignalsClient().getSignal(result.getId());
logger.info("We didn't delete the signal, it seems this was found {}: ",found);
} catch (SignalsException sigExc) {
if (sigExc.getCause() instanceof ApiException && ((ApiException) sigExc.getCause()).getCode() == 404) {
logger.info(
"Successfully got a 404 when trying to search for a non-existent signal. Deletion succeeded");
;
}
}
logger.info("Client shutting down.");
symClient.shutdown();
System.exit(0);
} catch (Exception e) {
e.printStackTrace();
}

}

}
4 changes: 2 additions & 2 deletions examples/utils/CopyChatRoom.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ public void init() {

String userName = symClient.getUsersClient().getUserFromId(symMessage.getFromUserId()).getDisplayName();

logger.debug("{}:{}:{}:{}", userName, new Date(Long.valueOf(symMessage.getTimestamp())).toString(), symMessage.getMessage(), symMessage.getAttachments().size());
logger.debug("{}:{}:{}:{}", userName, new Date(Long.valueOf(symMessage.getTimestamp())).toString(), symMessage.getMessage());

if (symMessage.getAttachments().size() > 0) {
if (symMessage.getAttachments() != null && symMessage.getAttachments().size() > 0) {
symAttachmentInfos.addAll(symMessage.getAttachments());


Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.diffblue</groupId>
<artifactId>deeptestutils</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>

<build>
Expand Down
39 changes: 25 additions & 14 deletions symphony-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
~ under the License.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>symphony-java-client</artifactId>
<groupId>org.symphonyoss.symphony</groupId>
Expand All @@ -42,7 +43,7 @@

<properties>
<jsoup-version>1.11.2</jsoup-version>
<symphony-api-version>1.50.0</symphony-api-version>
<symphony-api-version>1.51.0-SNAPSHOT</symphony-api-version>
<gson-version>2.8.2</gson-version>
<org-javassist>3.22.0-GA</org-javassist>
<failsafe.jvm.args>-Dlog4j.configurationFile=src/test/resources/log4j.properties -Xmx1024m
Expand Down Expand Up @@ -70,6 +71,16 @@
<groupId>org.symphonyoss.symphony</groupId>
<artifactId>symphony-authenticator-java-jersey2-client</artifactId>
<version>${symphony-api-version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.symphonyoss.symphony</groupId>
Expand Down Expand Up @@ -152,18 +163,18 @@


<!--<plugin>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-source-plugin</artifactId>-->
<!--<version>2.4</version>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>attach-sources</id>-->
<!--<phase>verify</phase>-->
<!--<goals>-->
<!--<goal>jar-no-fork</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--<groupId>org.apache.maven.plugins</groupId>-->
<!--<artifactId>maven-source-plugin</artifactId>-->
<!--<version>2.4</version>-->
<!--<executions>-->
<!--<execution>-->
<!--<id>attach-sources</id>-->
<!--<phase>verify</phase>-->
<!--<goals>-->
<!--<goal>jar-no-fork</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<!--</plugin>-->


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,13 @@ public interface SymphonyClient {
*/
ShareClient getShareClient();

/**
* Provides instance of the Signals client. This client supports the management of signals.
*
* @return {@link SignalsClient}
*/
SignalsClient getSignalsClient();

/**
* If set, returns the custom http client set during initialization.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,28 @@ public void load() throws ProgramFault {
}


/**
* This method is intended for use in unit tests that need to be able to treat this class as a DTO.
*
* @param id The configuration parameter to retrieve.
* @return The value of that configuration parameter, as stored in memory.
*/
public String rawGet(SymphonyClientConfigID id)
{
return(config.getProperty(id.getPropName()));
}


/**
* This method does some unusual shenanigans that probably belong elsewhere, so that this class can be a true DTO.
* A refactoring task for another day...
*
* @param id The configuration parameter to retrieve.
* @return The value of that configuration parameter, as stored in memory, or one of several Java "system properties"
* or environment variables with names vaguely similar to <code>id</code>. Basically non-deterministic, so YMMV.
*/
public String get(SymphonyClientConfigID id) {
String value = config.getProperty(id.getPropName());
String value = rawGet(id);

if (value == null)
value = System.getProperty(id.getPropName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public static interface UserCredsStep
public static interface BuildStep
{
BuildStep withReceiverEmail(String receiverEmail);
BuildStep withGetAllUsersTimeout(String getAllUsersTimeout);
BuildStep withServices(boolean enabled);
BuildStep withJMXHealthcheck(boolean enabled);
SymphonyClientConfig build();
Expand All @@ -105,6 +106,7 @@ private static class Steps
private String userCertFilename = null;
private char[] userCertPassword = null;
private String receiverEmail = null;
private String getAllUsersTimeout = null;
private boolean servicesEnabled = true;
private boolean jmxHealthCheckEnabled = true;

Expand Down Expand Up @@ -160,6 +162,13 @@ public BuildStep withReceiverEmail(String receiverEmail)
return (this);
}

@Override
public BuildStep withGetAllUsersTimeout(String getAllUsersTimeout)
{
this.getAllUsersTimeout = getAllUsersTimeout;
return (this);
}

@Override
public BuildStep withServices(boolean enabled)
{
Expand All @@ -179,16 +188,18 @@ public SymphonyClientConfig build()
{
SymphonyClientConfig result = new SymphonyClientConfig();

result.set(SymphonyClientConfigID.SESSIONAUTH_URL, this.sessionAuthUrl);
result.set(SymphonyClientConfigID.KEYAUTH_URL, this.keyAuthUrl);
result.set(SymphonyClientConfigID.POD_URL, this.podUrl);
result.set(SymphonyClientConfigID.AGENT_URL, this.agentUrl);
result.set(SymphonyClientConfigID.TRUSTSTORE_FILE, this.trustStoreFilename);
result.set(SymphonyClientConfigID.TRUSTSTORE_PASSWORD, new String(this.trustStorePassword)); // SECURITY HOLE DUE TO STRING INTERNING
result.set(SymphonyClientConfigID.USER_EMAIL, this.userEmail);
result.set(SymphonyClientConfigID.USER_CERT_FILE, this.userCertFilename);
result.set(SymphonyClientConfigID.USER_CERT_PASSWORD, new String(this.userCertPassword)); // SECURITY HOLE DUE TO STRING INTERNING
result.set(SymphonyClientConfigID.RECEIVER_EMAIL, this.receiverEmail);
if (this.sessionAuthUrl != null) result.set(SymphonyClientConfigID.SESSIONAUTH_URL, this.sessionAuthUrl);
if (this.keyAuthUrl != null) result.set(SymphonyClientConfigID.KEYAUTH_URL, this.keyAuthUrl);
if (this.podUrl != null) result.set(SymphonyClientConfigID.POD_URL, this.podUrl);
if (this.agentUrl != null) result.set(SymphonyClientConfigID.AGENT_URL, this.agentUrl);
if (this.trustStoreFilename != null) result.set(SymphonyClientConfigID.TRUSTSTORE_FILE, this.trustStoreFilename);
if (this.trustStorePassword != null) result.set(SymphonyClientConfigID.TRUSTSTORE_PASSWORD, new String(this.trustStorePassword)); // SECURITY HOLE DUE TO STRING INTERNING
if (this.userEmail != null) result.set(SymphonyClientConfigID.USER_EMAIL, this.userEmail);
if (this.userCertFilename != null) result.set(SymphonyClientConfigID.USER_CERT_FILE, this.userCertFilename);
if (this.userCertPassword != null) result.set(SymphonyClientConfigID.USER_CERT_PASSWORD, new String(this.userCertPassword)); // SECURITY HOLE DUE TO STRING INTERNING
if (this.receiverEmail != null) result.set(SymphonyClientConfigID.RECEIVER_EMAIL, this.receiverEmail);
if (this.getAllUsersTimeout != null) result.set(SymphonyClientConfigID.GET_ALL_USERS_TIMEOUT, this.getAllUsersTimeout);

result.set(SymphonyClientConfigID.DISABLE_SERVICES, String.valueOf(!this.servicesEnabled));
result.set(SymphonyClientConfigID.HEALTHCHECK_JMX_ENABLED, String.valueOf(this.jmxHealthCheckEnabled));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public enum SymphonyClientConfigID {
USER_CERT_PASSWORD("javax.net.ssl.keyStorePassword"),
USER_EMAIL,
RECEIVER_EMAIL(false),
GET_ALL_USERS_TIMEOUT(false),
DISABLE_SERVICES(false),
HEALTHCHECK_JMX_ENABLED(false);

Expand Down
Loading