diff --git a/README.md b/README.md
index 7bbe262..65bcf71 100644
--- a/README.md
+++ b/README.md
@@ -38,14 +38,14 @@ $ make setup # start minikube&tackle using David's scripts - local env only
### Run test suite
```
-$ make test
+$ make test-all
```
Run test manually example:
```
$ export HUB_BASE_URL="http://`minikube ip`/hub"
-$ go test -v analysis/windup_basic_test.go
+$ go test -count=1 -v ./analysis/
```
For parallel analysis test execution, set ```export PARALLEL=1```.
diff --git a/analysis/analysis_test.go b/analysis/analysis_test.go
index 4ac9372..0c29e58 100644
--- a/analysis/analysis_test.go
+++ b/analysis/analysis_test.go
@@ -9,6 +9,7 @@ import (
"github.com/konveyor/go-konveyor-tests/hack/addon"
"github.com/konveyor/go-konveyor-tests/hack/uniq"
+ "github.com/konveyor/go-konveyor-tests/hack/windupreport"
"github.com/konveyor/tackle2-hub/api"
"github.com/konveyor/tackle2-hub/test/assert"
)
@@ -85,6 +86,16 @@ func TestApplicationAnalysis(t *testing.T) {
}
}
+ // Check the analysis result (effort, issues, etc).
+ // Parse report for windup, get analysis from Hub API for lsp analyzer
+ gotAnalysis := windupreport.Parse(t, tc.Application.ID)
+ if gotAnalysis.Effort != tc.Analysis.Effort {
+ t.Errorf("Different effort error. Got %d, expected %d", gotAnalysis.Effort, tc.Analysis.Effort)
+ }
+ if !assert.FlatEqual(gotAnalysis.Issues, tc.Analysis.Issues) {
+ t.Errorf("Analysis Issues don't match. Got:\n %+v\nexpected:\n %+v\n", gotAnalysis.Issues, tc.Analysis.Issues)
+ }
+
// Check analysis-created Tags.
gotApp, _ := RichClient.Application.Get(tc.Application.ID)
found, gotAnalysisTags := 0, 0
diff --git a/analysis/pkg.go b/analysis/pkg.go
index 27d2a4c..f0342c5 100644
--- a/analysis/pkg.go
+++ b/analysis/pkg.go
@@ -42,6 +42,7 @@ type TC struct {
TaskData string
// After-analysis assertions.
ReportContent map[string][]string
+ Analysis api.Analysis
AnalysisTags []api.Tag
}
diff --git a/analysis/test_cases.go b/analysis/test_cases.go
index 1a91508..d3825e7 100644
--- a/analysis/test_cases.go
+++ b/analysis/test_cases.go
@@ -5,7 +5,6 @@ import (
"github.com/konveyor/tackle2-hub/api"
)
-//
// Test cases for Application Analysis.
var TestCases = []TC{
{
@@ -19,7 +18,7 @@ var TestCases = []TC{
Branch: "1.2.0",
},
},
- Task: Windup,
+ Task: Analyze,
ReportContent: map[string][]string{
"/windup/report/index.html": {
"5\nstory points",
@@ -27,6 +26,35 @@ var TestCases = []TC{
"9\nInformation",
},
},
+ Analysis: api.Analysis{
+ Effort: 5,
+ Issues: []api.Issue{
+ {
+ Category: "cloud-mandatory",
+ Description: "Trivial change or 1-1 library swap",
+ Effort: 5,
+ Name: "File system - Java IO",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Application properties file detected",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Bean Validation",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Maven POM (pom.xml)",
+ },
+ },
+ },
AnalysisTags: []api.Tag{
{Name: "CDI"},
{Name: "HTML"},
@@ -43,12 +71,12 @@ var TestCases = []TC{
Name: "Petclinic",
Description: "Spring framework app",
Repository: &api.Repository{
- Kind: "git",
- URL: "https://github.com/savitharaghunathan/spring-framework-petclinic.git",
+ Kind: "git",
+ URL: "https://github.com/savitharaghunathan/spring-framework-petclinic.git",
Branch: "main",
},
},
- Task: Windup,
+ Task: Analyze,
ReportContent: map[string][]string{
"/windup/report/index.html": {
"5\nstory points",
@@ -56,6 +84,41 @@ var TestCases = []TC{
"4\nInformation",
},
},
+ Analysis: api.Analysis{
+ Effort: 5,
+ Issues: []api.Issue{
+ {
+ Category: "cloud-mandatory",
+ Description: "Trivial change or 1-1 library swap",
+ Effort: 5,
+ Name: "File system - Java IO",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Embedded Spring Data JPA",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Embedded framework - Spring MVC",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Maven POM (pom.xml)",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Spring JMX configuration detected",
+ },
+ },
+ },
AnalysisTags: []api.Tag{
{Name: "Spring MVC"},
{Name: "CSS"},
@@ -72,14 +135,14 @@ var TestCases = []TC{
Name: "Petclinic",
Description: "Spring framework app",
Repository: &api.Repository{
- Kind: "git",
- URL: "https://github.com/savitharaghunathan/spring-framework-petclinic.git",
+ Kind: "git",
+ URL: "https://github.com/savitharaghunathan/spring-framework-petclinic.git",
Branch: "legacy",
},
},
CustomRules: []api.RuleSet{
{
- Name: "Hazelcast Java distributed session store ruleset.",
+ Name: "Hazelcast Java distributed session store ruleset.",
Custom: true,
Image: api.Ref{
ID: 1,
@@ -93,7 +156,7 @@ var TestCases = []TC{
},
},
},
- Task: Windup,
+ Task: Analyze,
ReportContent: map[string][]string{
"/windup/report/index.html": {
"12\nstory points",
@@ -101,6 +164,77 @@ var TestCases = []TC{
"13\nInformation",
},
},
+ Analysis: api.Analysis{
+ Effort: 12,
+ Issues: []api.Issue{
+ {
+ Category: "cloud-mandatory",
+ Description: "Complex change with documented solution",
+ Effort: 6,
+ Name: "Embedded Hazelcast",
+ },
+ {
+ Category: "cloud-mandatory",
+ Description: "Trivial change or 1-1 library swap",
+ Effort: 1,
+ Name: "Embedded Hazelcast dependencies",
+ },
+ {
+ Category: "cloud-mandatory",
+ Description: "Trivial change or 1-1 library swap",
+ Effort: 5,
+ Name: "File system - Java IO",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Bean Validation",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Common Annotations",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Embedded Spring Data JPA",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Embedded framework - Spring MVC",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "JAXB",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Java Servlet",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Maven POM (pom.xml)",
+ },
+ {
+ Category: "information",
+ Description: "Info",
+ Effort: 0,
+ Name: "Spring JMX configuration detected",
+ },
+ },
+ },
AnalysisTags: []api.Tag{
{Name: "Java EE JAXB"},
{Name: "Servlet"},
@@ -116,25 +250,24 @@ var TestCases = []TC{
},
}
-//
// Shared parameters.
var Addons = []string{
- "windup", // legacy windup analyzer
-// "analyzer", // LSP analyzer
+ "windup", // legacy windup analyzer
+ // "analyzer", // LSP analyzer
}
-var Windup = api.Task{
- State: "Ready", // Created / Ready
- Data: defaultTaskData,
+var Analyze = api.Task{
+ State: "Ready", // Created / Ready
+ Data: defaultTaskData,
}
var defaultTaskData = addon.Data{
Output: "/windup/report",
Mode: addon.Mode{
Artifact: "",
- Binary: false,
+ Binary: false,
WithDeps: false,
- Diva: true,
+ Diva: true,
},
Sources: []string{},
Targets: []string{"cloud-readiness"},
diff --git a/go.mod b/go.mod
index 5a22bd4..c6ccd98 100644
--- a/go.mod
+++ b/go.mod
@@ -4,17 +4,14 @@ go 1.18
require (
github.com/PuerkitoBio/goquery v1.8.1
- github.com/gocolly/colly v1.2.0
- github.com/konveyor/tackle2-hub v0.2.1-0.20230622161619-908a0a350015
+ github.com/konveyor/tackle2-addon v0.2.0
+ github.com/konveyor/tackle2-hub v0.2.1-0.20230627223342-1747a2022128
)
require (
github.com/Nerzal/gocloak/v10 v10.0.1 // indirect
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/andygrunwald/go-jira v1.16.0 // indirect
- github.com/antchfx/htmlquery v1.3.0 // indirect
- github.com/antchfx/xmlquery v1.3.17 // indirect
- github.com/antchfx/xpath v1.2.4 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bytedance/sonic v1.8.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
@@ -35,11 +32,9 @@ require (
github.com/go-playground/validator/v10 v10.13.0 // indirect
github.com/go-resty/resty/v2 v2.6.0 // indirect
github.com/go-sql-driver/mysql v1.7.0 // indirect
- github.com/gobwas/glob v0.2.3 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
- github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-querystring v1.1.0 // indirect
@@ -50,9 +45,7 @@ require (
github.com/jortel/go-utils v0.1.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
- github.com/kennygrant/sanitize v1.2.4 // indirect
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
- github.com/konveyor/tackle2-addon v0.2.0 // indirect
github.com/leodido/go-urn v1.2.3 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
@@ -68,10 +61,8 @@ require (
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
- github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d // indirect
github.com/segmentio/ksuid v1.0.4 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
- github.com/temoto/robotstxt v1.1.2 // indirect
github.com/trivago/tgo v1.0.7 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.9 // indirect
diff --git a/go.sum b/go.sum
index ff395ca..26ea739 100644
--- a/go.sum
+++ b/go.sum
@@ -4,19 +4,10 @@ github.com/Nerzal/gocloak/v10 v10.0.1 h1:W9pyD4I6w57ceNmjJoS4mXezBAxpupj11ytxper
github.com/Nerzal/gocloak/v10 v10.0.1/go.mod h1:18jh1lwSHEJeSvmdH+08JyJU/XjPdNYLWEZ7paDB2k8=
github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM=
github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ=
-github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
-github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/andygrunwald/go-jira v1.16.0 h1:PU7C7Fkk5L96JvPc6vDVIrd99vdPnYudHu4ju2c2ikQ=
github.com/andygrunwald/go-jira v1.16.0/go.mod h1:UQH4IBVxIYWbgagc0LF/k9FRs9xjIiQ8hIcC6HfLwFU=
-github.com/antchfx/htmlquery v1.3.0 h1:5I5yNFOVI+egyia5F2s/5Do2nFWxJz41Tr3DyfKD25E=
-github.com/antchfx/htmlquery v1.3.0/go.mod h1:zKPDVTMhfOmcwxheXUsx4rKJy8KEY/PU6eXr/2SebQ8=
-github.com/antchfx/xmlquery v1.3.17 h1:d0qWjPp/D+vtRw7ivCwT5ApH/3CkQU8JOeo3245PpTk=
-github.com/antchfx/xmlquery v1.3.17/go.mod h1:Afkq4JIeXut75taLSuI31ISJ/zeq+3jG7TunF7noreA=
-github.com/antchfx/xpath v1.2.3/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
-github.com/antchfx/xpath v1.2.4 h1:dW1HB/JxKvGtJ9WyVGJ0sIoEcqftV3SqIstujI+B9XY=
-github.com/antchfx/xpath v1.2.4/go.mod h1:i54GszH55fYfBmoZXapTHN8T8tkcHfRgLyVwwqzXNcs=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM=
@@ -49,7 +40,6 @@ github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8=
github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k=
-github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
@@ -72,12 +62,8 @@ github.com/go-resty/resty/v2 v2.6.0 h1:joIR5PNLM2EFqqESUjCMGXrWmXNHEU9CEiK813oKY
github.com/go-resty/resty/v2 v2.6.0/go.mod h1:PwvJS6hvaPkjtjNg9ph+VrSD92bi5Zq73w/BIH7cC3Q=
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
-github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
-github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA=
github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
-github.com/gocolly/colly v1.2.0 h1:qRz9YAn8FIH0qzgNUw+HT9UN7wm1oF9OBAilwEWpyrI=
-github.com/gocolly/colly v1.2.0/go.mod h1:Hof5T3ZswNVsOHYmba1u03W65HDWgpV5HifSuueE0EA=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang-jwt/jwt/v4 v4.1.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
@@ -87,8 +73,6 @@ github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0ktxqI+Sida1w446QrXBRJ0nee3SNZlA=
github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
-github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE=
-github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -135,20 +119,16 @@ github.com/jortel/go-utils v0.1.1 h1:zkAAA+i5Z+151zUG7lkjILGxSo3pQ4bkLTRcPTCy3hs
github.com/jortel/go-utils v0.1.1/go.mod h1:sl6vav63ODI0sUfSz8e0pImNmCVFnVsuOFhZmwe9GDk=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
-github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
-github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
-github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o=
-github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/konveyor/tackle2-addon v0.2.0 h1:YWyFY72ZU2oKsPFb0Pt1U/1sWtD186BcYxtwJRDOni0=
github.com/konveyor/tackle2-addon v0.2.0/go.mod h1:2poGMxU2vxmz7+FppLvSliMrk0mAtbDHp+LeZ/p2/Q8=
-github.com/konveyor/tackle2-hub v0.2.1-0.20230622161619-908a0a350015 h1:8Xu616eAKr4yrcL+EX26gzbSyMZqF2bFEjUTwfQTKDg=
-github.com/konveyor/tackle2-hub v0.2.1-0.20230622161619-908a0a350015/go.mod h1:UR7IJ1Qa9RgcdsO81yLWjTB6h7Qz1Y2bypu6YU2LFg8=
+github.com/konveyor/tackle2-hub v0.2.1-0.20230627223342-1747a2022128 h1:LDB5D7SWbGj1N85APCzvA1fnwZTDMqR1gCdQ653kVpw=
+github.com/konveyor/tackle2-hub v0.2.1-0.20230627223342-1747a2022128/go.mod h1:UR7IJ1Qa9RgcdsO81yLWjTB6h7Qz1Y2bypu6YU2LFg8=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -174,8 +154,6 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
-github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
-github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo/v2 v2.1.4 h1:GNapqRSid3zijZ9H77KrgVG4/8KqiyRsxcSxe+7ApXY=
@@ -199,8 +177,6 @@ github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
-github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d h1:hrujxIzL1woJ7AwssoOcM/tq5JjjG2yYOc8odClEiXA=
-github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU=
github.com/segmentio/ksuid v1.0.4 h1:sBo2BdShXjmcugAMwjugoGUdUV0pcxY5mW4xKRn3v4c=
github.com/segmentio/ksuid v1.0.4/go.mod h1:/XUiZBD3kVx5SmUOl55voK5yeAbBNNIed+2O73XgrPE=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
@@ -219,8 +195,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
-github.com/temoto/robotstxt v1.1.2 h1:W2pOjSJ6SWvldyEuiFXNxz3xZ8aiWX5LbfDiOFd7Fxg=
-github.com/temoto/robotstxt v1.1.2/go.mod h1:+1AmkuG3IYkh1kv0d2qEB9Le88ehNO0zwOr3ujewlOo=
github.com/trivago/tgo v1.0.7 h1:uaWH/XIy9aWYWpjm2CU3RpcqZXmX2ysQ9/Go+d9gyrM=
github.com/trivago/tgo v1.0.7/go.mod h1:w4dpD+3tzNIIiIfkWWa85w5/B77tlvdZckQ+6PkFnhc=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
@@ -262,7 +236,6 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210928044308-7d9f5e0b762b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
-golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
@@ -289,14 +262,12 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
-golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
@@ -305,7 +276,6 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
-golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
diff --git a/hack/windupreport/parser.go b/hack/windupreport/parser.go
index 5618512..fafa27d 100644
--- a/hack/windupreport/parser.go
+++ b/hack/windupreport/parser.go
@@ -1,48 +1,79 @@
package windupreport
import (
+ "bufio"
"fmt"
- "io"
- "log"
+ "os"
+ "path/filepath"
+ "sort"
+ "strconv"
+ "strings"
+ "testing"
"github.com/PuerkitoBio/goquery"
- "github.com/gocolly/colly"
"github.com/konveyor/tackle2-hub/api"
+ "github.com/konveyor/tackle2-hub/binding"
+ "github.com/konveyor/tackle2-hub/test/api/client"
+ "github.com/konveyor/tackle2-hub/test/assert"
)
+// Setup Hub API client
+var RichClient *binding.RichClient
+func init() {
+ // Prepare RichClient and login to Hub API (configured from env variables).
+ RichClient = client.PrepareRichClient()
+}
-func Parse(reader io.Reader) (analysis api.Analysis) {
- doc, err := goquery.NewDocumentFromReader(reader)
- if err != nil {
- log.Fatal(err)
- }
- log.Printf("%+v", doc)
+func ParseWindupReportIssues(t *testing.T, appId uint) (issues []api.Issue) {
+ doc, err := goquery.NewDocumentFromReader(downloadReport(t, appId, "/windup/report/reports/migration_issues.html"))
+ assert.Must(t, err)
- // Story points
- doc.Find(".effortPoints.total span.points").Each(func(i int, s *goquery.Selection) {
- // For each item found, get the title
- points := s.Text()
- fmt.Printf("Review %d: %s\n", i, points)
- })
+ for _, category := range []string{"cloud-mandatory", "information"} {
+ doc.Find(fmt.Sprintf("#table-%s tr.problemSummary", category)).Each(func(i int, s *goquery.Selection) {
+ issue := api.Issue{}
+ issue.Category = category
+ issue.Description = s.Find("td:nth-child(5n+4)").Text()
+ issue.Effort, _ = strconv.Atoi(s.Find("td:nth-child(5n+5)").Text())
+ issue.Name = strings.TrimSpace(s.Find("td:first-child").Text())
+ issues = append(issues, issue)
+ })
+ }
- return
+ // Sort issues to have stable order.
+ sort.SliceStable(issues, func(i, j int) bool {
+ return issues[i].Category+issues[i].Name < issues[j].Category+issues[j].Name
+ })
+ return
}
-func ScrapeReport(reportUrl string) {
- c := colly.NewCollector()
- c.Visit(reportUrl)
-
- // Each application
- c.OnHTML("li.product", func(e *colly.HTMLElement) {
-
-
- url := e.ChildAttr("a", "href")
- name := e.ChildText(".name")
-
- // append
+func Parse(t *testing.T, appId uint) (analysis api.Analysis) {
+ doc, err := goquery.NewDocumentFromReader(downloadReport(t, appId, "/windup/report/index.html"))
+ assert.Must(t, err)
+
+ doc.Find("div.stats").Each(func(i int, s *goquery.Selection) {
+ analysis.Effort, _ = strconv.Atoi(s.Find("span.points").Text())
})
- // Parse application/dependency
+ analysis.Issues = ParseWindupReportIssues(t, appId)
-}
\ No newline at end of file
+ return
+}
+
+// Get report file and return reader.
+func downloadReport(t *testing.T, appId uint, path string) (reader *bufio.Reader) {
+ // Prepare temp directory.
+ tempDir, err := os.MkdirTemp("/tmp", fmt.Sprintf("app_%d_windup_report", appId))
+ if err != nil {
+ panic(err.Error())
+ }
+ fileName := filepath.Join(tempDir, filepath.Base(path))
+ // Download the file from bucket.
+ err = RichClient.Application.Bucket(appId).Get(path, tempDir)
+ assert.Must(t, err)
+ f, err := os.Open(fileName)
+ assert.Must(t, err)
+ // Return reader.
+ reader = bufio.NewReader(f)
+ return
+}
diff --git a/hack/windupreport/parser_test.go b/hack/windupreport/parser_test.go
deleted file mode 100644
index da95e8e..0000000
--- a/hack/windupreport/parser_test.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package windupreport
-
-import (
- "bufio"
- "log"
- "os"
- "testing"
-
- "github.com/konveyor/tackle2-hub/api"
- "github.com/konveyor/tackle2-hub/test/assert"
-)
-
-type TC struct {
- Name string
- ReportRoot string
- AnalysisResult api.Analysis
- // ReportContent map[string][]string
-}
-
-var Samples = []TC{
- {
- Name: "Pathfinder",
- ReportRoot: "windup-report-index.html",
- AnalysisResult: api.Analysis{
- Issues: []api.Issue{
- {
- Name: "fooissue",
- },
- },
- Dependencies: []api.TechDependency{
-
- },
- },
- },
-}
-
-func TestParse(t *testing.T) {
- for _, tc := range Samples {
- f, err := os.Open(tc.ReportRoot)
- if err != nil {
- log.Fatal(err)
- }
- gotAnalysis := Parse(bufio.NewReader(f))
-
- if !assert.FlatEqual(gotAnalysis, tc.AnalysisResult) {
- t.Errorf("Different response error. Got %+v, expected %+v", gotAnalysis, tc.AnalysisResult)
- }
- }
-}
diff --git a/hack/windupreport/windup-report-index.html b/hack/windupreport/windup-report-index.html
deleted file mode 100644
index 9fabd31..0000000
--- a/hack/windupreport/windup-report-index.html
+++ /dev/null
@@ -1,321 +0,0 @@
-
-
-
-
-
-
-
- Application List
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 5
- story points
-
-
-
-
- Number of incidents |
-
-
- 5 |
- Cloud Mandatory |
-
-
- 9 |
- Information |
-
-
- 14 |
- Total |
-
-
-
-
-
-
-
-
-
- Application Properties File
-
-
- Bean Validation
-
-
- CDI
-
-
- JAX-RS
-
-
- JPA entities
-
-
- Java Source
-
-
- Maven XML
-
-
- Properties
-
-
-
-
-
-
-
-
-
-
-
-
Page generated: May 10, 2023, 9:06:40 AM
-
-
-
-
-
-
-
-