Merge branch 'master' into pr/720-tim-bootstrap-security
This commit is contained in:
commit
5ee61b493a
|
@ -19,13 +19,13 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
public class JavaFolderSizeUnitTest {
|
||||
private final long EXPECTED_SIZE = 381;
|
||||
private final long EXPECTED_SIZE = 24;
|
||||
private String path;
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
final String separator = File.separator;
|
||||
path = String.format("src%stest%sresources", separator, separator);
|
||||
path = String.format("src%stest%sresources%stestFolder", separator, separator, separator);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -76,6 +76,7 @@ public class JavaFileUnitTest {
|
|||
|
||||
@Test
|
||||
public final void givenUsingApache_whenMovingFile_thenCorrect() throws IOException {
|
||||
FileUtils.touch(new File("src/test/resources/fileToMove_apache.txt"));
|
||||
FileUtils.moveFile(FileUtils.getFile("src/test/resources/fileToMove_apache.txt"), FileUtils.getFile("src/test/resources/fileMoved_apache2.txt"));
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Hello world
|
|
@ -0,0 +1 @@
|
|||
Hello world !
|
|
@ -19,6 +19,7 @@ class FirstTest {
|
|||
.sum() > 5, "Sum should be greater than 5");
|
||||
}
|
||||
|
||||
@Disabled("test to show MultipleFailuresError")
|
||||
@Test
|
||||
void groupAssertions() {
|
||||
int[] numbers = {0, 1, 2, 3, 4};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.spring.data.es.config;
|
||||
package com.baeldung.spring.data.dynamodb.config;
|
||||
|
||||
import com.amazonaws.auth.AWSCredentials;
|
||||
import com.amazonaws.auth.BasicAWSCredentials;
|
||||
|
@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
|
|||
import org.springframework.util.StringUtils;
|
||||
|
||||
@Configuration
|
||||
@EnableDynamoDBRepositories(basePackages = "com.baeldung.spring.data.es.repositories")
|
||||
@EnableDynamoDBRepositories(basePackages = "com.baeldung.spring.data.dynamodb.repositories")
|
||||
public class DynamoDBConfig {
|
||||
|
||||
@Value("${amazon.dynamodb.endpoint}")
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.spring.data.es.model;
|
||||
package com.baeldung.spring.data.dynamodb.model;
|
||||
|
||||
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute;
|
||||
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAutoGeneratedKey;
|
|
@ -1,6 +1,6 @@
|
|||
package com.baeldung.spring.data.es.repositories;
|
||||
package com.baeldung.spring.data.dynamodb.repositories;
|
||||
|
||||
import com.baeldung.spring.data.es.model.ProductInfo;
|
||||
import com.baeldung.spring.data.dynamodb.model.ProductInfo;
|
||||
import org.socialsignin.spring.data.dynamodb.repository.EnableScan;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.baeldung.spring.data.es.repository;
|
||||
package com.baeldung.spring.data.dynamodb.repository;
|
||||
|
||||
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
|
||||
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
|
||||
|
@ -6,9 +6,10 @@ import com.amazonaws.services.dynamodbv2.model.CreateTableRequest;
|
|||
import com.amazonaws.services.dynamodbv2.model.ProvisionedThroughput;
|
||||
import com.amazonaws.services.dynamodbv2.model.ResourceInUseException;
|
||||
import com.baeldung.Application;
|
||||
import com.baeldung.spring.data.es.model.ProductInfo;
|
||||
import com.baeldung.spring.data.es.repositories.ProductInfoRepository;
|
||||
import com.baeldung.spring.data.dynamodb.model.ProductInfo;
|
||||
import com.baeldung.spring.data.dynamodb.repositories.ProductInfoRepository;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -43,6 +44,7 @@ public class ProductInfoRepositoryIntegrationTest {
|
|||
private static final String EXPECTED_PRICE = "50";
|
||||
|
||||
@Before
|
||||
@Ignore //TODO Remove Ignore annotations when running locally with Local DynamoDB instance
|
||||
public void setup() throws Exception {
|
||||
|
||||
try {
|
||||
|
@ -62,6 +64,7 @@ public class ProductInfoRepositoryIntegrationTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
@Ignore //TODO Remove Ignore annotations when running locally with Local DynamoDB instance
|
||||
public void givenItemWithExpectedCost_whenRunFindAll_thenItemIsFound() {
|
||||
|
||||
ProductInfo productInfo = new ProductInfo(EXPECTED_COST, EXPECTED_PRICE);
|
|
@ -0,0 +1,18 @@
|
|||
package org.baeldung.security.filter;
|
||||
|
||||
import org.springframework.web.filter.GenericFilterBean;
|
||||
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
public class CustomFilter extends GenericFilterBean {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.baeldung.security.filter.configuration;
|
||||
|
||||
import org.baeldung.security.filter.CustomFilter;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
|
||||
|
||||
@Configuration
|
||||
public class CustomWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.addFilterAfter(new CustomFilter(), BasicAuthenticationFilter.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
<http-basic entry-point-ref="myBasicAuthenticationEntryPoint"/>
|
||||
|
||||
<custom-filter after="BASIC_AUTH_FILTER" ref="myFilter" />
|
||||
</http>
|
||||
|
||||
<authentication-manager>
|
||||
|
@ -22,4 +23,6 @@
|
|||
</authentication-provider>
|
||||
</authentication-manager>
|
||||
|
||||
<beans:bean id="myFilter" class="org.baeldung.security.filter.CustomFilter"/>
|
||||
|
||||
</beans:beans>
|
Loading…
Reference in New Issue