Skip to content

Commit

Permalink
Merge pull request #10 from hawx/use-https-by-default
Browse files Browse the repository at this point in the history
Use https by default
  • Loading branch information
hawx committed Mar 7, 2016
2 parents f10931b + bd07157 commit 88e5187
Show file tree
Hide file tree
Showing 23 changed files with 99 additions and 102 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
language: java
2 changes: 1 addition & 1 deletion esendex-java-sdk.iml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
Expand Down
19 changes: 14 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,38 @@
<modelVersion>4.0.0</modelVersion>
<properties>
<buildnumber>0</buildnumber>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<groupId>esendex-java-sdk</groupId>
<artifactId>esendex-java-sdk</artifactId>
<version>2.2.0</version>
<version>3.0.0</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<version>2.19.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/esendex/sdk/java/EsendexProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ public class EsendexProperties {
* The Enum Key.
*/
public enum Key {
VERSION ("esendex.version"),
NAMESPACE ("esendex.namespace"),
DOMAIN ("esendex.domain"),
SURVEYS_DOMAIN("esendex.surveys_domain"),
PORT ("esendex.port"),
BUILD_VERSION("esendex.build_version");
VERSION ("esendex.version"),
NAMESPACE ("esendex.namespace"),
DOMAIN ("esendex.domain"),
SECURE ("esendex.secure"),
SURVEYS_DOMAIN ("esendex.surveys_domain"),
PORT ("esendex.port"),
BUILD_VERSION ("esendex.build_version");

String value;
Key(String v) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Resource(Authenticator auth, String id, HttpQuery query, String version,

public Resource(Authenticator auth, String account, String id, HttpQuery query, String version) {

this.secure = false;
this.secure = EsendexProperties.instance().getProperty(EsendexProperties.Key.SECURE).equals("true");
this.account = account;
this.id = id;
this.query = query;
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/esendex.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ esendex.version=v1.0
esendex.namespace=http://api.esendex.com/ns/
esendex.domain=api.esendex.com
esendex.surveys_domain=surveys.api.esendex.com
esendex.secure=true
esendex.port=80
esendex.build_version=${pom.version}
50 changes: 1 addition & 49 deletions src/test/java/com/esendex/java/sdk/BaseTest.java
Original file line number Diff line number Diff line change
@@ -1,57 +1,9 @@
package com.esendex.java.sdk;

import esendex.sdk.java.EsendexException;
import esendex.sdk.java.EsendexProperties;
import esendex.sdk.java.ServiceFactory;
import esendex.sdk.java.service.auth.UserPassword;
import esendex.sdk.java.service.impl.IServiceFactory;

public abstract class BaseTest {

public static boolean IsSessionMode = false;

public static final String USER;
public static final String PASSWORD;
public static final String ACCOUNT;
public static final String DESTINATION_NUMBER;
private static final UserPassword userPassword;


static {
EsendexTestProperties testProperties = EsendexTestProperties.instance();

USER = testProperties.getUsername();
PASSWORD = testProperties.getPassword();
ACCOUNT = testProperties.getAccount();
DESTINATION_NUMBER = testProperties.getDestinationNumber();

userPassword = new UserPassword(USER, PASSWORD);

String domain = testProperties.getDomain();

if(domain != null)
EsendexProperties.instance().setProperty("esendex.domain", domain);
}

public static IServiceFactory getFactory() throws EsendexException {
return IsSessionMode
? getBasicFactory()
: getSessionFactory();
}

private static IServiceFactory getBasicFactory() {

if (basicFactory == null)
basicFactory = ServiceFactory.createBasicAuthenticatingFactory(userPassword);
return basicFactory;
}
private static IServiceFactory basicFactory;

private static IServiceFactory getSessionFactory() throws EsendexException {

if (sessionFactory == null)
sessionFactory = ServiceFactory.createSessionAuthenticatingFactory(userPassword);
return sessionFactory;
EsendexProperties.instance().setProperty("esendex.secure", "false");
}
private static IServiceFactory sessionFactory;
}
20 changes: 0 additions & 20 deletions src/test/java/com/esendex/java/sdk/SanityTest.java

This file was deleted.

59 changes: 59 additions & 0 deletions src/test/java/com/esendex/java/sdk/integration/BaseTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package com.esendex.java.sdk.integration;

import com.esendex.java.sdk.EsendexTestProperties;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.EsendexProperties;
import esendex.sdk.java.ServiceFactory;
import esendex.sdk.java.service.auth.UserPassword;
import esendex.sdk.java.service.impl.IServiceFactory;

public abstract class BaseTest {

public static boolean IsSessionMode = false;

public static final String USER;
public static final String PASSWORD;
public static final String ACCOUNT;
public static final String DESTINATION_NUMBER;
private static final UserPassword userPassword;


static {
EsendexTestProperties testProperties = EsendexTestProperties.instance();

USER = testProperties.getUsername();
PASSWORD = testProperties.getPassword();
ACCOUNT = testProperties.getAccount();
DESTINATION_NUMBER = testProperties.getDestinationNumber();

userPassword = new UserPassword(USER, PASSWORD);

String domain = testProperties.getDomain();

EsendexProperties.instance().setProperty("esendex.secure", "false");
if (domain != null)
EsendexProperties.instance().setProperty("esendex.domain", domain);
}

public static IServiceFactory getFactory() throws EsendexException {
return IsSessionMode
? getBasicFactory()
: getSessionFactory();
}

private static IServiceFactory getBasicFactory() {

if (basicFactory == null)
basicFactory = ServiceFactory.createBasicAuthenticatingFactory(userPassword);
return basicFactory;
}
private static IServiceFactory basicFactory;

private static IServiceFactory getSessionFactory() throws EsendexException {

if (sessionFactory == null)
sessionFactory = ServiceFactory.createSessionAuthenticatingFactory(userPassword);
return sessionFactory;
}
private static IServiceFactory sessionFactory;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.esendex.java.sdk.integration.contactsservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.request.ContactRequest;
import esendex.sdk.java.model.domain.response.ContactResponse;
import esendex.sdk.java.service.ContactService;
import org.junit.BeforeClass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package com.esendex.java.sdk.integration.inboxservice;

import com.esendex.java.sdk.BaseTest;
import esendex.sdk.java.EsendexException;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.model.domain.response.InboxMessageCollectionResponse;
import esendex.sdk.java.model.domain.response.InboxMessageResponse;
import esendex.sdk.java.service.InboxService;
import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertTrue;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.inboxservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.response.InboxMessageCollectionResponse;
import esendex.sdk.java.model.domain.response.InboxMessageResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.inboxservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.response.InboxMessageCollectionResponse;
import esendex.sdk.java.model.domain.response.InboxMessageResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.inboxservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.response.InboxMessageCollectionResponse;
import esendex.sdk.java.model.domain.response.InboxMessageResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.inboxservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.response.InboxMessageResponse;
import esendex.sdk.java.service.InboxService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.messagingservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.request.SmsMessageCollectionRequest;
import esendex.sdk.java.model.domain.request.SmsMessageRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.messagingservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.request.SmsMessageCollectionRequest;
import esendex.sdk.java.model.domain.request.SmsMessageRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.messagingservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.request.SmsMessageRequest;
import esendex.sdk.java.model.domain.response.MessageResultResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.messagingservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.request.SmsMessageRequest;
import esendex.sdk.java.model.domain.response.MessageResultResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.messagingservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.request.SmsMessageRequest;
import esendex.sdk.java.model.domain.response.MessageResultResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.sentservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.response.SentMessageCollectionResponse;
import esendex.sdk.java.model.domain.response.SentMessageResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.sentservice;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.response.SentMessageCollectionResponse;
import esendex.sdk.java.model.domain.response.SentMessageResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.esendex.java.sdk.integration.sentservice.session;

import com.esendex.java.sdk.BaseTest;
import com.esendex.java.sdk.integration.BaseTest;
import esendex.sdk.java.EsendexException;
import esendex.sdk.java.model.domain.response.SentMessageCollectionResponse;
import esendex.sdk.java.model.domain.response.SentMessageResponse;
Expand Down

0 comments on commit 88e5187

Please sign in to comment.