Projects test harness and app props reconciling tests

This commit is contained in:
BoykoAlex
2016-10-31 13:02:13 -04:00
parent 146ae7ee61
commit 80782e97ba
91 changed files with 2005 additions and 101 deletions

View File

@@ -11,7 +11,6 @@
package org.springframework.ide.vscode.commons.maven.java;
import java.io.File;
import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -67,7 +66,7 @@ public class MavenJavaProject implements IJavaProject {
}
public Path getOutputFolder() {
return Paths.get(URI.create(mavenProject.getBuild().getOutputDirectory()));
return Paths.get(new File(mavenProject.getBuild().getOutputDirectory()).toURI());
}
}

View File

@@ -1,6 +1,8 @@
package org.springframework.ide.vscode.languageserver.testharness;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import java.io.File;
import java.nio.charset.Charset;
@@ -256,6 +258,8 @@ public class LanguageServerHarness {
public void assertCompletion(String textBefore, String expectTextAfter) throws Exception {
Editor editor = newEditor(textBefore);
assertNotNull(editor.getCompletions());
assertFalse(editor.getCompletions().isEmpty());
CompletionItem completion = editor.getFirstCompletion();
editor.apply(completion);
assertEquals(expectTextAfter, editor.getText());

View File

@@ -10,6 +10,8 @@
*******************************************************************************/
package org.springframework.ide.vscode.project.harness;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -43,7 +45,7 @@ public class ProjectsHarness {
public IJavaProject project(ProjectType type, String name) throws Exception {
return cache.get(type + "/" + name, () -> {
Path testProjectPath = Paths.get(ProjectsHarness.class.getResource("/" + name).toURI());
Path testProjectPath = getProjectPath(name);
switch (type) {
case MAVEN:
return new MavenJavaProject(testProjectPath.resolve(MavenCore.POM_XML).toFile());
@@ -55,6 +57,12 @@ public class ProjectsHarness {
}
});
}
protected Path getProjectPath(String name) throws URISyntaxException {
URL sourceLocation = ProjectsHarness.class.getProtectionDomain().getCodeSource().getLocation();
// file:/Users/aboyko/git/sts4/vscode-extensions/commons/project-test-harness/target/project-test-harness-0.0.1-SNAPSHOT.jar
return Paths.get(sourceLocation.toURI()).getParent().getParent().resolve("test-projects").resolve(name);
}
public MavenJavaProject mavenProject(String name) throws Exception {
return (MavenJavaProject) project(ProjectType.MAVEN, name);

View File

@@ -0,0 +1,66 @@
<?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>org.test</groupId>
<artifactId>demo-live-metadata</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<repositories>
<repository>
<id>libs-snapshot</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>1.2.1.BUILD-SNAPSHOT</version>
<optional>true</optional>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.Application</start-class>
<java.version>1.7</java.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,16 @@
package demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan
@EnableAutoConfiguration
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}

View File

@@ -0,0 +1,44 @@
package demo;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
*
* @author Stephane Nicoll
*/
@ConfigurationProperties("foo")
public class FooProperties {
private String name;
private String description;
/**
* A nice counter description.
*/
private Integer counter = 0;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getCounter() {
return counter;
}
public void setCounter(Integer counter) {
this.counter = counter;
}
}

View File

@@ -0,0 +1,16 @@
package demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
public class ApplicationTests {
@Test
public void contextLoads() {
}
}

View File

@@ -0,0 +1,90 @@
<?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>org.test</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.DemoApplication</start-class>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<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-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

View File

@@ -0,0 +1,32 @@
package demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@SpringBootApplication
@EnableConfigurationProperties
public class DemoApplication implements CommandLineRunner {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Autowired
FooProperties props;
@Override
public void run(String... args) throws Exception {
System.out.println("Hello world!");
for (Foo foo : props.getList()) {
System.out.println("===================");
System.out.println("name = "+foo.getName());
System.out.println("desc = "+foo.getDescription());
for (String string : foo.getRoles()) {
System.out.println(" role: "+string);
}
}
}
}

View File

@@ -0,0 +1,31 @@
package demo;
import java.util.List;
public class Foo {
private String name;
private String description;
private List<String> roles;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<String> getRoles() {
return roles;
}
public void setRoles(List<String> roles) {
this.roles = roles;
}
}

View File

@@ -0,0 +1,23 @@
package demo;
import java.util.List;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
@ConfigurationProperties("volder.foo")
@Configuration
public class FooProperties {
private List<Foo> list;
public List<Foo> getList() {
return list;
}
public void setList(List<Foo> foo) {
this.list = foo;
}
}

View File

@@ -0,0 +1,8 @@
logging.level.com.acme.bragger=INFO
volder.foo.list[0].name=Kris
volder.foo.list[0].description=Good Guy
volder.foo.list[0].bogus=bad
volder.foo.list[0].roles[0]=Bad-ass

View File

@@ -0,0 +1,16 @@
package demo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = DemoApplication.class)
public class DemoApplicationTests {
@Test
public void contextLoads() {
}
}

View File

@@ -0,0 +1,5 @@
/.apt_generated/
.project
.factorypath
.classpath
.settings

View File

@@ -0,0 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip

View File

@@ -0,0 +1,236 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
#
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
# for the new JDKs provided by Oracle.
#
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
#
# Apple JDKs
#
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
fi
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
#
# Apple JDKs
#
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
#
# Oracle JDKs
#
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
#
# Apple JDKs
#
export JAVA_HOME=`/usr/libexec/java_home`
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
local basedir=$(pwd)
local wdir=$(pwd)
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
wdir=$(cd "$wdir/.."; pwd)
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in $@
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

View File

@@ -0,0 +1,146 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %*
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in %*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

View File

@@ -0,0 +1,58 @@
<?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.example</groupId>
<artifactId>demo-sts-4335</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,12 @@
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}

View File

@@ -0,0 +1,37 @@
package com.example;
import java.util.Map.Entry;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import com.wellsfargo.lendingplatform.web.config.TestObjectWithList;
@Component
public class Runner implements CommandLineRunner {
@Autowired
TestMap props;
@Override
public void run(String... arg0) throws Exception {
p(">>> test map");
for (Entry<String, TestObjectWithList> e : props.getTestMap().entrySet()) {
p(e.getKey() + " -> ");
String[] strings = e.getValue().getStringList();
if (strings==null) {
p(" null");
} else {
for (String string : strings) {
p(" '"+string+"'");
}
}
}
}
private void p(String string) {
System.out.println(string);
}
}

View File

@@ -0,0 +1,25 @@
package com.example;
import java.util.LinkedHashMap;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import com.wellsfargo.lendingplatform.web.config.TestObjectWithList;
@Component
@ConfigurationProperties
public class TestMap {
private LinkedHashMap<String, TestObjectWithList> testMap;
public LinkedHashMap<String, TestObjectWithList> getTestMap() {
return testMap;
}
public void setTestMap(LinkedHashMap<String, TestObjectWithList> testMap) {
this.testMap = testMap;
}
}

View File

@@ -0,0 +1,5 @@
package com.wellsfargo.lendingplatform.web.config;
public enum Color {
RED, GREEN, BLUE
}

View File

@@ -0,0 +1,33 @@
package com.wellsfargo.lendingplatform.web.config;
import java.util.List;
public class TestObjectWithList {
private String[] stringList;
private Color[] colorList;
private List<Color> list;
public String[] getStringList() {
return stringList;
}
public void setStringList(String[] stringList) {
this.stringList = stringList;
}
public Color[] getColorList() {
return colorList;
}
public void setColorList(Color[] colorList) {
this.colorList = colorList;
}
public List<Color> getList() {
return list;
}
public void setList(List<Color> list) {
this.list = list;
}
}

View File

@@ -0,0 +1,4 @@
test-map.test-list-object.string-list[0]=not-a-color
test-map.test-list-object.string-list[1]=RED
test-map.test-list-object.string-list[2]=GREEN
test-map.some-key.list[0]=something

View File

@@ -0,0 +1,18 @@
package com.example;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = DemoApplication.class)
@WebAppConfiguration
public class DemoApplicationTests {
@Test
public void contextLoads() {
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
.classpath
.project
.settings

View File

@@ -0,0 +1,53 @@
<?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.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>boot13</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,12 @@
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Boot13Application {
public static void main(String[] args) {
SpringApplication.run(Boot13Application.class, args);
}
}

View File

@@ -0,0 +1,18 @@
package com.example;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Boot13Application.class)
@WebAppConfiguration
public class Boot13ApplicationTests {
@Test
public void contextLoads() {
}
}

View File

@@ -0,0 +1,57 @@
<?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.example</groupId>
<artifactId>boot13_with_mongo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,12 @@
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}

View File

@@ -0,0 +1,14 @@
package com.example;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class MyController {
@RequestMapping("/")
public String hello() {
return "Hello";
}
}

View File

@@ -0,0 +1,9 @@
logging:
level:
spring:
data:
mongodb:
field-naming-strategy:

View File

@@ -0,0 +1,16 @@
package com.example;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = DemoApplication.class)
public class DemoApplicationTests {
@Test
public void contextLoads() {
}
}

View File

@@ -0,0 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip

View File

@@ -0,0 +1,236 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
#
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
# for the new JDKs provided by Oracle.
#
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
#
# Apple JDKs
#
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
fi
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
#
# Apple JDKs
#
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
#
# Oracle JDKs
#
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
#
# Apple JDKs
#
export JAVA_HOME=`/usr/libexec/java_home`
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
local basedir=$(pwd)
local wdir=$(pwd)
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
wdir=$(cd "$wdir/.."; pwd)
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in $@
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

View File

@@ -0,0 +1,146 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %*
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in %*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

View File

@@ -0,0 +1 @@
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip

View File

@@ -0,0 +1,236 @@
#!/bin/sh
# ----------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Maven2 Start Up Batch script
#
# Required ENV vars:
# ------------------
# JAVA_HOME - location of a JDK home dir
#
# Optional ENV vars
# -----------------
# M2_HOME - location of maven2's installed home dir
# MAVEN_OPTS - parameters passed to the Java VM when running Maven
# e.g. to debug Maven itself, use
# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
# ----------------------------------------------------------------------------
if [ -z "$MAVEN_SKIP_RC" ] ; then
if [ -f /etc/mavenrc ] ; then
. /etc/mavenrc
fi
if [ -f "$HOME/.mavenrc" ] ; then
. "$HOME/.mavenrc"
fi
fi
# OS specific support. $var _must_ be set to either true or false.
cygwin=false;
darwin=false;
mingw=false
case "`uname`" in
CYGWIN*) cygwin=true ;;
MINGW*) mingw=true;;
Darwin*) darwin=true
#
# Look for the Apple JDKs first to preserve the existing behaviour, and then look
# for the new JDKs provided by Oracle.
#
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK ] ; then
#
# Apple JDKs
#
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home
fi
if [ -z "$JAVA_HOME" ] && [ -L /System/Library/Java/JavaVirtualMachines/CurrentJDK ] ; then
#
# Apple JDKs
#
export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
if [ -z "$JAVA_HOME" ] && [ -L "/Library/Java/JavaVirtualMachines/CurrentJDK" ] ; then
#
# Oracle JDKs
#
export JAVA_HOME=/Library/Java/JavaVirtualMachines/CurrentJDK/Contents/Home
fi
if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then
#
# Apple JDKs
#
export JAVA_HOME=`/usr/libexec/java_home`
fi
;;
esac
if [ -z "$JAVA_HOME" ] ; then
if [ -r /etc/gentoo-release ] ; then
JAVA_HOME=`java-config --jre-home`
fi
fi
if [ -z "$M2_HOME" ] ; then
## resolve links - $0 may be a link to maven's home
PRG="$0"
# need this for relative symlinks
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG="`dirname "$PRG"`/$link"
fi
done
saveddir=`pwd`
M2_HOME=`dirname "$PRG"`/..
# make it fully qualified
M2_HOME=`cd "$M2_HOME" && pwd`
cd "$saveddir"
# echo Using m2 at $M2_HOME
fi
# For Cygwin, ensure paths are in UNIX format before anything is touched
if $cygwin ; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --unix "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# For Migwn, ensure paths are in UNIX format before anything is touched
if $mingw ; then
[ -n "$M2_HOME" ] &&
M2_HOME="`(cd "$M2_HOME"; pwd)`"
[ -n "$JAVA_HOME" ] &&
JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
# TODO classpath?
fi
if [ -z "$JAVA_HOME" ]; then
javaExecutable="`which javac`"
if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
# readlink(1) is not available as standard on Solaris 10.
readLink=`which readlink`
if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
if $darwin ; then
javaHome="`dirname \"$javaExecutable\"`"
javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
else
javaExecutable="`readlink -f \"$javaExecutable\"`"
fi
javaHome="`dirname \"$javaExecutable\"`"
javaHome=`expr "$javaHome" : '\(.*\)/bin'`
JAVA_HOME="$javaHome"
export JAVA_HOME
fi
fi
fi
if [ -z "$JAVACMD" ] ; then
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
else
JAVACMD="`which java`"
fi
fi
if [ ! -x "$JAVACMD" ] ; then
echo "Error: JAVA_HOME is not defined correctly." >&2
echo " We cannot execute $JAVACMD" >&2
exit 1
fi
if [ -z "$JAVA_HOME" ] ; then
echo "Warning: JAVA_HOME environment variable is not set."
fi
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# traverses directory structure from process work directory to filesystem root
# first directory with .mvn subdirectory is considered project base directory
find_maven_basedir() {
local basedir=$(pwd)
local wdir=$(pwd)
while [ "$wdir" != '/' ] ; do
if [ -d "$wdir"/.mvn ] ; then
basedir=$wdir
break
fi
wdir=$(cd "$wdir/.."; pwd)
done
echo "${basedir}"
}
# concatenates all lines of a file
concat_lines() {
if [ -f "$1" ]; then
echo "$(tr -s '\n' ' ' < "$1")"
fi
}
export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)}
MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
# For Cygwin, switch paths to Windows format before running java
if $cygwin; then
[ -n "$M2_HOME" ] &&
M2_HOME=`cygpath --path --windows "$M2_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$MAVEN_PROJECTBASEDIR" ] &&
MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi
# Provide a "standardized" way to retrieve the CLI args that will
# work with both Windows and non-Windows executions.
MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
export MAVEN_CMD_LINE_ARGS
WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in $@
exec "$JAVACMD" \
$MAVEN_OPTS \
-classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
"-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"

View File

@@ -0,0 +1,146 @@
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven2 Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
set MAVEN_CMD_LINE_ARGS=%MAVEN_CONFIG% %*
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR=""%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar""
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
# avoid using MAVEN_CMD_LINE_ARGS below since that would loose parameter escaping in %*
%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%" == "on" pause
if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
exit /B %ERROR_CODE%

View File

@@ -7,7 +7,8 @@ import java.util.HashMap;
import java.util.Map;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
import org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Key;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;
import org.springframework.ide.vscode.java.properties.parser.PropertiesFileEscapes;
/**
* Instance of this class is fed the regions of names in a properties file, checks them for duplicates and
@@ -24,7 +25,7 @@ public class DuplicateNameChecker {
* This is used so that the first occurrence can still be reported retroactively
* when the second occurrence is encountered.
*/
private Map<String, Key> seen = new HashMap<>();
private Map<String, DocumentRegion> seen = new HashMap<>();
IProblemCollector problems;
@@ -32,11 +33,11 @@ public class DuplicateNameChecker {
this.problems = problems;
}
public void check(Key nameRegion) {
String name = nameRegion.decode();
public void check(DocumentRegion nameRegion) throws Exception {
String name = PropertiesFileEscapes.unescape(nameRegion.toString());
if (!name.isEmpty()) {
if (seen.containsKey(name)) {
Key pending = seen.get(name);
DocumentRegion pending = seen.get(name);
if (pending!=null) {
reportDuplicate(pending);
seen.put(name, null);
@@ -48,8 +49,8 @@ public class DuplicateNameChecker {
}
}
private void reportDuplicate(Key nameRegion) {
String decodedKey = nameRegion.decode();
private void reportDuplicate(DocumentRegion nameRegion) throws Exception {
String decodedKey = PropertiesFileEscapes.unescape(nameRegion.toString());
problems.accept(problem(PROP_DUPLICATE_KEY,
"Duplicate property '"+decodedKey+"'", nameRegion));
}

View File

@@ -1,7 +1,7 @@
package org.springframework.ide.vscode.application.properties.reconcile;
import static org.springframework.ide.vscode.application.properties.reconcile.SpringPropertyProblem.problem;
import static org.springframework.ide.vscode.application.properties.metadata.types.TypeUtil.isBracketable;
import static org.springframework.ide.vscode.application.properties.reconcile.SpringPropertyProblem.problem;
import java.util.List;
@@ -13,10 +13,10 @@ import org.springframework.ide.vscode.application.properties.metadata.types.Type
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblem;
import org.springframework.ide.vscode.commons.languageserver.util.BadLocationException;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;
import org.springframework.ide.vscode.commons.languageserver.util.IDocument;
import org.springframework.ide.vscode.commons.util.StringUtil;
import org.springframework.ide.vscode.commons.util.ValueParser;
import org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Node;
/**
* Helper class for {@link SpringPropertiesReconcileEngine} and {@link SpringPropertiesCompletionEngine}.
@@ -43,16 +43,16 @@ public class PropertyNavigator {
private TypeUtil typeUtil;
private Node region;
private DocumentRegion region;
private String regionText;
public PropertyNavigator(IDocument doc, IProblemCollector problemCollector, TypeUtil typeUtil, Node region) throws BadLocationException {
public PropertyNavigator(IDocument doc, IProblemCollector problemCollector, TypeUtil typeUtil, DocumentRegion region) throws BadLocationException {
this.doc = doc;
this.problemCollector = problemCollector==null?IProblemCollector.NULL:problemCollector;
this.typeUtil = typeUtil;
this.region = region;
this.regionText = doc.get(region.getOffset(), region.getLength());
this.regionText = doc.get(region.getStart(), region.getLength());
}
/**
@@ -65,26 +65,26 @@ public class PropertyNavigator {
*/
public Type navigate(int offset, Type type) {
if (type!=null) {
if (offset<getEnd(region)) {
if (offset<region.getEnd()) {
char navOp = getChar(offset);
if (navOp=='.') {
if (typeUtil.isDotable(type)) {
return dotNavigate(offset, type);
} else {
problemCollector.accept(problem(ApplicationPropertiesProblemType.PROP_INVALID_BEAN_NAVIGATION,
"Can't use '.' navigation for property '"+textBetween(region.getOffset(), offset)+"' of type "+type,
offset, getEnd(region)-offset));
"Can't use '.' navigation for property '"+textBetween(region.getStart(), offset)+"' of type "+type,
offset, region.getEnd()-offset));
}
} else if (navOp=='[') {
if (isBracketable(type)) {
return bracketNavigate(offset, type);
} else {
problemCollector.accept(problem(ApplicationPropertiesProblemType.PROP_INVALID_INDEXED_NAVIGATION,
"Can't use '[..]' navigation for property '"+textBetween(region.getOffset(), offset)+"' of type "+type,
offset, getEnd(region)-offset));
"Can't use '[..]' navigation for property '"+textBetween(region.getStart(), offset)+"' of type "+type,
offset, region.getEnd()-offset));
}
} else {
problemCollector.accept(problem(ApplicationPropertiesProblemType.PROP_EXPECTED_DOT_OR_LBRACK, "Expecting either a '.' or '['", offset, getEnd(region)-offset));
problemCollector.accept(problem(ApplicationPropertiesProblemType.PROP_EXPECTED_DOT_OR_LBRACK, "Expecting either a '.' or '['", offset, region.getEnd()-offset));
}
} else {
//end of nav chain
@@ -107,7 +107,7 @@ public class PropertyNavigator {
}
private int indexOf(char c, int from) {
int offset = region.getOffset();
int offset = region.getStart();
int found = regionText.indexOf(c, from-offset);
if (found>=0) {
return found+offset;
@@ -134,7 +134,7 @@ public class PropertyNavigator {
Integer.parseInt(indexStr);
} catch (Exception e) {
problemCollector.accept(problem(ApplicationPropertiesProblemType.PROP_NON_INTEGER_IN_BRACKETS,
"Expecting 'Integer' for '[...]' notation '"+textBetween(region.getOffset(), lbrack)+"'",
"Expecting 'Integer' for '[...]' notation '"+textBetween(region.getStart(), lbrack)+"'",
lbrack+1, rbrack-lbrack-1
));
}
@@ -183,7 +183,7 @@ public class PropertyNavigator {
int keyStart = offset+1;
int keyEnd = nextNavOp(".[", offset+1);
if (keyEnd<0) {
keyEnd = getEnd(region);
keyEnd = region.getEnd();
}
String key = StringUtil.camelCaseToHyphens(textBetween(keyStart, keyEnd));
@@ -232,7 +232,7 @@ public class PropertyNavigator {
* @return position of next navop if found, or the position at the end of the region if not found.
*/
private int nextNavOp(String navops, int pos) {
int end = getEnd(region);
int end = region.getEnd();
while (pos < end && navops.indexOf(getChar(pos))<0) {
pos++;
}
@@ -248,7 +248,4 @@ public class PropertyNavigator {
}
}
private int getEnd(Node region) {
return region.getOffset()+region.getLength();
}
}

View File

@@ -19,8 +19,6 @@ import static org.springframework.ide.vscode.commons.util.StringUtil.commonPrefi
import java.util.regex.Pattern;
import javax.inject.Provider;
import org.springframework.ide.vscode.application.properties.metadata.PropertyInfo;
import org.springframework.ide.vscode.application.properties.metadata.SpringPropertyIndex;
import org.springframework.ide.vscode.application.properties.metadata.SpringPropertyIndexProvider;
@@ -32,6 +30,7 @@ import org.springframework.ide.vscode.application.properties.metadata.util.Fuzzy
import org.springframework.ide.vscode.application.properties.quickfix.ReplaceDeprecatedPropertyQuickfix;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IReconcileEngine;
import org.springframework.ide.vscode.commons.languageserver.util.BadLocationException;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;
import org.springframework.ide.vscode.commons.languageserver.util.IDocument;
import org.springframework.ide.vscode.commons.util.Log;
@@ -39,7 +38,6 @@ import org.springframework.ide.vscode.commons.util.ValueParser;
import org.springframework.ide.vscode.java.properties.antlr.parser.AntlrParser;
import org.springframework.ide.vscode.java.properties.parser.ParseResults;
import org.springframework.ide.vscode.java.properties.parser.Parser;
import org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Key;
import org.springframework.ide.vscode.java.properties.parser.PropertiesAst.KeyValuePair;
import org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Node;
import org.springframework.ide.vscode.java.properties.parser.PropertiesFileEscapes;
@@ -53,7 +51,6 @@ import org.springframework.ide.vscode.java.properties.parser.PropertiesFileEscap
*
* @author Kris De Volder
*/
@SuppressWarnings("restriction")
public class SpringPropertiesReconcileEngine implements IReconcileEngine {
/**
@@ -102,29 +99,31 @@ public class SpringPropertiesReconcileEngine implements IReconcileEngine {
}
results.ast.getNodes(KeyValuePair.class).forEach(pair -> {
Key fullName = pair.getKey();
String keyName = fullName.decode();
duplicateNameChecker.check(fullName);
PropertyInfo validProperty = SpringPropertyIndex.findLongestValidProperty(index, keyName);
// Key fullName = pair.getKey();
// String keyName = fullName.decode();
try {
DocumentRegion propertyNameRegion = createRegion(doc, pair.getKey());
String keyName = PropertiesFileEscapes.unescape(propertyNameRegion.toString());
duplicateNameChecker.check(propertyNameRegion);
PropertyInfo validProperty = SpringPropertyIndex.findLongestValidProperty(index, keyName);
if (validProperty!=null) {
//TODO: Remove last remnants of 'IRegion trimmedRegion' here and replace
// it all with just passing around 'fullName' DocumentRegion. This may require changes
// in PropertyNavigator (probably these changes are also for the better making it simpler as well)
if (validProperty.isDeprecated()) {
problemCollector.accept(problemDeprecated(fullName, validProperty));
problemCollector.accept(problemDeprecated(propertyNameRegion, validProperty));
}
int offset = validProperty.getId().length() + fullName.getOffset();
PropertyNavigator navigator = new PropertyNavigator(doc, problemCollector, typeUtilProvider.getTypeUtil(doc), fullName);
int offset = validProperty.getId().length() + propertyNameRegion.getStart();
PropertyNavigator navigator = new PropertyNavigator(doc, problemCollector, typeUtilProvider.getTypeUtil(doc), propertyNameRegion);
Type valueType = navigator.navigate(offset, TypeParser.parse(validProperty.getType()));
if (valueType!=null) {
reconcileType(doc, valueType, pair.getValue(), problemCollector);
}
} else { //validProperty==null
//The name is invalid, with no 'prefix' of the name being a valid property name.
PropertyInfo similarEntry = index.findLongestCommonPrefixEntry(fullName.toString());
PropertyInfo similarEntry = index.findLongestCommonPrefixEntry(propertyNameRegion.toString());
CharSequence validPrefix = commonPrefix(similarEntry.getId(), keyName);
problemCollector.accept(problemUnkownProperty(createRegion(doc, fullName), similarEntry, validPrefix));
problemCollector.accept(problemUnkownProperty(propertyNameRegion, similarEntry, validPrefix));
} //end: validProperty==null
} catch (Exception e) {
Log.log(e);
@@ -137,14 +136,14 @@ public class SpringPropertiesReconcileEngine implements IReconcileEngine {
}
}
protected SpringPropertyProblem problemDeprecated(Key key, PropertyInfo property) {
protected SpringPropertyProblem problemDeprecated(DocumentRegion region, PropertyInfo property) {
SpringPropertyProblem p = problem(PROP_DEPRECATED,
TypeUtil.deprecatedPropertyMessage(
property.getId(), null,
property.getDeprecationReplacement(),
property.getDeprecationReason()
),
key
region
);
p.setPropertyName(property.getId());
p.setMetadata(property);
@@ -180,7 +179,14 @@ public class SpringPropertiesReconcileEngine implements IReconcileEngine {
}
private DocumentRegion createRegion(IDocument doc, Node value) {
return new DocumentRegion(doc, value.getOffset(), value.getOffset() + value.getLength());
// Trim trailing spaces (there is no leading white space already)
int length = value.getLength();
try {
length = doc.get(value.getOffset(), value.getLength()).trim().length();
} catch (BadLocationException e) {
// ignore
}
return new DocumentRegion(doc, value.getOffset(), value.getOffset() + length);
}
private void reconcileType(DocumentRegion region, Type expectType, IProblemCollector problems) {

View File

@@ -5,7 +5,6 @@ import org.springframework.ide.vscode.commons.languageserver.quickfix.ProblemFix
import org.springframework.ide.vscode.commons.languageserver.reconcile.ProblemType;
import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileProblemImpl;
import org.springframework.ide.vscode.commons.languageserver.util.DocumentRegion;
import org.springframework.ide.vscode.java.properties.parser.PropertiesAst.Node;
// TODO: Move to a common project shared between YAML and Properties
@@ -23,10 +22,6 @@ public class SpringPropertyProblem extends ReconcileProblemImpl {
return new SpringPropertyProblem(type, msg, offset, len);
}
public static SpringPropertyProblem problem(ApplicationPropertiesProblemType type, String msg, Node region) {
return new SpringPropertyProblem(type, msg, region.getOffset(), region.getLength());
}
public static SpringPropertyProblem problem(ApplicationPropertiesProblemType type, String msg, DocumentRegion region) {
return new SpringPropertyProblem(type, msg, region.getStart(), region.getLength());
}

View File

@@ -30,7 +30,6 @@ import org.springframework.ide.vscode.commons.java.IType;
import org.springframework.ide.vscode.commons.languageserver.util.SimpleLanguageServer;
import org.springframework.ide.vscode.commons.maven.java.MavenJavaProject;
import org.springframework.ide.vscode.languageserver.testharness.Editor;
import org.springframework.ide.vscode.languageserver.testharness.LanguageServerHarness;
import org.springframework.ide.vscode.properties.editor.test.harness.AbstractPropsEditorTest;
import org.springframework.ide.vscode.properties.editor.test.harness.StyledStringMatcher;
@@ -53,7 +52,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
editor.assertProblems("key|extraneous input");
}
@Test public void linterRunsOnDocumentOpenAndChange() throws Exception {
public void linterRunsOnDocumentOpenAndChange() throws Exception {
Editor editor = newEditor("key");
editor.assertProblems("key|mismatched input");
@@ -67,7 +66,6 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
editor.assertProblems("problem|extraneous input", "another|mismatched input");
}
@Ignore @Test public void testServerPortCompletion() throws Exception {
data("server.port", INTEGER, 8080, "Port where server listens for http.");
assertCompletion("ser<*>", "server.port=<*>");
@@ -216,13 +214,13 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testPredefinedProject() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo");
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
IType type = p.findType("demo.DemoApplication");
assertNotNull(type);
}
@Ignore @Test public void testEnableApt() throws Throwable {
MavenJavaProject p = createPredefinedMavenProject("demo-live-metadata");
MavenJavaProject p = createPredefinedMavenProject("boot-1.2.0-properties-live-metadta");
//Check some assumptions about the initial state of the test project (if these checks fail then
// the test may be 'vacuous' since the things we are testing for already exist beforehand.
@@ -233,7 +231,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testHyperlinkTargets() throws Exception {
System.out.println(">>> testHyperlinkTargets");
IJavaProject p = createPredefinedMavenProject("demo");
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(p);
Editor editor = newEditor(
@@ -257,7 +255,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testHyperlinkTargetsLoggingLevel() throws Exception {
System.out.println(">>> testHyperlinkTargetsLoggingLevel");
IJavaProject p = createPredefinedMavenProject("demo");
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(p);
@@ -270,7 +268,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
System.out.println("<<< testHyperlinkTargetsLoggingLevel");
}
@Ignore @Test public void testReconcile() throws Exception {
@Test public void testReconcile() throws Exception {
defaultTestData();
Editor editor = newEditor(
"server.port=8080\n" +
@@ -288,7 +286,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testReconcilePojoArray() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-list-of-pojo");
IJavaProject p = createPredefinedMavenProject("boot-1.2.1-app-properties-list-of-pojo");
useProject(p);
assertNotNull(p.findType("demo.Foo"));
@@ -313,7 +311,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testPojoArrayCompletions() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-list-of-pojo");
IJavaProject p = createPredefinedMavenProject("boot-1.2.1-app-properties-list-of-pojo");
useProject(p);
assertNotNull(p.findType("demo.Foo"));
@@ -335,7 +333,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
);
}
@Ignore @Test public void testReconcileArrayNotation() throws Exception {
@Test public void testReconcileArrayNotation() throws Exception {
defaultTestData();
Editor editor = newEditor(
"borked=bad+\n" + //token problem, to make sure reconciler is working
@@ -348,7 +346,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
);
}
@Ignore @Test public void testReconcileArrayNotationError() throws Exception {
@Test public void testReconcileArrayNotationError() throws Exception {
defaultTestData();
Editor editor = newEditor(
"security.user.role[bork]=foo\n" +
@@ -366,7 +364,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
);
}
@Ignore @Test public void testRelaxedNameReconciling() throws Exception {
@Test public void testRelaxedNameReconciling() throws Exception {
data("connection.remote-host", "java.lang.String", "service.net", null);
data("foo-bar.name", "java.lang.String", null, null);
Editor editor = newEditor(
@@ -382,7 +380,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
);
}
@Ignore @Test public void testRelaxedNameReconcilingErrors() throws Exception {
@Test public void testRelaxedNameReconcilingErrors() throws Exception {
//Tricky with relaxec names: the error positions have to be moved
// around because the relaxed names aren't same length as the
// canonical ids.
@@ -402,7 +400,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
assertCompletion("fooBar<*>", "foo-bar-zor.enabled=<*>");
}
@Ignore @Test public void testReconcileValues() throws Exception {
@Test public void testReconcileValues() throws Exception {
defaultTestData();
Editor editor = newEditor(
"server.port=badPort\n" +
@@ -414,7 +412,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
);
}
@Ignore @Test public void testNoReconcileInterpolatedValues() throws Exception {
@Test public void testNoReconcileInterpolatedValues() throws Exception {
defaultTestData();
Editor editor = newEditor(
"server.port=${port}\n" +
@@ -426,7 +424,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
);
}
@Ignore @Test public void testReconcileValuesWithSpaces() throws Exception {
@Test public void testReconcileValuesWithSpaces() throws Exception {
defaultTestData();
Editor editor = newEditor(
"server.port = badPort\n" +
@@ -442,7 +440,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testReconcileWithExtraSpaces() throws Exception {
@Test public void testReconcileWithExtraSpaces() throws Exception {
defaultTestData();
//Same test as previous but with extra spaces to make things more confusing
Editor editor = newEditor(
@@ -461,7 +459,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumPropertyCompletionInsideCommaSeparateList() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -484,7 +482,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumPropertyCompletion() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -503,7 +501,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testEnumPropertyReconciling() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -526,7 +524,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumMapValueCompletion() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -543,7 +541,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumMapValueReconciling() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
data("foo.name-colors", "java.util.Map<java.lang.String,demo.Color>", null, "Map with colors in its values");
@@ -562,7 +560,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumMapKeyCompletion() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
data("foo.color-names", "java.util.Map<demo.Color,java.lang.String>", null, "Map with colors in its keys");
@@ -600,7 +598,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumMapKeyReconciling() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -620,7 +618,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testPojoCompletions() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -655,7 +653,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testPojoReconciling() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -690,7 +688,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
//Interpretation of '.' changes depending on the domain type (i.e. when domain type is
//is a simple type got which '.' navigation is invalid then the '.' is 'eaten' by the key.
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -730,7 +728,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
//Similar to testMapKeyDotInterpretation but this time maps are not attached to property
// directly but via a pojo property
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -756,7 +754,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumsInLowerCaseReconciling() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.ClothingSize"));
@@ -800,7 +798,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumsInLowerCaseContentAssist() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.ClothingSize"));
@@ -843,7 +841,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testNavigationProposalAfterRelaxedPropertyName() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
@@ -852,7 +850,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testValueProposalAssignedToRelaxedPropertyName() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
@@ -951,7 +949,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testDeprecatedBeanPropertyReconcile() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo");
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(p);
data("foo", "demo.Deprecater", null, "A Bean with deprecated properties");
@@ -968,7 +966,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testDeprecatedBeanPropertyCompletions() throws Exception {
IJavaProject p = createPredefinedMavenProject("demo");
IJavaProject p = createPredefinedMavenProject("tricky-getters-boot-1.3.1-app");
useProject(p);
data("foo", "demo.Deprecater", null, "A Bean with deprecated properties");
@@ -1024,7 +1022,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
// map property value
// list property value
useProject(createPredefinedMavenProject("boot13"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-app"));
assertCompletionsDisplayString(
"spring.http.converters.preferred-json-mapper=<*>\n"
, //=>
@@ -1034,7 +1032,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testPropertyListHintCompletions() throws Exception {
useProject(createPredefinedMavenProject("boot13"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-app"));
assertCompletion(
"management.health.status.ord<*>"
@@ -1062,7 +1060,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testPropertyMapValueCompletions() throws Exception {
useProject(createPredefinedMavenProject("boot13"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-app"));
assertCompletionsDisplayString(
"logging.level.some: <*>"
@@ -1090,7 +1088,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testPropertyMapKeyCompletions() throws Exception {
useProject(createPredefinedMavenProject("boot13"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-app"));
assertCompletionWithLabel(
"logging.level.<*>"
, //==============
@@ -1155,7 +1153,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void test_STS_3335_reconcile_list_nested_in_Map_of_String() throws Exception {
Editor editor;
useProject(createPredefinedMavenProject("demo-sts-4335"));
useProject(createPredefinedMavenProject("boot-1.3.3-sts-4335"));
editor = newEditor(
"test-map.test-list-object.color-list[0]=not-a-color\n"+
@@ -1176,7 +1174,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void test_STS_3335_completions_list_nested_in_Map_of_String() throws Exception {
useProject(createPredefinedMavenProject("demo-sts-4335"));
useProject(createPredefinedMavenProject("boot-1.3.3-sts-4335"));
assertCompletions(
"test-map.some-string-key.col<*>"
@@ -1200,7 +1198,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testSimpleResourceCompletion() throws Exception {
CachingValueProvider.TIMEOUT = Duration.ofSeconds(20);
useProject(createPredefinedMavenProject("boot13"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-app"));
data("my.nice.resource", "org.springframework.core.io.Resource", null, "A very nice resource.");
@@ -1224,7 +1222,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testClasspathResourceCompletion() throws Exception {
CachingValueProvider.TIMEOUT = Duration.ofSeconds(20);
useProject(createPredefinedMavenProject("boot13"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-app"));
data("my.nice.resource", "org.springframework.core.io.Resource", null, "A very nice resource.");
data("my.nice.list", "java.util.List<org.springframework.core.io.Resource>", null, "A nice list of resources.");
@@ -1294,7 +1292,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testClasspathResourceCompletionInCommaList() throws Exception {
CachingValueProvider.TIMEOUT = Duration.ofSeconds(20);
useProject(createPredefinedMavenProject("boot13"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-app"));
data("my.nice.list", "java.util.List<org.springframework.core.io.Resource>", null, "A nice list of resources.");
data("my.nice.array", "org.springframework.core.io.Resource[]", null, "A nice array of resources.");
@@ -1330,7 +1328,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testClassReferenceCompletion() throws Exception {
CachingValueProvider.TIMEOUT = Duration.ofSeconds(20);
useProject(createPredefinedMavenProject("boot13_with_mongo"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-with-mongo"));
assertCompletion(
"spring.data.mongodb.field-na<*>"
@@ -1356,7 +1354,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
);
//Test what happens when 'target' type isn't on the classpath:
useProject(createPredefinedMavenProject("boot13"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-app"));
assertCompletionsDisplayString(
"spring.data.mongodb.field-naming-strategy=<*>"
// =>
@@ -1366,7 +1364,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testClassReferenceInValueLink() throws Exception {
Editor editor;
useProject(createPredefinedMavenProject("boot13_with_mongo"));
useProject(createPredefinedMavenProject("empty-boot-1.3.0-with-mongo"));
editor = newEditor(
"#stuff\n" +
@@ -1386,7 +1384,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testCommaListReconcile() throws Exception {
Editor editor;
IJavaProject p = createPredefinedMavenProject("demo-enum");
IJavaProject p = createPredefinedMavenProject("enums-boot-1.3.2-app");
useProject(p);
assertNotNull(p.findType("demo.Color"));
@@ -1453,7 +1451,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
editor.assertProblems( " |demo.Color");
}
@Ignore @Test public void testReconcileDuplicateKey() throws Exception {
@Test public void testReconcileDuplicateKey() throws Exception {
Editor editor;
data("some.property", "java.lang.String", null, "yada");
data("some.other.property", "java.lang.String", null, "yada");
@@ -1504,7 +1502,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumJavaDocShownInValueContentAssist() throws Exception {
useProject(createPredefinedMavenProject("demo-enum"));
useProject(createPredefinedMavenProject("enums-boot-1.3.2-app"));
data("my.background", "demo.Color", null, "Color to use as default background.");
assertCompletionWithInfoHover(
@@ -1517,7 +1515,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
}
@Ignore @Test public void testEnumJavaDocShownInValueHover() throws Exception {
useProject(createPredefinedMavenProject("demo-enum"));
useProject(createPredefinedMavenProject("enums-boot-1.3.2-app"));
data("my.background", "demo.Color", null, "Color to use as default background.");
Editor editor;
@@ -1536,7 +1534,7 @@ public class ApplicationPropertiesEditorTest extends AbstractPropsEditorTest {
@Ignore @Test public void testEnumInValueLink() throws Exception {
useProject(createPredefinedMavenProject("demo-enum"));
useProject(createPredefinedMavenProject("enums-boot-1.3.2-app"));
data("my.background", "demo.Color", null, "Color to use as default background.");
Editor editor;