Skip to content

Commit 4b2a40a

Browse files
kkorotkovr-brown
authored andcommitted
Refactor demo to prepare for multiple examples
1 parent 04d889a commit 4b2a40a

10 files changed

Lines changed: 581 additions & 440 deletions

File tree

NetLicensingClient-demo/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747
</transformers>
4848
</configuration>
4949
</plugin>
50+
<plugin>
51+
<groupId>org.apache.maven.plugins</groupId>
52+
<artifactId>maven-surefire-plugin</artifactId>
53+
<configuration>
54+
<!-- Do not execute unit tests on build.
55+
Unit tests in this project are used
56+
for manual run of API examples. -->
57+
<skipTests>true</skipTests>
58+
</configuration>
59+
</plugin>
5060
</plugins>
5161
</build>
5262

@@ -60,6 +70,14 @@
6070
<groupId>commons-io</groupId>
6171
<artifactId>commons-io</artifactId>
6272
</dependency>
73+
<dependency>
74+
<groupId>commons-cli</groupId>
75+
<artifactId>commons-cli</artifactId>
76+
</dependency>
77+
<dependency>
78+
<groupId>junit</groupId>
79+
<artifactId>junit</artifactId>
80+
</dependency>
6381
</dependencies>
6482

6583
</project>

NetLicensingClient-demo/src/main/java/com/labs64/netlicensing/demo/NetLicensingClientDemo.java

Lines changed: 40 additions & 439 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.labs64.netlicensing.examples;
2+
3+
import java.util.HashMap;
4+
import java.util.Map;
5+
6+
public class AllExamples {
7+
8+
public static Map<String, Class<? extends NetLicensingExample>> list = new HashMap<>();
9+
10+
private static void addExample(Class<? extends NetLicensingExample> exampleClass) {
11+
list.put(exampleClass.getSimpleName(), exampleClass);
12+
}
13+
14+
static
15+
{
16+
addExample(CallEveryAPIMethod.class);
17+
}
18+
}

NetLicensingClient-demo/src/main/java/com/labs64/netlicensing/examples/CallEveryAPIMethod.java

Lines changed: 469 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.labs64.netlicensing.examples;
2+
3+
public interface NetLicensingExample {
4+
5+
void execute();
6+
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Classes in this package contain NetLicensing API examples for various use cases.
3+
*/
4+
package com.labs64.netlicensing.examples;

NetLicensingClient-demo/src/main/java/com/labs64/netlicensing/demo/ConsoleWriter.java renamed to NetLicensingClient-demo/src/main/java/com/labs64/netlicensing/utils/ConsoleWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* See the License for the specific language governing permissions and
1111
* limitations under the License.
1212
*/
13-
package com.labs64.netlicensing.demo;
13+
package com.labs64.netlicensing.utils;
1414

1515
import static java.lang.System.out;
1616

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Utilities used in NetLicensing examples
3+
*/
4+
package com.labs64.netlicensing.utils;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.labs64.netlicensing.examples;
2+
3+
import org.junit.Test;
4+
5+
public class RunExamples {
6+
7+
@Test
8+
public void testExampleCallForEveryMethod() {
9+
new CallEveryAPIMethod().execute();
10+
}
11+
12+
}

pom.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
<commons-collections4.version>4.2</commons-collections4.version>
7979
<commons-codec.version>1.11</commons-codec.version>
8080
<commons-io.version>2.6</commons-io.version>
81+
<commons-cli.version>1.4</commons-cli.version>
8182
<log4j.version>1.2.17</log4j.version>
8283
<slf4j.version>1.7.25</slf4j.version>
8384
<junit.version>4.13.1</junit.version>
@@ -282,6 +283,13 @@
282283
<scope>compile</scope>
283284
<optional>true</optional>
284285
</dependency>
286+
<dependency>
287+
<groupId>commons-cli</groupId>
288+
<artifactId>commons-cli</artifactId>
289+
<version>${commons-cli.version}</version>
290+
<scope>compile</scope>
291+
<optional>true</optional>
292+
</dependency>
285293
<dependency>
286294
<groupId>org.glassfish.jersey.core</groupId>
287295
<artifactId>jersey-client</artifactId>

0 commit comments

Comments
 (0)