Skip to content

Commit 88e5187

Browse files
committed
Merge pull request #10 from hawx/use-https-by-default
Use https by default
2 parents f10931b + bd07157 commit 88e5187

23 files changed

+99
-102
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
language: java

esendex-java-sdk.iml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3-
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
3+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false">
44
<output url="file://$MODULE_DIR$/target/classes" />
55
<output-test url="file://$MODULE_DIR$/target/test-classes" />
66
<content url="file://$MODULE_DIR$">

pom.xml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,38 @@
55
<modelVersion>4.0.0</modelVersion>
66
<properties>
77
<buildnumber>0</buildnumber>
8+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
89
</properties>
910
<groupId>esendex-java-sdk</groupId>
1011
<artifactId>esendex-java-sdk</artifactId>
11-
<version>2.2.0</version>
12+
<version>3.0.0</version>
1213
<build>
1314
<plugins>
1415
<plugin>
1516
<artifactId>maven-compiler-plugin</artifactId>
1617
<version>2.3.2</version>
1718
<configuration>
18-
<source>1.8</source>
19-
<target>1.8</target>
19+
<source>1.7</source>
20+
<target>1.7</target>
2021
</configuration>
2122
</plugin>
2223
<plugin>
2324
<groupId>org.apache.maven.plugins</groupId>
2425
<artifactId>maven-failsafe-plugin</artifactId>
25-
<version>2.17</version>
26+
<version>2.19.1</version>
27+
<executions>
28+
<execution>
29+
<goals>
30+
<goal>integration-test</goal>
31+
<goal>verify</goal>
32+
</goals>
33+
</execution>
34+
</executions>
2635
</plugin>
2736
<plugin>
2837
<groupId>org.apache.maven.plugins</groupId>
2938
<artifactId>maven-surefire-plugin</artifactId>
30-
<version>2.17</version>
39+
<version>2.19.1</version>
3140
<dependencies>
3241
<dependency>
3342
<groupId>org.apache.maven.surefire</groupId>

src/main/java/esendex/sdk/java/EsendexProperties.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ public class EsendexProperties {
1515
* The Enum Key.
1616
*/
1717
public enum Key {
18-
VERSION ("esendex.version"),
19-
NAMESPACE ("esendex.namespace"),
20-
DOMAIN ("esendex.domain"),
21-
SURVEYS_DOMAIN("esendex.surveys_domain"),
22-
PORT ("esendex.port"),
23-
BUILD_VERSION("esendex.build_version");
18+
VERSION ("esendex.version"),
19+
NAMESPACE ("esendex.namespace"),
20+
DOMAIN ("esendex.domain"),
21+
SECURE ("esendex.secure"),
22+
SURVEYS_DOMAIN ("esendex.surveys_domain"),
23+
PORT ("esendex.port"),
24+
BUILD_VERSION ("esendex.build_version");
2425

2526
String value;
2627
Key(String v) {

src/main/java/esendex/sdk/java/service/resource/base/Resource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public Resource(Authenticator auth, String id, HttpQuery query, String version,
5252

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

55-
this.secure = false;
55+
this.secure = EsendexProperties.instance().getProperty(EsendexProperties.Key.SECURE).equals("true");
5656
this.account = account;
5757
this.id = id;
5858
this.query = query;

src/main/resources/esendex.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ esendex.version=v1.0
22
esendex.namespace=http://api.esendex.com/ns/
33
esendex.domain=api.esendex.com
44
esendex.surveys_domain=surveys.api.esendex.com
5+
esendex.secure=true
56
esendex.port=80
67
esendex.build_version=${pom.version}
Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,9 @@
11
package com.esendex.java.sdk;
22

3-
import esendex.sdk.java.EsendexException;
43
import esendex.sdk.java.EsendexProperties;
5-
import esendex.sdk.java.ServiceFactory;
6-
import esendex.sdk.java.service.auth.UserPassword;
7-
import esendex.sdk.java.service.impl.IServiceFactory;
84

95
public abstract class BaseTest {
10-
11-
public static boolean IsSessionMode = false;
12-
13-
public static final String USER;
14-
public static final String PASSWORD;
15-
public static final String ACCOUNT;
16-
public static final String DESTINATION_NUMBER;
17-
private static final UserPassword userPassword;
18-
19-
206
static {
21-
EsendexTestProperties testProperties = EsendexTestProperties.instance();
22-
23-
USER = testProperties.getUsername();
24-
PASSWORD = testProperties.getPassword();
25-
ACCOUNT = testProperties.getAccount();
26-
DESTINATION_NUMBER = testProperties.getDestinationNumber();
27-
28-
userPassword = new UserPassword(USER, PASSWORD);
29-
30-
String domain = testProperties.getDomain();
31-
32-
if(domain != null)
33-
EsendexProperties.instance().setProperty("esendex.domain", domain);
34-
}
35-
36-
public static IServiceFactory getFactory() throws EsendexException {
37-
return IsSessionMode
38-
? getBasicFactory()
39-
: getSessionFactory();
40-
}
41-
42-
private static IServiceFactory getBasicFactory() {
43-
44-
if (basicFactory == null)
45-
basicFactory = ServiceFactory.createBasicAuthenticatingFactory(userPassword);
46-
return basicFactory;
47-
}
48-
private static IServiceFactory basicFactory;
49-
50-
private static IServiceFactory getSessionFactory() throws EsendexException {
51-
52-
if (sessionFactory == null)
53-
sessionFactory = ServiceFactory.createSessionAuthenticatingFactory(userPassword);
54-
return sessionFactory;
7+
EsendexProperties.instance().setProperty("esendex.secure", "false");
558
}
56-
private static IServiceFactory sessionFactory;
579
}

src/test/java/com/esendex/java/sdk/SanityTest.java

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package com.esendex.java.sdk.integration;
2+
3+
import com.esendex.java.sdk.EsendexTestProperties;
4+
import esendex.sdk.java.EsendexException;
5+
import esendex.sdk.java.EsendexProperties;
6+
import esendex.sdk.java.ServiceFactory;
7+
import esendex.sdk.java.service.auth.UserPassword;
8+
import esendex.sdk.java.service.impl.IServiceFactory;
9+
10+
public abstract class BaseTest {
11+
12+
public static boolean IsSessionMode = false;
13+
14+
public static final String USER;
15+
public static final String PASSWORD;
16+
public static final String ACCOUNT;
17+
public static final String DESTINATION_NUMBER;
18+
private static final UserPassword userPassword;
19+
20+
21+
static {
22+
EsendexTestProperties testProperties = EsendexTestProperties.instance();
23+
24+
USER = testProperties.getUsername();
25+
PASSWORD = testProperties.getPassword();
26+
ACCOUNT = testProperties.getAccount();
27+
DESTINATION_NUMBER = testProperties.getDestinationNumber();
28+
29+
userPassword = new UserPassword(USER, PASSWORD);
30+
31+
String domain = testProperties.getDomain();
32+
33+
EsendexProperties.instance().setProperty("esendex.secure", "false");
34+
if (domain != null)
35+
EsendexProperties.instance().setProperty("esendex.domain", domain);
36+
}
37+
38+
public static IServiceFactory getFactory() throws EsendexException {
39+
return IsSessionMode
40+
? getBasicFactory()
41+
: getSessionFactory();
42+
}
43+
44+
private static IServiceFactory getBasicFactory() {
45+
46+
if (basicFactory == null)
47+
basicFactory = ServiceFactory.createBasicAuthenticatingFactory(userPassword);
48+
return basicFactory;
49+
}
50+
private static IServiceFactory basicFactory;
51+
52+
private static IServiceFactory getSessionFactory() throws EsendexException {
53+
54+
if (sessionFactory == null)
55+
sessionFactory = ServiceFactory.createSessionAuthenticatingFactory(userPassword);
56+
return sessionFactory;
57+
}
58+
private static IServiceFactory sessionFactory;
59+
}

src/test/java/com/esendex/java/sdk/integration/contactsservice/ContactsServiceGetContactIT.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
package com.esendex.java.sdk.integration.contactsservice;
22

3-
import com.esendex.java.sdk.BaseTest;
3+
import com.esendex.java.sdk.integration.BaseTest;
44
import esendex.sdk.java.EsendexException;
5-
import esendex.sdk.java.model.domain.request.ContactRequest;
65
import esendex.sdk.java.model.domain.response.ContactResponse;
76
import esendex.sdk.java.service.ContactService;
87
import org.junit.BeforeClass;

0 commit comments

Comments
 (0)