Skip to content

Commit

Permalink
Fix the rests of the configuraions and properties.
Browse files Browse the repository at this point in the history
  • Loading branch information
vifraa committed Dec 16, 2020
1 parent 67a6b09 commit 7aa35ce
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 30 deletions.
7 changes: 7 additions & 0 deletions example_pom.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ var examplePom = `
<properties>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</properties>
</developer>
</developers>
Expand All @@ -69,6 +70,8 @@ var examplePom = `
<timezone>+1</timezone>
<properties>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</properties>
</contributor>
</contributors>
Expand Down Expand Up @@ -121,6 +124,8 @@ var examplePom = `
<address>address</address>
<configuration>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</configuration>
</notifier>
</notifiers>
Expand Down Expand Up @@ -616,6 +621,8 @@ var examplePom = `
<properties>
<key>value</key>
<key2>value2</key2>
<key3>value3</key3>
</properties>
<dependencyManagement>
Expand Down
60 changes: 30 additions & 30 deletions gopom.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,26 +100,26 @@ type License struct {
}

type Developer struct {
ID string `xml:"id"`
Name string `xml:"name"`
Email string `xml:"email"`
URL string `xml:"url"`
Organization string `xml:"organization"`
OrganizationURL string `xml:"organizationUrl"`
Roles []string `xml:"roles>role"`
Timezone string `xml:"timezone"`
// TODO Implement properties/key=value
ID string `xml:"id"`
Name string `xml:"name"`
Email string `xml:"email"`
URL string `xml:"url"`
Organization string `xml:"organization"`
OrganizationURL string `xml:"organizationUrl"`
Roles []string `xml:"roles>role"`
Timezone string `xml:"timezone"`
Properties Properties `xml:"properties"`
}

type Contributor struct {
Name string `xml:"name"`
Email string `xml:"email"`
URL string `xml:"url"`
Organization string `xml:"organization"`
OrganizationURL string `xml:"organizationUrl"`
Roles []string `xml:"roles>role"`
Timezone string `xml:"timezone"`
// TODO Implement properties/key=value
Name string `xml:"name"`
Email string `xml:"email"`
URL string `xml:"url"`
Organization string `xml:"organization"`
OrganizationURL string `xml:"organizationUrl"`
Roles []string `xml:"roles>role"`
Timezone string `xml:"timezone"`
Properties Properties `xml:"properties"`
}

type MailingList struct {
Expand Down Expand Up @@ -154,13 +154,13 @@ type CIManagement struct {
}

type Notifier struct {
Type string `xml:"type"`
SendOnError bool `xml:"sendOnError"`
SendOnFailure bool `xml:"sendOnFailure"`
SendOnSuccess bool `xml:"sendOnSuccess"`
SendOnWarning bool `xml:"sendOnWarning"`
Address string `xml:"address"`
// TODO add Configuration field
Type string `xml:"type"`
SendOnError bool `xml:"sendOnError"`
SendOnFailure bool `xml:"sendOnFailure"`
SendOnSuccess bool `xml:"sendOnSuccess"`
SendOnWarning bool `xml:"sendOnWarning"`
Address string `xml:"address"`
Configuration Properties `xml:"configuration"`
}

type DistributionManagement struct {
Expand Down Expand Up @@ -313,12 +313,12 @@ type Profile struct {
Build BuildBase `xml:"build"`
Modules []string `xml:"modules>module"`
DistributionManagement DistributionManagement `xml:"distributionManagement"`
// TODO properties/key?value*
DependencyManagement DependencyManagement `xml:"dependencyManagement"`
Dependencies []Dependency `xml:"dependencies>dependency"`
Repositories []Repository `xml:"repositories>repository"`
PluginRepositories []PluginRepository `xml:"pluginRepositories>pluginRepository"`
Reporting Reporting `xml:"reporting"`
Properties Properties `xml:"properties"`
DependencyManagement DependencyManagement `xml:"dependencyManagement"`
Dependencies []Dependency `xml:"dependencies>dependency"`
Repositories []Repository `xml:"repositories>repository"`
PluginRepositories []PluginRepository `xml:"pluginRepositories>pluginRepository"`
Reporting Reporting `xml:"reporting"`
}

type Activation struct {
Expand Down
28 changes: 28 additions & 0 deletions gopom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,3 +701,31 @@ func Test_ParsingParentProperties(t *testing.T) {
assert.Equal(t, "value2", p.Properties.Entries["key2"])
assert.Equal(t, "value3", p.Properties.Entries["key3"])
}

func Test_ParsingDeveloperProperties(t *testing.T) {
assert.Equal(t, 3, len(p.Developers[0].Properties.Entries))
assert.Equal(t, "value", p.Properties.Entries["key"])
assert.Equal(t, "value2", p.Properties.Entries["key2"])
assert.Equal(t, "value3", p.Properties.Entries["key3"])
}

func Test_ParsingContributorProperties(t *testing.T) {
assert.Equal(t, 3, len(p.Contributors[0].Properties.Entries))
assert.Equal(t, "value", p.Properties.Entries["key"])
assert.Equal(t, "value2", p.Properties.Entries["key2"])
assert.Equal(t, "value3", p.Properties.Entries["key3"])
}

func Test_ParsingProfileProperties(t *testing.T) {
assert.Equal(t, 3, len(p.Profiles[0].Properties.Entries))
assert.Equal(t, "value", p.Properties.Entries["key"])
assert.Equal(t, "value2", p.Properties.Entries["key2"])
assert.Equal(t, "value3", p.Properties.Entries["key3"])
}

func Test_ParsingNotifierConfigurations(t *testing.T) {
assert.Equal(t, 3, len(p.CIManagement.Notifiers[0].Configuration.Entries))
assert.Equal(t, "value", p.Properties.Entries["key"])
assert.Equal(t, "value2", p.Properties.Entries["key2"])
assert.Equal(t, "value3", p.Properties.Entries["key3"])
}

0 comments on commit 7aa35ce

Please sign in to comment.