diff --git a/pkg/apis/enricher/framework/java/weblogic_detector.go b/pkg/apis/enricher/framework/java/weblogic_detector.go
new file mode 100644
index 0000000..4ffb912
--- /dev/null
+++ b/pkg/apis/enricher/framework/java/weblogic_detector.go
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v2.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ * Red Hat, Inc.
+ ******************************************************************************/
+
+package enricher
+
+import (
+ "context"
+
+ "github.com/devfile/alizer/pkg/apis/model"
+)
+
+type WebLogicDetector struct{}
+
+func (o WebLogicDetector) GetSupportedFrameworks() []string {
+ return []string{"WebLogic"}
+}
+
+// DoFrameworkDetection uses the groupId and artifactId to check for the framework name
+func (o WebLogicDetector) DoFrameworkDetection(language *model.Language, config string) {
+ if hasFwk, _ := hasFramework(config, "com.oracle.weblogic", ""); hasFwk {
+ language.Frameworks = append(language.Frameworks, "WebLogic")
+ }
+}
+
+func (o WebLogicDetector) DoPortsDetection(component *model.Component, ctx *context.Context) {
+}
diff --git a/pkg/apis/enricher/framework/java/websphere_detector.go b/pkg/apis/enricher/framework/java/websphere_detector.go
new file mode 100644
index 0000000..c3f83c3
--- /dev/null
+++ b/pkg/apis/enricher/framework/java/websphere_detector.go
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2021 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v2.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v20.html
+ *
+ * Contributors:
+ * Red Hat, Inc.
+ ******************************************************************************/
+
+package enricher
+
+import (
+ "context"
+
+ "github.com/devfile/alizer/pkg/apis/model"
+)
+
+type WebSphereDetector struct{}
+
+func (o WebSphereDetector) GetSupportedFrameworks() []string {
+ return []string{"WebSphere"}
+}
+
+// DoFrameworkDetection uses the groupId and artifactId to check for the framework name
+func (o WebSphereDetector) DoFrameworkDetection(language *model.Language, config string) {
+ hasWebSphereFwk, _ := hasFramework(config, "com.ibm.websphere.appserver", "")
+ hasOpenLibertyFwk, _ := hasFramework(config, "io.openliberty", "")
+ if hasWebSphereFwk && !hasOpenLibertyFwk {
+ language.Frameworks = append(language.Frameworks, "WebSphere")
+ }
+}
+
+func (o WebSphereDetector) DoPortsDetection(component *model.Component, ctx *context.Context) {
+}
diff --git a/pkg/apis/enricher/java_enricher.go b/pkg/apis/enricher/java_enricher.go
index fdbef64..23922e5 100644
--- a/pkg/apis/enricher/java_enricher.go
+++ b/pkg/apis/enricher/java_enricher.go
@@ -34,6 +34,8 @@ func getJavaFrameworkDetectors() []FrameworkDetectorWithConfigFile {
&framework.VertxDetector{},
&framework.WildFlyDetector{},
&framework.JBossEAPDetector{},
+ &framework.WebSphereDetector{},
+ &framework.WebLogicDetector{},
}
}
diff --git a/resources/projects/weblogic-app/pom.xml b/resources/projects/weblogic-app/pom.xml
new file mode 100644
index 0000000..342347f
--- /dev/null
+++ b/resources/projects/weblogic-app/pom.xml
@@ -0,0 +1,52 @@
+
Try: /hello
+ + \ No newline at end of file diff --git a/resources/projects/websphere-app/pom.xml b/resources/projects/websphere-app/pom.xml new file mode 100644 index 0000000..e365f12 --- /dev/null +++ b/resources/projects/websphere-app/pom.xml @@ -0,0 +1,44 @@ +Try: /hello
+ + \ No newline at end of file diff --git a/test/apis/component_recognizer_test.go b/test/apis/component_recognizer_test.go index 0fc24d7..f49a4b5 100644 --- a/test/apis/component_recognizer_test.go +++ b/test/apis/component_recognizer_test.go @@ -104,6 +104,14 @@ func TestComponentDetectionOnOpenLiberty(t *testing.T) { isComponentsInProject(t, "open-liberty", 1, "java", "openliberty") } +func TestComponentDetectionOnWebSphere(t *testing.T) { + isComponentsInProject(t, "websphere-app", 1, "java", "websphere-app") +} + +func TestComponentDetectionOnWebLogic(t *testing.T) { + isComponentsInProject(t, "weblogic-app", 1, "java", "weblogic-app") +} + func TestComponentDetectionOnQuarkus(t *testing.T) { isComponentsInProject(t, "quarkus", 1, "java", "code-with-quarkus-maven") } @@ -423,7 +431,7 @@ func TestComponentDetectionWithGitIgnoreRule(t *testing.T) { func TestComponentDetectionMultiProjects(t *testing.T) { components := getComponentsFromTestProject(t, "") - nComps := 71 + nComps := 73 if len(components) != nComps { t.Errorf("Expected %v components but found %v", strconv.Itoa(nComps), strconv.Itoa(len(components))) }