Merge branch 'master' into BAEL-1689
This commit is contained in:
commit
b7b5b50b22
|
@ -40,3 +40,5 @@ This tutorials project is being built **[>> HERE](https://rest-security.ci.cloud
|
|||
- [Apache Maven Standard Directory Layout](http://www.baeldung.com/maven-directory-structure)
|
||||
- [Apache Maven Tutorial](http://www.baeldung.com/maven)
|
||||
- [Designing a User Friendly Java Library](http://www.baeldung.com/design-a-user-friendly-java-library)
|
||||
- [Java Service Provider Interface](http://www.baeldung.com/java-spi)
|
||||
- [Java Streams vs Vavr Streams](http://www.baeldung.com/vavr-java-streams)
|
||||
|
|
|
@ -13,7 +13,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class HillClimbingAlgorithmTest {
|
||||
public class HillClimbingAlgorithmUnitTest {
|
||||
private Stack<String> initStack;
|
||||
private Stack<String> goalStack;
|
||||
|
|
@ -6,7 +6,7 @@ import org.junit.Test;
|
|||
|
||||
import com.baeldung.algorithms.string.search.StringSearchAlgorithms;
|
||||
|
||||
public class StringSearchAlgorithmsTest {
|
||||
public class StringSearchAlgorithmsUnitTest {
|
||||
|
||||
|
||||
@Test
|
|
@ -7,7 +7,7 @@ import org.junit.Assert;
|
|||
import org.junit.Test;
|
||||
import com.baeldung.algorithms.binarysearch.BinarySearch;
|
||||
|
||||
public class BinarySearchTest {
|
||||
public class BinarySearchUnitTest {
|
||||
|
||||
int[] sortedArray = { 0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9 };
|
||||
int key = 6;
|
|
@ -15,7 +15,7 @@ import com.baeldung.algorithms.mcts.tictactoe.Board;
|
|||
import com.baeldung.algorithms.mcts.tictactoe.Position;
|
||||
import com.baeldung.algorithms.mcts.tree.Tree;
|
||||
|
||||
public class MCTSTest {
|
||||
public class MCTSUnitTest {
|
||||
private Tree gameTree;
|
||||
private MonteCarloTreeSearch mcts;
|
||||
|
|
@ -7,7 +7,7 @@ import static org.junit.Assert.*;
|
|||
import com.baeldung.algorithms.minimax.MiniMax;
|
||||
import com.baeldung.algorithms.minimax.Tree;
|
||||
|
||||
public class MinimaxTest {
|
||||
public class MinimaxUnitTest {
|
||||
private Tree gameTree;
|
||||
private MiniMax miniMax;
|
||||
|
|
@ -4,7 +4,7 @@ import static org.junit.Assert.*;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
public class BubbleSortTest {
|
||||
public class BubbleSortUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenIntegerArray_whenSortedWithBubbleSort_thenGetSortedArray() {
|
|
@ -7,13 +7,13 @@ import org.junit.runners.Parameterized;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
public class EditDistanceTest extends EditDistanceDataProvider {
|
||||
public class EditDistanceUnitTest extends EditDistanceDataProvider {
|
||||
|
||||
private String x;
|
||||
private String y;
|
||||
private int result;
|
||||
|
||||
public EditDistanceTest(String a, String b, int res) {
|
||||
public EditDistanceUnitTest(String a, String b, int res) {
|
||||
super();
|
||||
x = a;
|
||||
y = b;
|
|
@ -6,11 +6,11 @@ import org.junit.runner.RunWith;
|
|||
import org.junit.runners.Parameterized;
|
||||
|
||||
@RunWith(value = Parameterized.class)
|
||||
public class CycleDetectionBruteForceTest extends CycleDetectionTestBase {
|
||||
public class CycleDetectionBruteForceUnitTest extends CycleDetectionTestBase {
|
||||
boolean cycleExists;
|
||||
Node<Integer> head;
|
||||
|
||||
public CycleDetectionBruteForceTest(Node<Integer> head, boolean cycleExists) {
|
||||
public CycleDetectionBruteForceUnitTest(Node<Integer> head, boolean cycleExists) {
|
||||
super();
|
||||
this.cycleExists = cycleExists;
|
||||
this.head = head;
|
|
@ -6,11 +6,11 @@ import org.junit.runner.RunWith;
|
|||
import org.junit.runners.Parameterized;
|
||||
|
||||
@RunWith(value = Parameterized.class)
|
||||
public class CycleDetectionByFastAndSlowIteratorsTest extends CycleDetectionTestBase {
|
||||
public class CycleDetectionByFastAndSlowIteratorsUnitTest extends CycleDetectionTestBase {
|
||||
boolean cycleExists;
|
||||
Node<Integer> head;
|
||||
|
||||
public CycleDetectionByFastAndSlowIteratorsTest(Node<Integer> head, boolean cycleExists) {
|
||||
public CycleDetectionByFastAndSlowIteratorsUnitTest(Node<Integer> head, boolean cycleExists) {
|
||||
super();
|
||||
this.cycleExists = cycleExists;
|
||||
this.head = head;
|
|
@ -6,11 +6,11 @@ import org.junit.runner.RunWith;
|
|||
import org.junit.runners.Parameterized;
|
||||
|
||||
@RunWith(value = Parameterized.class)
|
||||
public class CycleDetectionByHashingTest extends CycleDetectionTestBase {
|
||||
public class CycleDetectionByHashingUnitTest extends CycleDetectionTestBase {
|
||||
boolean cycleExists;
|
||||
Node<Integer> head;
|
||||
|
||||
public CycleDetectionByHashingTest(Node<Integer> head, boolean cycleExists) {
|
||||
public CycleDetectionByHashingUnitTest(Node<Integer> head, boolean cycleExists) {
|
||||
super();
|
||||
this.cycleExists = cycleExists;
|
||||
this.head = head;
|
|
@ -6,11 +6,11 @@ import org.junit.runner.RunWith;
|
|||
import org.junit.runners.Parameterized;
|
||||
|
||||
@RunWith(value = Parameterized.class)
|
||||
public class CycleRemovalBruteForceTest extends CycleDetectionTestBase {
|
||||
public class CycleRemovalBruteForceUnitTest extends CycleDetectionTestBase {
|
||||
boolean cycleExists;
|
||||
Node<Integer> head;
|
||||
|
||||
public CycleRemovalBruteForceTest(Node<Integer> head, boolean cycleExists) {
|
||||
public CycleRemovalBruteForceUnitTest(Node<Integer> head, boolean cycleExists) {
|
||||
super();
|
||||
this.cycleExists = cycleExists;
|
||||
this.head = head;
|
|
@ -6,11 +6,11 @@ import org.junit.runner.RunWith;
|
|||
import org.junit.runners.Parameterized;
|
||||
|
||||
@RunWith(value = Parameterized.class)
|
||||
public class CycleRemovalByCountingLoopNodesTest extends CycleDetectionTestBase {
|
||||
public class CycleRemovalByCountingLoopNodesUnitTest extends CycleDetectionTestBase {
|
||||
boolean cycleExists;
|
||||
Node<Integer> head;
|
||||
|
||||
public CycleRemovalByCountingLoopNodesTest(Node<Integer> head, boolean cycleExists) {
|
||||
public CycleRemovalByCountingLoopNodesUnitTest(Node<Integer> head, boolean cycleExists) {
|
||||
super();
|
||||
this.cycleExists = cycleExists;
|
||||
this.head = head;
|
|
@ -6,11 +6,11 @@ import org.junit.runner.RunWith;
|
|||
import org.junit.runners.Parameterized;
|
||||
|
||||
@RunWith(value = Parameterized.class)
|
||||
public class CycleRemovalWithoutCountingLoopNodesTest extends CycleDetectionTestBase {
|
||||
public class CycleRemovalWithoutCountingLoopNodesUnitTest extends CycleDetectionTestBase {
|
||||
boolean cycleExists;
|
||||
Node<Integer> head;
|
||||
|
||||
public CycleRemovalWithoutCountingLoopNodesTest(Node<Integer> head, boolean cycleExists) {
|
||||
public CycleRemovalWithoutCountingLoopNodesUnitTest(Node<Integer> head, boolean cycleExists) {
|
||||
super();
|
||||
this.cycleExists = cycleExists;
|
||||
this.head = head;
|
|
@ -6,7 +6,7 @@ import org.junit.Test;
|
|||
|
||||
import com.baeldung.algorithms.numberwordconverter.NumberWordConverter;
|
||||
|
||||
public class NumberWordConverterTest {
|
||||
public class NumberWordConverterUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenMoneyNegative_thenReturnInvalidInput() {
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PrimeGeneratorTest {
|
||||
public class PrimeGeneratorUnitTest {
|
||||
@Test
|
||||
public void whenBruteForced_returnsSuccessfully() {
|
||||
final List<Integer> primeNumbers = primeNumbersBruteForce(20);
|
|
@ -12,7 +12,7 @@ import org.jgrapht.graph.SimpleWeightedGraph;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class CompleteGraphTest {
|
||||
public class CompleteGraphUnitTest {
|
||||
|
||||
static SimpleWeightedGraph<String, DefaultEdge> completeGraph;
|
||||
static int size = 10;
|
|
@ -24,7 +24,7 @@ import org.jgrapht.traverse.DepthFirstIterator;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DirectedGraphTests {
|
||||
public class DirectedGraphUnitTest {
|
||||
DirectedGraph<String, DefaultEdge> directedGraph;
|
||||
|
||||
@Before
|
|
@ -12,7 +12,7 @@ import org.jgrapht.graph.SimpleWeightedGraph;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class EulerianCircuitTest {
|
||||
public class EulerianCircuitUnitTest {
|
||||
SimpleWeightedGraph<String, DefaultEdge> simpleGraph;
|
||||
|
||||
@Before
|
|
@ -6,7 +6,7 @@ import org.apache.curator.framework.CuratorFrameworkFactory;
|
|||
import org.apache.curator.retry.RetryNTimes;
|
||||
import org.junit.Before;
|
||||
|
||||
public abstract class BaseTest {
|
||||
public abstract class BaseManualTest {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
|
@ -12,9 +12,9 @@ import org.apache.curator.framework.CuratorFramework;
|
|||
import org.apache.curator.x.async.AsyncCuratorFramework;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.baeldung.apache.curator.BaseTest;
|
||||
import com.baeldung.apache.curator.BaseManualTest;
|
||||
|
||||
public class ConfigurationManagementManualTest extends BaseTest {
|
||||
public class ConfigurationManagementManualTest extends BaseManualTest {
|
||||
|
||||
private static final String KEY_FORMAT = "/%s";
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ import org.apache.curator.x.async.modeled.ModeledFramework;
|
|||
import org.apache.curator.x.async.modeled.ZPath;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.baeldung.apache.curator.BaseTest;
|
||||
import com.baeldung.apache.curator.BaseManualTest;
|
||||
|
||||
public class ModelTypedExamplesManualTest extends BaseTest {
|
||||
public class ModelTypedExamplesManualTest extends BaseManualTest {
|
||||
|
||||
@Test
|
||||
public void givenPath_whenStoreAModel_thenNodesAreCreated()
|
||||
|
|
|
@ -10,9 +10,9 @@ import org.apache.curator.framework.recipes.shared.SharedCount;
|
|||
import org.apache.curator.framework.state.ConnectionState;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.baeldung.apache.curator.BaseTest;
|
||||
import com.baeldung.apache.curator.BaseManualTest;
|
||||
|
||||
public class RecipesManualTest extends BaseTest {
|
||||
public class RecipesManualTest extends BaseManualTest {
|
||||
|
||||
@Test
|
||||
public void givenRunningZookeeper_whenUsingLeaderElection_thenNoErrors() {
|
||||
|
|
|
@ -10,7 +10,7 @@ import opennlp.tools.tokenize.SimpleTokenizer;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ChunkerTest {
|
||||
public class ChunkerUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenChunkerModel_whenChunk_thenChunksAreDetected() throws Exception {
|
|
@ -19,7 +19,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import static org.assertj.core.api.Assertions.tuple;
|
||||
import org.junit.Test;
|
||||
|
||||
public class LanguageDetectorAndTrainingDataTest {
|
||||
public class LanguageDetectorAndTrainingDataUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenLanguageDictionary_whenLanguageDetect_thenLanguageIsDetected() throws FileNotFoundException, IOException {
|
|
@ -8,7 +8,7 @@ import opennlp.tools.tokenize.SimpleTokenizer;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import org.junit.Test;
|
||||
|
||||
public class LemmetizerTest {
|
||||
public class LemmetizerUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenEnglishDictionary_whenLemmatize_thenLemmasAreDetected() throws Exception {
|
|
@ -11,7 +11,7 @@ import opennlp.tools.util.Span;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import org.junit.Test;
|
||||
|
||||
public class NamedEntityRecognitionTest {
|
||||
public class NamedEntityRecognitionUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenEnglishPersonModel_whenNER_thenPersonsAreDetected() throws Exception {
|
|
@ -7,7 +7,7 @@ import opennlp.tools.tokenize.SimpleTokenizer;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import org.junit.Test;
|
||||
|
||||
public class POSTaggerTest {
|
||||
public class POSTaggerUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenPOSModel_whenPOSTagging_thenPOSAreDetected() throws Exception {
|
|
@ -6,7 +6,7 @@ import opennlp.tools.sentdetect.SentenceModel;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import org.junit.Test;
|
||||
|
||||
public class SentenceDetectionTest {
|
||||
public class SentenceDetectionUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenEnglishModel_whenDetect_thenSentencesAreDetected() throws Exception {
|
|
@ -8,7 +8,7 @@ import opennlp.tools.tokenize.WhitespaceTokenizer;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TokenizerTest {
|
||||
public class TokenizerUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenEnglishModel_whenTokenize_thenTokensAreDetected() throws Exception {
|
|
@ -1,2 +1,3 @@
|
|||
### Relevant Articles:
|
||||
- [Introduction to AutoValue](http://www.baeldung.com/introduction-to-autovalue)
|
||||
- [Introduction to AutoFactory](http://www.baeldung.com/autofactory)
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/build/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
|
@ -0,0 +1,4 @@
|
|||
### Relevant Articles:
|
||||
|
||||
- [Deploy Spring Boot App to Azure](http://www.baeldung.com/spring-boot-azure)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
FROM frolvlad/alpine-oraclejdk8:slim
|
||||
VOLUME /tmp
|
||||
ADD azure-0.1.jar app.jar
|
||||
RUN sh -c 'touch /app.jar'
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT [ "sh", "-c", "java -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]
|
|
@ -0,0 +1,131 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>azure</artifactId>
|
||||
<version>0.1</version>
|
||||
<packaging>war</packaging>
|
||||
<name>azure</name>
|
||||
<description>Demo project for Spring Boot on Azure</description>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<azure.containerRegistry>baeldungadr</azure.containerRegistry>
|
||||
<docker.image.prefix>${azure.containerRegistry}.azurecr.io</docker.image.prefix>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.6</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<configuration>
|
||||
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
|
||||
<registryUrl>https://${docker.image.prefix}</registryUrl>
|
||||
<serverId>${azure.containerRegistry}</serverId>
|
||||
<dockerDirectory>docker</dockerDirectory>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/</targetPath>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.microsoft.azure</groupId>
|
||||
<artifactId>azure-webapp-maven-plugin</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<configuration>
|
||||
<authentication>
|
||||
<serverId>azure-auth</serverId>
|
||||
</authentication>
|
||||
<resourceGroup>baeldung-group</resourceGroup>
|
||||
<appName>baeldung-webapp</appName>
|
||||
<appServicePlanName>baeldung-plan</appServicePlanName>
|
||||
<javaVersion>1.8</javaVersion>
|
||||
<!--<javaWebContainer>tomcat 8.5</javaWebContainer>-->
|
||||
<!--<region>japanwest</region>-->
|
||||
<!--<containerSettings>-->
|
||||
<!--<imageName>${docker.image.prefix}/${project.artifactId}</imageName>-->
|
||||
<!--<registryUrl>https://${docker.image.prefix}</registryUrl>-->
|
||||
<!--<serverId>${azure.containerRegistry}</serverId>-->
|
||||
<!--</containerSettings>-->
|
||||
<appSettings>
|
||||
<property>
|
||||
<name>spring.datasource.url</name>
|
||||
<value>jdbc:h2:file:~/test</value>
|
||||
<!--<value>jdbc:mysql://127.0.0.1:55738/localdb</value>-->
|
||||
</property>
|
||||
<property>
|
||||
<name>spring.datasource.username</name>
|
||||
<value>sa</value>
|
||||
<!--<value>azure</value>-->
|
||||
</property>
|
||||
<property>
|
||||
<name>spring.datasource.password</name>
|
||||
<value></value>
|
||||
<!--<value>replace-with-your-password</value>-->
|
||||
</property>
|
||||
</appSettings>
|
||||
<!--<deploymentType>ftp</deploymentType>-->
|
||||
<!--<resources>-->
|
||||
<!--<resource>-->
|
||||
<!--<directory>${project.basedir}/target</directory>-->
|
||||
<!--<targetPath>webapps</targetPath>-->
|
||||
<!--<includes>-->
|
||||
<!--<include>*.war</include>-->
|
||||
<!--</includes>-->
|
||||
<!--</resource>-->
|
||||
<!--</resources>-->
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
|
@ -0,0 +1,19 @@
|
|||
package com.baeldung.springboot.azure;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
@SpringBootApplication
|
||||
public class AzureApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(AzureApplication.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AzureApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.baeldung.springboot.azure;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import static com.baeldung.springboot.azure.User.userNamed;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
@RestController
|
||||
public class TestController {
|
||||
|
||||
@GetMapping("/hello")
|
||||
public String hello() {
|
||||
return "hello azure!";
|
||||
}
|
||||
|
||||
@Autowired private UserRepository userRepository;
|
||||
|
||||
@PostMapping("/user")
|
||||
public String register(@RequestParam String name) {
|
||||
userRepository.save(userNamed(name));
|
||||
return "registered";
|
||||
}
|
||||
|
||||
@GetMapping("/user")
|
||||
public Iterable<User> userlist() {
|
||||
return userRepository.findAll();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.baeldung.springboot.azure;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
@Entity
|
||||
public class User {
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
public static User userNamed(String name) {
|
||||
User u = new User();
|
||||
u.setName(name);
|
||||
return u;
|
||||
}
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Integer id;
|
||||
private String name;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.baeldung.springboot.azure;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
/**
|
||||
* @author aiet
|
||||
*/
|
||||
public interface UserRepository extends CrudRepository<User, Long> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
server.port=8080
|
||||
server.address=0.0.0.0
|
||||
spring.jpa.hibernate.ddl-auto=create
|
||||
|
||||
logging.file=azure.log
|
||||
logging.level.root=info
|
||||
|
||||
spring.datasource.url=jdbc:h2:file:~/test
|
||||
spring.datasource.username=sa
|
||||
spring.datasource.password=
|
||||
|
||||
#spring.datasource.url=jdbc:mysql://localhost:3306/localdb
|
||||
#spring.datasource.username=your-db-username
|
||||
#spring.datasource.password=your-db-password
|
||||
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.baeldung.springboot.azure;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
public class AzureApplicationTests {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
|
@ -9,7 +9,7 @@ import org.junit.Test;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class AppTest {
|
||||
public class AppUnitTest {
|
||||
|
||||
@Rule
|
||||
public BQTestFactory bqTestFactory = new BQTestFactory();
|
|
@ -12,7 +12,7 @@
|
|||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.0.0.M7</version>
|
||||
<version>1.5.13.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
|
@ -60,28 +60,6 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>spring-milestones</id>
|
||||
<name>Spring Milestones</name>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.baeldung.cassecuredapp.controllers;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.log4j.LogManager;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.web.authentication.logout.CookieClearingLogoutHandler;
|
||||
|
|
|
@ -0,0 +1,228 @@
|
|||
<factorypath>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-support-json-service-registry/5.3.0-SNAPSHOT/cas-server-support-json-service-registry-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-api/2.11.0/log4j-api-2.11.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-core/2.11.0/log4j-core-2.11.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-jcl/2.11.0/log4j-jcl-2.11.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-slf4j-impl/2.11.0/log4j-slf4j-impl-2.11.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-web/2.11.0/log4j-web-2.11.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/slf4j/jul-to-slf4j/1.7.25/jul-to-slf4j-1.7.25.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/lmax/disruptor/3.4.2/disruptor-3.4.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/guava/25.0-jre/guava-25.0-jre.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/checkerframework/checker-compat-qual/2.0.0/checker-compat-qual-2.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_annotations/2.1.3/error_prone_annotations-2.1.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/reflections/reflections/0.9.11/reflections-0.9.11.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/javassist/javassist/3.22.0-GA/javassist-3.22.0-GA.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springmodules/spring-modules-cache/0.8/spring-modules-cache-0.8.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-attributes/commons-attributes-api/2.1/commons-attributes-api-2.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/qdox/qdox/1.5/qdox-1.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-attributes/commons-attributes-compiler/2.1/commons-attributes-compiler-2.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/geronimo-spec/geronimo-spec-jta/1.0.1B-rc4/geronimo-spec-jta-1.0.1B-rc4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/opensymphony/oscache/2.1.1/oscache-2.1.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/oro/oro/2.0.8/oro-2.0.8.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-io/commons-io/2.6/commons-io-2.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-text/1.3/commons-text-1.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-pool2/2.5.0/commons-pool2-2.5.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-cli/commons-cli/1.4/commons-cli-1.4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-beanutils/commons-beanutils/1.9.3/commons-beanutils-1.9.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-configuration2/2.2/commons-configuration2-2.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-validator/commons-validator/1.6/commons-validator-1.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-codec/commons-codec/1.11/commons-codec-1.11.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-jexl/commons-jexl/1.1/commons-jexl-1.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-lang/commons-lang/2.6/commons-lang-2.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jooq/jool/0.9.12/jool-0.9.12.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/lalyos/jfiglet/0.0.8/jfiglet-0.0.8.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/commons-collections/commons-collections/3.2.2/commons-collections-3.2.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/joda-time/joda-time/2.9.9/joda-time-2.9.9.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/inspektr/inspektr-audit/1.8.2.GA/inspektr-audit-1.8.2.GA.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/inspektr/inspektr-common/1.8.2.GA/inspektr-common-1.8.2.GA.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.9.3/jackson-core-2.9.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/inspektr/inspektr-support-spring/1.8.2.GA/inspektr-support-spring-1.8.2.GA.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/inspektr/inspektr-error/1.8.2.GA/inspektr-error-1.8.2.GA.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/service/persondir/person-directory-impl/1.8.6/person-directory-impl-1.8.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/service/persondir/person-directory-api/1.8.6/person-directory-api-1.8.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/shell/spring-shell/1.2.0.RELEASE/spring-shell-1.2.0.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-aop/4.3.17.RELEASE/spring-aop-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-beans/4.3.17.RELEASE/spring-beans-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/webflow/spring-binding/2.5.0.RELEASE/spring-binding-2.5.0.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context/4.3.17.RELEASE/spring-context-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-context-support/4.3.17.RELEASE/spring-context-support-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-core/4.3.17.RELEASE/spring-core-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/data/spring-data-mongodb/1.10.7.RELEASE/spring-data-mongodb-1.10.7.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/data/spring-data-commons/1.13.7.RELEASE/spring-data-commons-1.13.7.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-jms/4.3.17.RELEASE/spring-jms-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-messaging/4.3.17.RELEASE/spring-messaging-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-expression/4.3.17.RELEASE/spring-expression-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-jdbc/4.3.17.RELEASE/spring-jdbc-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-orm/4.3.17.RELEASE/spring-orm-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-tx/4.3.17.RELEASE/spring-tx-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-web/4.3.17.RELEASE/spring-web-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/webflow/spring-webflow/2.5.0.RELEASE/spring-webflow-2.5.0.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/spring-webflow-client-repo/1.0.3/spring-webflow-client-repo-1.0.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-webmvc/4.3.17.RELEASE/spring-webmvc-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.9.5/jackson-databind-2.9.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/datatype/jackson-datatype-guava/2.9.5/jackson-datatype-guava-2.9.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.9.5/jackson-annotations-2.9.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.5/jackson-jaxrs-json-provider-2.9.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.9.5/jackson-jaxrs-base-2.9.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.5/jackson-module-jaxb-annotations-2.9.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.9.5/jackson-datatype-jsr310-2.9.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/hjson/hjson/3.0.0/hjson-3.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.9.5/jackson-dataformat-yaml-2.9.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpclient/4.5.5/httpclient-4.5.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/httpcomponents/httpcore/4.4.9/httpcore-4.4.9.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/axet/wget/1.4.9/wget-1.4.9.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/axet/threads/0.0.14/threads-0.0.14.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jsoup/jsoup/1.10.1/jsoup-1.10.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/quartz-scheduler/quartz/2.3.0/quartz-2.3.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/mchange/mchange-commons-java/0.2.11/mchange-commons-java-0.2.11.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/hibernate-core/5.2.16.Final/hibernate-core-5.2.16.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/javax/persistence/hibernate-jpa-2.1-api/1.0.0.Final/hibernate-jpa-2.1-api-1.0.0.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/spec/javax/transaction/jboss-transaction-api_1.2_spec/1.0.1.Final/jboss-transaction-api_1.2_spec-1.0.1.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/jandex/2.0.3.Final/jandex-2.0.3.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/common/hibernate-commons-annotations/5.0.1.Final/hibernate-commons-annotations-5.0.1.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/hibernate-hikaricp/5.2.16.Final/hibernate-hikaricp-5.2.16.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/hibernate-entitymanager/5.2.16.Final/hibernate-entitymanager-5.2.16.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jboss/logging/jboss-logging/3.3.1.Final/jboss-logging-3.3.1.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/net/bytebuddy/byte-buddy/1.6.14/byte-buddy-1.6.14.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/hibernate/hibernate-validator/5.4.1.Final/hibernate-validator-5.4.1.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/zaxxer/HikariCP/3.1.0/HikariCP-3.1.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/javax/el/javax.el-api/3.0.0/javax.el-api-3.0.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/glassfish/web/el-impl/2.2/el-impl-2.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/javax/el/el-api/2.2/el-api-2.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/cloud/spring-cloud-commons/1.3.0.RELEASE/spring-cloud-commons-1.3.0.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/security/spring-security-crypto/4.2.3.RELEASE/spring-security-crypto-4.2.3.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/cloud/spring-cloud-context/1.3.0.RELEASE/spring-cloud-context-1.3.0.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-websocket/1.5.13.RELEASE/spring-boot-starter-websocket-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter/1.5.13.RELEASE/spring-boot-starter-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/yaml/snakeyaml/1.17/snakeyaml-1.17.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/spring-websocket/4.3.17.RELEASE/spring-websocket-4.3.17.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-mail/1.5.13.RELEASE/spring-boot-starter-mail-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/sun/mail/javax.mail/1.5.6/javax.mail-1.5.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-web/1.5.13.RELEASE/spring-boot-starter-web-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-autoconfigure/1.5.13.RELEASE/spring-boot-autoconfigure-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot/1.5.13.RELEASE/spring-boot-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-devtools/1.5.13.RELEASE/spring-boot-devtools-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-actuator/1.5.13.RELEASE/spring-boot-starter-actuator-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-actuator/1.5.13.RELEASE/spring-boot-actuator-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-services/5.3.0-SNAPSHOT/cas-server-core-api-services-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-authentication/5.3.0-SNAPSHOT/cas-server-core-api-authentication-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-protocol/5.3.0-SNAPSHOT/cas-server-core-api-protocol-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-util/5.3.0-SNAPSHOT/cas-server-core-api-util-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/aspectj/aspectjrt/1.9.1/aspectjrt-1.9.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/aspectj/aspectjweaver/1.9.1/aspectjweaver-1.9.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-services/5.3.0-SNAPSHOT/cas-server-core-services-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-audit/5.3.0-SNAPSHOT/cas-server-core-api-audit-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api/5.3.0-SNAPSHOT/cas-server-core-api-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-services-api/5.3.0-SNAPSHOT/cas-server-core-services-api-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-services-authentication/5.3.0-SNAPSHOT/cas-server-core-services-authentication-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-web-api/5.3.0-SNAPSHOT/cas-server-core-web-api-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-logout/5.3.0-SNAPSHOT/cas-server-core-api-logout-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/thymeleaf/thymeleaf-spring4/3.0.9.RELEASE/thymeleaf-spring4-3.0.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/thymeleaf/thymeleaf/3.0.9.RELEASE/thymeleaf-3.0.9.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/attoparser/attoparser/2.0.4.RELEASE/attoparser-2.0.4.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/unbescape/unbescape/1.1.5.RELEASE/unbescape-1.1.5.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-thymeleaf/1.5.13.RELEASE/spring-boot-starter-thymeleaf-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-security-filter/2.0.10.2/cas-server-security-filter-2.0.10.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-authentication-attributes/5.3.0-SNAPSHOT/cas-server-core-authentication-attributes-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/groovy/groovy-jsr223/2.4.15/groovy-jsr223-2.4.15.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/groovy/groovy/2.4.15/groovy-2.4.15.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/groovy/groovy-console/2.4.15/groovy-console-2.4.15.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/groovy/groovy-swing/2.4.15/groovy-swing-2.4.15.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/groovy/groovy-templates/2.4.15/groovy-templates-2.4.15.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/groovy/groovy-xml/2.4.15/groovy-xml-2.4.15.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/groovy/groovy-groovysh/2.4.15/groovy-groovysh-2.4.15.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/jline/jline/2.12/jline-2.12.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-util-api/5.3.0-SNAPSHOT/cas-server-core-util-api-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/bitbucket/b_c/jose4j/0.6.3/jose4j-0.6.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-ticket/5.3.0-SNAPSHOT/cas-server-core-api-ticket-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-web/5.3.0-SNAPSHOT/cas-server-core-api-web-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/pac4j-cas/3.0.0-RC2/pac4j-cas-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jasig/cas/client/cas-client-core/3.5.0/cas-client-core-3.5.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jasig/cas/client/cas-client-support-saml/3.5.0/cas-client-support-saml-3.5.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/pac4j-config/3.0.0-RC2/pac4j-config-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/pac4j-core/3.0.0-RC2/pac4j-core-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/pac4j-http/3.0.0-RC2/pac4j-http-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/pac4j-jwt/3.0.0-RC2/pac4j-jwt-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/pac4j-oidc/3.0.0-RC2/pac4j-oidc-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/pac4j-mongo/3.0.0-RC2/pac4j-mongo-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/pac4j-oauth/3.0.0-RC2/pac4j-oauth-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/scribejava/scribejava-apis/5.3.0/scribejava-apis-5.3.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/scribejava/scribejava-core/5.3.0/scribejava-core-5.3.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/pac4j-saml/3.0.0-RC2/pac4j-saml-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/xalan/xalan/2.7.2/xalan-2.7.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/xalan/serializer/2.7.2/serializer-2.7.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/pac4j/spring-webmvc-pac4j/3.0.0-RC2/spring-webmvc-pac4j-3.0.0-RC2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/nimbusds/nimbus-jose-jwt/5.10/nimbus-jose-jwt-5.10.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/stephenc/jcip/jcip-annotations/1.0-1/jcip-annotations-1.0-1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/nimbusds/oauth2-oidc-sdk/5.62/oauth2-oidc-sdk-5.62.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/javax/mail/mail/1.4.7/mail-1.4.7.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/nimbusds/lang-tag/1.4.3/lang-tag-1.4.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/net/minidev/json-smart/1.3.1/json-smart-1.3.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/zxing/core/3.3.2/core-3.3.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/bouncycastle/bcpkix-jdk15on/1.59/bcpkix-jdk15on-1.59.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/cryptacular/cryptacular/1.2.2/cryptacular-1.2.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/bouncycastle/bcprov-jdk15on/1.59/bcprov-jdk15on-1.59.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/vdurmont/semver4j/2.2.0/semver4j-2.2.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/oshi/oshi-core/3.5.0/oshi-core-3.5.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/threeten/threetenbp/1.3.6/threetenbp-1.3.6.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-configuration-api/5.3.0-SNAPSHOT/cas-server-core-configuration-api-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-configuration/5.3.0-SNAPSHOT/cas-server-core-api-configuration-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-configuration-model/5.3.0-SNAPSHOT/cas-server-core-api-configuration-model-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-configuration-processor/1.5.13.RELEASE/spring-boot-configuration-processor-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/json/json/20160810/json-20160810.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-configuration-metadata/1.5.13.RELEASE/spring-boot-configuration-metadata-1.5.13.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/javaparser/javaparser-core/3.6.5/javaparser-core-3.6.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-webflow/5.3.0-SNAPSHOT/cas-server-core-api-webflow-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/security/spring-security-core/4.2.6.RELEASE/spring-security-core-4.2.6.RELEASE.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/mongodb/mongo-java-driver/3.6.3/mongo-java-driver-3.6.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/jasypt/jasypt/1.9.2/jasypt-1.9.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-services-registry/5.3.0-SNAPSHOT/cas-server-core-services-registry-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-events/5.3.0-SNAPSHOT/cas-server-core-api-events-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-api-validation/5.3.0-SNAPSHOT/cas-server-core-api-validation-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-support-jdbc/5.3.0-SNAPSHOT/cas-server-support-jdbc-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-authentication-api/5.3.0-SNAPSHOT/cas-server-core-authentication-api-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-core-authentication-mfa/5.3.0-SNAPSHOT/cas-server-core-authentication-mfa-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/ben-manes/caffeine/caffeine/2.6.2/caffeine-2.6.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/github/ben-manes/caffeine/guava/2.6.2/guava-2.6.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/timgroup/java-statsd-client/3.1.0/java-statsd-client-3.1.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/io/dropwizard/metrics/metrics-annotation/3.2.5/metrics-annotation-3.2.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/io/dropwizard/metrics/metrics-core/3.2.5/metrics-core-3.2.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/io/dropwizard/metrics/metrics-jvm/3.2.5/metrics-jvm-3.2.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/io/dropwizard/metrics/metrics-healthchecks/3.2.5/metrics-healthchecks-3.2.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/io/dropwizard/metrics/metrics-servlets/3.2.5/metrics-servlets-3.2.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/io/dropwizard/metrics/metrics-json/3.2.5/metrics-json-3.2.5.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/papertrail/profiler/1.0.2/profiler-1.0.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/ryantenney/metrics/metrics-spring/3.1.3/metrics-spring-3.1.3.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-support-jdbc-authentication/5.3.0-SNAPSHOT/cas-server-support-jdbc-authentication-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-core/1.4.0/shiro-core-1.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-lang/1.4.0/shiro-lang-1.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-cache/1.4.0/shiro-cache-1.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-crypto-hash/1.4.0/shiro-crypto-hash-1.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-crypto-core/1.4.0/shiro-crypto-core-1.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-crypto-cipher/1.4.0/shiro-crypto-cipher-1.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-config-core/1.4.0/shiro-config-core-1.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-config-ogdl/1.4.0/shiro-config-ogdl-1.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/shiro/shiro-event/1.4.0/shiro-event-1.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/apereo/cas/cas-server-support-jdbc-drivers/5.3.0-SNAPSHOT/cas-server-support-jdbc-drivers-5.3.0-SNAPSHOT.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/hsqldb/hsqldb/2.4.0/hsqldb-2.4.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/postgresql/postgresql/42.2.2/postgresql-42.2.2.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/mysql/mysql-connector-java/8.0.11/mysql-connector-java-8.0.11.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/protobuf/protobuf-java/2.6.0/protobuf-java-2.6.0.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/org/mariadb/jdbc/mariadb-java-client/2.2.4/mariadb-java-client-2.2.4.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="VARJAR" id="M2_REPO/net/sourceforge/jtds/jtds/1.3.1/jtds-1.3.1.jar" enabled="true" runInBatchMode="false"/>
|
||||
<factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="true" runInBatchMode="false"/>
|
||||
</factorypath>
|
|
@ -6,10 +6,11 @@ Generic CAS WAR overlay to exercise the latest versions of CAS. This overlay cou
|
|||
# Versions
|
||||
|
||||
```xml
|
||||
<cas.version>5.1.x</cas.version>
|
||||
<cas.version>5.3.x</cas.version>
|
||||
```
|
||||
|
||||
# Requirements
|
||||
|
||||
* JDK 1.8+
|
||||
|
||||
# Configuration
|
||||
|
@ -64,20 +65,23 @@ Run the CAS web application as an executable WAR via Spring Boot. This is most u
|
|||
|
||||
### Warning!
|
||||
|
||||
Be careful with this method of deployment. `bootRun` is not designed to work with already executable WAR artifacts such that CAS server web application. YMMV. Today, uses of this mode ONLY work when there is **NO OTHER** dependency added to the build script and the `cas-server-webapp` is the only present module. See [this issue](https://github.com/apereo/cas/issues/2334) and [this issue](https://github.com/spring-projects/spring-boot/issues/8320) for more info.
|
||||
Be careful with this method of deployment. `bootRun` is not designed to work with already executable WAR artifacts such that CAS server web application. YMMV. Today, uses of this mode ONLY work when there is **NO OTHER** dependency added to the build script and the `cas-server-webapp` is the only present module. See [this issue](https://github.com/spring-projects/spring-boot/issues/8320) for more info.
|
||||
|
||||
|
||||
## Spring Boot App Server Selection
|
||||
There is an app.server property in the pom.xml that can be used to select a spring boot application server.
|
||||
It defaults to "-tomcat" but "-jetty" and "-undertow" are supported.
|
||||
It can also be set to an empty value (nothing) if you want to deploy CAS to an external application server of your choice and you don't want the spring boot libraries included.
|
||||
|
||||
There is an app.server property in the `pom.xml` that can be used to select a spring boot application server.
|
||||
It defaults to `-tomcat` but `-jetty` and `-undertow` are supported.
|
||||
|
||||
It can also be set to an empty value (nothing) if you want to deploy CAS to an external application server of your choice.
|
||||
|
||||
```xml
|
||||
<app.server>-tomcat<app.server>
|
||||
```
|
||||
|
||||
## Windows Build
|
||||
If you are building on windows, try build.cmd instead of build.sh. Arguments are similar but for usage, run:
|
||||
|
||||
If you are building on windows, try `build.cmd` instead of `build.sh`. Arguments are similar but for usage, run:
|
||||
|
||||
```
|
||||
build.cmd help
|
||||
|
@ -86,3 +90,12 @@ build.cmd help
|
|||
## External
|
||||
|
||||
Deploy resultant `target/cas.war` to a servlet container of choice.
|
||||
|
||||
|
||||
## Command Line Shell
|
||||
|
||||
Invokes the CAS Command Line Shell. For a list of commands either use no arguments or use `-h`. To enter the interactive shell use `-sh`.
|
||||
|
||||
```bash
|
||||
./build.sh cli
|
||||
```
|
|
@ -23,8 +23,10 @@
|
|||
@if "%1" == "bootrun" call:bootrun %2 %3 %4
|
||||
@if "%1" == "debug" call:debug %2 %3 %4
|
||||
@if "%1" == "run" call:run %2 %3 %4
|
||||
@if "%1" == "runalone" call:runalone %2 %3 %4
|
||||
@if "%1" == "help" call:help
|
||||
@if "%1" == "gencert" call:gencert
|
||||
@if "%1" == "cli" call:runcli %2 %3 %4
|
||||
|
||||
@rem function section starts here
|
||||
@goto:eof
|
||||
|
@ -38,7 +40,7 @@
|
|||
@goto:eof
|
||||
|
||||
:help
|
||||
@echo "Usage: build.bat [copy|clean|package|run|debug|bootrun|gencert] [optional extra args for maven]"
|
||||
@echo "Usage: build.bat [copy|clean|package|run|debug|bootrun|gencert|cli] [optional extra args for maven or cli]"
|
||||
@echo "To get started on a clean system, run "build.bat copy" and "build.bat gencert", then "build.bat run"
|
||||
@echo "Note that using the copy or gencert arguments will create and/or overwrite the %CAS_DIR% which is outside this project"
|
||||
@goto:eof
|
||||
|
@ -66,6 +68,10 @@
|
|||
call:package %1 %2 %3 & java %JAVA_ARGS% -jar target/cas.war
|
||||
@goto:eof
|
||||
|
||||
:runalone
|
||||
call:package %1 %2 %3 & target/cas.war
|
||||
@goto:eof
|
||||
|
||||
:gencert
|
||||
where /q keytool
|
||||
if ERRORLEVEL 1 (
|
||||
|
@ -80,3 +86,17 @@
|
|||
keytool -exportcert -alias cas -storepass changeit -keystore %CAS_DIR%\thekeystore -file %CAS_DIR%\cas.cer
|
||||
)
|
||||
@goto:eof
|
||||
|
||||
:runcli
|
||||
for /f %%i in ('call %MAVEN_CMD% -q --non-recursive "-Dexec.executable=cmd" "-Dexec.args=/C echo ${cas.version}" "org.codehaus.mojo:exec-maven-plugin:1.3.1:exec"') do set CAS_VERSION=%%i
|
||||
@set CAS_VERSION=%CAS_VERSION: =%
|
||||
@set DOWNLOAD_DIR=target
|
||||
@set COMMAND_FILE=cas-server-support-shell-%CAS_VERSION%.jar
|
||||
@if not exist %DOWNLOAD_DIR% mkdir %DOWNLOAD_DIR%
|
||||
@if not exist %DOWNLOAD_DIR%\%COMMAND_FILE% (
|
||||
@call mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:get -DgroupId=org.apereo.cas -DartifactId=cas-server-support-shell -Dversion=%CAS_VERSION% -Dpackaging=jar -DartifactItem.outputDirectory=%DOWNLOAD_DIR% -DartifactItem.destFileName=%COMMAND_FILE% -DremoteRepositories=central::default::http://repo1.maven.apache.org/maven2,snapshots::::https://oss.sonatype.org/content/repositories/snapshots -Dtransitive=false
|
||||
@call mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy -Dmdep.useBaseVersion=true -Dartifact=org.apereo.cas:cas-server-support-shell:%CAS_VERSION%:jar -DoutputDirectory=%DOWNLOAD_DIR%
|
||||
)
|
||||
@call java %JAVA_ARGS% -jar %DOWNLOAD_DIR%\%COMMAND_FILE% %1 %2 %3
|
||||
|
||||
@goto:eof
|
|
@ -13,24 +13,31 @@ function help() {
|
|||
echo "Usage: build.sh [copy|clean|package|run|debug|bootrun|gencert]"
|
||||
echo " copy: Copy config from ./etc/cas/config to /etc/cas/config"
|
||||
echo " clean: Clean Maven build directory"
|
||||
echo " package: Clean and build CAS war, also call copy"
|
||||
echo " run: Build and run CAS.war via spring boot (java -jar target/cas.war)"
|
||||
echo " package: Clean and build CAS war"
|
||||
echo " run: Build and run cas.war via Java (i.e. java -jar target/cas.war)"
|
||||
echo " runalone: Build and run cas.war on its own as a standalone executable (target/cas.war)"
|
||||
echo " debug: Run CAS.war and listen for Java debugger on port 5000"
|
||||
echo " bootrun: Run with maven spring boot plugin, doesn't work with multiple dependencies"
|
||||
echo " bootrun: Run with maven spring boot plugin"
|
||||
echo " listviews: List all CAS views that ship with the web application and can be customized in the overlay"
|
||||
echo " getview: Ask for a view name to be included in the overlay for customizations"
|
||||
echo " gencert: Create keystore with SSL certificate in location where CAS looks by default"
|
||||
echo " cli: Run the CAS command line shell and pass commands"
|
||||
}
|
||||
|
||||
function clean() {
|
||||
shift
|
||||
./mvnw clean "$@"
|
||||
}
|
||||
|
||||
function package() {
|
||||
shift
|
||||
./mvnw clean package -T 5 "$@"
|
||||
copy
|
||||
# copy
|
||||
}
|
||||
|
||||
function bootrun() {
|
||||
./mvnw clean package spring-boot:run -T 5 "$@"
|
||||
shift
|
||||
./mvnw clean package spring-boot:run -P bootiful -T 5 "$@"
|
||||
}
|
||||
|
||||
function debug() {
|
||||
|
@ -41,14 +48,59 @@ function run() {
|
|||
package && java -jar target/cas.war
|
||||
}
|
||||
|
||||
function runalone() {
|
||||
shift
|
||||
./mvnw clean package -P default,exec "$@"
|
||||
chmod +x target/cas.war
|
||||
target/cas.war
|
||||
}
|
||||
|
||||
function listviews() {
|
||||
shift
|
||||
explodeapp
|
||||
find $PWD/target/cas -type f -name "*.html" | xargs -n 1 basename | sort | more
|
||||
}
|
||||
|
||||
function explodeapp() {
|
||||
if [ ! -d $PWD/target/cas ];then
|
||||
echo "Building the CAS web application and exploding the final war file..."
|
||||
./mvnw clean package war:exploded "$@"
|
||||
fi
|
||||
echo "Exploded the CAS web application file."
|
||||
}
|
||||
|
||||
function getview() {
|
||||
shift
|
||||
explodeapp
|
||||
echo "Searching for view name $@..."
|
||||
results=`find $PWD/target/cas -type f -name "*.html" | grep -i "$@"`
|
||||
echo -e "Found view(s): \n$results"
|
||||
count=`wc -w <<< "$results"`
|
||||
if [ "$count" -eq 1 ];then
|
||||
# echo "Found view $results to include in the overlay"
|
||||
firststring="target/cas/WEB-INF/classes"
|
||||
secondstring="src/main/resources"
|
||||
overlayfile=`echo "${results/$firststring/$secondstring}"`
|
||||
overlaypath=`dirname "${overlayfile}"`
|
||||
# echo "Overlay file is $overlayfile to be created at $overlaypath"
|
||||
mkdir -p $overlaypath
|
||||
cp $results $overlaypath
|
||||
echo "Created view at $overlayfile"
|
||||
ls $overlayfile
|
||||
else
|
||||
echo "More than one view file is found. Narrow down the search query..."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function gencert() {
|
||||
if [[ ! -d /etc/cas ]] ; then
|
||||
if [[ ! -d /etc/cas ]] ; then
|
||||
copy
|
||||
fi
|
||||
which keytool
|
||||
if [[ $? -ne 0 ]] ; then
|
||||
echo Error: Java JDK \'keytool\' is not installed or is not in the path
|
||||
exit 1
|
||||
echo Error: Java JDK \'keytool\' is not installed or is not in the path
|
||||
exit 1
|
||||
fi
|
||||
# override DNAME and CERT_SUBJ_ALT_NAMES before calling or use dummy values
|
||||
DNAME="${DNAME:-CN=cas.example.org,OU=Example,OU=Org,C=US}"
|
||||
|
@ -58,21 +110,49 @@ function gencert() {
|
|||
keytool -exportcert -alias cas -storepass changeit -keystore /etc/cas/thekeystore -file /etc/cas/cas.cer
|
||||
}
|
||||
|
||||
function cli() {
|
||||
|
||||
CAS_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${cas.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec 2>/dev/null)
|
||||
# echo "CAS version: $CAS_VERSION"
|
||||
JAR_FILE_NAME="cas-server-support-shell-${CAS_VERSION}.jar"
|
||||
# echo "JAR name: $JAR_FILE_NAME"
|
||||
JAR_PATH="org/apereo/cas/cas-server-support-shell/${CAS_VERSION}/${JAR_FILE_NAME}"
|
||||
# echo "JAR path: $JAR_PATH"
|
||||
|
||||
JAR_FILE_LOCAL="$HOME/.m2/repository/$JAR_PATH";
|
||||
# echo "Local JAR file path: $JAR_FILE_LOCAL";
|
||||
if [ -f "$JAR_FILE_LOCAL" ]; then
|
||||
# echo "Using JAR file locally at $JAR_FILE_LOCAL"
|
||||
java -jar $JAR_FILE_LOCAL "$@"
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
DOWNLOAD_DIR=./target
|
||||
COMMAND_FILE="${DOWNLOAD_DIR}/${JAR_FILE_NAME}"
|
||||
if [ ! -f "$COMMAND_FILE" ]; then
|
||||
mkdir -p $DOWNLOAD_DIR
|
||||
./mvnw org.apache.maven.plugins:maven-dependency-plugin:3.0.2:get -DgroupId=org.apereo.cas -DartifactId=cas-server-support-shell -Dversion=$CAS_VERSION -Dpackaging=jar -DartifactItem.outputDirectory=$DOWNLOAD_DIR -DremoteRepositories=central::default::http://repo1.maven.apache.org/maven2,snapshots::::https://oss.sonatype.org/content/repositories/snapshots -Dtransitive=false
|
||||
./mvnw org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy -Dmdep.useBaseVersion=true -Dartifact=org.apereo.cas:cas-server-support-shell:$CAS_VERSION:jar -DoutputDirectory=$DOWNLOAD_DIR
|
||||
fi
|
||||
java -jar $COMMAND_FILE "$@"
|
||||
exit 0;
|
||||
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
echo -e "No commands provided. Defaulting to [run]\n"
|
||||
run
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
case "$1" in
|
||||
"copy")
|
||||
copy
|
||||
copy
|
||||
;;
|
||||
"clean")
|
||||
shift
|
||||
clean "$@"
|
||||
;;
|
||||
;;
|
||||
"package")
|
||||
shift
|
||||
package "$@"
|
||||
|
@ -87,11 +167,23 @@ case "$1" in
|
|||
"run")
|
||||
run "$@"
|
||||
;;
|
||||
"runalone")
|
||||
runalone "$@"
|
||||
;;
|
||||
"listviews")
|
||||
listviews "$@"
|
||||
;;
|
||||
"gencert")
|
||||
gencert "$@"
|
||||
;;
|
||||
"getview")
|
||||
getview "$@"
|
||||
;;
|
||||
"cli")
|
||||
shift
|
||||
cli "$@"
|
||||
;;
|
||||
*)
|
||||
help
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
<AsyncLogger name="org.openid4java" level="warn" />
|
||||
<AsyncLogger name="org.ldaptive" level="warn" />
|
||||
<AsyncLogger name="com.hazelcast" level="warn" />
|
||||
<AsyncLogger name="org.jasig.spring" level="warn" />
|
||||
<AsyncLogger name="org.apereo.spring" level="warn" />
|
||||
|
||||
<!-- Log perf stats only to perfStats.log -->
|
||||
<AsyncLogger name="perfStatsLogger" level="info" additivity="false" includeLocation="true">
|
||||
|
|
Binary file not shown.
|
@ -1 +1,3 @@
|
|||
distributionUrl=https\://repository.apache.org/content/repositories/releases/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip
|
||||
#Maven download properties
|
||||
#Fri Dec 01 21:35:11 MST 2017
|
||||
distributionUrl=https\://repository.apache.org/content/repositories/releases/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip
|
||||
|
|
|
@ -7,37 +7,23 @@
|
|||
<artifactId>cas-server</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>${org.springframework.boot.spring-boot-starter-parent.version}</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apereo.cas</groupId>
|
||||
<artifactId>cas-server-webapp${app.server}</artifactId>
|
||||
<version>${cas.version}</version>
|
||||
<type>war</type>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apereo.cas</groupId>
|
||||
<artifactId>cas-server-support-json-service-registry</artifactId>
|
||||
<version>${cas.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apereo.cas</groupId>
|
||||
<artifactId>cas-server-support-jdbc</artifactId>
|
||||
<version>${cas.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apereo.cas</groupId>
|
||||
<artifactId>cas-server-support-jdbc-drivers</artifactId>
|
||||
<version>${cas.version}</version>
|
||||
</dependency>
|
||||
<groupId>org.apereo.cas</groupId>
|
||||
<artifactId>cas-server-support-json-service-registry</artifactId>
|
||||
<version>${cas.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apereo.cas</groupId>
|
||||
<artifactId>cas-server-support-jdbc</artifactId>
|
||||
<version>${cas.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apereo.cas</groupId>
|
||||
<artifactId>cas-server-support-jdbc-drivers</artifactId>
|
||||
<version>${cas.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -45,7 +31,7 @@
|
|||
<plugin>
|
||||
<groupId>com.rimerosolutions.maven.plugins</groupId>
|
||||
<artifactId>wrapper-maven-plugin</artifactId>
|
||||
<version>${wrapper-maven-plugin.version}</version>
|
||||
<version>0.0.4</version>
|
||||
<configuration>
|
||||
<verifyDownload>true</verifyDownload>
|
||||
<checksumAlgorithm>MD5</checksumAlgorithm>
|
||||
|
@ -56,22 +42,30 @@
|
|||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${springboot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>org.springframework.boot.loader.WarLauncher</mainClass>
|
||||
<mainClass>${mainClassName}</mainClass>
|
||||
<addResources>true</addResources>
|
||||
<executable>${isExecutable}</executable>
|
||||
<layout>WAR</layout>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>${maven-war-plugin.version}</version>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<warName>cas</warName>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<recompressZippedFiles>false</recompressZippedFiles>
|
||||
<archive>
|
||||
<compress>false</compress>
|
||||
<manifestFile>${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp${app.server}/META-INF/MANIFEST.MF
|
||||
</manifestFile>
|
||||
<manifestFile>${manifestFileToUse}</manifestFile>
|
||||
</archive>
|
||||
<overlays>
|
||||
<overlay>
|
||||
|
@ -84,47 +78,26 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
<version>3.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>cas</finalName>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<id>pgp</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.github.s4u.plugins</groupId>
|
||||
<artifactId>pgpverify-maven-plugin</artifactId>
|
||||
<version>${pgpverify-maven-plugin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<pgpKeyServer>hkp://pool.sks-keyservers.net</pgpKeyServer>
|
||||
<pgpKeysCachePath>${settings.localRepository}/pgpkeys-cache</pgpKeysCachePath>
|
||||
<scope>test</scope>
|
||||
<verifyPomFiles>true</verifyPomFiles>
|
||||
<failNoSignature>false</failNoSignature>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<properties>
|
||||
<cas.version>5.3.0-SNAPSHOT</cas.version>
|
||||
<springboot.version>1.5.13.RELEASE</springboot.version>
|
||||
<!-- app.server could be -jetty, -undertow, -tomcat, or blank if you plan to provide appserver -->
|
||||
<app.server>-tomcat</app.server>
|
||||
|
||||
<mainClassName>org.springframework.boot.loader.WarLauncher</mainClassName>
|
||||
<isExecutable>false</isExecutable>
|
||||
<manifestFileToUse>${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp${app.server}/META-INF/MANIFEST.MF</manifestFileToUse>
|
||||
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -151,25 +124,110 @@
|
|||
<id>shibboleth-releases</id>
|
||||
<url>https://build.shibboleth.net/nexus/content/repositories/releases</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestones</id>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<properties>
|
||||
<cas.version>5.1.4</cas.version>
|
||||
<springboot.version>1.5.3.RELEASE</springboot.version>
|
||||
<!-- app.server could be -jetty, -undertow, -tomcat, or blank if you plan to provide appserver -->
|
||||
<app.server>-tomcat</app.server>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<org.springframework.boot.spring-boot-starter-parent.version>2.0.0.M7</org.springframework.boot.spring-boot-starter-parent.version>
|
||||
<wrapper-maven-plugin.version>0.0.4</wrapper-maven-plugin.version>
|
||||
<maven-war-plugin.version>2.6</maven-war-plugin.version>
|
||||
<maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
|
||||
<pgpverify-maven-plugin.version>1.1.0</pgpverify-maven-plugin.version>
|
||||
</properties>
|
||||
<profiles>
|
||||
<profile>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<id>default</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apereo.cas</groupId>
|
||||
<artifactId>cas-server-webapp${app.server}</artifactId>
|
||||
<version>${cas.version}</version>
|
||||
<type>war</type>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
...Additional dependencies may be placed here...
|
||||
-->
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
</project>
|
||||
<profile>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<id>exec</id>
|
||||
<properties>
|
||||
<mainClassName>org.apereo.cas.web.CasWebApplication</mainClassName>
|
||||
<isExecutable>true</isExecutable>
|
||||
<manifestFileToUse></manifestFileToUse>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.soebes.maven.plugins</groupId>
|
||||
<artifactId>echo-maven-plugin</artifactId>
|
||||
<version>0.3.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>prepare-package</phase>
|
||||
<goals>
|
||||
<goal>echo</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<echos>
|
||||
<echo>Executable profile to make the generated CAS web application executable.</echo>
|
||||
</echos>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<id>bootiful</id>
|
||||
<properties>
|
||||
<app.server>-tomcat</app.server>
|
||||
<isExecutable>false</isExecutable>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apereo.cas</groupId>
|
||||
<artifactId>cas-server-webapp${app.server}</artifactId>
|
||||
<version>${cas.version}</version>
|
||||
<type>war</type>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<id>pgp</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>com.github.s4u.plugins</groupId>
|
||||
<artifactId>pgpverify-maven-plugin</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<pgpKeyServer>hkp://pool.sks-keyservers.net</pgpKeyServer>
|
||||
<pgpKeysCachePath>${settings.localRepository}/pgpkeys-cache</pgpKeysCachePath>
|
||||
<scope>test</scope>
|
||||
<verifyPomFiles>true</verifyPomFiles>
|
||||
<failNoSignature>false</failNoSignature>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
|
|
@ -43,7 +43,7 @@ spring.http.encoding.force=true
|
|||
##
|
||||
#CAS CONFIG LOCATION
|
||||
#
|
||||
cas.standalone.config=classpath:/etc/cas/config
|
||||
standalone.config=classpath:/etc/cas/config
|
||||
|
||||
|
||||
##
|
||||
|
@ -109,7 +109,7 @@ cas.authn.jdbc.query[0].sql=SELECT * FROM users WHERE email = ?
|
|||
cas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
|
||||
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialect
|
||||
cas.authn.jdbc.query[0].user=root
|
||||
cas.authn.jdbc.query[0].password=root
|
||||
cas.authn.jdbc.query[0].password=1234
|
||||
cas.authn.jdbc.query[0].ddlAuto=none
|
||||
#cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver
|
||||
cas.authn.jdbc.query[0].driverClass=com.mysql.cj.jdbc.Driver
|
||||
|
|
|
@ -3,38 +3,7 @@ cas.server.prefix: https://localhost:643/cas
|
|||
|
||||
cas.adminPagesSecurity.ip=127\.0\.0\.1
|
||||
|
||||
logging.config: file:/etc/cas/config/log4j2.xml
|
||||
|
||||
cas.serviceRegistry.initFromJson=true
|
||||
cas.serviceRegistry.config.location=classpath:/services
|
||||
|
||||
cas.authn.accept.users=
|
||||
cas.authn.accept.name=
|
||||
|
||||
|
||||
#CAS Database Authentication Property
|
||||
|
||||
# cas.authn.jdbc.query[0].healthQuery=
|
||||
# cas.authn.jdbc.query[0].isolateInternalQueries=false
|
||||
# cas.authn.jdbc.query[0].failFast=true
|
||||
# cas.authn.jdbc.query[0].isolationLevelName=ISOLATION_READ_COMMITTED
|
||||
# cas.authn.jdbc.query[0].leakThreshold=10
|
||||
# cas.authn.jdbc.query[0].propagationBehaviorName=PROPAGATION_REQUIRED
|
||||
# cas.authn.jdbc.query[0].batchSize=1
|
||||
# cas.authn.jdbc.query[0].maxAgeDays=180
|
||||
# cas.authn.jdbc.query[0].autocommit=false
|
||||
# cas.authn.jdbc.query[0].idleTimeout=5000
|
||||
# cas.authn.jdbc.query[0].credentialCriteria=
|
||||
# cas.authn.jdbc.query[0].name=
|
||||
# cas.authn.jdbc.query[0].order=0
|
||||
# cas.authn.jdbc.query[0].dataSourceName=
|
||||
# cas.authn.jdbc.query[0].dataSourceProxy=false
|
||||
# cas.authn.jdbc.query[0].fieldExpired=
|
||||
# cas.authn.jdbc.query[0].fieldDisabled=
|
||||
# cas.authn.jdbc.query[0].principalAttributeList=sn,cn:commonName,givenName
|
||||
# cas.authn.jdbc.query[0].passwordEncoder.type=NONE|DEFAULT|STANDARD|BCRYPT|SCRYPT|PBKDF2|com.example.CustomPasswordEncoder
|
||||
# cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=
|
||||
# cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=
|
||||
# cas.authn.jdbc.query[0].passwordEncoder.secret=
|
||||
# cas.authn.jdbc.query[0].passwordEncoder.strength=16
|
||||
# cas.authn.jdbc.query[0].principalTransformation.suffix=
|
||||
# cas.authn.jdbc.query[0].principalTransformation.caseConversion=NONE|UPPERCASE|LOWERCASE
|
||||
# cas.authn.jdbc.query[0].principalTransformation.prefix=
|
||||
cas.serviceRegistry.config.location=classpath:/services
|
|
@ -92,7 +92,7 @@
|
|||
<AsyncLogger name="org.openid4java" level="warn" />
|
||||
<AsyncLogger name="org.ldaptive" level="warn" />
|
||||
<AsyncLogger name="com.hazelcast" level="warn" />
|
||||
<AsyncLogger name="org.jasig.spring" level="warn" />
|
||||
<AsyncLogger name="org.apereo.spring" level="warn" />
|
||||
|
||||
<!-- Log perf stats only to perfStats.log -->
|
||||
<AsyncLogger name="perfStatsLogger" level="info" additivity="false" includeLocation="true">
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,117 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!-- Specify the refresh internal in seconds. -->
|
||||
<Configuration monitorInterval="5" packages="org.apereo.cas.logging">
|
||||
<Properties>
|
||||
<!--
|
||||
Default log directory is the current directory but that can be overridden with -Dcas.log.dir=<logdir>
|
||||
Or you can change this property to a new default
|
||||
-->
|
||||
<Property name="cas.log.dir" >.</Property>
|
||||
<!-- To see more CAS specific logging, adjust this property to info or debug or run server with -Dcas.log.leve=debug -->
|
||||
<Property name="cas.log.level" >warn</Property>
|
||||
</Properties>
|
||||
<Appenders>
|
||||
<Console name="console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d %p [%c] - <%m>%n"/>
|
||||
</Console>
|
||||
<RollingFile name="file" fileName="${sys:cas.log.dir}/cas.log" append="true"
|
||||
filePattern="${sys:cas.log.dir}/cas-%d{yyyy-MM-dd-HH}-%i.log">
|
||||
<PatternLayout pattern="%d %p [%c] - <%m>%n"/>
|
||||
<Policies>
|
||||
<OnStartupTriggeringPolicy />
|
||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
||||
<TimeBasedTriggeringPolicy />
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
<RollingFile name="auditlogfile" fileName="${sys:cas.log.dir}/cas_audit.log" append="true"
|
||||
filePattern="${sys:cas.log.dir}/cas_audit-%d{yyyy-MM-dd-HH}-%i.log">
|
||||
<PatternLayout pattern="%d %p [%c] - %m%n"/>
|
||||
<Policies>
|
||||
<OnStartupTriggeringPolicy />
|
||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
||||
<TimeBasedTriggeringPolicy />
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
|
||||
<RollingFile name="perfFileAppender" fileName="${sys:cas.log.dir}/perfStats.log" append="true"
|
||||
filePattern="${sys:cas.log.dir}/perfStats-%d{yyyy-MM-dd-HH}-%i.log">
|
||||
<PatternLayout pattern="%m%n"/>
|
||||
<Policies>
|
||||
<OnStartupTriggeringPolicy />
|
||||
<SizeBasedTriggeringPolicy size="10 MB"/>
|
||||
<TimeBasedTriggeringPolicy />
|
||||
</Policies>
|
||||
</RollingFile>
|
||||
|
||||
<CasAppender name="casAudit">
|
||||
<AppenderRef ref="auditlogfile" />
|
||||
</CasAppender>
|
||||
<CasAppender name="casFile">
|
||||
<AppenderRef ref="file" />
|
||||
</CasAppender>
|
||||
<CasAppender name="casConsole">
|
||||
<AppenderRef ref="console" />
|
||||
</CasAppender>
|
||||
<CasAppender name="casPerf">
|
||||
<AppenderRef ref="perfFileAppender" />
|
||||
</CasAppender>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<!-- If adding a Logger with level set higher than warn, make category as selective as possible -->
|
||||
<!-- Loggers inherit appenders from Root Logger unless additivity is false -->
|
||||
<AsyncLogger name="org.apereo" level="${sys:cas.log.level}" includeLocation="true"/>
|
||||
<AsyncLogger name="org.apereo.services.persondir" level="${sys:cas.log.level}" includeLocation="true"/>
|
||||
<AsyncLogger name="org.apereo.cas.web.flow" level="info" includeLocation="true"/>
|
||||
<AsyncLogger name="org.apache" level="warn" />
|
||||
<AsyncLogger name="org.apache.http" level="error" />
|
||||
<AsyncLogger name="org.springframework" level="warn" />
|
||||
<AsyncLogger name="org.springframework.cloud.server" level="warn" />
|
||||
<AsyncLogger name="org.springframework.cloud.client" level="warn" />
|
||||
<AsyncLogger name="org.springframework.cloud.bus" level="warn" />
|
||||
<AsyncLogger name="org.springframework.aop" level="warn" />
|
||||
<AsyncLogger name="org.springframework.boot" level="warn" />
|
||||
<AsyncLogger name="org.springframework.boot.actuate.autoconfigure" level="warn" />
|
||||
<AsyncLogger name="org.springframework.webflow" level="warn" />
|
||||
<AsyncLogger name="org.springframework.session" level="warn" />
|
||||
<AsyncLogger name="org.springframework.amqp" level="error" />
|
||||
<AsyncLogger name="org.springframework.integration" level="warn" />
|
||||
<AsyncLogger name="org.springframework.messaging" level="warn" />
|
||||
<AsyncLogger name="org.springframework.web" level="warn" />
|
||||
<AsyncLogger name="org.springframework.orm.jpa" level="warn" />
|
||||
<AsyncLogger name="org.springframework.scheduling" level="warn" />
|
||||
<AsyncLogger name="org.springframework.context.annotation" level="error" />
|
||||
<AsyncLogger name="org.springframework.boot.devtools" level="error" />
|
||||
<AsyncLogger name="org.springframework.web.socket" level="warn" />
|
||||
<AsyncLogger name="org.thymeleaf" level="warn" />
|
||||
<AsyncLogger name="org.pac4j" level="warn" />
|
||||
<AsyncLogger name="org.opensaml" level="warn"/>
|
||||
<AsyncLogger name="net.sf.ehcache" level="warn" />
|
||||
<AsyncLogger name="com.couchbase" level="warn" includeLocation="true"/>
|
||||
<AsyncLogger name="com.ryantenney.metrics" level="warn" />
|
||||
<AsyncLogger name="net.jradius" level="warn" />
|
||||
<AsyncLogger name="org.openid4java" level="warn" />
|
||||
<AsyncLogger name="org.ldaptive" level="warn" />
|
||||
<AsyncLogger name="com.hazelcast" level="warn" />
|
||||
<AsyncLogger name="org.apereo.spring" level="warn" />
|
||||
|
||||
<!-- Log perf stats only to perfStats.log -->
|
||||
<AsyncLogger name="perfStatsLogger" level="info" additivity="false" includeLocation="true">
|
||||
<AppenderRef ref="casPerf"/>
|
||||
</AsyncLogger>
|
||||
|
||||
<!-- Log audit to all root appenders, and also to audit log (additivity is not false) -->
|
||||
<AsyncLogger name="org.apereo.inspektr.audit.support" level="info" includeLocation="true" >
|
||||
<AppenderRef ref="casAudit"/>
|
||||
</AsyncLogger>
|
||||
|
||||
<!-- All Loggers inherit appenders specified here, unless additivity="false" on the Logger -->
|
||||
<AsyncRoot level="warn">
|
||||
<AppenderRef ref="casFile"/>
|
||||
<!--
|
||||
For deployment to an application server running as service,
|
||||
delete the casConsole appender below
|
||||
-->
|
||||
<AppenderRef ref="casConsole"/>
|
||||
</AsyncRoot>
|
||||
</Loggers>
|
||||
</Configuration>
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-spring</artifactId>
|
||||
<artifactId>parent-spring-4</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-spring</relativePath>
|
||||
<relativePath>../parent-spring-4</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
|
@ -38,7 +38,6 @@
|
|||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<spring.version>4.3.4.RELEASE</spring.version>
|
||||
<aspectjweaver.version>1.8.9</aspectjweaver.version>
|
||||
<weld-se-core.version>2.4.1.Final</weld-se-core.version>
|
||||
</properties>
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
### Relevant Articles:
|
||||
|
||||
- [Java 10 LocalVariable Type-Inference](http://www.baeldung.com/java-10-local-variable-type-inference)
|
||||
- [Guide to Java 10](http://www.baeldung.com/java-10-overview)
|
|
@ -50,4 +50,6 @@
|
|||
- [Filtering Kotlin Collections](http://www.baeldung.com/kotlin-filter-collection)
|
||||
- [How to Find an Element in a List with Java](http://www.baeldung.com/find-list-element-java)
|
||||
- [Measure Elapsed Time in Java](http://www.baeldung.com/java-measure-elapsed-time)
|
||||
- [Java Optional – orElse() vs orElseGet()](http://www.baeldung.com/java-optional-or-else-vs-or-else-get)
|
||||
- [An Introduction to Java.util.Hashtable Class](http://www.baeldung.com/java-hash-table)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.junit.Test;
|
|||
|
||||
import com.baeldung.counter.CounterUtil.MutableInteger;
|
||||
|
||||
public class CounterTest {
|
||||
public class CounterUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenMapWithWrapperAsCounter_runsSuccessfully() {
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
public class FindACustomerInGivenListTest {
|
||||
public class FindACustomerInGivenListUnitTest {
|
||||
|
||||
private static List<Customer> customers = new ArrayList<>();
|
||||
|
|
@ -233,7 +233,7 @@ public class HashtableUnitTest {
|
|||
Hashtable<String, Integer> table = new Hashtable<String, Integer>();
|
||||
String[] animals = { "cat", "dog", "dog", "cat", "bird", "mouse", "mouse" };
|
||||
for (String animal : animals) {
|
||||
table.compute(animal, (key, value) -> (value == null ? Integer.valueOf(1) : Integer.valueOf(value) + 1));
|
||||
table.compute(animal, (key, value) -> (value == null ? 1 : value + 1));
|
||||
}
|
||||
assertThat(table.values(), hasItems(2, 2, 2, 1));
|
||||
|
||||
|
@ -271,4 +271,4 @@ public class HashtableUnitTest {
|
|||
|
||||
assertThat(table.values(), hasItems("cat - a small domesticated carnivorous mammal", "dog - another animal"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ import org.junit.Test;
|
|||
* @author Santosh Thakur
|
||||
*/
|
||||
|
||||
public class IteratorsTest {
|
||||
public class IteratorsUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenFailFast_ThenThrowsException() {
|
|
@ -8,11 +8,11 @@ import static org.junit.Assert.*;
|
|||
|
||||
import com.baeldung.optional.OrElseAndOrElseGet;
|
||||
|
||||
public class OrElseAndOrElseGetTest {
|
||||
public class OrElseAndOrElseGetUnitTest {
|
||||
|
||||
private OrElseAndOrElseGet orElsevsOrElseGet = new OrElseAndOrElseGet();
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(OrElseAndOrElseGetTest.class);
|
||||
private static final Logger LOG = LoggerFactory.getLogger(OrElseAndOrElseGetUnitTest.class);
|
||||
|
||||
@Test
|
||||
public void givenNonEmptyOptional_whenOrElseUsed_thenGivenStringReturned() {
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class PrimeGeneratorTest {
|
||||
public class PrimeGeneratorUnitTest {
|
||||
@Test
|
||||
public void whenBruteForced_returnsSuccessfully() {
|
||||
final List<Integer> primeNumbers = primeNumbersBruteForce(20);
|
|
@ -9,7 +9,7 @@ import static org.assertj.core.api.Assertions.*;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ExecutorTest {
|
||||
public class ExecutorUnitTest {
|
||||
Article article;
|
||||
Stream<Author> stream;
|
||||
Spliterator<Author> spliterator;
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class StreamApiTest {
|
||||
public class StreamApiUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenList_whenGetLastElementUsingReduce_thenReturnLastElement() {
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class StreamIndicesTest {
|
||||
public class StreamIndicesUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenCalled_thenReturnListOfEvenIndexedStrings() {
|
|
@ -16,7 +16,7 @@ import org.junit.Test;
|
|||
import com.baeldung.stream.mycollectors.MyImmutableListCollector;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public class StreamToImmutableTest {
|
||||
public class StreamToImmutableUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenUsingCollectingToImmutableSet_thenSuccess() {
|
|
@ -8,7 +8,7 @@ import java.util.stream.Stream;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
public class SupplierStreamTest {
|
||||
public class SupplierStreamUnitTest {
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void givenStream_whenStreamUsedTwice_thenThrowException() {
|
|
@ -9,7 +9,7 @@ import java.time.temporal.TemporalAdjuster;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class CustomTemporalAdjusterTest {
|
||||
public class CustomTemporalAdjusterUnitTest {
|
||||
|
||||
private static final TemporalAdjuster NEXT_WORKING_DAY = new CustomTemporalAdjuster();
|
||||
|
|
@ -7,7 +7,7 @@ import java.time.temporal.TemporalAdjusters;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TemporalAdjustersTest {
|
||||
public class TemporalAdjustersUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenAdjust_thenNextSunday() {
|
|
@ -24,3 +24,4 @@
|
|||
- [Method Handles in Java](http://www.baeldung.com/java-method-handles)
|
||||
- [Introduction to Chronicle Queue](http://www.baeldung.com/java-chronicle-queue)
|
||||
- [A Guide to Java 9 Modularity](http://www.baeldung.com/java-9-modularity)
|
||||
- [Optional orElse Optional](http://www.baeldung.com/java-optional-or-else-optional)
|
||||
|
|
|
@ -47,6 +47,11 @@
|
|||
<version>${awaitility.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -89,6 +94,7 @@
|
|||
<awaitility.version>1.7.0</awaitility.version>
|
||||
<maven.compiler.source>1.9</maven.compiler.source>
|
||||
<maven.compiler.target>1.9</maven.compiler.target>
|
||||
<guava.version>25.1-jre</guava.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
package com.baeldung.optionals;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class Optionals {
|
||||
|
||||
public static <T> Optional<T> or(Optional<T> optional, Optional<T> fallback) {
|
||||
return optional.isPresent() ? optional : fallback;
|
||||
}
|
||||
|
||||
public static Optional<String> getName(Optional<String> name) {
|
||||
return name.or(() -> getCustomMessage());
|
||||
}
|
||||
|
||||
public static com.google.common.base.Optional<String> getOptionalGuavaName(com.google.common.base.Optional<String> name) {
|
||||
return name.or(getCustomMessageGuava());
|
||||
}
|
||||
|
||||
private static Optional<String> getCustomMessage() {
|
||||
return Optional.of("Name not provided");
|
||||
}
|
||||
|
||||
private static com.google.common.base.Optional<String> getCustomMessageGuava() {
|
||||
return com.google.common.base.Optional.of("Name not provided");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.baeldung.optionals;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class OptionalsTest {
|
||||
|
||||
@Test
|
||||
public void givenOptional_whenEmptyValue_thenCustomMessage() {
|
||||
assertEquals(Optional.of("Name not provided"), Optionals.getName(Optional.ofNullable(null)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenOptional_whenValue_thenOptional() {
|
||||
String name = "Filan Fisteku";
|
||||
Optional<String> optionalString = Optional.ofNullable(name);
|
||||
assertEquals(optionalString, Optionals.getName(optionalString));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenOptional_whenValue_thenOptionalGeneralMethod() {
|
||||
String name = "Filan Fisteku";
|
||||
String missingOptional = "Name not provided";
|
||||
Optional<String> optionalString = Optional.ofNullable(name);
|
||||
Optional<String> fallbackOptionalString = Optional.ofNullable(missingOptional);
|
||||
assertEquals(optionalString, Optionals.or(optionalString, fallbackOptionalString));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEmptyOptional_whenValue_thenOptionalGeneralMethod() {
|
||||
String missingOptional = "Name not provided";
|
||||
Optional<String> optionalString = Optional.empty();
|
||||
Optional<String> fallbackOptionalString = Optional.ofNullable(missingOptional);
|
||||
assertEquals(fallbackOptionalString, Optionals.or(optionalString, fallbackOptionalString));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenGuavaOptional_whenInvoke_thenOptional() {
|
||||
String name = "Filan Fisteku";
|
||||
com.google.common.base.Optional<String> stringOptional = com.google.common.base.Optional.of(name);
|
||||
assertEquals(stringOptional, Optionals.getOptionalGuavaName(stringOptional));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenGuavaOptional_whenNull_thenDefaultText() {
|
||||
assertEquals(com.google.common.base.Optional.of("Name not provided"), Optionals.getOptionalGuavaName(com.google.common.base.Optional.fromNullable(null)));
|
||||
}
|
||||
}
|
|
@ -28,3 +28,5 @@
|
|||
- [A Guide to TreeSet in Java](http://www.baeldung.com/java-tree-set)
|
||||
- [Java TreeMap vs HashMap](http://www.baeldung.com/java-treemap-vs-hashmap)
|
||||
- [How to TDD a List Implementation in Java](http://www.baeldung.com/java-test-driven-list)
|
||||
- [How to Store Duplicate Keys in a Map in Java?](http://www.baeldung.com/java-map-duplicate-keys)
|
||||
- [Getting the Size of an Iterable in Java](http://www.baeldung.com/java-iterable-size)
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package com.baeldung.java.iterable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.apache.commons.collections4.IterableUtils;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
|
||||
/**
|
||||
* Provides methods for getting the size of an {@link Iterable} object.
|
||||
*/
|
||||
public class IterableSize {
|
||||
|
||||
/**
|
||||
* Get the size of {@code Iterable} using Java 7.
|
||||
*
|
||||
* @param data the iterable
|
||||
* @return the size of the iterable
|
||||
*/
|
||||
public static int sizeUsingJava7(final Iterable data) {
|
||||
|
||||
if (data instanceof Collection) {
|
||||
return ((Collection<?>) data).size();
|
||||
}
|
||||
int counter = 0;
|
||||
for (final Object i : data) {
|
||||
counter++;
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of {@code Iterable} using Java 8.
|
||||
*
|
||||
* @param data the iterable
|
||||
* @return the size of the iterable
|
||||
*/
|
||||
public static long sizeUsingJava8(final Iterable data) {
|
||||
|
||||
return StreamSupport.stream(data.spliterator(), false).count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of {@code Iterable} using Apache Collections.
|
||||
*
|
||||
* @param data the iterable
|
||||
* @return the size of the iterable
|
||||
*/
|
||||
public static int sizeUsingApacheCollections(final Iterable data) {
|
||||
|
||||
return IterableUtils.size(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the size of {@code Iterable} using Google Guava.
|
||||
*
|
||||
* @param data the iterable
|
||||
* @return the size of the iterable
|
||||
*/
|
||||
public static int sizeUsingGoogleGuava(final Iterable data) {
|
||||
|
||||
return Iterables.size(data);
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ArrayConvertToListTest {
|
||||
public class ArrayConvertToListUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenAnStringArray_whenConvertArrayToList_thenListCreated() {
|
|
@ -6,7 +6,7 @@ import java.util.Deque;
|
|||
import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ArrayDequeTest {
|
||||
public class ArrayDequeUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenOffer_addsAtLast() {
|
|
@ -0,0 +1,59 @@
|
|||
package com.baeldung.java.iterable;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
class IterableSizeUnitTest {
|
||||
|
||||
private final List<String> list = Lists.newArrayList("Apple", "Orange", "Banana");
|
||||
|
||||
private Iterable data;
|
||||
|
||||
@Test
|
||||
void whenUsingJava7_iterableOfCollectionType_thenCorrectSize() {
|
||||
|
||||
final int size = IterableSize.sizeUsingJava7(list);
|
||||
|
||||
assertEquals(3, size);
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenUsingJava7_iterableNotOfCollectionType_thenCorrect() {
|
||||
|
||||
final SQLException exception = new SQLException();
|
||||
exception.setNextException(new SQLException());
|
||||
final int size = IterableSize.sizeUsingJava7(exception);
|
||||
|
||||
assertEquals(2, size);
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenUsingJava8_thenCorrect() {
|
||||
|
||||
final long size = IterableSize.sizeUsingJava8(list);
|
||||
|
||||
assertEquals(3, size);
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenUsingApacheCollections_thenCorrect() {
|
||||
|
||||
final int size = IterableSize.sizeUsingApacheCollections(list);
|
||||
|
||||
assertEquals(3, size);
|
||||
}
|
||||
|
||||
@Test
|
||||
void whenUsingGoogleGuava_thenCorrect() {
|
||||
|
||||
final int size = IterableSize.sizeUsingGoogleGuava(list);
|
||||
|
||||
assertEquals(3, size);
|
||||
}
|
||||
}
|
|
@ -23,8 +23,8 @@ import com.google.common.collect.LinkedHashMultimap;
|
|||
import com.google.common.collect.Multimap;
|
||||
import com.google.common.collect.TreeMultimap;
|
||||
|
||||
public class MapMultipleValuesTest {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MapMultipleValuesTest.class);
|
||||
public class MapMultipleValuesUnitTest {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MapMultipleValuesUnitTest.class);
|
||||
|
||||
@Test
|
||||
public void givenHashMap_whenPuttingTwice_thenReturningFirstValue() {
|
|
@ -9,7 +9,7 @@ import java.util.stream.IntStream;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
public class ThreadSafeCounterTest {
|
||||
public class ThreadSafeCounterIntegrationTest {
|
||||
|
||||
@Test
|
||||
public void givenMultiThread_whenSafeCounterWithLockIncrement() throws InterruptedException {
|
|
@ -6,7 +6,7 @@ import static org.junit.Assert.assertTrue;
|
|||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DaemonThreadTest {
|
||||
public class DaemonThreadUnitTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
|
@ -9,7 +9,7 @@ import java.util.stream.IntStream;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class BaeldungSychronizedBlockTest {
|
||||
public class BaeldungSychronizedBlockUnitTest {
|
||||
|
||||
@Test
|
||||
public void givenMultiThread_whenBlockSync() throws InterruptedException {
|
|
@ -10,7 +10,7 @@ import java.util.stream.IntStream;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class BaeldungSynchronizeMethodsTest {
|
||||
public class BaeldungSynchronizeMethodsUnitTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
|
@ -27,3 +27,4 @@
|
|||
- [A Guide to WatchService in Java NIO2](http://www.baeldung.com/java-nio2-watchservice)
|
||||
- [Guide to Java NIO2 Asynchronous Channel APIs](http://www.baeldung.com/java-nio-2-async-channels)
|
||||
- [A Guide to NIO2 Asynchronous Socket Channel](http://www.baeldung.com/java-nio2-async-socket-channel)
|
||||
- [Download a File From an URL in Java](http://www.baeldung.com/java-download-file)
|
||||
|
|
|
@ -196,6 +196,12 @@
|
|||
<version>${hsqldb.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- https://mvnrepository.com/artifact/org.asynchttpclient/async-http-client -->
|
||||
<dependency>
|
||||
<groupId>org.asynchttpclient</groupId>
|
||||
<artifactId>async-http-client</artifactId>
|
||||
<version>${async-http-client.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -365,6 +371,7 @@
|
|||
<hsqldb.version>2.4.0</hsqldb.version>
|
||||
<esapi.version>2.1.0.1</esapi.version>
|
||||
<jmh-generator-annprocess.version>1.19</jmh-generator-annprocess.version>
|
||||
<async-http-client.version>2.4.5</async-http-client.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,89 @@
|
|||
package com.baeldung.download;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.asynchttpclient.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.nio.channels.Channels;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.ReadableByteChannel;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
public class FileDownload {
|
||||
|
||||
public static void downloadWithJavaIO(String url, String localFilename) {
|
||||
|
||||
try (BufferedInputStream in = new BufferedInputStream(new URL(url).openStream()); FileOutputStream fileOutputStream = new FileOutputStream(localFilename)) {
|
||||
|
||||
byte dataBuffer[] = new byte[1024];
|
||||
int bytesRead;
|
||||
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1) {
|
||||
fileOutputStream.write(dataBuffer, 0, bytesRead);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void downloadWithJava7IO(String url, String localFilename) {
|
||||
|
||||
try (InputStream in = new URL(url).openStream()) {
|
||||
Files.copy(in, Paths.get(localFilename), StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void downloadWithJavaNIO(String fileURL, String localFilename) throws IOException {
|
||||
|
||||
URL url = new URL(fileURL);
|
||||
try (ReadableByteChannel readableByteChannel = Channels.newChannel(url.openStream());
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(localFilename); FileChannel fileChannel = fileOutputStream.getChannel()) {
|
||||
|
||||
fileChannel.transferFrom(readableByteChannel, 0, Long.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
|
||||
public static void downloadWithApacheCommons(String url, String localFilename) {
|
||||
|
||||
int CONNECT_TIMEOUT = 10000;
|
||||
int READ_TIMEOUT = 10000;
|
||||
try {
|
||||
FileUtils.copyURLToFile(new URL(url), new File(localFilename), CONNECT_TIMEOUT, READ_TIMEOUT);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void downloadWithAHC(String url, String localFilename) throws ExecutionException, InterruptedException, IOException {
|
||||
|
||||
FileOutputStream stream = new FileOutputStream(localFilename);
|
||||
AsyncHttpClient client = Dsl.asyncHttpClient();
|
||||
|
||||
client.prepareGet(url)
|
||||
.execute(new AsyncCompletionHandler<FileOutputStream>() {
|
||||
|
||||
@Override
|
||||
public State onBodyPartReceived(HttpResponseBodyPart bodyPart) throws Exception {
|
||||
stream.getChannel()
|
||||
.write(bodyPart.getBodyByteBuffer());
|
||||
return State.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileOutputStream onCompleted(Response response) throws Exception {
|
||||
return stream;
|
||||
}
|
||||
})
|
||||
.get();
|
||||
|
||||
stream.getChannel().close();
|
||||
client.close();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.baeldung.download;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
|
||||
public class ResumableDownload {
|
||||
|
||||
public static long downloadFile(String downloadUrl, String saveAsFileName) throws IOException, URISyntaxException {
|
||||
|
||||
File outputFile = new File(saveAsFileName);
|
||||
URLConnection downloadFileConnection = new URI(downloadUrl).toURL()
|
||||
.openConnection();
|
||||
return transferDataAndGetBytesDownloaded(downloadFileConnection, outputFile);
|
||||
}
|
||||
|
||||
private static long transferDataAndGetBytesDownloaded(URLConnection downloadFileConnection, File outputFile) throws IOException {
|
||||
|
||||
long bytesDownloaded = 0;
|
||||
try (InputStream is = downloadFileConnection.getInputStream(); OutputStream os = new FileOutputStream(outputFile, true)) {
|
||||
|
||||
byte[] buffer = new byte[1024];
|
||||
|
||||
int bytesCount;
|
||||
while ((bytesCount = is.read(buffer)) > 0) {
|
||||
os.write(buffer, 0, bytesCount);
|
||||
bytesDownloaded += bytesCount;
|
||||
}
|
||||
}
|
||||
return bytesDownloaded;
|
||||
}
|
||||
|
||||
public static long downloadFileWithResume(String downloadUrl, String saveAsFileName) throws IOException, URISyntaxException {
|
||||
File outputFile = new File(saveAsFileName);
|
||||
|
||||
URLConnection downloadFileConnection = addFileResumeFunctionality(downloadUrl, outputFile);
|
||||
return transferDataAndGetBytesDownloaded(downloadFileConnection, outputFile);
|
||||
}
|
||||
|
||||
private static URLConnection addFileResumeFunctionality(String downloadUrl, File outputFile) throws IOException, URISyntaxException, ProtocolException, ProtocolException {
|
||||
long existingFileSize = 0L;
|
||||
URLConnection downloadFileConnection = new URI(downloadUrl).toURL()
|
||||
.openConnection();
|
||||
|
||||
if (outputFile.exists() && downloadFileConnection instanceof HttpURLConnection) {
|
||||
HttpURLConnection httpFileConnection = (HttpURLConnection) downloadFileConnection;
|
||||
|
||||
HttpURLConnection tmpFileConn = (HttpURLConnection) new URI(downloadUrl).toURL()
|
||||
.openConnection();
|
||||
tmpFileConn.setRequestMethod("HEAD");
|
||||
long fileLength = tmpFileConn.getContentLengthLong();
|
||||
existingFileSize = outputFile.length();
|
||||
|
||||
if (existingFileSize < fileLength) {
|
||||
httpFileConnection.setRequestProperty("Range", "bytes=" + existingFileSize + "-" + fileLength);
|
||||
} else {
|
||||
throw new IOException("File Download already completed.");
|
||||
}
|
||||
}
|
||||
return downloadFileConnection;
|
||||
}
|
||||
|
||||
}
|
|
@ -18,7 +18,7 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
public class FileCopierTest {
|
||||
public class FileCopierIntegrationTest {
|
||||
File original = new File("src/test/resources/original.txt");
|
||||
|
||||
@Before
|
|
@ -0,0 +1,91 @@
|
|||
package com.baeldung.download;
|
||||
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class FileDownloadIntegrationTest {
|
||||
|
||||
static String FILE_URL = "http://ovh.net/files/1Mio.dat";
|
||||
static String FILE_NAME = "file.dat";
|
||||
static String FILE_MD5_HASH = "6cb91af4ed4c60c11613b75cd1fc6116";
|
||||
|
||||
@Test
|
||||
public void givenJavaIO_whenDownloadingFile_thenDownloadShouldBeCorrect() throws NoSuchAlgorithmException, IOException {
|
||||
|
||||
FileDownload.downloadWithJavaIO(FILE_URL, FILE_NAME);
|
||||
assertTrue(checkMd5Hash(FILE_NAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenJavaNIO_whenDownloadingFile_thenDownloadShouldBeCorrect() throws NoSuchAlgorithmException, IOException {
|
||||
|
||||
FileDownload.downloadWithJavaNIO(FILE_URL, FILE_NAME);
|
||||
assertTrue(checkMd5Hash(FILE_NAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenJava7IO_whenDownloadingFile_thenDownloadShouldBeCorrect() throws NoSuchAlgorithmException, IOException {
|
||||
|
||||
FileDownload.downloadWithJava7IO(FILE_URL, FILE_NAME);
|
||||
assertTrue(checkMd5Hash(FILE_NAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAHCLibrary_whenDownloadingFile_thenDownloadShouldBeCorrect() throws NoSuchAlgorithmException, IOException, ExecutionException, InterruptedException {
|
||||
|
||||
FileDownload.downloadWithAHC(FILE_URL, FILE_NAME);
|
||||
assertTrue(checkMd5Hash(FILE_NAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenApacheCommonsIO_whenDownloadingFile_thenDownloadShouldBeCorrect() throws NoSuchAlgorithmException, IOException {
|
||||
|
||||
FileDownload.downloadWithApacheCommons(FILE_URL, FILE_NAME);
|
||||
assertTrue(checkMd5Hash(FILE_NAME));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenJavaIO_whenDownloadingFileStops_thenDownloadShouldBeResumedCorrectly() throws NoSuchAlgorithmException, IOException, URISyntaxException {
|
||||
|
||||
ResumableDownload.downloadFileWithResume(FILE_URL, FILE_NAME);
|
||||
assertTrue(checkMd5Hash(FILE_NAME));
|
||||
}
|
||||
|
||||
private boolean checkMd5Hash(String filename) throws IOException, NoSuchAlgorithmException {
|
||||
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(Files.readAllBytes(Paths.get(filename)));
|
||||
byte[] digest = md.digest();
|
||||
String myChecksum = DatatypeConverter.printHexBinary(digest);
|
||||
|
||||
return myChecksum.equalsIgnoreCase(FILE_MD5_HASH);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() throws IOException {
|
||||
if (Files.exists(Paths.get(FILE_NAME))) {
|
||||
Files.delete(Paths.get(FILE_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void cleanup() throws IOException {
|
||||
if (Files.exists(Paths.get(FILE_NAME))) {
|
||||
Files.delete(Paths.get(FILE_NAME));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -24,7 +24,7 @@ import org.junit.Test;
|
|||
|
||||
import com.baeldung.util.StreamUtils;
|
||||
|
||||
public class FilesTest {
|
||||
public class FilesManualTest {
|
||||
|
||||
public static final String fileName = "src/main/resources/countries.properties";
|
||||
|
|
@ -139,5 +139,15 @@
|
|||
- [Sending Emails with Java](http://www.baeldung.com/java-email)
|
||||
- [Introduction to SSL in Java](http://www.baeldung.com/java-ssl)
|
||||
- [Java KeyStore API](http://www.baeldung.com/java-keystore)
|
||||
- [Using Java Assertions](http://www.baeldung.com/java-assert)
|
||||
- [Double-Checked Locking with Singleton](http://www.baeldung.com/java-singleton-double-checked-locking)
|
||||
- [Guide to Java Clock Class](http://www.baeldung.com/java-clock)
|
||||
- [Using Java Assertions](http://www.baeldung.com/java-assert)
|
||||
- [Pass-By-Value as a Parameter Passing Mechanism in Java](http://www.baeldung.com/java-pass-by-value-or-pass-by-reference)
|
||||
- [Check If a String Is Numeric in Java](http://www.baeldung.com/java-check-string-number)
|
||||
- [Variable and Method Hiding in Java](http://www.baeldung.com/java-variable-method-hiding)
|
||||
- [Access Modifiers in Java](http://www.baeldung.com/java-access-modifiers)
|
||||
- [NaN in Java](http://www.baeldung.com/java-not-a-number)
|
||||
- [Infinite Loops in Java](http://www.baeldung.com/infinite-loops-java)
|
||||
- [Why Use char[] Array Over a String for Storing Passwords in Java?](http://www.baeldung.com/java-storing-passwords)
|
||||
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ public class ArrayBenchmarkRunner {
|
|||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Options options = new OptionsBuilder()
|
||||
.include(SearchArrayTest.class.getSimpleName()).threads(1)
|
||||
.include(SearchArrayUnitTest.class.getSimpleName()).threads(1)
|
||||
.forks(1).shouldFailOnError(true).shouldDoGC(true)
|
||||
.jvmArgs("-server").build();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit;
|
|||
@BenchmarkMode(Mode.AverageTime)
|
||||
@Warmup(iterations = 5)
|
||||
@OutputTimeUnit(TimeUnit.MICROSECONDS)
|
||||
public class SearchArrayTest {
|
||||
public class SearchArrayUnitTest {
|
||||
|
||||
@State(Scope.Benchmark)
|
||||
public static class SearchData {
|
|
@ -0,0 +1,23 @@
|
|||
package com.baeldung.extension;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
|
||||
public class Extension {
|
||||
//Instead of file name we can also specify full path of a file eg. /baeldung/com/demo/abc.java
|
||||
public String getExtensionByApacheCommonLib(String filename) {
|
||||
return FilenameUtils.getExtension(filename);
|
||||
}
|
||||
|
||||
public String getExtensionByStringHandling(String filename) {
|
||||
String fileExtension = "";
|
||||
if (filename.contains(".") && filename.lastIndexOf(".") != 0) {
|
||||
fileExtension = filename.substring(filename.lastIndexOf(".") + 1);
|
||||
}
|
||||
return fileExtension;
|
||||
}
|
||||
|
||||
public String getExtensionByGuava(String filename) {
|
||||
return Files.getFileExtension(filename);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue