Skip to content

Commit

Permalink
Merged in SHIBUI-692 (pull request #147)
Browse files Browse the repository at this point in the history
SHIBUI-692 - The order of merges (SHIBUI-680, SHIBUI-692, SHIBUI-693, SHIBUI-734)

Approved-by: Shibui Jenkins <shibui.jenkins@gmail.com>
Approved-by: Bill Smith <wsmith@unicon.net>
  • Loading branch information
dima767 authored and Jonathan Johnson committed Aug 15, 2018
2 parents 7c1db8a + bb7ec1e commit fd1230b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,12 @@ class JPAMetadataResolverServiceImpl implements MetadataResolverService {
}

void constructXmlNodeForFilter(RequiredValidUntilFilter filter, def markupBuilderDelegate) {
markupBuilderDelegate.MetadataFilter(
'xsi:type': 'RequiredValidUntil',
maxValidityInterval: filter.maxValidityInterval
)
if(filter.xmlShouldBeGenerated()) {
markupBuilderDelegate.MetadataFilter(
'xsi:type': 'RequiredValidUntil',
maxValidityInterval: filter.maxValidityInterval
)
}
}

void constructXmlNodeForResolver(FilesystemMetadataResolver resolver, def markupBuilderDelegate, Closure childNodes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ public RequiredValidUntilFilter() {
}

private String maxValidityInterval;

public boolean xmlShouldBeGenerated() {
return (maxValidityInterval != null) && (!maxValidityInterval.equals("PT0S"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package edu.internet2.tier.shibboleth.admin.ui.domain.filters

import spock.lang.Specification
import spock.lang.Subject

/**
* @author Dmitriy Kopylenko
*/
class RequiredValidUntilFilterTests extends Specification {

def "correct logic in xmlShouldBeGenerated() method"() {
given: "filter under test with maxValidityInterval property not set (null)"
@Subject
def filter = new RequiredValidUntilFilter()
expect:
!filter.xmlShouldBeGenerated()
when: "filter under test with maxValidityInterval property not set to PT0S"
filter.maxValidityInterval = 'PT0S'
then:
!filter.xmlShouldBeGenerated()
when: "filter under test with maxValidityInterval property not set to some other valid value"
filter.maxValidityInterval = 'PT30S'
then:
filter.xmlShouldBeGenerated()
}
}

0 comments on commit fd1230b

Please sign in to comment.