Skip to content

Commit 6b4f6b4

Browse files
Merge branch 'master' into uplift-zeromq
2 parents 8a75680 + 33cb700 commit 6b4f6b4

File tree

159 files changed

+10977
-10158
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+10977
-10158
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@
22
build/
33
*.iml
44
.gradle
5+
.classpath
6+
.project
7+
.settings/
8+
/bin/
9+
target/

.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
11
language: java
22
dist: trusty
33
jdk: oraclejdk8
4+
5+
notifications:
6+
webhooks: https://www.travisbuddy.com/
7+
on_success: never
8+
9+
before_deploy:
10+
- ./gradlew clean
11+
- ./gradlew -Pversion=${TRAVIS_TAG:1} assemble
12+
- cp pom.xml build/libs/trex-java-sdk-${TRAVIS_TAG:1}.pom
13+
14+
deploy:
15+
- provider: releases
16+
api_key: "$GITHUB_TOKEN"
17+
file_glob: true
18+
file: "build/libs/*"
19+
skip_cleanup: true
20+
on:
21+
branch: master
22+
tags: true #Deploying only on tagged builds

build.gradle

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,38 @@
11
group 'com.cisco.trex'
2-
version '1.0-SNAPSHOT'
32

43
apply plugin: 'java'
4+
apply plugin: 'maven'
5+
apply plugin: 'com.github.sherter.google-java-format'
56

67
sourceCompatibility = 1.8
78
targetCompatibility = 1.8
89

10+
buildscript {
11+
repositories {
12+
maven {
13+
url "https://plugins.gradle.org/m2/"
14+
}
15+
}
16+
dependencies {
17+
classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.8"
18+
}
19+
}
20+
921
repositories {
1022
mavenCentral()
1123
}
1224

1325
dependencies {
14-
compile group: 'org.pcap4j', name: 'pcap4j-core', version:'1.7.1'
15-
compile group: 'org.pcap4j', name: 'pcap4j-packetfactory-static', version:'1.7.1'
16-
compile group: 'commons-lang', name: 'commons-lang', version:'2.4'
17-
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
26+
compile group: 'org.pcap4j', name: 'pcap4j-packetfactory-static', version:'1.7.7' //1.8.0+ requires java 9
27+
compile group: 'org.apache.commons', name: 'commons-lang3', version:'3.9'
28+
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.26'
29+
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.11.2'
1830
compile group: 'org.zeromq', name: 'jeromq', version:'0.5.1'
19-
compile group: 'com.google.code.gson', name: 'gson', version:'2.7'
31+
compile group: 'com.google.code.gson', name: 'gson', version:'2.8.5'
2032
compile group: 'com.google.guava', name: 'guava', version: '24.0-jre'
21-
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version:'2.6.0'
22-
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.6.0'
33+
compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version:'2.9.8'
2334
testCompile group: 'junit', name: 'junit', version: '4.12'
35+
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.28.2'
2436

2537
sourceSets {
2638
e2eTest {
@@ -33,6 +45,51 @@ dependencies {
3345
}
3446
}
3547

48+
task writePom {
49+
doLast {
50+
pom {
51+
project {
52+
artifactId 'trex-java-sdk'
53+
licenses {
54+
license {
55+
name 'The Apache Software License, Version 2.0'
56+
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
57+
}
58+
}
59+
}
60+
}.writeTo("pom.xml")
61+
}
62+
}
63+
64+
jar {
65+
dependsOn writePom
66+
into("META-INF/maven/$project.group/$project.name") {
67+
from("pom.xml")
68+
}
69+
}
70+
71+
task javadocJar(type: Jar) {
72+
classifier = 'javadoc'
73+
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
74+
from javadoc
75+
}
76+
77+
task sourcesJar(type: Jar) {
78+
classifier = 'sources'
79+
from sourceSets.main.allSource
80+
}
81+
82+
task jarWithDependencies(type: Jar) {
83+
dependsOn writePom
84+
baseName = project.name + '-with-dependencies'
85+
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
86+
with jar
87+
}
88+
89+
artifacts {
90+
archives javadocJar, sourcesJar, jarWithDependencies
91+
}
92+
3693
test {
3794
testLogging {
3895
events "passed", "skipped" , "failed"
Lines changed: 25 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,36 @@
11
package com.cisco.trex.stateless;
22

33
import com.cisco.trex.stateless.exception.TRexConnectionException;
4-
import com.cisco.trex.stateless.exception.TRexTimeoutException;
54
import com.cisco.trex.stateless.model.*;
5+
import java.util.List;
66
import org.slf4j.Logger;
77
import org.slf4j.LoggerFactory;
88

9-
import java.util.Collections;
10-
import java.util.HashMap;
11-
import java.util.List;
12-
import java.util.Map;
13-
149
public class TRexClientApp {
15-
public static TRexClient client = null;
16-
public static final String client_name = "trex-test-user";
17-
public static final String trex_host = "trex.mycompany.com";
18-
public static final String trex_port = "4501";
19-
private static Logger logger = LoggerFactory.getLogger(TRexClientApp.class);
20-
21-
// API usage example. see also:
22-
// https://github.com/cisco-system-traffic-generator/trex-java-sdk/blob/master/src/test/java/com/cisco/trex/stateless/TRexClientTest.java
10+
public static TRexClient client = null;
11+
public static final String client_name = "trex-test-user";
12+
public static final String trex_host = "trex.mycompany.com";
13+
public static final String trex_port = "4501";
14+
private static Logger logger = LoggerFactory.getLogger(TRexClientApp.class);
2315

24-
public static void main(String[] args) {
25-
client = new TRexClient(trex_host, trex_port, client_name);
26-
try {
27-
client.connect();
28-
List<Port> ports = client.getPorts();
29-
System.out.println("Found " + ports.size() + " ports");
30-
List<String> cmds = client.getSupportedCommands();
31-
logger.info("List of available commands:");
32-
for (String cmd : cmds) {
33-
logger.info(" - " + cmd);
34-
}
35-
} catch (TRexConnectionException e) {
36-
e.printStackTrace();
37-
} finally {
38-
client.disconnect();
39-
}
16+
// API usage example. see also:
17+
// https://github.com/cisco-system-traffic-generator/trex-java-sdk/blob/master/src/test/java/com/cisco/trex/stateless/TRexClientTest.java
18+
19+
public static void main(String[] args) {
20+
client = new TRexClient(trex_host, trex_port, client_name);
21+
try {
22+
client.connect();
23+
List<Port> ports = client.getPorts();
24+
System.out.println("Found " + ports.size() + " ports");
25+
List<String> cmds = client.getSupportedCommands();
26+
logger.info("List of available commands:");
27+
for (String cmd : cmds) {
28+
logger.info(" - " + cmd);
29+
}
30+
} catch (TRexConnectionException e) {
31+
e.printStackTrace();
32+
} finally {
33+
client.disconnect();
4034
}
35+
}
4136
}
42-

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
group=com.cisco.trex
2+
archivesBaseName=trex-java-sdk
3+
version=1.0-SNAPSHOT

0 commit comments

Comments
 (0)