Skip to content

Commit

Permalink
fix test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoayyed committed Sep 27, 2019
1 parent 61469c3 commit eb26c44
Show file tree
Hide file tree
Showing 135 changed files with 559 additions and 800 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
import org.springframework.context.support.StaticApplicationContext;
import org.springframework.test.context.TestPropertySource;

import java.util.HashMap;

Expand All @@ -23,9 +22,9 @@
* @since 5.3.0
*/
@Tag("Groovy")
@SpringBootTest(classes = RefreshAutoConfiguration.class)
@SpringBootTest(classes = RefreshAutoConfiguration.class,
properties = "cas.authn.attributeRepository.groovy[0].location=classpath:GroovyAttributeDao.groovy")
@EnableConfigurationProperties(CasConfigurationProperties.class)
@TestPropertySource(properties = "cas.authn.attributeRepository.groovy[0].location=classpath:GroovyAttributeDao.groovy")
public class InternalGroovyScriptDaoTests {
@Autowired
private CasConfigurationProperties casProperties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.springframework.core.env.CompositePropertySource;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ResourceLoader;
import org.springframework.test.context.TestPropertySource;

import static org.junit.jupiter.api.Assertions.*;

Expand All @@ -27,8 +26,8 @@
RefreshAutoConfiguration.class,
CasCoreBootstrapStandaloneLocatorConfiguration.class,
CasCoreBootstrapStandaloneConfiguration.class
})
@TestPropertySource(properties = {"spring.cloud.config.enabled=false", "spring.application.name=CAS"})
},
properties = {"spring.cloud.config.enabled=false", "spring.application.name=CAS"})
public class DefaultCasConfigurationPropertiesSourceLocatorTests {
static {
System.setProperty("spring.application.name", "cas");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.springframework.boot.test.context.TestConfiguration;
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.TestPropertySource;

/**
* This is {@link RegisteredServicesEventListenerTests}.
Expand All @@ -37,12 +36,7 @@
CasCoreUtilConfiguration.class,
MailSenderAutoConfiguration.class,
MailSenderValidatorAutoConfiguration.class
})
@Tag("Mail")
@EnabledIfContinuousIntegration
@EnabledIfPortOpen(port = 25000)
@EnableConfigurationProperties(CasConfigurationProperties.class)
@TestPropertySource(properties = {
}, properties = {
"spring.mail.host=localhost",
"spring.mail.port=25000",
"spring.mail.testConnection=true",
Expand All @@ -52,6 +46,10 @@
"cas.serviceRegistry.mail.subject=Sample Subject",
"cas.serviceRegistry.mail.text=Service %s has expired in CAS service registry"
})
@Tag("Mail")
@EnabledIfContinuousIntegration
@EnabledIfPortOpen(port = 25000)
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class RegisteredServicesEventListenerTests {
@Autowired
@Qualifier("servicesManager")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
import org.springframework.test.context.TestPropertySource;

import java.util.List;

Expand All @@ -34,11 +33,11 @@
CasCoreUtilConfiguration.class,
MailSenderAutoConfiguration.class,
MailSenderValidatorAutoConfiguration.class
})
},
properties = {"spring.mail.host=localhost", "spring.mail.port=25000", "spring.mail.testConnection=true"})
@Tag("Mail")
@EnabledIfContinuousIntegration
@EnabledIfPortOpen(port = 25000)
@TestPropertySource(properties = {"spring.mail.host=localhost", "spring.mail.port=25000", "spring.mail.testConnection=true"})
public class CommunicationsManagerTests {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
import org.springframework.test.context.TestPropertySource;

import static org.junit.jupiter.api.Assertions.*;

Expand All @@ -25,9 +24,8 @@
CasCoreUtilConfiguration.class,
MailSenderAutoConfiguration.class,
MailSenderValidatorAutoConfiguration.class
})
}, properties = "cas.smsProvider.groovy.location=classpath:/GroovySmsSender.groovy")
@Tag("Groovy")
@TestPropertySource(properties = "cas.smsProvider.groovy.location=classpath:/GroovySmsSender.groovy")
public class GroovySmsSenderTests {
@Autowired
@Qualifier("communicationsManager")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.http.MediaType;
import org.springframework.test.context.TestPropertySource;

import java.nio.charset.StandardCharsets;

Expand All @@ -33,9 +32,9 @@
CasCoreUtilConfiguration.class,
MailSenderAutoConfiguration.class,
MailSenderValidatorAutoConfiguration.class
})
},
properties = "cas.smsProvider.rest.url=http://localhost:8132")
@Tag("RestfulApi")
@TestPropertySource(properties = "cas.smsProvider.rest.url=http://localhost:8132")
public class RestfulSmsSenderTests {
@Autowired
@Qualifier("communicationsManager")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.webflow.context.servlet.ServletExternalContext;
import org.springframework.webflow.execution.RequestContextHolder;
import org.springframework.webflow.test.MockRequestContext;
Expand Down Expand Up @@ -83,15 +82,15 @@
CasMultifactorAuthenticationWebflowConfiguration.class,
CasCoreTicketIdGeneratorsConfiguration.class,
CasWebApplicationServiceFactoryConfiguration.class
})
@TestPropertySource(properties = {
"cas.authn.mfa.acceptto.apiUrl=http://localhost:5002",
"cas.authn.mfa.acceptto.application-id=thisisatestid",
"cas.authn.mfa.acceptto.secret=thisisasecret",
"cas.authn.mfa.acceptto.organization-id=thisisatestid",
"cas.authn.mfa.acceptto.organization-secret=thisisasecret",
"cas.authn.mfa.acceptto.registration-api-public-key.location=classpath:publickey.pem"
})
},
properties = {
"cas.authn.mfa.acceptto.apiUrl=http://localhost:5002",
"cas.authn.mfa.acceptto.application-id=thisisatestid",
"cas.authn.mfa.acceptto.secret=thisisasecret",
"cas.authn.mfa.acceptto.organization-id=thisisatestid",
"cas.authn.mfa.acceptto.organization-secret=thisisasecret",
"cas.authn.mfa.acceptto.registration-api-public-key.location=classpath:publickey.pem"
})
public class AccepttoMultifactorAuthenticationHandlerTests {
private static final ObjectMapper MAPPER = new ObjectMapper().findAndRegisterModules();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.webflow.context.servlet.ServletExternalContext;
import org.springframework.webflow.execution.RequestContextHolder;
import org.springframework.webflow.test.MockRequestContext;
Expand Down Expand Up @@ -89,15 +88,15 @@
CasMultifactorAuthenticationWebflowConfiguration.class,
CasCoreMultifactorAuthenticationConfiguration.class,
CasWebApplicationServiceFactoryConfiguration.class
})
@TestPropertySource(properties = {
"cas.authn.mfa.acceptto.apiUrl=http://localhost:5001",
"cas.authn.mfa.acceptto.application-id=thisisatestid",
"cas.authn.mfa.acceptto.secret=thisisasecret",
"cas.authn.mfa.acceptto.organization-id=thisisatestid",
"cas.authn.mfa.acceptto.organization-secret=thisisasecret",
"cas.authn.mfa.acceptto.registration-api-public-key.location=classpath:publickey.pem"
})
},
properties = {
"cas.authn.mfa.acceptto.apiUrl=http://localhost:5001",
"cas.authn.mfa.acceptto.application-id=thisisatestid",
"cas.authn.mfa.acceptto.secret=thisisasecret",
"cas.authn.mfa.acceptto.organization-id=thisisatestid",
"cas.authn.mfa.acceptto.organization-secret=thisisasecret",
"cas.authn.mfa.acceptto.registration-api-public-key.location=classpath:publickey.pem"
})
public class AccepttoMultifactorFetchChannelActionTests {
private static final ObjectMapper MAPPER = new ObjectMapper().findAndRegisterModules();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.webflow.context.servlet.ServletExternalContext;
import org.springframework.webflow.execution.RequestContextHolder;
import org.springframework.webflow.test.MockRequestContext;
Expand Down Expand Up @@ -90,15 +89,15 @@
CasMultifactorAuthenticationWebflowConfiguration.class,
CasCoreMultifactorAuthenticationConfiguration.class,
CasWebApplicationServiceFactoryConfiguration.class
})
@TestPropertySource(properties = {
"cas.authn.mfa.acceptto.apiUrl=http://localhost:5001",
"cas.authn.mfa.acceptto.application-id=thisisatestid",
"cas.authn.mfa.acceptto.secret=thisisasecret",
"cas.authn.mfa.acceptto.organization-id=thisisatestid",
"cas.authn.mfa.acceptto.organization-secret=thisisasecret",
"cas.authn.mfa.acceptto.registration-api-public-key.location=classpath:publickey.pem"
})
},
properties = {
"cas.authn.mfa.acceptto.apiUrl=http://localhost:5001",
"cas.authn.mfa.acceptto.application-id=thisisatestid",
"cas.authn.mfa.acceptto.secret=thisisasecret",
"cas.authn.mfa.acceptto.organization-id=thisisatestid",
"cas.authn.mfa.acceptto.organization-secret=thisisasecret",
"cas.authn.mfa.acceptto.registration-api-public-key.location=classpath:publickey.pem"
})
public class AccepttoMultifactorValidateChannelActionTests {
private static final ObjectMapper MAPPER = new ObjectMapper().findAndRegisterModules();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
import org.springframework.test.context.TestPropertySource;

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
Expand Down Expand Up @@ -67,15 +66,15 @@
CasMultifactorAuthenticationWebflowConfiguration.class,
CasCoreMultifactorAuthenticationConfiguration.class,
CasWebApplicationServiceFactoryConfiguration.class
})
@TestPropertySource(properties = {
"cas.authn.mfa.acceptto.apiUrl=http://localhost:5001",
"cas.authn.mfa.acceptto.application-id=thisisatestid",
"cas.authn.mfa.acceptto.secret=thisisasecret",
"cas.authn.mfa.acceptto.organization-id=thisisatestid",
"cas.authn.mfa.acceptto.organization-secret=thisisasecret",
"cas.authn.mfa.acceptto.registration-api-public-key.location=classpath:publickey.pem"
})
},
properties = {
"cas.authn.mfa.acceptto.apiUrl=http://localhost:5001",
"cas.authn.mfa.acceptto.application-id=thisisatestid",
"cas.authn.mfa.acceptto.secret=thisisasecret",
"cas.authn.mfa.acceptto.organization-id=thisisatestid",
"cas.authn.mfa.acceptto.organization-secret=thisisasecret",
"cas.authn.mfa.acceptto.registration-api-public-key.location=classpath:publickey.pem"
})
public class AccepttoQRCodeAuthenticationHandlerTests {
@Test
public void verifyOperation() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
import org.springframework.mock.web.MockServletContext;
import org.springframework.test.context.TestPropertySource;
import org.springframework.webflow.context.servlet.ServletExternalContext;
import org.springframework.webflow.execution.Action;
import org.springframework.webflow.execution.repository.NoSuchFlowExecutionException;
Expand Down Expand Up @@ -78,8 +77,7 @@
CasCookieConfiguration.class,
RefreshAutoConfiguration.class,
CasCoreServicesConfiguration.class
})
@TestPropertySource(properties = "cas.sso.allowMissingServiceParameter=false")
}, properties = "cas.sso.allowMissingServiceParameter=false")
public class InitialFlowSetupActionSsoTests {
@Autowired
@Qualifier("initialFlowSetupAction")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
import org.springframework.test.context.TestPropertySource;

/**
* This is {@link DynamoDbAuditTrailManagerTests}.
Expand All @@ -30,19 +29,19 @@
CasCoreUtilConfiguration.class,
CasWebApplicationServiceFactoryConfiguration.class,
RefreshAutoConfiguration.class,
CasCoreWebConfiguration.class}
CasCoreWebConfiguration.class},
properties = {
"cas.audit.dynamoDb.endpoint=http://localhost:8000",
"cas.audit.dynamoDb.dropTablesOnStartup=true",
"cas.audit.dynamoDb.localInstance=true",
"cas.audit.dynamoDb.region=us-east-1",
"cas.audit.dynamoDb.asynchronous=false"
}
)
@Tag("DynamoDb")
@Getter
@EnabledIfContinuousIntegration
@EnabledIfPortOpen(port = 8000)
@TestPropertySource(properties = {
"cas.audit.dynamoDb.endpoint=http://localhost:8000",
"cas.audit.dynamoDb.dropTablesOnStartup=true",
"cas.audit.dynamoDb.localInstance=true",
"cas.audit.dynamoDb.region=us-east-1",
"cas.audit.dynamoDb.asynchronous=false"
})
public class DynamoDbAuditTrailManagerTests extends BaseAuditConfigurationTests {

static {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.autoconfigure.RefreshAutoConfiguration;
import org.springframework.test.context.TestPropertySource;

/**
* This is {@link CasSupportJdbcAuditConfigurationTests}.
Expand All @@ -28,9 +27,8 @@
CasCoreUtilConfiguration.class,
AopAutoConfiguration.class,
RefreshAutoConfiguration.class
})
}, properties = "cas.audit.jdbc.asynchronous=false")
@EnableConfigurationProperties(CasConfigurationProperties.class)
@TestPropertySource(properties = "cas.audit.jdbc.asynchronous=false")
@Getter
public class CasSupportJdbcAuditConfigurationTests extends BaseAuditConfigurationTests {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* @author Misagh Moayyed
* @since 5.2.0
*/
@TestPropertySource
@SpringBootTest(classes = {
CasCoreAuditConfiguration.class,
CasSupportMongoDbAuditConfiguration.class,
Expand Down
Loading

0 comments on commit eb26c44

Please sign in to comment.