Skip to content

Commit

Permalink
WINDUP-2564 Rebranding to MTA (#1383)
Browse files Browse the repository at this point in the history
* windup rebrand

* windup core rebrand

* t
e Pleas enter the commit message for your changes. Lines starting

* rebranding as MTA

* Fix retrieval of user dir

* revert to .mta home dir
t Please enter the commit message for your changes. Lines starting

* alter header bar

* add mta icon

* replace mta icon with transparent background version

* added margin to right of logo in header bar

* fix logo not appearing on sub pages

* remove twitter details from about page

Co-authored-by: Mark Brophy <mbrophy@localhost.localdomain>
  • Loading branch information
m-brophy and Mark Brophy committed Jun 17, 2020
1 parent 7d052f0 commit 8b7947a
Show file tree
Hide file tree
Showing 73 changed files with 699 additions and 60 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public static void main(final String[] args)
runtimeLabelsDir.mkdirs();
}

final String defaultLog = new File(getUserWindupDir(), "log/rhamt.log").getAbsolutePath();
final String defaultLog = new File(getUserWindupDir(), "log/mta.log").getAbsolutePath();
final String logDir = System.getProperty("org.jboss.forge.log.file", defaultLog);

System.setProperty("org.jboss.forge.log.file", logDir);
Expand Down Expand Up @@ -235,7 +235,7 @@ public static String getVersion()

public static String getVersionString()
{
return "> Red Hat Application Migration Toolkit (RHAMT) CLI, version " + getRuntimeAPIVersion() + ".";
return "> Migration Toolkit for Applications by Red Hat (MTA) CLI, version " + getRuntimeAPIVersion() + ".";
}

public static Version getRuntimeAPIVersion()
Expand Down Expand Up @@ -266,7 +266,7 @@ public static File getUserWindupDir()
Path path = new File("").toPath();
return path.toFile();
}
return Paths.get(userHome).resolve(".rhamt").toFile();
return Paths.get(userHome).resolve(".mta").toFile();
}

private static File getUserAddonsDir()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected List<Path> getUserProvidedPaths(List<String> arguments)
Path userRulesDir = PathUtil.getUserRulesDir();
try
{
// do not filter files contained in UserRulesDir to search for "rhamt.xml" or "windup.xml"
// do not filter files contained in UserRulesDir to search for "rhamt.xml", "windup.xml" or "mta.xml"
// as it do not filter in the case of userProvidedPaths.
// It just adds the dir to be scanned by RuleProviderRegistryCache
if (Files.list(userRulesDir).count() > 0) userProvidedPaths.add(userRulesDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ else if (Boolean.class.isAssignableFrom(option.getType()))
else
{
System.out.println("Generating reports were disabled by option --skipReports");
System.out.println("If using that option was unintentional, please run RHAMT again to generate reports.");
System.out.println("If using that option was unintentional, please run MTA again to generate reports.");
}
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public void beforeStart(Furnace furnace) throws ContainerException
PrintWriter out = new PrintWriter(sw, true);
out.println();
out.println("");
out.print("Red Hat Application Migration Toolkit (RHAMT) CLI, version [ ");
out.print("Migration Toolkit for Applications (MTA) CLI, version [ ");
out.print(Bootstrap.getVersion());
out.print(" ] - by Red Hat, Inc. [ https://developers.redhat.com/products/rhamt/overview/ ]");
out.print(" ] - by Red Hat, Inc. [ https://developers.redhat.com/products/mta/overview/ ]");
out.println();
logger.info(sw.toString());
System.out.println(sw.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class GroovyWindupRuleProviderLoader implements RuleProviderLoader

private static final String GROOVY_RULES_WINDUP_EXTENSION = "windup.groovy";
private static final String GROOVY_RULES_RHAMT_EXTENSION = "rhamt.groovy";
private static final String GROOVY_RULES_MTA_EXTENSION = "mta.groovy";

@Inject
private FurnaceClasspathScanner scanner;
Expand Down Expand Up @@ -181,6 +182,8 @@ private Iterable<URL> getScripts(RuleLoaderContext ruleLoaderContext)
results.addAll(windupScripts);
List<URL> rhamtScripts = scanner.scan(GROOVY_RULES_RHAMT_EXTENSION);
results.addAll(rhamtScripts);
List<URL> mtaScripts = scanner.scan(GROOVY_RULES_MTA_EXTENSION);
results.addAll(mtaScripts);

for (Path userRulesPath : ruleLoaderContext.getRulePaths())
{
Expand Down Expand Up @@ -228,6 +231,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
private boolean pathMatchesNamePattern(Path file)
{
return file.getFileName().toString().toLowerCase().endsWith("." + GROOVY_RULES_WINDUP_EXTENSION)
|| file.getFileName().toString().toLowerCase().endsWith("." + GROOVY_RULES_RHAMT_EXTENSION);
|| file.getFileName().toString().toLowerCase().endsWith("." + GROOVY_RULES_RHAMT_EXTENSION)
|| file.getFileName().toString().toLowerCase().endsWith("." + GROOVY_RULES_MTA_EXTENSION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class LoadGroovyRulesTest
// path to use for the groovy example file in the addon
private static final String EXAMPLE_GROOVY_WINDUP_FILE = "/org/jboss/windup/addon/groovy/GroovyExampleRule.windup.groovy";
private static final String EXAMPLE_GROOVY_RHAMT_FILE = "/org/jboss/windup/addon/groovy/GroovyExampleRule.rhamt.groovy";
private static final String EXAMPLE_GROOVY_MTA_FILE = "/org/jboss/windup/addon/groovy/GroovyExampleRule.mta.groovy";

@Deployment
@AddonDependencies({
Expand All @@ -58,7 +59,8 @@ public static AddonArchive getDeployment()
.create(AddonArchive.class)
.addBeansXML()
.addAsResource(new File("src/test/resources/groovy/GroovyExampleRule.windup.groovy"), EXAMPLE_GROOVY_WINDUP_FILE)
.addAsResource(new File("src/test/resources/groovy/GroovyExampleRule.rhamt.groovy"), EXAMPLE_GROOVY_RHAMT_FILE);
.addAsResource(new File("src/test/resources/groovy/GroovyExampleRule.rhamt.groovy"), EXAMPLE_GROOVY_RHAMT_FILE)
.addAsResource(new File("src/test/resources/groovy/GroovyExampleRule.mta.groovy"), EXAMPLE_GROOVY_MTA_FILE);
return archive;
}

Expand Down Expand Up @@ -87,6 +89,8 @@ public void testGroovyRuleProviderFactory() throws Exception
boolean foundRuleOrigin = false;
boolean foundRhamtRuleProviderOrigin = false;
boolean foundRhamtRuleOrigin = false;
boolean foundMtaRuleProviderOrigin = false;
boolean foundMtaRuleOrigin = false;
for (RuleProvider provider : allProviders)
{
String providerOrigin = provider.getMetadata().getOrigin();
Expand All @@ -100,6 +104,11 @@ public void testGroovyRuleProviderFactory() throws Exception
foundRhamtRuleProviderOrigin = true;
}

if (providerOrigin.contains(EXAMPLE_GROOVY_MTA_FILE))
{
foundMtaRuleProviderOrigin = true;
}

Rule rule = RuleBuilder.define();
Context ruleContext = (Context) rule;

Expand All @@ -114,11 +123,17 @@ else if (ruleOrigin.contains(EXAMPLE_GROOVY_RHAMT_FILE))
{
foundRhamtRuleOrigin = true;
}
else if (ruleOrigin.contains(EXAMPLE_GROOVY_MTA_FILE))
{
foundMtaRuleOrigin = true;
}
}
Assert.assertTrue("Script path should have been set in Rule Metatada", foundRuleOrigin);
Assert.assertTrue("Script path should have been set in Rule Provider Metatada", foundRuleProviderOrigin);
Assert.assertTrue("Script path should have been set in RHAMT Rule Metatada", foundRhamtRuleOrigin);
Assert.assertTrue("Script path should have been set in RHAMT Rule Provider Metatada", foundRhamtRuleProviderOrigin);
Assert.assertTrue("Script path should have been set in MTA Rule Metatada", foundMtaRuleOrigin);
Assert.assertTrue("Script path should have been set in MTA Rule Provider Metatada", foundMtaRuleProviderOrigin);
Assert.assertTrue(allProviders.size() > 0);
}

Expand All @@ -133,6 +148,7 @@ public void testGroovyUserDirectoryRuleProvider() throws Exception
Files.createDirectories(userRulesPath);
Path exampleGroovyUserDirWindupGroovyFile = userRulesPath.resolve("ExampleUserFile.windup.groovy");
Path exampleGroovyUserDirRhamtGroovyFile = userRulesPath.resolve("ExampleUserFile.rhamt.groovy");
Path exampleGroovyUserDirMtaGroovyFile = userRulesPath.resolve("ExampleUserFile.mta.groovy");

// copy a groovy rule example to it
try (InputStream is = getClass().getResourceAsStream(EXAMPLE_GROOVY_WINDUP_FILE);
Expand All @@ -147,6 +163,12 @@ public void testGroovyUserDirectoryRuleProvider() throws Exception
IOUtils.copy(is, os);
}

try (InputStream is = getClass().getResourceAsStream(EXAMPLE_GROOVY_MTA_FILE);
OutputStream os = new FileOutputStream(exampleGroovyUserDirMtaGroovyFile.toFile()))
{
IOUtils.copy(is, os);
}

RuleLoaderContext ruleLoaderContext = new RuleLoaderContext(Collections.singleton(userRulesPath), null);

Imported<RuleProviderLoader> loaders = furnace.getAddonRegistry().getServices(
Expand All @@ -162,6 +184,7 @@ public void testGroovyUserDirectoryRuleProvider() throws Exception

boolean foundScriptPath = false;
boolean foundRhamtScriptPath = false;
boolean foundMtaScriptPath = false;
for (RuleProvider provider : allProviders)
{
Rule rule = RuleBuilder.define();
Expand All @@ -181,9 +204,15 @@ else if (origin.endsWith("ExampleUserFile.rhamt.groovy"))
// make sure we found the one from the user dir
foundRhamtScriptPath = true;
}
else if (origin.endsWith("ExampleUserFile.mta.groovy"))
{
// make sure we found the one from the user dir
foundMtaScriptPath = true;
}
}
Assert.assertTrue("Script path should have been set in Rule Metatada", foundScriptPath);
Assert.assertTrue("Script path should have been set in RHAMT Rule Metatada", foundRhamtScriptPath);
Assert.assertTrue("Script path should have been set in MTA Rule Metatada", foundMtaScriptPath);
Assert.assertTrue(allProviders.size() > 0);
}
finally
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import org.jboss.windup.config.operation.GraphOperation;
import org.jboss.windup.config.GraphRewrite;
import org.jboss.windup.config.phase.MigrationRulesPhase;
import org.jboss.windup.config.metadata.RuleMetadataType;
import org.jboss.windup.config.phase.RulePhase;
import org.jboss.windup.util.Logging;
import org.ocpsoft.rewrite.config.True;
import org.ocpsoft.rewrite.context.EvaluationContext;


ruleSet("ExampleGroovyRule").setPhase(MigrationRulesPhase.class)

.addRule()
.when(
new True()
)
.perform(
new GraphOperation () {
public void perform(GraphRewrite event, EvaluationContext context) {
Logging.get(this.getClass()).info("Performing rewrite operation in ExampleGroovyRule");
}
}
)
.withMetadata(RuleMetadataType.TAGS, "Basic")

Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class XMLLabelProviderLoader implements LabelProviderLoader

private static final String XML_LABELS_WINDUP_EXTENSION = "windup.label.xml";
private static final String XML_LABELS_RHAMT_EXTENSION = "rhamt.label.xml";
private static final String XML_LABELS_MTA_EXTENSION = "mta.label.xml";


@Inject
private Furnace furnace;
Expand Down Expand Up @@ -159,6 +161,7 @@ private Map<Addon, List<URL>> getAddonWindupXmlFiles()
{
Map<Addon, List<URL>> addon = scanner.scanForAddonMap(new FileExtensionFilter(XML_LABELS_WINDUP_EXTENSION));
addon.putAll(scanner.scanForAddonMap(new FileExtensionFilter(XML_LABELS_RHAMT_EXTENSION)));
addon.putAll(scanner.scanForAddonMap(new FileExtensionFilter(XML_LABELS_MTA_EXTENSION)));
return addon;
}

Expand Down Expand Up @@ -210,7 +213,8 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
private boolean pathMatchesNamePattern(Path file)
{
return file.getFileName().toString().toLowerCase().endsWith("." + XML_LABELS_WINDUP_EXTENSION)
|| file.getFileName().toString().toLowerCase().endsWith("." + XML_LABELS_RHAMT_EXTENSION);
|| file.getFileName().toString().toLowerCase().endsWith("." + XML_LABELS_RHAMT_EXTENSION)
|| file.getFileName().toString().toLowerCase().endsWith("." + XML_LABELS_MTA_EXTENSION);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class XMLRuleProviderLoader implements RuleProviderLoader

private static final String XML_RULES_WINDUP_EXTENSION = "windup.xml";
private static final String XML_RULES_RHAMT_EXTENSION = "rhamt.xml";
private static final String XML_RULES_MTA_EXTENSION = "mta.xml";

@Inject
private Furnace furnace;
Expand Down Expand Up @@ -157,6 +158,7 @@ private Map<Addon, List<URL>> getAddonWindupXmlFiles()
{
Map<Addon, List<URL>> addon = scanner.scanForAddonMap(new FileExtensionFilter(XML_RULES_WINDUP_EXTENSION));
addon.putAll(scanner.scanForAddonMap(new FileExtensionFilter(XML_RULES_RHAMT_EXTENSION)));
addon.putAll(scanner.scanForAddonMap(new FileExtensionFilter(XML_RULES_MTA_EXTENSION)));
return addon;
}

Expand Down Expand Up @@ -206,6 +208,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
private boolean pathMatchesNamePattern(Path file)
{
return file.getFileName().toString().toLowerCase().endsWith("." + XML_RULES_WINDUP_EXTENSION)
|| file.getFileName().toString().toLowerCase().endsWith("." + XML_RULES_RHAMT_EXTENSION);
|| file.getFileName().toString().toLowerCase().endsWith("." + XML_RULES_RHAMT_EXTENSION)
|| file.getFileName().toString().toLowerCase().endsWith("." + XML_RULES_MTA_EXTENSION);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class MetaDataHandlerTest
private static final String XML_WINDUP_WITH_OVERRIDE_FILE = "src/test/resources/testxml/metadata.override.windup.xml";
private static final String XML_RHAMT_FILE = "src/test/resources/testxml/metadata.rhamt.xml";
private static final String XML_RHAMT_WITH_OVERRIDE_FILE = "src/test/resources/testxml/metadata.override.rhamt.xml";
private static final String XML_MTA_FILE = "src/test/resources/testxml/metadata.mta.xml";
private static final String XML_MTA_WITH_OVERRIDE_FILE = "src/test/resources/testxml/metadata.override.mta.xml";

@Deployment
@AddonDependencies({
Expand Down Expand Up @@ -70,6 +72,13 @@ public void testRhamtXmlParsinfOfRulesetMetadata() throws Exception
testXmlParsinfOfRulesetMetadata(fXmlFile);
}

@Test
public void testMtaXmlParsinfOfRulesetMetadata() throws Exception
{
File fXmlFile = new File(XML_MTA_FILE);
testXmlParsinfOfRulesetMetadata(fXmlFile);
}

private void testXmlParsinfOfRulesetMetadata(File fXmlFile) throws Exception
{
RuleLoaderContext loaderContext = new RuleLoaderContext(Collections.singleton(fXmlFile.toPath()), null);
Expand Down Expand Up @@ -126,6 +135,13 @@ public void testRhamtXmlRuleOverrideProviderMetadata() throws Exception
testXmlRuleOverrideProviderMetadata(fXmlFile);
}

@Test
public void testMtaXmlRuleOverrideProviderMetadata() throws Exception
{
File fXmlFile = new File(XML_MTA_WITH_OVERRIDE_FILE);
testXmlRuleOverrideProviderMetadata(fXmlFile);
}

public void testXmlRuleOverrideProviderMetadata(File fXmlFile) throws Exception
{
RuleLoaderContext loaderContext = new RuleLoaderContext(Collections.singleton(fXmlFile.toPath()), null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public static AddonArchive getRhamtDeployment()
.addAsResource(new File("src/test/resources/labeltestxml/Test2.rhamt.label.xml"));
}

@Deployment(name = "mta,1")
public static AddonArchive getMtaDeployment()
{
return ShrinkWrap.create(AddonArchive.class)
.addBeansXML()
.addAsResource(new File("src/test/resources/labeltestxml/Test3.mta.label.xml"));
}

@Inject
private LabelProviderLoader loader;

Expand All @@ -58,7 +66,7 @@ public void testGetProviders() throws Exception
RuleLoaderContext ruleLoaderContext = new RuleLoaderContext();
List<LabelProvider> providers = loader.getProviders(ruleLoaderContext);
Assert.assertNotNull(providers);
Assert.assertEquals(2, providers.size());
Assert.assertEquals(3, providers.size());


LabelProvider provider = providers
Expand Down Expand Up @@ -91,6 +99,22 @@ public void testGetProviders() throws Exception

label = labels.get(1);
checkLabel2(label);


provider = providers
.stream()
.filter(p -> p.getMetadata().getID().equals("testlabelprovider3"))
.findFirst()
.orElseThrow(() -> new IllegalAccessError("No testlabelprovider3 found"));
checkMtaMetadata(provider);
labels = provider.getData().getLabels();
Assert.assertEquals(3, labels.size());

label = labels.get(0);
checkLabel1(label);

label = labels.get(1);
checkLabel2(label);
}

private void checkWindupMetadata(LabelProvider provider)
Expand All @@ -110,6 +134,14 @@ private void checkRhamtMetadata(LabelProvider provider)
Assert.assertTrue(provider.getMetadata().getOrigin().matches("jar:file:.*/rhamt-1.*/Test2.rhamt.label.xml"));
}

private void checkMtaMetadata(LabelProvider provider)
{
String id = provider.getMetadata().getID();
Assert.assertEquals("testlabelprovider3", id);
Assert.assertNull(provider.getMetadata().getDescription());
Assert.assertTrue(provider.getMetadata().getOrigin().matches("jar:file:.*/mta-1.*/Test3.mta.label.xml"));
}

private void checkLabel1(Label label)
{
Set<String> supported = label.getSupported();
Expand Down

0 comments on commit 8b7947a

Please sign in to comment.