Repository: zest-java Updated Branches: refs/heads/develop 9ae5a7529 -> 772aa0388
Yep, the upper/lower case became a problem. Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/772aa038 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/772aa038 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/772aa038 Branch: refs/heads/develop Commit: 772aa0388aa1a5abc5a48dfa23eeda146cb74724 Parents: 9ae5a75 Author: Niclas Hedhman <[email protected]> Authored: Mon Apr 18 12:52:31 2016 +0800 Committer: Niclas Hedhman <[email protected]> Committed: Mon Apr 18 12:52:31 2016 +0800 ---------------------------------------------------------------------- build.gradle | 10 +- tools/shell/src/bin/zest.bat_ | 25 ++++ .../create/project/RestProjectCreatorTest.java | 119 +++++++++++++++++++ .../project/RestappProjectCreatorTest.java | 119 ------------------- 4 files changed, 148 insertions(+), 125 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/772aa038/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index e8162ba..24ad44f 100644 --- a/build.gradle +++ b/build.gradle @@ -833,11 +833,9 @@ def libsImage = copySpec { } } -def toolsImage = copySpec { - releaseApprovedProjects.collect { proj -> - from( "$projectDir/src/bin/**") - into( "bin/" ) - } +def binFoldersImage = copySpec { + from "tools/shell/src/bin/**" + into( "bin/" ) } def binDistNoticesImage = copySpec { @@ -852,8 +850,8 @@ def binDistImage = copySpec { with docsImage with reportsDistImage with runtimeDependenciesListImage + with binFoldersImage with libsImage - with toolsImage } task zipSources( type: Zip ) { http://git-wip-us.apache.org/repos/asf/zest-java/blob/772aa038/tools/shell/src/bin/zest.bat_ ---------------------------------------------------------------------- diff --git a/tools/shell/src/bin/zest.bat_ b/tools/shell/src/bin/zest.bat_ new file mode 100644 index 0000000..3d85fbf --- /dev/null +++ b/tools/shell/src/bin/zest.bat_ @@ -0,0 +1,25 @@ +REM Licensed to the Apache Software Foundation (ASF) under one or more +REM contributor license agreements. See the NOTICE file distributed with +REM this work for additional information regarding copyright ownership. +REM The ASF licenses this file to You under the Apache License, Version 2.0 +REM (the "License"); you may not use this file except in compliance with +REM 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, software +REM distributed under the License is distributed on an "AS IS" BASIS, +REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +REM See the License for the specific language governing permissions and +REM limitations under the License. + + +REM TODO: Windows user to fix this script, please! + +REM Absolute path to this script, e.g. /home/user/bin/foo.sh +REM ZESTSCRIPT=$(readlink -f "$0") +REM Absolute path this script is in, thus /home/user/bin +REM ZESTPATH=$(dirname "$ZESTSCRIPT") + +java -Dzest.home=$ZESTPATH -jar org.apache.zest.tools.shell-@@version@@.jar "$@" + http://git-wip-us.apache.org/repos/asf/zest-java/blob/772aa038/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestProjectCreatorTest.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestProjectCreatorTest.java b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestProjectCreatorTest.java new file mode 100644 index 0000000..41d832b --- /dev/null +++ b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestProjectCreatorTest.java @@ -0,0 +1,119 @@ +/* + * 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. + * + * + */ + +package org.apache.zest.tools.shell.create.project; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import org.apache.zest.tools.shell.FileUtils; +import org.apache.zest.tools.shell.TestHelper; +import org.junit.Test; + +import static org.apache.zest.tools.shell.FileUtils.removeDir; +import static org.hamcrest.core.IsEqual.equalTo; +import static org.junit.Assert.assertThat; + +public class RestProjectCreatorTest +{ + private RestAppProjectCreator underTest = new RestAppProjectCreator(); + + @Test + public void givenCorrectInputWhenCreatedProjectExpectCompleteProjectCreated() + throws Exception + { + + TestHelper.zetZestZome(); + File projectDir = new File( "ZestTest" ); + if( projectDir.exists() ) + { + removeDir( projectDir ); + } + Map<String, String> properties = new HashMap<>(); + properties.put( "zest.home", System.getProperty( "zest.home" ) ); + properties.put( "root.package", "org.apache.zest.test" ); + properties.put( "project.dir", "ZestTest" ); + properties.put( "project.name", "ZestTest" ); + properties.put( "template.dir", "etc/templates/restapp/files" ); + underTest.create( "ZestTest", projectDir, properties ); + + assertThat( projectDir.exists(), equalTo( true ) ); + assertThat( new File( projectDir, "app/build.gradle" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "app/src" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "app/src/main/resources" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "app/src/main/java/org/apache/zest/test/app/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "app/src/main/java/org/apache/zest/test/app/ZestTest.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "app/src/main/webapp/WEB-INF/web.xml" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "app/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/ConfigModule.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/ConfigurationLayer.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/ConnectivityLayer.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/RestModule.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/CrudModule.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/DomainLayer.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/OrderModule.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/SecurityModule.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/FileConfigurationModule.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/IndexingModule.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/InfrastructureLayer.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/SerializationModule.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/StorageModule.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/ZestTestApplicationAssembler.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main/resources" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/build.gradle" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/main" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "bootstrap/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/build.gradle" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src/main/resources" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/Customer.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/Order.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/OrderItem.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/HardcodedSecurityRepositoryMixin.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/SecurityRepository.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "model/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "rest/build.gradle" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "rest/src" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "rest/src/main/resources" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "rest/src/main/java/org/apache/zest/test/rest/security/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "rest/src/main/java/org/apache/zest/test/rest/security/SimpleEnroler.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "rest/src/main/java/org/apache/zest/test/rest/security/SimpleVerifier.java" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "rest/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "gradle/wrapper/gradle-wrapper.jar" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "gradle/wrapper/gradle-wrapper.properties" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "gradlew" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "gradlew.bat" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "build.gradle" ).exists(), equalTo( true ) ); + assertThat( new File( projectDir, "settings.gradle" ).exists(), equalTo( true ) ); + if( ! FileUtils.removeDir( projectDir ) ) + { + System.err.println( "Unable to remove file. Why???" ); + } + assertThat( projectDir.exists(), equalTo( false ) ); + } +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/772aa038/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestappProjectCreatorTest.java ---------------------------------------------------------------------- diff --git a/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestappProjectCreatorTest.java b/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestappProjectCreatorTest.java deleted file mode 100644 index 4bd63f0..0000000 --- a/tools/shell/src/test/java/org/apache/zest/tools/shell/create/project/RestappProjectCreatorTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - * - * - */ - -package org.apache.zest.tools.shell.create.project; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import org.apache.zest.tools.shell.FileUtils; -import org.apache.zest.tools.shell.TestHelper; -import org.junit.Test; - -import static org.apache.zest.tools.shell.FileUtils.removeDir; -import static org.hamcrest.core.IsEqual.equalTo; -import static org.junit.Assert.assertThat; - -public class RestAppProjectCreatorTest -{ - private RestAppProjectCreator underTest = new RestAppProjectCreator(); - - @Test - public void givenCorrectInputWhenCreatedProjectExpectCompleteProjectCreated() - throws Exception - { - - TestHelper.zetZestZome(); - File projectDir = new File( "ZestTest" ); - if( projectDir.exists() ) - { - removeDir( projectDir ); - } - Map<String, String> properties = new HashMap<>(); - properties.put( "zest.home", System.getProperty( "zest.home" ) ); - properties.put( "root.package", "org.apache.zest.test" ); - properties.put( "project.dir", "ZestTest" ); - properties.put( "project.name", "ZestTest" ); - properties.put( "template.dir", "etc/templates/restapp/files" ); - underTest.create( "ZestTest", projectDir, properties ); - - assertThat( projectDir.exists(), equalTo( true ) ); - assertThat( new File( projectDir, "app/build.gradle" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "app/src" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "app/src/main/resources" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "app/src/main/java/org/apache/zest/test/app/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "app/src/main/java/org/apache/zest/test/app/ZestTest.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "app/src/main/webapp/WEB-INF/web.xml" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "app/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/ConfigModule.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/config/ConfigurationLayer.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/ConnectivityLayer.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/RestModule.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/connectivity/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/CrudModule.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/DomainLayer.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/OrderModule.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/domain/SecurityModule.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/FileConfigurationModule.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/IndexingModule.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/InfrastructureLayer.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/SerializationModule.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/infrastructure/StorageModule.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/java/org/apache/zest/test/bootstrap/ZestTestApplicationAssembler.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main/resources" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/build.gradle" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/main" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "bootstrap/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/build.gradle" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src/main/resources" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/Customer.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/Order.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/OrderItem.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/orders/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/HardcodedSecurityRepositoryMixin.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/SecurityRepository.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src/main/java/org/apache/zest/test/model/security/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "model/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "rest/build.gradle" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "rest/src" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "rest/src/main/resources" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "rest/src/main/java/org/apache/zest/test/rest/security/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "rest/src/main/java/org/apache/zest/test/rest/security/SimpleEnroler.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "rest/src/main/java/org/apache/zest/test/rest/security/SimpleVerifier.java" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "rest/src/test/java/org/apache/zest/test/package.html" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "gradle/wrapper/gradle-wrapper.jar" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "gradle/wrapper/gradle-wrapper.properties" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "gradlew" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "gradlew.bat" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "build.gradle" ).exists(), equalTo( true ) ); - assertThat( new File( projectDir, "settings.gradle" ).exists(), equalTo( true ) ); - if( ! FileUtils.removeDir( projectDir ) ) - { - System.err.println( "Unable to remove file. Why???" ); - } - assertThat( projectDir.exists(), equalTo( false ) ); - } -}
