Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
0xMartin committed Sep 18, 2024
1 parent e1dbda0 commit 33dc804
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 4 deletions.
Binary file modified examples/project-example/NATT.jar
Binary file not shown.
Binary file modified natt-config-editor/NATT.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion natt/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ task writeVersionProperties {

processResources.dependsOn writeVersionProperties

version = '1.6.7'
version = '1.7.0'
group = 'utb.fai.natt'
15 changes: 12 additions & 3 deletions natt/src/main/java/utb/fai/natt/core/NATTCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.io.IOException;
import java.io.InputStream;
import java.text.ParseException;
import java.util.LinkedList;
import java.util.Map;
import java.util.Properties;
Expand All @@ -46,6 +47,7 @@ public class NATTCore {
protected PluginLoader pluginLoader;
protected LocalHostIO localHostIO;
protected NetworkIO networkIO;
protected ServerHostUtility serverHostUtility;

// root keyworda, kterou se zacne vykonavani celeho testovani
protected NATTKeyword rootKeyword;
Expand Down Expand Up @@ -80,6 +82,7 @@ public NATTCore(String[] args) throws InternalErrorException {
this.localHostIO = new LocalHostIO("test-config.yaml");
this.networkIO = new NetworkIO("");
this.pluginLoader = new PluginLoader(NATTContext.instance());
this.serverHostUtility = new ServerHostUtility();

/************************************************************************************************************************* */

Expand All @@ -98,11 +101,16 @@ public NATTCore(String[] args) throws InternalErrorException {
options.addOption("kd", "keywordDoc", false,
"List of all registered keywords and their documentation in json format");
options.addOption("k", "keywords", false, "List of all registered keywords");
options.addOption("gui", "gui", false, "The output of the testing tool will be displayed in the GUI");
options.addOption("ht", "host", false,
"Host server for interactive testing. Specify --show-servers to display the option of hosting");
options.addOption("ss", "show-servers", false,
"Show all available servers that can be host and used for interactive testing.");

CommandLine cmd;
try {
cmd = parser.parse(options, args);
} catch (ParseException e) {
} catch (org.apache.commons.cli.ParseException e) {
e.printStackTrace();
throw new InternalErrorException("Failed to parse command line arguments.");
}
Expand Down Expand Up @@ -406,14 +414,15 @@ public void generateReport() throws InternalErrorException {
throw new InternalErrorException("Failed to generate report!");
}

// shrnuti vysledku testovani (vypise vsechny pripadne testovaci pripady ktere selhaly)
// shrnuti vysledku testovani (vypise vsechny pripadne testovaci pripady ktere
// selhaly)
LinkedList<String> list = new LinkedList<>();
NATTContext.instance().getTestCaseResults().stream().forEach(tc -> {
if (!tc.isPassed()) {
list.add(tc.getTestCaseName());
}
});
if(list.isEmpty()) {
if (list.isEmpty()) {
logger.info("All test cases passed.");
} else {
String listStr = list.stream()
Expand Down
48 changes: 48 additions & 0 deletions natt/src/main/java/utb/fai/natt/core/ServerHostUtility.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package utb.fai.natt.core;

import java.util.ArrayList;
import java.util.List;

/**
* This is simple terminal utility class for hosting a simple server for
* purpose of interactive testing. This utility use servers defined in module
* package.
*/
public class ServerHostUtility {

public ServerHostUtility() {

}

/**
* Host a server for interactive testing.
*
* @param option Option of server to host
*/
public void hostServer(String option) {

}

/**
* Get the list of available servers that can be hosted.
*
* @return List of options
*/
public List<String> getHostOptions() {
List<String> opts = new ArrayList<String>();
opts.add("email-server");
opts.add("mqtt-broker");
opts.add("telnet-server");
opts.add("telnet-server-echo");
opts.add("telnet-server-broadcast");
opts.add("http-server");
return opts;
}

/**
* Terminate the server.
*/
public void terminateServer() {
}

}

0 comments on commit 33dc804

Please sign in to comment.