Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
HFTSoftwareProject
junittestlauncher
Commits
e1d4c672
Commit
e1d4c672
authored
Jul 01, 2020
by
Kammleiter
Browse files
temp disable shutdown
parent
85876e23
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/hftstuttgart/junitlauncher/rest/TaskUpload.java
View file @
e1d4c672
...
@@ -27,31 +27,31 @@ public class TaskUpload {
...
@@ -27,31 +27,31 @@ public class TaskUpload {
@PostConstruct
@PostConstruct
public
void
startTest
()
{
public
void
startTest
()
{
String
env
=
System
.
getenv
(
"job_id"
);
//
String env = System.getenv("job_id");
if
(
env
==
null
||
env
.
equals
(
""
))
{
//
if(env == null || env.equals("")) {
throw
new
IllegalArgumentException
(
"Environment variable env not set"
);
//
throw new IllegalArgumentException("Environment variable env not set");
}
//
}
LOG
.
info
(
"Running jobId: "
+
env
);
//
LOG.info("Running jobId: " + env);
UserResult
jUnitResult
=
null
;
//
UserResult jUnitResult = null;
try
{
//
try {
jUnitResult
=
jUnitTestHelper
.
runUnitTests
();
//
jUnitResult = jUnitTestHelper.runUnitTests();
LOG
.
info
(
"jUnitResult: "
+
jUnitResult
.
getCompilationErrors
()
+
jUnitResult
.
getTestResults
());
//
LOG.info("jUnitResult: " + jUnitResult.getCompilationErrors() + jUnitResult.getTestResults());
}
catch
(
IOException
|
ClassNotFoundException
e
)
{
//
} catch (IOException | ClassNotFoundException e) {
LOG
.
error
(
"Error while compiling or testing"
,
e
);
//
LOG.error("Error while compiling or testing", e);
}
//
}
LOG
.
info
(
"Posting UserResult to backend at: "
+
this
.
backendUrl
);
//
LOG.info("Posting UserResult to backend at: " + this.backendUrl);
ResponseEntity
<
Void
>
response
=
null
;
//
ResponseEntity<Void> response = null;
try
{
//
try {
response
=
new
RestTemplate
().
postForEntity
(
this
.
backendUrl
+
"?jobID="
+
env
,
jUnitResult
,
Void
.
class
);
//
response = new RestTemplate().postForEntity(this.backendUrl + "?jobID=" + env, jUnitResult, Void.class);
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
LOG
.
error
(
"Error while Posting to backend: "
+
e
.
getMessage
());
//
LOG.error("Error while Posting to backend: " + e.getMessage());
// System.exit(0);
//
// System.exit(0);
}
//
}
if
(
response
.
getStatusCode
()
!=
HttpStatus
.
OK
)
{
//
if (response.getStatusCode() != HttpStatus.OK) {
LOG
.
error
(
"Error while Posting to backend: "
+
response
.
toString
());
//
LOG.error("Error while Posting to backend: " + response.toString());
}
else
{
//
} else {
LOG
.
info
(
"Successfully tested and sent"
);
//
LOG.info("Successfully tested and sent");
}
//
}
// System.exit(0);
//
// System.exit(0);
}
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment