Skip to content

Commit

Permalink
minor change (#949)
Browse files Browse the repository at this point in the history
Signed-off-by: Karishma Punwatkar <[email protected]>
  • Loading branch information
kpunwatk authored Feb 8, 2024
1 parent 2c53539 commit 292b555
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,35 @@ import {
deleteByList,
} from "../../../../../utils/utils";
import { Analysis } from "../../../../models/migration/applicationinventory/analysis";
import { SEC } from "../../../../types/constants";
import { CredentialType, SEC, UserCredentials } from "../../../../types/constants";
import { Application } from "../../../../models/migration/applicationinventory/application";
import { AppIssue } from "../../../../types/types";
import { CredentialsSourceControlUsername } from "../../../../models/administration/credentials/credentialsSourceControlUsername";
import { CredentialsMaven } from "../../../../models/administration/credentials/credentialsMaven";
import * as data from "../../../../../utils/data_utils";
let applicationsList: Array<Analysis> = [];
let source_credential: CredentialsSourceControlUsername;
let maven_credential: CredentialsMaven;

describe(["@tier2"], "Bug MTA-2006: Affected files validation", () => {
before("Login", function () {
login();

// Create source Credentials
source_credential = new CredentialsSourceControlUsername(
data.getRandomCredentialsData(
CredentialType.sourceControl,
UserCredentials.usernamePassword,
true
)
);
source_credential.create();

// Create Maven credentials
maven_credential = new CredentialsMaven(
data.getRandomCredentialsData(CredentialType.maven, null, true)
);
maven_credential.create();
});

beforeEach("Load data", function () {
Expand Down Expand Up @@ -71,6 +92,75 @@ describe(["@tier2"], "Bug MTA-2006: Affected files validation", () => {
);
});

it("Affected files validation with source analysis on bookserver app", function () {
// Automate bug https://issues.redhat.com/browse/MTA-1628
const application = new Analysis(
getRandomApplicationData("affected_files_on_bookserverapp", {
sourceData: this.appData["bookserver-app"],
}),
getRandomAnalysisData(this.analysisData["affected_files_on_bookserverapp"])
);
application.create();
applicationsList.push(application);
cy.wait("@getApplication");
cy.wait(2 * SEC);
application.analyze();
application.verifyAnalysisStatus("Completed");
application.validateIssues(this.analysisData["affected_files_on_bookserverapp"]["issues"]);
this.analysisData["affected_files_on_bookserverapp"]["issues"].forEach(
(currentIssue: AppIssue) => {
application.validateAffected(currentIssue);
}
);
});

it("Affected files validation with source analysis on tackle-testapp app", function () {
// Automate bug https://issues.redhat.com/browse/MTA-1600
const application = new Analysis(
getRandomApplicationData("affected_files_on_tackleTestapp", {
sourceData: this.appData["tackle-testapp-git"],
}),
getRandomAnalysisData(this.analysisData["affected_files_on_tackleTestapp"])
);
application.create();
applicationsList.push(application);
cy.wait("@getApplication");
cy.wait(2 * SEC);
application.manageCredentials(source_credential.name, maven_credential.name);
application.analyze();
application.verifyAnalysisStatus("Completed");
application.validateIssues(this.analysisData["affected_files_on_tackleTestapp"]["issues"]);
this.analysisData["affected_files_on_tackleTestapp"]["issues"].forEach(
(currentIssue: AppIssue) => {
application.validateAffected(currentIssue);
}
);
});

it("Affected files validation with source+deps analysis on tackle-testapp app", function () {
// Automate bug https://issues.redhat.com/browse/MTA-1622
const application = new Analysis(
getRandomApplicationData("affected_files_on_tackleTestapp_deps", {
sourceData: this.appData["tackle-testapp-git"],
}),
getRandomAnalysisData(this.analysisData["affected_files_on_tackleTestapp_deps"])
);
application.create();
applicationsList.push(application);
cy.wait("@getApplication");
cy.wait(2 * SEC);
application.analyze();
application.verifyAnalysisStatus("Completed");
application.validateIssues(
this.analysisData["affected_files_on_tackleTestapp_deps"]["issues"]
);
this.analysisData["affected_files_on_tackleTestapp_deps"]["issues"].forEach(
(currentIssue: AppIssue) => {
application.validateAffected(currentIssue);
}
);
});

after("Perform test data clean up", function () {
deleteByList(applicationsList);
});
Expand Down
60 changes: 60 additions & 0 deletions cypress/fixtures/analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,5 +277,65 @@
"labels": ["hibernate", "hibernate-search"]
}
]
},

"affected_files_on_bookserverapp": {
"source": "Source code",
"target": ["Quarkus"],
"appName": "book-server",
"issues": [
{
"name": "Add Maven profile to run the Quarkus native build",
"category": "mandatory",
"source": "java-ee",
"targets": ["quarkus"],
"effort": 1,
"incidents": 2,
"affectedFiles": 1,
"ruleSet": "quarkus/springboot",
"rule": "javaee-pom-to-quarkus-00060",
"labels": "None"
}
]
},

"affected_files_on_tackleTestapp": {
"source": "Source code",
"target": ["Quarkus"],
"appName": "tackle-testapp",
"issues": [
{
"name": "Adopt Maven Surefire plugin",
"category": "mandatory",
"source": "java-ee",
"targets": ["quarkus"],
"effort": 1,
"incidents": 1,
"affectedFiles": 1,
"ruleSet": "quarkus/springboot",
"rule": "javaee-pom-to-quarkus-00040",
"labels": "None"
}
]
},

"affected_files_on_tackleTestapp_deps": {
"source": "Source code + dependencies",
"target": ["Camel"],
"appName": "tackle-testapp",
"issues": [
{
"name": "'jaxb-core' Maven dependency missing",
"category": "potential",
"source": "camel",
"targets": ["camel"],
"effort": 1,
"incidents": 1,
"affectedFiles": 1,
"ruleSet": "camel3/camel2",
"rule": "xml-java-versions-00002",
"labels": "None"
}
]
}
}

0 comments on commit 292b555

Please sign in to comment.