-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#169 Feature: Migrate aiops references in PDP python projects
- Refactor the PDP package. - Refactor all the child directories, classes, and methods. - Corrected all the imports inside the velocity templates to ensure a successful build of PDP Python. - Baton migration scripts for automated migrations from legacy package names to the new aiSSEMBLE landscape.
- Loading branch information
1 parent
70134c6
commit fdf4196
Showing
18 changed files
with
140 additions
and
211 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...m/boozallen/aissemble/upgrade/migration/v1_8_0/AiopsReferencePDPPythonMigrationSteps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.boozallen.aissemble.upgrade.migration.v1_8_0; | ||
|
||
/*- | ||
* #%L | ||
* aiSSEMBLE::Foundation::Upgrade | ||
* %% | ||
* Copyright (C) 2021 Booz Allen | ||
* %% | ||
* This software package is licensed under the Booz Allen Public License. All Rights Reserved. | ||
* #L% | ||
*/ | ||
|
||
import com.boozallen.aissemble.upgrade.migration.AbstractAissembleMigration; | ||
import com.boozallen.aissemble.upgrade.migration.AbstractMigrationTest; | ||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.Then; | ||
import io.cucumber.java.en.When; | ||
import org.apache.commons.io.FileUtils; | ||
|
||
import java.io.File; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
public class AiopsReferencePDPPythonMigrationSteps extends AbstractMigrationTest { | ||
|
||
private AbstractAissembleMigration migration; | ||
private File validatedFile; | ||
private static Boolean validateMigration(File original, File migrated) { | ||
Boolean isMigrated = false; | ||
|
||
try { | ||
isMigrated = FileUtils.contentEquals(original, migrated); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
return isMigrated; | ||
} | ||
|
||
/** | ||
* Function to check whether the migration is necessary. | ||
* @param file file to check | ||
* @return isFileNameSame - Boolean indicating whether the file names are the same. | ||
*/ | ||
|
||
public static Boolean isAissembleSecurityProperties(File file) { | ||
return file.getName().equals("aissemble-security.properties"); | ||
} | ||
|
||
@Given("a Python implemented project policy decision point docker properties file is referencing aiops") | ||
public void aPythonImplementedProjectPolicyDecisionPointDockerPropertiesFileIsReferencingAiops() { | ||
testFile = getTestFile("v1_8_0/AiopsReferencePDPPythonMigration/migration/aiops-security.properties"); | ||
} | ||
|
||
@When("the 1.8.0 aiops reference pdp python migration executes") | ||
public void theAiopsReferencePdpPythonMigrationExecutes() { | ||
migration = new AiopsReferencePDPPythonMigration(); | ||
performMigration(migration); | ||
} | ||
|
||
@Then("the properties file will be renamed to aissemble-security.properties") | ||
public void thePropertiesFileWillBeRenamedToAissembleSecurityProperties() { | ||
assertTrue("aissemble-securities.properties file was unabled to be renamed.", isAissembleSecurityProperties(getTestFile("v1_8_0/AiopsReferencePDPPythonMigration/migration/aissemble-security.properties"))); | ||
} | ||
|
||
@Given("a Python implemented project policy decision point docker Dockerfile is referencing aiops in the target path of the properties file") | ||
public void aPythonImplementedProjectPolicyDecisionPointDockerDockerfileIsReferencingAiopsInTheTargetPathOfThePropertiesFile() { | ||
testFile = getTestFile("v1_8_0/AiopsReferencePDPPythonMigration/migration/Dockerfile"); | ||
} | ||
|
||
@Then("the target path in the Dockerfile will be refactored to referenced aissemble-security.properties") | ||
public void theTargetPathInTheDockerfileWillBeRefactoredToReferencedAissembleSecurityProperties() { | ||
validatedFile = getTestFile("/v1_8_0/AiopsReferencePDPPythonMigration/validation/Dockerfile_Validated"); | ||
assertTrue("PDP Dockerfile is still referencing aiops in the target path.", validateMigration(testFile, validatedFile)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.