http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/build.gradle ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/build.gradle b/internals/testsupport-internal/build.gradle deleted file mode 100644 index a38d41c..0000000 --- a/internals/testsupport-internal/build.gradle +++ /dev/null @@ -1,32 +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. - */ - -apply plugin: 'polygene-internal' -apply plugin: 'polygene-internal-docker' - -description = "Apache Polygene⢠Internal Test Support" - -jar { manifest { name = "Apache Polygene⢠Internals - Test Support" } } - -dependencies { - api polygene.core.testsupport - - implementation libraries.docker_junit - - runtimeOnly polygene.core.runtime -}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/docker/cassandra/Dockerfile ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/docker/cassandra/Dockerfile b/internals/testsupport-internal/src/main/docker/cassandra/Dockerfile deleted file mode 100644 index 11d22b4..0000000 --- a/internals/testsupport-internal/src/main/docker/cassandra/Dockerfile +++ /dev/null @@ -1,16 +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. - -FROM @cassandra@ http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/docker/memcached/Dockerfile ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/docker/memcached/Dockerfile b/internals/testsupport-internal/src/main/docker/memcached/Dockerfile deleted file mode 100644 index 0b1a4b2..0000000 --- a/internals/testsupport-internal/src/main/docker/memcached/Dockerfile +++ /dev/null @@ -1,16 +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. - -FROM @memcached@ http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/docker/mysql/Dockerfile ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/docker/mysql/Dockerfile b/internals/testsupport-internal/src/main/docker/mysql/Dockerfile deleted file mode 100644 index 967d45d..0000000 --- a/internals/testsupport-internal/src/main/docker/mysql/Dockerfile +++ /dev/null @@ -1,16 +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. - -FROM @mariadb@ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/docker/postgres/Dockerfile ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/docker/postgres/Dockerfile b/internals/testsupport-internal/src/main/docker/postgres/Dockerfile deleted file mode 100644 index d3dad53..0000000 --- a/internals/testsupport-internal/src/main/docker/postgres/Dockerfile +++ /dev/null @@ -1,17 +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. - -FROM @postgres@ -COPY init-test-db.sh /docker-entrypoint-initdb.d/init-test-db.sh http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/docker/postgres/init-test-db.sh ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/docker/postgres/init-test-db.sh b/internals/testsupport-internal/src/main/docker/postgres/init-test-db.sh deleted file mode 100755 index 347d78d..0000000 --- a/internals/testsupport-internal/src/main/docker/postgres/init-test-db.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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. - -set -e - -# Create test user and database -psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL - CREATE USER jdbc_test_login; - CREATE DATABASE jdbc_test_db; - GRANT ALL PRIVILEGES ON DATABASE jdbc_test_db TO jdbc_test_login; -EOSQL - -# Enable ltree extension on test database -psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" -d jdbc_test_db <<-EOSQL - CREATE EXTENSION ltree; -EOSQL http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/docker/redis/Dockerfile ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/docker/redis/Dockerfile b/internals/testsupport-internal/src/main/docker/redis/Dockerfile deleted file mode 100644 index d0e67fc..0000000 --- a/internals/testsupport-internal/src/main/docker/redis/Dockerfile +++ /dev/null @@ -1,16 +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. - -FROM @redis@ http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/docker/riak/Dockerfile ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/docker/riak/Dockerfile b/internals/testsupport-internal/src/main/docker/riak/Dockerfile deleted file mode 100644 index 776d7af..0000000 --- a/internals/testsupport-internal/src/main/docker/riak/Dockerfile +++ /dev/null @@ -1,16 +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. - -FROM @riak@ http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/docker/s3server/Dockerfile ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/docker/s3server/Dockerfile b/internals/testsupport-internal/src/main/docker/s3server/Dockerfile deleted file mode 100644 index a4bff87..0000000 --- a/internals/testsupport-internal/src/main/docker/s3server/Dockerfile +++ /dev/null @@ -1,20 +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. - -FROM @s3server@ - -# See https://github.com/scality/S3/blob/master/DOCKER.md -ENV SCALITY_ACCESS_KEY_ID dummyIdentifier -ENV SCALITY_SECRET_ACCESS_KEY dummyCredential http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/DelayChecker.java ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/DelayChecker.java b/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/DelayChecker.java deleted file mode 100644 index 574381d..0000000 --- a/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/DelayChecker.java +++ /dev/null @@ -1,60 +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.polygene.test.internal; - -import pl.domzal.junit.docker.rule.wait.StartCondition; -import pl.domzal.junit.docker.rule.wait.StartConditionCheck; - -class DelayChecker - implements StartCondition -{ - - private final long millis; - private final long doneAt; - - DelayChecker( long millis ) - { - this.millis = millis; - this.doneAt = System.currentTimeMillis() + millis; - } - - @Override - public StartConditionCheck build( pl.domzal.junit.docker.rule.DockerRule currentRule ) - { - return new StartConditionCheck() - { - - @Override - public boolean check() - { - return System.currentTimeMillis() > doneAt; - } - - @Override - public String describe() - { - return String.format( "delay check %d ms", millis ); - } - - @Override - public void after() - { - } - }; - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/DockerRule.java ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/DockerRule.java b/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/DockerRule.java deleted file mode 100644 index 35b4f12..0000000 --- a/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/DockerRule.java +++ /dev/null @@ -1,156 +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.polygene.test.internal; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; -import pl.domzal.junit.docker.rule.DockerRuleBuilder; -import pl.domzal.junit.docker.rule.WaitFor; -import pl.domzal.junit.docker.rule.wait.LineListener; -import pl.domzal.junit.docker.rule.wait.StartCondition; -import pl.domzal.junit.docker.rule.wait.StartConditionCheck; - -import static java.util.stream.Collectors.joining; -import static org.junit.Assume.assumeFalse; - -public class DockerRule - implements TestRule -{ - private final boolean dockerDisabled = Boolean.valueOf( System.getProperty( "DOCKER_DISABLED", "false" ) ); - private final pl.domzal.junit.docker.rule.DockerRule dockerRule; - - public DockerRule( String image, int... portsToWaitFor ) - { - this( image, null, WaitFor.tcpPort( portsToWaitFor ) ); - } - - public DockerRule( String image, String... logMessageSequenceToWaitFor ) - { - this( image, null, WaitFor.logMessageSequence( logMessageSequenceToWaitFor ) ); - } - - public DockerRule( String image, Map<String, String> environment, String... logMessageSequnceToWaitFor ) - { - this( image, environment, WaitFor.logMessageSequence( logMessageSequnceToWaitFor ) ); - } - - public DockerRule( String image, Long delay, int... portsToWaitFor ) - { - this( image, null, new DelayChecker( delay ), WaitFor.tcpPort( portsToWaitFor ), new DelayChecker( delay ) ); - } - - public DockerRule( String image, Long delay, String... logMessageSequenceToWaitFor ) - { - this( image, null, WaitFor.logMessageSequence( logMessageSequenceToWaitFor ), new DelayChecker( delay ) ); - } - - public DockerRule( String image, Map<String, String> environment, Long delay, String... logMessageSequnceToWaitFor ) - { - this( image, environment, WaitFor.logMessageSequence( logMessageSequnceToWaitFor ), new DelayChecker( delay ) ); - } - - public DockerRule( String image, Map<String, String> environment, StartCondition... waitFor ) - { - if( environment == null ) - { - environment = Collections.emptyMap(); - } - if( dockerDisabled ) - { - dockerRule = null; - } - else - { - DockerRuleBuilder builder = pl.domzal.junit.docker.rule.DockerRule - .builder() - .imageName( "org.apache.polygene:org.apache.polygene.internal.docker-" + image ) - .publishAllPorts( true ) - .waitForTimeout( 60000 ) - .waitFor( rule -> new AndChecker( rule, waitFor ) ); - environment.forEach( builder::env ); - dockerRule = builder.build(); - } - } - - @Override - public Statement apply( Statement base, Description description ) - { - assumeFalse( dockerDisabled ); - return dockerRule.apply( base, description ); - } - - public String getDockerHost() - { - return dockerRule.getDockerHost(); - } - - public int getExposedContainerPort( String containerPort ) - { - return Integer.valueOf( dockerRule.getExposedContainerPort( containerPort ) ); - } - - public class AndChecker - implements StartConditionCheck, LineListener - { - private List<StartConditionCheck> allOf; - - public AndChecker( pl.domzal.junit.docker.rule.DockerRule rule, StartCondition... allOf ) - { - this.allOf = Arrays.stream( allOf ).map( cond -> cond.build( rule ) ).collect( Collectors.toList() ); - } - - @Override - public boolean check() - { - return allOf.stream() - .allMatch( StartConditionCheck::check ); - } - - @Override - public String describe() - { - return allOf.stream() - .map( StartConditionCheck::describe ) - .collect( joining( ",", "and(", ")" ) ); - } - - @Override - public void after() - { - allOf.forEach( StartConditionCheck::after ); - } - - @Override - public void nextLine( String line ) - { - allOf.forEach( listener -> - { - if( listener instanceof LineListener ) - { - ( (LineListener) listener ).nextLine( line ); - } - } ); - } - } -} http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/package.html ---------------------------------------------------------------------- diff --git a/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/package.html b/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/package.html deleted file mode 100644 index 6288f30..0000000 --- a/internals/testsupport-internal/src/main/java/org/apache/polygene/test/internal/package.html +++ /dev/null @@ -1,25 +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. - ~ - ~ - --> - -<html> -<body> -<h1>Polygene Internal TestSupport.</h1> -</body> -</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/settings.gradle ---------------------------------------------------------------------- diff --git a/settings.gradle b/settings.gradle index 3c44077..2e91a9f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -99,6 +99,4 @@ include 'core:api', 'samples:sql-support', 'samples:swing' -include 'internals:testsupport-internal' - include 'manual', 'reports', 'distributions', 'release' http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/tools/generator-polygene/app/index.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/index.js b/tools/generator-polygene/app/index.js index a0531cf..02429e3 100644 --- a/tools/generator-polygene/app/index.js +++ b/tools/generator-polygene/app/index.js @@ -28,7 +28,7 @@ var polygene = {}; module.exports = generators.Base.extend( { constructor: function () { - console.log("WARNING!!! This is BETA quality and likely to change drastically over time."); + console.log("WARNING!!! This is BETA quality and likely to change drastically over time. "); // + JSON.stringify(arguments)); generators.Base.apply(this, arguments); this.option('import-model', { http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl index 7aee6a8..3696a63 100644 --- a/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl +++ b/tools/generator-polygene/app/templates/ConfigurationLayer/ConfigModule/bootstrap.tmpl @@ -29,6 +29,8 @@ import org.apache.polygene.entitystore.memory.MemoryEntityStoreService; public class ConfigModule implements ModuleAssembler { + public static String NAME = "Configuration Module"; + @Override public ModuleAssembly assemble( LayerAssembly layer, ModuleAssembly module ) throws AssemblyException http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl b/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl index d83ae32..b691118 100644 --- a/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl +++ b/tools/generator-polygene/app/templates/ConfigurationLayer/bootstrap.tmpl @@ -28,7 +28,7 @@ import org.apache.polygene.bootstrap.layered.LayeredLayerAssembler; public class ConfigurationLayer extends LayeredLayerAssembler implements LayerAssembler { - public static String NAME; + public static String NAME = "Configuration Layer"; private ModuleAssembly configModule; @Override http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl index c6c5707..3a66952 100644 --- a/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl +++ b/tools/generator-polygene/app/templates/RestAPIApplication/Launcher.java.tmpl @@ -51,7 +51,7 @@ public class <%= polygene.name %>Launcher extends PolygeneRestApplicationLaunche DevelopmentKeyManagement.initializeKeyStore(); } <% } -%> return new <%= polygene.name %>ApplicationAssembler( name, version, mode ); +%> return new <%= polygene.name %>ApplicationAssembler( name, version, mode, none -> {} ); } protected String entryLayer() http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/tools/generator-polygene/app/templates/RestAPIApplication/app.js ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/app.js b/tools/generator-polygene/app/templates/RestAPIApplication/app.js index 142b090..c016bec 100644 --- a/tools/generator-polygene/app/templates/RestAPIApplication/app.js +++ b/tools/generator-polygene/app/templates/RestAPIApplication/app.js @@ -43,7 +43,7 @@ module.exports = { p.copyTemplate(p.ctx, 'RestAPIApplication/bootstrap-test.tmpl', - 'app/src/test/java/'+p.javaPackageDir+'/BootstrapTest.java'); + 'app/src/test/java/' + p.javaPackageDir + '/app/BootstrapTest.java'); p.copyTemplate(p.ctx, 'RestAPIApplication/bootstrap.tmpl', http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl index 19ccf9d..6643fd9 100644 --- a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl +++ b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap-test.tmpl @@ -17,14 +17,184 @@ * * -%> -package <%= polygene.packageName %>.bootstrap; +package <%= polygene.packageName %>.app; +import <%= polygene.packageName %>.bootstrap.<%= polygene.name %>ApplicationAssembler; + +import <%= polygene.packageName %>.bootstrap.config.ConfigModule; +import <%= polygene.packageName %>.bootstrap.config.ConfigurationLayer; +import org.apache.polygene.api.structure.Application; +import org.apache.polygene.bootstrap.ApplicationAssembly; +import org.apache.polygene.bootstrap.AssemblyException; +import org.apache.polygene.bootstrap.ModuleAssembly; +import org.apache.polygene.bootstrap.layered.LayeredApplicationAssembler; +import org.apache.polygene.entitystore..<%= polygene.entitystore.toLowerCase() %>.<%= polygene.entitystore %>EntityStoreConfiguration; +import org.apache.polygene.test.docker.DockerRule; +import org.junit.ClassRule; import org.junit.Test; public class BootstrapTest { @Test - public void applicationBootstrapSucceeds() { - // TODO Assemble, activate, passivate application to make sure it starts properly + public void applicationBootstrapSucceeds() + throws Exception + { + <%= polygene.name %>Launcher launcher = new <%= polygene.name %>Launcher() + { + @Override + protected LayeredApplicationAssembler createApplicationAssembler() + throws AssemblyException + { +<% if( polygene.hasFeature( 'security' ) { +%> DevelopmentKeyManagement.initializeKeyStore(); +<% } +%> return new <%= polygene.name %>ApplicationAssembler( "LaunchTest", "0", Application.Mode.development, BootstrapTest.this::setupTest ); + } + }; + launcher.initialize(); + System.out.println("Application Launched..."); + } + + private void setupTest( ApplicationAssembly assembly ) + { + entityStoreSetup( assembly ); + } +<% +if( polygene.entitystore === 'Cassandra' ) { +%> + private void entityStoreSetup( ApplicationAssembly assembly ) + { + ModuleAssembly config = assembly.layer( ConfigurationLayer.NAME ).module( ConfigModule.NAME ); + CassandraEntityStoreConfiguration defaults = config.forMixin( CassandraEntityStoreConfiguration.class ).declareDefaults(); + String host = DOCKER.getDockerHost(); + int port = DOCKER.getExposedContainerPort( "9042/tcp" ); + System.out.println("Cassandra: " + host + ":" + port); + defaults.hostnames().set( host + ':' + port ); + defaults.createIfMissing().set( true ); + } + + @ClassRule + public static final DockerRule DOCKER = new DockerRule( "cassandra", "Starting listening for CQL clients" ); +<% } +if( polygene.entitystore === 'DerbySQL' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'File' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'Geode' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'H2SQL' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'Hazelcast' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'JClouds' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'Jdbm' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'LevelDB' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'Memory' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'MongoDB' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'MySQL' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } + + @ClassRule + public static final DockerRule DOCKER = new DockerRule( + "mysql", + new HashMap<String, String>() + {{ + put( "MYSQL_ROOT_PASSWORD", "" ); + put( "MYSQL_ALLOW_EMPTY_PASSWORD", "yes" ); + put( "MYSQL_DATABASE", "jdbc_test_db" ); + put( "MYSQL_ROOT_HOST", "172.17.0.1" ); + }}, + 30000L +// , "mysqld: ready for connections" TODO: add this after next release of tdomzal/junit-docker-rule + ); +<% } +if( polygene.entitystore === 'PostgreSQL' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } + + @ClassRule + public static final DockerRule DOCKER = + new DockerRule( "postgres", 3000L, "PostgreSQL init process complete; ready for start up." ); +<% } +if( polygene.entitystore === 'Preferences' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } +<% } +if( polygene.entitystore === 'Redis' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } + + @ClassRule + public static final DockerRule DOCKER = new DockerRule( "redis", 6379 ); +<% } +if( polygene.entitystore === 'Riak' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { + } + + @ClassRule + public static final DockerRule DOCKER = new DockerRule( "riak","riak_auth_mods started on node"); +<% } +if( polygene.entitystore === 'SQLite' ) { +%> + private void entityStoreSetup(ApplicationAssembly assembly ) + { } +<% +} %> } http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0645fa49/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap.tmpl ---------------------------------------------------------------------- diff --git a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap.tmpl b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap.tmpl index f8e247a..3521cde 100644 --- a/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap.tmpl +++ b/tools/generator-polygene/app/templates/RestAPIApplication/bootstrap.tmpl @@ -19,6 +19,7 @@ -%> package <%= polygene.packageName %>.bootstrap; +import java.util.function.Consumer; import org.apache.polygene.api.structure.Application; import org.apache.polygene.bootstrap.AssemblyException; import org.apache.polygene.bootstrap.ApplicationAssembly; @@ -33,10 +34,13 @@ import <%= polygene.packageName %>.bootstrap.infrastructure.InfrastructureLayer; public class <%= polygene.name %>ApplicationAssembler extends LayeredApplicationAssembler { - public <%= polygene.name %>ApplicationAssembler( String name, String version, Application.Mode mode ) + private Consumer<ApplicationAssembly> customize; + + public <%= polygene.name %>ApplicationAssembler( String name, String version, Application.Mode mode, Consumer<ApplicationAssembly> customize ) throws AssemblyException { super( name, version, mode ); + this.customize = customize; } @Override @@ -52,5 +56,6 @@ public class <%= polygene.name %>ApplicationAssembler extends LayeredApplication connect.uses( infra ); domain.uses( infra ); infra.uses( config ); + customize.accept( assembly ); } }
