Skip to content

Commit 194e716

Browse files
#70 added code coverage tool to pom.xml, and a BuiltinHttpClientFactoryTest test
1 parent 0cdfb8d commit 194e716

File tree

3 files changed

+50
-6
lines changed

3 files changed

+50
-6
lines changed

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,33 +40,45 @@ additions to the SoftLayer API.
4040
<dependency>
4141
<groupId>com.softlayer.api</groupId>
4242
<artifactId>softlayer-api-client</artifactId>
43-
<version>0.3.1</version>
43+
<version>0.3.2</version>
4444
</dependency>
4545
```
4646

4747
### Gradle
4848

4949
```groovy
50-
implementation 'com.softlayer.api:softlayer-api-client:0.3.1'
50+
implementation 'com.softlayer.api:softlayer-api-client:0.3.2'
5151
```
5252

5353
### Kotlin
5454

5555
```kotlin
56-
compile("com.softlayer.api:softlayer-api-client:0.3.1")
56+
compile("com.softlayer.api:softlayer-api-client:0.3.2")
5757
```
5858

5959
### Creating a Client
6060

6161
All clients are instances of `ApiClient`. Currently there is only one implementation, the `RestApiClient`. Simply
6262
instantiate it and provide your credentials:
6363

64+
65+
#### Username and API Key
66+
For using a Classic Infrastructure or IBM Cloud API key. When using the IBM Cloud Api key, your username is litterally `apikey`, more information about that can be found on the SLDN [Authenticating to the SoftLayer API](https://sldn.softlayer.com/article/authenticating-softlayer-api/#cloud-api) article.
67+
6468
```java
6569
import com.softlayer.api.*;
6670

6771
ApiClient client = new RestApiClient().withCredentials("my user", "my api key");
6872
```
6973

74+
#### Acesses Token
75+
Information on how to get a temoprary api token can be found on the SLDN [Authenticating to the SoftLayer API](https://sldn.softlayer.com/article/authenticating-softlayer-api/#temp-token) article.
76+
77+
```java
78+
import com.softlayer.api.*;
79+
ApiClient client = new RestApiClient().withBearerToken("qqqqwwwweeeaaassddd....");
80+
```
81+
7082
If the end point isn't at the normal SoftLayer API, you can provide the prefix to the constructor of the
7183
`RestApiClient`. By default it is set to the public API endpoint, `https://api.softlayer.com/rest/v3.1/`.
7284

@@ -296,4 +308,4 @@ fully qualified class name of your implementation on a single line in a file in
296308

297309
## Copyright
298310

299-
This software is Copyright (c) 2020 The SoftLayer Developer Network. See the bundled LICENSE file for more information.
311+
This software is Copyright (c) 2021 The SoftLayer Developer Network. See the bundled LICENSE file for more information.

pom.xml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<artifactId>softlayer-api-client</artifactId>
55
<packaging>jar</packaging>
66
<!-- Please keep version in sync with README -->
7-
<version>0.3.1</version>
7+
<version>0.3.2</version>
88
<name>SoftLayer API Client for Java</name>
99
<description>API client for accessing the SoftLayer API</description>
1010
<url>http://sldn.softlayer.com</url>
@@ -40,7 +40,7 @@
4040
<connection>scm:git:git@github.com:softlayer/softlayer-java.git</connection>
4141
<developerConnection>scm:git:git@github.com:softlayer/softlayer-java.git</developerConnection>
4242
<url>git@github.com:softlayer/softlayer-java.git</url>
43-
<tag>0.3.1</tag>
43+
<tag>0.3.2</tag>
4444
</scm>
4545
<properties>
4646
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -161,6 +161,30 @@
161161
</execution>
162162
</executions>
163163
</plugin>
164+
<plugin>
165+
<groupId>org.jacoco</groupId>
166+
<artifactId>jacoco-maven-plugin</artifactId>
167+
<version>0.8.6</version>
168+
<configuration>
169+
<excludes>
170+
<exclude>**/*com/softlayer/api/service/**/*</exclude>
171+
</excludes>
172+
</configuration>
173+
<executions>
174+
<execution>
175+
<goals>
176+
<goal>prepare-agent</goal>
177+
</goals>
178+
</execution>
179+
<execution>
180+
<id>report</id>
181+
<phase>prepare-package</phase>
182+
<goals>
183+
<goal>report</goal>
184+
</goals>
185+
</execution>
186+
</executions>
187+
</plugin>
164188
</plugins>
165189
</build>
166190
</project>

src/test/java/com/softlayer/api/http/BuiltInHttpClientFactoryTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ public void testGetThreadPoolDefaultsToDaemonThreads() throws Exception {
2323
assertTrue(daemon);
2424
}
2525

26+
@Test
27+
public void testGetThreadPoolLazyLoading() {
28+
BuiltInHttpClientFactory factory = new BuiltInHttpClientFactory();
29+
ExecutorService threadPool = factory.getThreadPool();
30+
assertNotNull(threadPool);
31+
assertEquals(threadPool, factory.getThreadPool());
32+
}
33+
2634
@Test
2735
public void testSetThreadPoolShutsDownNonUserDefined() {
2836
BuiltInHttpClientFactory factory = new BuiltInHttpClientFactory();

0 commit comments

Comments
 (0)