Skip to content

Commit

Permalink
Merge branch 'release-2.0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
sporth committed Nov 6, 2024
2 parents 990e1f2 + 0a04f50 commit c75adf3
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id "war"
id "org.springframework.boot"
id "io.freefair.lombok"
id "com.gorylenko.gradle-git-properties" version "1.4.21"
id "com.gorylenko.gradle-git-properties" version "2.4.2"
id "com.palantir.docker" version "0.28.0"
id "com.palantir.docker-run" version "0.28.0"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package edu.internet2.tier.shibboleth.admin.ui.configuration;

import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.stereotype.Component;

@Component
public class TomcatConfiguration implements WebServerFactoryCustomizer<ConfigurableServletWebServerFactory> {
public class TomcatConfiguration
implements WebServerFactoryCustomizer<TomcatServletWebServerFactory> {

@Override
public void customize(ConfigurableServletWebServerFactory factory) {
System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
public void customize(TomcatServletWebServerFactory factory) {
factory.getTomcatConnectorCustomizers().add(connector -> connector.setEncodedSolidusHandling("decode"));
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package edu.internet2.tier.shibboleth.admin.ui.controller

import com.fasterxml.jackson.databind.ObjectMapper
import edu.internet2.tier.shibboleth.admin.ui.AbstractBaseDataJpaTest
import edu.internet2.tier.shibboleth.admin.ui.configuration.CustomPropertiesConfiguration
import edu.internet2.tier.shibboleth.admin.ui.configuration.SearchConfiguration
import edu.internet2.tier.shibboleth.admin.ui.configuration.ShibUIConfiguration
import edu.internet2.tier.shibboleth.admin.ui.domain.AttributeBundle
import edu.internet2.tier.shibboleth.admin.ui.exception.ObjectIdExistsException
Expand All @@ -13,6 +16,7 @@ import org.springframework.boot.autoconfigure.domain.EntityScan
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest
import org.springframework.boot.test.context.TestConfiguration
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Import
import org.springframework.data.jpa.repository.config.EnableJpaRepositories
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.web.servlet.setup.MockMvcBuilders
Expand All @@ -29,11 +33,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status

@DataJpaTest(properties = ["spring.jackson.mapper.accept-case-insensitive-enums=true"])
@EnableJpaRepositories(basePackages = ["edu.internet2.tier.shibboleth.admin.ui"])
@EntityScan("edu.internet2.tier.shibboleth.admin.ui")
@ContextConfiguration(classes = [ShibUIConfiguration, ABCTConfig])
class AttributeBundleControllerTests extends Specification {
@Import([ShibUIConfiguration.class, ABCTConfig.class])
class AttributeBundleControllerTests extends AbstractBaseDataJpaTest {
@Autowired
AttributeBundleController controller

Expand Down Expand Up @@ -67,7 +68,7 @@ class AttributeBundleControllerTests extends Specification {
{
"name": "bundleName",
"resourceId": "randomIDVal",
"attributes": ["eduPersonPrincipalName", "surname", "givenName"]
"attributeNames": ["eduPersonPrincipalName", "surname", "givenName"]
}
"""

Expand All @@ -80,7 +81,7 @@ class AttributeBundleControllerTests extends Specification {
.andExpect(content().contentType(APPLICATION_JSON))
.andExpect(jsonPath("\$.[0].name").value("bundleName"))
.andExpect(jsonPath("\$.[0].resourceId").value("randomIDVal"))
.andExpect(jsonPath("\$.[0].attributes", containsInAnyOrder("eduPersonPrincipalName", "surname", "givenName")))
.andExpect(jsonPath("\$.[0].attributeNames", containsInAnyOrder("eduPersonPrincipalName", "surname", "givenName")))
}

def "CREATE checks" () {
Expand All @@ -92,7 +93,7 @@ class AttributeBundleControllerTests extends Specification {
{
"name": "bundleName",
"resourceId": "randomIDVal",
"attributes": ["eduPersonPrincipalName", "surname", "givenName"]
"attributeNames": ["eduPersonPrincipalName", "surname", "givenName"]
}
"""
AttributeBundle bundle = objectMapper.readValue(json, AttributeBundle.class)
Expand All @@ -111,7 +112,7 @@ class AttributeBundleControllerTests extends Specification {
{
"name": "bundle2",
"resourceId": "differentResourceId",
"attributes": ["eduPersonPrincipalName", "surname", "givenName"]
"attributeNames": ["eduPersonPrincipalName", "surname", "givenName"]
}
"""

Expand All @@ -121,7 +122,7 @@ class AttributeBundleControllerTests extends Specification {
.andExpect(content().contentType(APPLICATION_JSON))
.andExpect(jsonPath("\$.name").value("bundle2"))
.andExpect(jsonPath("\$.resourceId").value("differentResourceId"))
.andExpect(jsonPath("\$.attributes", containsInAnyOrder("eduPersonPrincipalName", "surname", "givenName")))
.andExpect(jsonPath("\$.attributeNames", containsInAnyOrder("eduPersonPrincipalName", "surname", "givenName")))
}

def "test delete" () {
Expand All @@ -133,7 +134,7 @@ class AttributeBundleControllerTests extends Specification {
{
"name": "bundleName",
"resourceId": "randomIDVal",
"attributes": ["eduPersonPrincipalName", "surname", "givenName"]
"attributeNames": ["eduPersonPrincipalName", "surname", "givenName"]
}
"""
AttributeBundle bundle = objectMapper.readValue(json, AttributeBundle.class)
Expand Down Expand Up @@ -167,7 +168,7 @@ class AttributeBundleControllerTests extends Specification {
{
"name": "bundleName",
"resourceId": "randomIDVal",
"attributes": ["eduPersonPrincipalName", "surname", "givenName"]
"attributeNames": ["eduPersonPrincipalName", "surname", "givenName"]
}
"""
AttributeBundle bundle = objectMapper.readValue(json, AttributeBundle.class)
Expand All @@ -187,7 +188,7 @@ class AttributeBundleControllerTests extends Specification {
{
"name": "bundle2",
"resourceId": "randomIDVal",
"attributes": ["eduPersonUniqueId", "employeeNumber", "givenName"]
"attributeNames": ["eduPersonUniqueId", "employeeNumber", "givenName"]
}
"""

Expand All @@ -198,7 +199,7 @@ class AttributeBundleControllerTests extends Specification {
.andExpect(content().contentType(APPLICATION_JSON))
.andExpect(jsonPath("\$.name").value("bundle2"))
.andExpect(jsonPath("\$.resourceId").value("randomIDVal"))
.andExpect(jsonPath("\$.attributes", containsInAnyOrder("eduPersonUniqueId", "employeeNumber", "givenName")))
.andExpect(jsonPath("\$.attributeNames", containsInAnyOrder("eduPersonUniqueId", "employeeNumber", "givenName")))
}

// can go away with merge to develop and this extends the base test class
Expand All @@ -219,6 +220,11 @@ class AttributeBundleControllerTests extends Specification {
it
}
}
//
// @Bean
// public CustomPropertiesConfiguration customPropertiesConfiguration() {
// return new CustomPropertiesConfiguration();
// }

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class AttributeBundleRepositoryTests extends Specification {
{
"name": "bundleName",
"resourceId": "randomIDVal",
"attributes": ["eduPersonPrincipalName", "surname", "givenName"]
"attributeNames": ["eduPersonPrincipalName", "surname", "givenName"]
}
"""

Expand Down

0 comments on commit c75adf3

Please sign in to comment.