Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing configuration tags #7

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 60 additions & 12 deletions example_pom.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,11 @@ var examplePom = `
<goal>goal</goal>
</goals>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</execution>
</executions>
<dependencies>
Expand All @@ -350,7 +354,11 @@ var examplePom = `
<goal>goal</goal>
</goals>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Expand All @@ -368,7 +376,11 @@ var examplePom = `
<goal>goal</goal>
</goals>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</execution>
</executions>
<dependencies>
Expand All @@ -393,7 +405,11 @@ var examplePom = `
<goal>goal</goal>
</goals>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</plugin>
</plugins>
</build>
Expand All @@ -414,11 +430,19 @@ var examplePom = `
<report>report</report>
</reports>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</reportSet>
</reportSets>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</plugin>
</plugins>
</reporting>
Expand Down Expand Up @@ -492,7 +516,11 @@ var examplePom = `
<goal>goal</goal>
</goals>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</execution>
</executions>
<dependencies>
Expand All @@ -517,7 +545,11 @@ var examplePom = `
<goal>goal</goal>
</goals>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</plugin>
</plugins>
</pluginManagement>
Expand All @@ -535,7 +567,11 @@ var examplePom = `
<goal>goal</goal>
</goals>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</execution>
</executions>
<dependencies>
Expand All @@ -560,7 +596,11 @@ var examplePom = `
<goal>goal</goal>
</goals>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</plugin>
</plugins>
</build>
Expand Down Expand Up @@ -719,11 +759,19 @@ var examplePom = `
<report>report</report>
</reports>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</reportSet>
</reportSets>
<inherited>inherited</inherited>
<configuration>configuration</configuration>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</plugin>
</plugins>
</reporting>
Expand Down
42 changes: 23 additions & 19 deletions gopom.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,20 +304,22 @@ type PluginManagement struct {
}

type Plugin struct {
GroupID string `xml:"groupId"`
ArtifactID string `xml:"artifactId"`
Version string `xml:"version"`
Extensions string `xml:"extensions"`
Executions []PluginExecution `xml:"executions>execution"`
Dependencies []Dependency `xml:"dependencies>dependency"`
Inherited string `xml:"inherited"`
GroupID string `xml:"groupId"`
ArtifactID string `xml:"artifactId"`
Version string `xml:"version"`
Extensions string `xml:"extensions"`
Executions []PluginExecution `xml:"executions>execution"`
Dependencies []Dependency `xml:"dependencies>dependency"`
Inherited string `xml:"inherited"`
Configuration Properties `xml:"configuration"`
}

type PluginExecution struct {
ID string `xml:"id"`
Phase string `xml:"phase"`
Goals []string `xml:"goals>goal"`
Inherited string `xml:"inherited"`
ID string `xml:"id"`
Phase string `xml:"phase"`
Goals []string `xml:"goals>goal"`
Inherited string `xml:"inherited"`
Configuration Properties `xml:"configuration"`
}

type Reporting struct {
Expand All @@ -327,17 +329,19 @@ type Reporting struct {
}

type ReportingPlugin struct {
GroupID string `xml:"groupId"`
ArtifactID string `xml:"artifactId"`
Version string `xml:"version"`
Inherited string `xml:"inherited"`
ReportSets []ReportSet `xml:"reportSets>reportSet"`
GroupID string `xml:"groupId"`
ArtifactID string `xml:"artifactId"`
Version string `xml:"version"`
Inherited string `xml:"inherited"`
ReportSets []ReportSet `xml:"reportSets>reportSet"`
Configuration Properties `xml:"configuration"`
}

type ReportSet struct {
ID string `xml:"id"`
Reports []string `xml:"reports>report"`
Inherited string `xml:"inherited"`
ID string `xml:"id"`
Reports []string `xml:"reports>report"`
Inherited string `xml:"inherited"`
Configuration Properties `xml:"configuration"`
}

type Profile struct {
Expand Down
55 changes: 52 additions & 3 deletions gopom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,14 @@ func TestParsing_Build(t *testing.T) {
assert.Equal(t, 1, len(pl[0].Executions[0].Goals))
assert.Equal(t, "goal", pl[0].Executions[0].Goals[0])
assert.Equal(t, "inherited", pl[0].Executions[0].Inherited)
assert.Equal(t, 3, len(pl[0].Executions[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].Executions[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].Executions[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].Executions[0].Configuration.Entries["key3"])
assert.Equal(t, 3, len(pl[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].Configuration.Entries["key3"])

assert.Equal(t, 1, len(pl[0].Dependencies))
d := pl[0].Dependencies[0]
Expand Down Expand Up @@ -454,6 +462,14 @@ func TestParsing_Build(t *testing.T) {
assert.Equal(t, 1, len(pl[0].Executions[0].Goals))
assert.Equal(t, "goal", pl[0].Executions[0].Goals[0])
assert.Equal(t, "inherited", pl[0].Executions[0].Inherited)
assert.Equal(t, 3, len(pl[0].Executions[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].Executions[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].Executions[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].Executions[0].Configuration.Entries["key3"])
assert.Equal(t, 3, len(pl[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].Configuration.Entries["key3"])

assert.Equal(t, 1, len(pl[0].Dependencies))
d = pl[0].Dependencies[0]
Expand Down Expand Up @@ -485,6 +501,14 @@ func TestParsing_Reporting(t *testing.T) {
assert.Equal(t, 1, len(pl[0].ReportSets[0].Reports))
assert.Equal(t, "report", pl[0].ReportSets[0].Reports[0])
assert.Equal(t, "inherited", pl[0].ReportSets[0].Inherited)
assert.Equal(t, 3, len(pl[0].ReportSets[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].ReportSets[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].ReportSets[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].ReportSets[0].Configuration.Entries["key3"])
assert.Equal(t, 3, len(pl[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].Configuration.Entries["key3"])
}

func TestParsing_Profiles(t *testing.T) {
Expand Down Expand Up @@ -538,6 +562,14 @@ func TestParsing_Profiles(t *testing.T) {
assert.Equal(t, 1, len(pl[0].Executions[0].Goals))
assert.Equal(t, "goal", pl[0].Executions[0].Goals[0])
assert.Equal(t, "inherited", pl[0].Executions[0].Inherited)
assert.Equal(t, 3, len(pl[0].Executions[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].Executions[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].Executions[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].Executions[0].Configuration.Entries["key3"])
assert.Equal(t, 3, len(pl[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].Configuration.Entries["key3"])

assert.Equal(t, 1, len(pl[0].Dependencies))
d := pl[0].Dependencies[0]
Expand Down Expand Up @@ -565,6 +597,14 @@ func TestParsing_Profiles(t *testing.T) {
assert.Equal(t, 1, len(pl[0].Executions[0].Goals))
assert.Equal(t, "goal", pl[0].Executions[0].Goals[0])
assert.Equal(t, "inherited", pl[0].Executions[0].Inherited)
assert.Equal(t, 3, len(pl[0].Executions[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].Executions[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].Executions[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].Executions[0].Configuration.Entries["key3"])
assert.Equal(t, 3, len(pl[0].Configuration.Entries))
assert.Equal(t, "value", pl[0].Configuration.Entries["key"])
assert.Equal(t, "value2", pl[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", pl[0].Configuration.Entries["key3"])

assert.Equal(t, 1, len(pl[0].Dependencies))
d = pl[0].Dependencies[0]
Expand Down Expand Up @@ -693,6 +733,14 @@ func TestParsing_Profiles(t *testing.T) {
assert.Equal(t, 1, len(repPl[0].ReportSets[0].Reports))
assert.Equal(t, "report", repPl[0].ReportSets[0].Reports[0])
assert.Equal(t, "inherited", repPl[0].ReportSets[0].Inherited)
assert.Equal(t, 3, len(repPl[0].ReportSets[0].Configuration.Entries))
assert.Equal(t, "value", repPl[0].ReportSets[0].Configuration.Entries["key"])
assert.Equal(t, "value2", repPl[0].ReportSets[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", repPl[0].ReportSets[0].Configuration.Entries["key3"])
assert.Equal(t, 3, len(repPl[0].Configuration.Entries))
assert.Equal(t, "value", repPl[0].Configuration.Entries["key"])
assert.Equal(t, "value2", repPl[0].Configuration.Entries["key2"])
assert.Equal(t, "value3", repPl[0].Configuration.Entries["key3"])
}

func Test_ParsingParentProperties(t *testing.T) {
Expand Down Expand Up @@ -732,9 +780,10 @@ func Test_ParsingNotifierConfigurations(t *testing.T) {

func Test_MarshalingProjectToXML(t *testing.T) {
ignitePlugin := Plugin{
GroupID: "org.apache.ignite",
ArtifactID: "ignite-core",
Version: "2.14.0",
GroupID: "org.apache.ignite",
ArtifactID: "ignite-core",
Version: "2.14.0",
Configuration: Properties{Entries: map[string]string{}},
}

// Add plugin to build plugins of original project p and marshal it to XML.
Expand Down
Loading