Skip to content

Commit

Permalink
Merge pull request #1 from MicroFocus/daniel_rebrand_product_name
Browse files Browse the repository at this point in the history
removing or changing "LoadRunner" and "LRE" expressions to "OpenText Enterprise Performance Engineering"
  • Loading branch information
danieldanan authored Jan 21, 2025
2 parents 429c4f4 + 24528e0 commit b5c1fdb
Show file tree
Hide file tree
Showing 10 changed files with 521 additions and 440 deletions.
50 changes: 25 additions & 25 deletions README.md

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'LoadRunner Enterprise Test Execution Action'
description: 'Run test in LoadRunner Enterprise'
name: 'OpenText Enterprise Performance Engineering Test Execution Action'
description: 'Run test in OpenText Enterprise Performance Engineering'
author: 'OpenText'
branding:
color: 'blue'
Expand All @@ -13,16 +13,16 @@ inputs:
required: false
lre_server:
description: >-
'LRE Server, port (when not mentionned, default is 80 or 433 for secured)
'Server, port (when not mentionned, default is 80 or 433 for secured)
and tenant (when not mentionned, default is ?tenant=fa128c06-5436-413d-9cfa-9f04bb738df3).
e.g.: mylreserver.mydomain.com:81/?tenant=fa128c06-5436-413d-9cfa-9f04bb738df3'
e.g.: myserver.mydomain.com:81/?tenant=fa128c06-5436-413d-9cfa-9f04bb738df3'
required: true
lre_https_protocol:
description: 'Use secured protocol for connecting to LRE. Possible values: true or false'
required: false
default: 'false'
lre_authenticate_with_token:
description: 'Authenticate with LRE token. Required when SSO is configured in LRE. Possible values: true or false'
description: 'Authenticate with token (access key). Required when SSO is configured in the server. Possible values: true or false'
required: false
default: 'false'
lre_username:
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

</plugins>
</build>
<version>1.0-SNAPSHOT</version>
<version>1.1-SNAPSHOT</version>
<name>lreactions</name>
<url>http://maven.apache.org</url>
<dependencies>
Expand Down
43 changes: 23 additions & 20 deletions java/src/main/java/com/opentext/lre/actions/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ public class Main
private static final int PORT = 57395;
private static ServerSocket serverSocket;
private static LreTestRunModel lreTestRunModel;
//public static final String artifactsResourceName = "LreResult";

public static void main( String[] args ) throws Exception {
int exit = 0;
Expand Down Expand Up @@ -61,31 +60,15 @@ private static void releaseSocket() {
}

private static void initEnvironmentVariables(String[] args) throws Exception {
InputRetriever inputRetriever = new InputRetriever(args);
lreTestRunModel = inputRetriever.getLreTestRunModel();
InputRetriever inputRetriever = new InputRetriever(args);
lreTestRunModel = inputRetriever.getLreTestRunModel();
}

private static int performOperations() {
int exit = 0;
try {
if (lreTestRunModel != null) {
DateFormatter dateFormatter = new DateFormatter("_E_yyyy_MMM_dd_'at'_HH_mm_ss_SSS_a_zzz");
String logFileName = "lre_run_test_" + dateFormatter.getDate() + ".log";
File dir = new File(Paths.get(lreTestRunModel.getWorkspace(), artifactsResourceName, logFileName).toString());
if(!dir.getParentFile().exists()) {
try {
Files.createDirectory(dir.getParentFile().toPath());
} catch (IOException e) {
if(!dir.getParentFile().exists()) {
boolean isDirectoryCreated = dir.getParentFile().mkdirs();
if (isDirectoryCreated) {
throw new IOException("could not create directory " + dir.getParentFile().toString());
}
}
}
}
LogHelper.setup(dir.getAbsolutePath(), lreTestRunModel.isEnableStacktrace());
LogHelper.log(LocalizationManager.getString("BeginningLRETestExecution"), true);
PrepareLogger();
LreTestRunBuilder lreTestRunBuilder = new LreTestRunBuilder(lreTestRunModel);
boolean buildSuccess = lreTestRunBuilder.perform();
if(buildSuccess) {
Expand All @@ -105,4 +88,24 @@ private static int performOperations() {
}
return exit;
}

private static void PrepareLogger() throws IOException {
DateFormatter dateFormatter = new DateFormatter("_E_yyyy_MMM_dd_'at'_HH_mm_ss_SSS_a_zzz");
String logFileName = "lre_run_test_" + dateFormatter.getDate() + ".log";
File dir = new File(Paths.get(lreTestRunModel.getWorkspace(), artifactsResourceName, logFileName).toString());
if(!dir.getParentFile().exists()) {
try {
Files.createDirectory(dir.getParentFile().toPath());
} catch (IOException e) {
if(!dir.getParentFile().exists()) {
boolean isDirectoryCreated = dir.getParentFile().mkdirs();
if (isDirectoryCreated) {
throw new IOException("could not create directory " + dir.getParentFile().toString());
}
}
}
}
LogHelper.setup(dir.getAbsolutePath(), lreTestRunModel.isEnableStacktrace());
LogHelper.log(LocalizationManager.getString("BeginningLRETestExecution"), true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.opentext.lre.actions.common.helpers;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Path;

import com.opentext.lre.actions.common.helpers.utils.LogHelper;
import org.json.JSONObject;

public class OutputUpdater {
private String parameterKey = "lre_run_id";
private String filePath;
public OutputUpdater(Path workspace)
{
String directoryPath = workspace != null ? workspace.toString() : System.getProperty("user.dir");
filePath = directoryPath + File.separator + parameterKey + ".conf";
}

// Method to update or create the config file with the specified parameter
public void updateParameter(String parameterValue) {
JSONObject json = new JSONObject();
json.put(parameterKey, parameterValue);

// Check if the file exists and whether it has write permissions
File file = new File(filePath);

// If the file exists, check if it's writable
if (file.exists()) {
if (file.canWrite()) {
// File exists and is writable, so proceed with writing
writeToFile(file, json);
} else {
// If the file exists but cannot be written to, print a message
LogHelper.error("OutputUpdater - Error: File is not writable.");
}
} else {
// File doesn't exist, create a new file
writeToFile(file, json);
}
}

// Method to write the JSON data to the file
private void writeToFile(File file, JSONObject json) {
try (FileWriter fileWriter = new FileWriter(file)) {
// Write or update the file with the new parameter value
fileWriter.write(json.toString());
LogHelper.info("File updated: " + file.getAbsolutePath());
} catch (IOException e) {
LogHelper.logStackTrace("OutputUpdater - Error while writing to file.", e);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.opentext.lre.actions.runtest;

import com.microfocus.adm.performancecenter.plugins.common.pcentities.*;
import com.opentext.lre.actions.common.helpers.OutputUpdater;
import com.opentext.lre.actions.common.helpers.LocalizationManager;
import com.opentext.lre.actions.common.helpers.constants.LreTestRunHelper;
import com.opentext.lre.actions.common.helpers.result.model.junit.Error;
Expand Down Expand Up @@ -69,7 +70,7 @@ public String toString() {
public static final String PUBLISHING = "Publishing";
public static final String ERROR = "Error";
private static final String artifactsDirectoryName = "LreResult";
private static final String RUNID_BUILD_VARIABLE = "PC_RUN_ID";
private static final String RUNID_BUILD_VARIABLE = "lre_run_id";
private String junitResultsFileName;

//private transient static Run<?, ?> _run;
Expand Down Expand Up @@ -108,6 +109,7 @@ public String toString() {
private File lreReportFile;
private File lreNVInsgithsFile;
private BuildStatus buildStatus;
private OutputUpdater outputUpdater;
public BuildStatus getBuildStatus() {
return buildStatus;
}
Expand Down Expand Up @@ -177,6 +179,7 @@ public LreTestRunBuilder(
this.workspace = Paths.get(workspace);
this.buildStatus = BuildStatus.Initiated;
this.enableStackTrace = enableStackTrace;
this.outputUpdater = new OutputUpdater(this.workspace);
}

private static String getLreServerAndPort(String lreServerAndPort) {
Expand Down Expand Up @@ -217,7 +220,6 @@ public LreTestRunBuilder(LreTestRunModel lreTestRunModel)
lreTestRunModel.isEnableStacktrace(),
lreTestRunModel.getWorkspace());
this.lreTestRunModel = lreTestRunModel;

}


Expand Down Expand Up @@ -334,9 +336,6 @@ private Testsuites run(LreTestRunClient lreTestRunClient)
}
try {
publishRunIdVariable(runId);
LogHelper.log("%s: %s = %s \n", true,
LocalizationManager.getString("SetEnvironmentVariable"),
RUNID_BUILD_VARIABLE, runId);
response = lreTestRunClient.waitForRunCompletion(runId);
if (response != null && RunState.get(response.getRunState()) == FINISHED &&
getLreTestRunModel().getPostRunAction() != PostRunAction.DO_NOTHING) {
Expand Down Expand Up @@ -423,11 +422,12 @@ private String getReportDirectory() {
artifactsDirectoryName);
}

private String publishRunIdVariable(int runId) {
private void publishRunIdVariable(int runId) {
//verify if there is a way to publish runid
String message = String.format("publishRunIdVariable for %s", runId);
LogHelper.log(message, true);
return message;
LogHelper.log("publish RunId Variable \n%s=%s", true, RUNID_BUILD_VARIABLE, runId);
if(outputUpdater != null) {
outputUpdater.updateParameter(String.valueOf(runId));
}
}

private String buildEventLogString(PcRunEventLog eventLog) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ThatsAllFolks=End
BeginningLRETestExecution=Beginning LRE test execution
BeginningLRETestExecution=Beginning test execution
SkippingEverything=Skipping everything
DisplayName=Run Performance Test Using LoadRunner Enterprise
DisplayName=Run Performance Test Using OpenText Enterprise Performance Engineering
CannotFindCredentials=Cannot find credentials with the credentialsId
BuildParameterNotConsidered=Build parameters will not be taken in consideration
ArtifactId=hp-application-automation-tools-plugin
Expand Down Expand Up @@ -44,8 +44,8 @@ SetEnvironmentVariable=Set Environment Variable
UsingProxy=Using proxy
UsingProxyCredentialsBuildParameters=Using proxy credentials of the following user as specified in build parameters:
UsingProxyCredentialsConfiguration=Using proxy credentials of following user as specified in configuration:
UsingPCCredentialsBuildParameters=Using LoadRunner Enterprise credentials supplied in build parameters
UsingPCCredentialsConfiguration=Using LoadRunner Enterprise credentials supplied in configuration
UsingPCCredentialsBuildParameters=Using credentials supplied in build parameters
UsingPCCredentialsConfiguration=Using credentials supplied in configuration
TryingToLogin=Trying to login
LoginSucceeded=Login succeeded
LoginFailed=Login failed
Expand All @@ -69,12 +69,12 @@ NotFoundTestInstanceID=Could not find existing test instanceID. Creating a new t
SearchingAvailableTestSet=Searching for available TestSet
TestInstanceCreatedSuccessfully=Test Instance has been created successfully. Test Instance ID
CreatingNewTestInstance=Creating new Test Instance
NoTestSetAvailable=There is no TestSet available in the project. Please create a testset from LoadRunner Enterprise UI.
NoTestSetAvailable=There is no TestSet available in the project. Please create a testset from the UI.
NoTrendReportAssociated=No trend report ID is associated with the test.
PleaseTurnAutomaticTrendOn=Please turn Automatic Trending on for the test through LoadRunner Enterprise UI.
PleaseTurnAutomaticTrendOn=Please turn Automatic Trending on for the test through the UI.
PleaseTurnAutomaticTrendOnAlternative=Alternatively you can check 'Add run to trend report with ID' on Jenkins job configuration.
StoppingMonitoringOnRun=Stopping monitoring on Run
StoppedFromLre=Stopped from LoadRunner Enterprise side with state
StoppedFromLre=Stopped from server side with state
PublishingAnalysisReport=Publishing analysis report
PublishingNVInsightsReport=Publishing NV Insights report
FailedToGetRunReport=Failed to get run report
Expand All @@ -87,7 +87,7 @@ StopRunFailed=Stop run failed
PublishingRun=Publishing run
OnTrendReport=on trend report
FailedToAddRunToTrendReport=Failed to add run to trend report
ProblemConnectingToPCServer=Problem connecting to LoadRunner Enterprise Server
ProblemConnectingToPCServer=Problem connecting to Server
PublishingStatus=publishing status
PublishingEndTimeout=Publishing did not end after 30 minutes, aborting...
PublishingStartTimeout=Publishing did not start after 15 minutes, aborting...
Expand Down
Loading

0 comments on commit b5c1fdb

Please sign in to comment.