This is an automated email from the ASF dual-hosted git repository.
ilyak pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new 1cef0ec IGNITE-11380 Add support of JAR files to UriDeploymentSpi -
Fixes #6177.
1cef0ec is described below
commit 1cef0ec629bb038c2039656e27b08d123cc725ed
Author: Denis Mekhanikov <[email protected]>
AuthorDate: Tue Mar 26 12:18:58 2019 +0300
IGNITE-11380 Add support of JAR files to UriDeploymentSpi - Fixes #6177.
Signed-off-by: Ilya Kasnacheev <[email protected]>
---
modules/core/src/test/config/tests.properties | 5 +-
modules/extdata/uri/pom.xml | 118 +++++++++++++++++++++
.../uri/tasks/GridUriDeploymentDependency9.java | 58 ++++++++++
.../uri/tasks/GridUriDeploymentTestTask10.java | 44 ++++++++
.../uri/tasks/GridUriDeploymentTestTask11.java | 44 ++++++++
.../uri/tasks/GridUriDeploymentTestTask8.java | 44 ++++++++
.../uri/tasks/GridUriDeploymentTestTask9.java | 73 +++++++++++++
.../tasks/GridUriDeploymentTestWithNameTask10.java | 46 ++++++++
.../tasks/GridUriDeploymentTestWithNameTask11.java | 46 ++++++++
.../tasks/GridUriDeploymentTestWithNameTask8.java | 46 ++++++++
.../ignite/spi/deployment/uri/tasks/spring9.xml | 45 ++++++++
.../spi/deployment/uri/tasks/test9.properties | 22 ++++
.../uri/GridUriDeploymentClassLoader.java | 47 ++++++--
.../uri/GridUriDeploymentClassLoaderFactory.java | 8 +-
.../uri/GridUriDeploymentFileProcessor.java | 59 ++++++-----
.../uri/GridUriDeploymentFileProcessorResult.java | 8 +-
.../uri/GridUriDeploymentJarVerifier.java | 4 +-
.../uri/GridUriDeploymentSpringDocument.java | 2 +-
.../uri/GridUriDeploymentUnitDescriptor.java | 15 +--
.../spi/deployment/uri/UriDeploymentSpi.java | 72 +++++++------
.../scanners/file/UriDeploymentFileScanner.java | 54 +++++-----
...DeploymentClassLoaderMultiThreadedSelfTest.java | 2 +-
.../scanners/file/GridFileDeploymentSelfTest.java | 52 +++++++--
.../scanners/http/GridHttpDeploymentSelfTest.java | 35 +++++-
24 files changed, 819 insertions(+), 130 deletions(-)
diff --git a/modules/core/src/test/config/tests.properties
b/modules/core/src/test/config/tests.properties
index 89ea55e..a591237 100644
--- a/modules/core/src/test/config/tests.properties
+++ b/modules/core/src/test/config/tests.properties
@@ -64,13 +64,16 @@ ant.gar.tmpdir=${java.io.tmpdir}/gg
# The same as p2p.uri.cls but without protocol
ant.gar.srcdir=@{IGNITE_HOME}/modules/extdata/uri/target/classes/
+# Paths to use in URI deployment SPI tests
+urideployment.jar.uri=modules/extdata/uri/target/deploy/uri.jar
+urideployment.path.tmp=modules/extdata/uri/target/deploy_tmp/
+
# GAR paths to use in URI deployment SPI tests
ant.urideployment.gar.uri=file://freq=5000@localhost/EXTDATA/uri/target/deploy
ant.urideployment.gar.file=modules/extdata/uri/target/deploy/uri.gar
ant.urideployment.gar.libs-file=modules/extdata/uri/target/deploy2/uri-libs.gar
ant.urideployment.gar.classes-file=modules/extdata/uri/target/deploy2/uri-classes.gar
ant.urideployment.gar.path=modules/extdata/uri/target/deploy/
-ant.urideployment.gar.path.tmp=modules/extdata/uri/target/deploy_tmp/
# Classpath directory for GridP2PUserVersionChangeSelfTest
ant.userversion.class.dir=@{IGNITE_HOME}/modules/tests/java/
diff --git a/modules/extdata/uri/pom.xml b/modules/extdata/uri/pom.xml
index 9bda995..60a8c41 100644
--- a/modules/extdata/uri/pom.xml
+++ b/modules/extdata/uri/pom.xml
@@ -112,6 +112,98 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>jar-file</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <finalName>deployfile</finalName>
+
<outputDirectory>${basedir}/target/file</outputDirectory>
+ <includes>
+
<include>**/GridUriDeploymentTestTask8.class</include>
+
<include>**/GridUriDeploymentTestWithNameTask8.class</include>
+
<include>**/GridUriDeploymentTestTask9.class</include>
+
<include>**/GridUriDeploymentDependency9.class</include>
+ <include>**/test9.properties</include>
+ <include>**/spring9.xml</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>jar-uri</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <finalName>uri</finalName>
+
<outputDirectory>${basedir}/target/deploy</outputDirectory>
+ <includes>
+
<include>**/GridUriDeploymentTestTask8.class</include>
+
<include>**/GridUriDeploymentTestWithNameTask8.class</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>jar-well-signed</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <finalName>well-signed-deployfile</finalName>
+
<outputDirectory>${basedir}/target/file</outputDirectory>
+ <includes>
+
<include>**/GridUriDeploymentTestTask10.class</include>
+
<include>**/GridUriDeploymentTestWithNameTask10.class</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>jar-bad-signed</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <configuration>
+ <finalName>bad-signed-deployfile</finalName>
+
<outputDirectory>${basedir}/target/file</outputDirectory>
+ <includes>
+
<include>**/GridUriDeploymentTestTask11.class</include>
+
<include>**/GridUriDeploymentTestWithNameTask11.class</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jarsigner-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>sign-well</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ <configuration>
+
<archive>${basedir}/target/file/well-signed-deployfile.jar</archive>
+
<keystore>${basedir}/config/signeddeploy/keystore</keystore>
+ <alias>business</alias>
+ <storepass>abc123</storepass>
+ <keypass>abc123</keypass>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<dependencies>
@@ -129,6 +221,32 @@
</dependencies>
<executions>
<execution>
+ <id>jar-badly-signed</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>compile</phase>
+ <configuration>
+ <target>
+ <mkdir
dir="${basedir}/target/file_tmp/classes/org/apache/ignite/spi/deployment/uri/tasks/"
/>
+ <copy
file="${basedir}/target/classes/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask11.class"
todir="${basedir}/target/file_tmp/classes/org/apache/ignite/spi/deployment/uri/tasks/"
/>
+ <copy
file="${basedir}/target/classes/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask11.class"
tofile="${basedir}/target/file_tmp/classes/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask11.class"
/>
+
+ <jar
destfile="${basedir}/target/file/bad-signed-deployfile.jar"
basedir="${basedir}/target/file_tmp/classes" />
+
+ <signjar
jar="${basedir}/target/file/bad-signed-deployfile.jar"
keystore="${basedir}/config/signeddeploy/keystore" storepass="abc123"
keypass="abc123" alias="business" />
+
+ <sleep seconds="2" />
+
+ <touch
file="${basedir}/target/classes/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask11.class"
/>
+
+ <zip
destfile="${basedir}/target/file/bad-signed-deployfile.jar"
basedir="${basedir}/target/classes/"
includes="org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask11.class"
update="yes" />
+
+ <delete dir="${basedir}/target/file_tmp/"/>
+ </target>
+ </configuration>
+ </execution>
+ <execution>
<id>gar</id>
<goals>
<goal>run</goal>
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentDependency9.java
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentDependency9.java
new file mode 100644
index 0000000..5930ea9
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentDependency9.java
@@ -0,0 +1,58 @@
+/*
+ * 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.ignite.spi.deployment.uri.tasks;
+
+import org.apache.ignite.internal.util.typedef.internal.U;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+/**
+ * This class is used by {@link GridUriDeploymentTestTask9} which is loaded
from a JAR file.
+ * It's loaded along with {@code test9.properties} file from the same JAR.
+ */
+public class GridUriDeploymentDependency9 {
+ /** */
+ public static final String RESOURCE =
"org/apache/ignite/spi/deployment/uri/tasks/test9.properties";
+
+ /**
+ * @return Value of the property {@code test9.txt} loaded from the {@code
test9.properties} file.
+ */
+ public String getMessage() {
+ InputStream in = null;
+
+ try {
+ in = getClass().getClassLoader().getResourceAsStream(RESOURCE);
+
+ Properties props = new Properties();
+
+ props.load(in);
+
+ return props.getProperty("test9.txt");
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ finally{
+ U.close(in, null);
+ }
+
+ return null;
+ }
+}
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask10.java
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask10.java
new file mode 100644
index 0000000..7564c0f
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask10.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ignite.spi.deployment.uri.tasks;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Simple URI deployment test task.
+ */
+public class GridUriDeploymentTestTask10 extends
ComputeTaskSplitAdapter<Object, Object> {
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Collection<? extends ComputeJob> split(int gridSize,
Object arg) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Object reduce(List<ComputeJobResult> results) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask11.java
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask11.java
new file mode 100644
index 0000000..4c5d0a6
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask11.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ignite.spi.deployment.uri.tasks;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Simple URI deployment test task.
+ */
+public class GridUriDeploymentTestTask11 extends
ComputeTaskSplitAdapter<Object, Object> {
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Collection<? extends ComputeJob> split(int gridSize,
Object arg) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Object reduce(List<ComputeJobResult> results) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask8.java
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask8.java
new file mode 100644
index 0000000..b449a33
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask8.java
@@ -0,0 +1,44 @@
+/*
+ * 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.ignite.spi.deployment.uri.tasks;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Simple URI deployment test task.
+ */
+public class GridUriDeploymentTestTask8 extends
ComputeTaskSplitAdapter<Object, Object> {
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Collection<? extends ComputeJob> split(int gridSize,
Object arg) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Object reduce(List<ComputeJobResult> results) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask9.java
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask9.java
new file mode 100644
index 0000000..d82f019
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestTask9.java
@@ -0,0 +1,73 @@
+/*
+ * 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.ignite.spi.deployment.uri.tasks;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.core.io.ClassPathResource;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * URI deployment test task which loads Spring bean definitions from
spring9.xml configuration file.
+ */
+public class GridUriDeploymentTestTask9 extends
ComputeTaskSplitAdapter<Object, Object> {
+ /** */
+ private static final long serialVersionUID = 172455091783232848L;
+
+ /** */
+ public GridUriDeploymentTestTask9() {
+ XmlBeanFactory factory = new XmlBeanFactory(
+ new
ClassPathResource("org/apache/ignite/spi/deployment/uri/tasks/spring9.xml",
+ getClass().getClassLoader()));
+
+ factory.setBeanClassLoader(getClass().getClassLoader());
+
+ Map map = (Map)factory.getBean("task.cfg");
+
+ System.out.println("Loaded data from spring9.xml [map=" + map + ']');
+
+ assert map != null;
+
+ GridUriDeploymentDependency9 depend = new
GridUriDeploymentDependency9();
+
+ System.out.println("GridUriDeploymentTestTask9 dependency resolved
[msg=" + depend.getMessage() + ']');
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Collection<? extends ComputeJob> split(int gridSize,
Object arg) {
+ System.out.println("Split is called: " + this);
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Object reduce(List<ComputeJobResult> results) {
+ System.out.println("Reduce is called.");
+
+ return null;
+ }
+}
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask10.java
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask10.java
new file mode 100644
index 0000000..9322f96
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask10.java
@@ -0,0 +1,46 @@
+/*
+ * 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.ignite.spi.deployment.uri.tasks;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskName;
+import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * URI deployment test task with name.
+ */
+@ComputeTaskName("GridUriDeploymentTestWithNameTask10")
+public class GridUriDeploymentTestWithNameTask10 extends
ComputeTaskSplitAdapter<Object, Object> {
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Collection<? extends ComputeJob> split(int gridSize,
Object arg) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Object reduce(List<ComputeJobResult> results) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask11.java
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask11.java
new file mode 100644
index 0000000..eb4d700
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask11.java
@@ -0,0 +1,46 @@
+/*
+ * 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.ignite.spi.deployment.uri.tasks;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskName;
+import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * URI deployment test task with name.
+ */
+@ComputeTaskName("GridUriDeploymentTestWithNameTask11")
+public class GridUriDeploymentTestWithNameTask11 extends
ComputeTaskSplitAdapter<Object, Object> {
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Collection<? extends ComputeJob> split(int gridSize,
Object arg) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Object reduce(List<ComputeJobResult> results) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask8.java
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask8.java
new file mode 100644
index 0000000..f457da4
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/GridUriDeploymentTestWithNameTask8.java
@@ -0,0 +1,46 @@
+/*
+ * 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.ignite.spi.deployment.uri.tasks;
+
+import org.apache.ignite.compute.ComputeJob;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.compute.ComputeTaskName;
+import org.apache.ignite.compute.ComputeTaskSplitAdapter;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * URI deployment test task with name.
+ */
+@ComputeTaskName("GridUriDeploymentTestWithNameTask8")
+public class GridUriDeploymentTestWithNameTask8 extends
ComputeTaskSplitAdapter<Object, Object> {
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Collection<? extends ComputeJob> split(int gridSize,
Object arg) {
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override public Object reduce(List<ComputeJobResult> results) {
+ return null;
+ }
+}
\ No newline at end of file
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/spring9.xml
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/spring9.xml
new file mode 100644
index 0000000..32eff11
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/spring9.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ 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.
+-->
+
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
+
+<!--
+ Spring configuration file for test classes in JAR-file.
+-->
+<beans>
+ <description>Spring configuration file for test
GridUriDeploymentTestTask9.</description>
+
+ <bean id="task.cfg" class="java.util.HashMap">
+ <constructor-arg>
+ <!--
+ Note: all keys hardcoded in test.
+ -->
+ <map>
+ <entry>
+ <key><value>testKey1</value></key>
+ <value>testValue1</value>
+ </entry>
+ <entry>
+ <key><value>testKey2</value></key>
+ <value>testValue2</value>
+ </entry>
+ </map>
+ </constructor-arg>
+ </bean>
+</beans>
diff --git
a/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/test9.properties
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/test9.properties
new file mode 100644
index 0000000..d2cb798
--- /dev/null
+++
b/modules/extdata/uri/src/main/java/org/apache/ignite/spi/deployment/uri/tasks/test9.properties
@@ -0,0 +1,22 @@
+#
+# 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.
+#
+
+#
+# Tests properties loaded by Uri class loader.
+#
+
+test9.txt = Test Message 9
diff --git
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoader.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoader.java
index bb7416c..bd46237 100644
---
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoader.java
+++
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoader.java
@@ -26,9 +26,9 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
/**
- * Loads classes and resources from "unpacked" GAR file (GAR directory).
+ * Loads classes and resources from "unpacked" deployment archives.
* <p>
- * Class loader scans GAR directory first and then if
+ * Class loader scans package directory first and then if
* class/resource was not found scans all JAR files.
*/
class GridUriDeploymentClassLoader extends URLClassLoader {
@@ -50,7 +50,7 @@ class GridUriDeploymentClassLoader extends URLClassLoader {
if (cls == null) {
try {
try {
- // Search classes in GAR file.
+ // Search classes in a deployment unit.
// NOTE: findClass(String) is not overridden since it is
always called after
// findLoadedClass(String) in exclusive synchronization
block.
cls = findClass(name);
@@ -75,19 +75,19 @@ class GridUriDeploymentClassLoader extends URLClassLoader {
}
/**
- * Load class from GAR file.
+ * Load class from a deployment unit.
*
* @param name Class name.
* @return Loaded class.
* @throws ClassNotFoundException If no class found.
*/
- public synchronized Class<?> loadClassGarOnly(String name) throws
ClassNotFoundException {
+ public synchronized Class<?> loadClassIsolated(String name) throws
ClassNotFoundException {
// First, check if the class has already been loaded.
Class<?> cls = findLoadedClass(name);
if (cls == null) {
try {
- // Search classes in GAR file.
+ // Search classes in deployment unit.
// NOTE: findClass(String) is not overridden since it is
always called after
// findLoadedClass(String) in exclusive synchronization block.
cls = findClass(name);
@@ -105,6 +105,19 @@ class GridUriDeploymentClassLoader extends URLClassLoader {
return cls;
}
+ /**
+ * Load class from GAR file.
+ *
+ * @param name Class name.
+ * @return Loaded class.
+ * @throws ClassNotFoundException If no class found.
+ * @deprecated Use {@link
GridUriDeploymentClassLoader#loadClassIsolated(String)} instead.
+ */
+ @Deprecated
+ public synchronized Class<?> loadClassGarOnly(String name) throws
ClassNotFoundException {
+ return loadClassIsolated(name);
+ }
+
/** {@inheritDoc} */
@Override public URL getResource(String name) {
URL url = findResource(name);
@@ -120,8 +133,8 @@ class GridUriDeploymentClassLoader extends URLClassLoader {
/** {@inheritDoc} */
@Override public InputStream getResourceAsStream(String name) {
- // Find resource in GAR file first.
- InputStream in = getResourceAsStreamGarOnly(name);
+ // Find resource in a deployment unit first.
+ InputStream in = getResourceAsStreamIsolated(name);
// Find resource in parent class loader.
if (in == null)
@@ -134,13 +147,13 @@ class GridUriDeploymentClassLoader extends URLClassLoader
{
}
/**
- * Returns an input stream for reading the specified resource from GAR
file only.
+ * Returns an input stream for reading the specified resource from a
deployment unit only.
*
* @param name Resource name.
* @return An input stream for reading the resource, or {@code null}
* if the resource could not be found.
*/
- @Nullable public InputStream getResourceAsStreamGarOnly(String name) {
+ @Nullable public InputStream getResourceAsStreamIsolated(String name) {
URL url = findResource(name);
try {
@@ -151,6 +164,20 @@ class GridUriDeploymentClassLoader extends URLClassLoader {
}
}
+ /**
+ * Returns an input stream for reading the specified resource from GAR
file only.
+ *
+ * @param name Resource name.
+ * @return An input stream for reading the resource, or {@code null}
+ * if the resource could not be found.
+ *
+ * @deprecated Use {@link
GridUriDeploymentClassLoader#getResourceAsStreamIsolated(String)} instead.
+ */
+ @Deprecated
+ @Nullable public InputStream getResourceAsStreamGarOnly(String name) {
+ return getResourceAsStreamIsolated(name);
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridUriDeploymentClassLoader.class, this, "urls",
Arrays.toString(getURLs()));
diff --git
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderFactory.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderFactory.java
index 08e6459..f1b8705 100644
---
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderFactory.java
+++
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderFactory.java
@@ -28,9 +28,9 @@ import org.apache.ignite.spi.IgniteSpiException;
/**
* Factory class to create class loader that loads classes and resources from
- * the GAR file or "unpacked" GAR file (GAR directory).
+ * the deployment archive or "unpacked" deployment archive (package directory).
* <p>
- * Class loader scans GAR file or GAR directory first and than if
+ * Class loader scans deployment archive or directory first and than if
* class/resource was not found scans all JAR files.
* It is assumed that all libraries are in the {@link #DFLT_LIBS_DIR_PATH}
* directory.
@@ -41,7 +41,7 @@ class GridUriDeploymentClassLoaderFactory {
/**
* @param parent Parent class loader.
- * @param file GAR file or directory with unpacked GAR file.
+ * @param file Deployment archive or directory with an unpacked deployment
archive.
* @param log Logger.
* @return Class Loader.
* @throws org.apache.ignite.spi.IgniteSpiException In case of any error.
@@ -82,7 +82,7 @@ class GridUriDeploymentClassLoaderFactory {
return new GridUriDeploymentClassLoader(urls.toArray(new
URL[urls.size()]), parent);
}
catch (MalformedURLException e) {
- throw new IgniteSpiException("Failed to create class loader for
GAR file: " + file, e);
+ throw new IgniteSpiException("Failed to create class loader for a
package: " + file, e);
}
}
diff --git
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessor.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessor.java
index 238b710..a564503 100644
---
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessor.java
+++
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessor.java
@@ -58,53 +58,54 @@ final class GridUriDeploymentFileProcessor {
}
/**
- * Method processes given GAR file and extracts all tasks from it which are
- * either mentioned in GAR descriptor or implements interface {@link
org.apache.ignite.compute.ComputeTask}
+ * Method processes given package and extracts all tasks from it which are
+ * either mentioned in a task descriptor or implement interface {@link
org.apache.ignite.compute.ComputeTask}
* if there is no descriptor in file.
*
- * @param file GAR file with tasks.
- * @param uri GAR file deployment URI.
- * @param deployDir deployment directory with downloaded GAR files.
+ * @param file Package file with tasks.
+ * @param uri URI of the package.
+ * @param deployDir deployment directory with downloaded files.
* @param log Logger.
* @throws org.apache.ignite.spi.IgniteSpiException Thrown if file could
not be read.
* @return List of tasks from given file.
*/
@Nullable static GridUriDeploymentFileProcessorResult processFile(File
file, String uri, File deployDir,
IgniteLogger log) throws IgniteSpiException {
- File gar = file;
+ File pkg = file;
if (!checkIntegrity(file, log)) {
- U.error(log, "Tasks in GAR not loaded in configuration (invalid
file signature) [uri=" +
+ U.error(log, "Failed to load tasks from a package (invalid file
signature) [uri=" +
U.hidePassword(uri) + ']');
return null;
}
if (!file.isDirectory()) {
- gar = new File(deployDir, "dirzip_" + file.getName());
+ pkg = new File(deployDir, "dirzip_" + file.getName());
- gar.mkdirs();
+ pkg.mkdirs();
try {
- U.unzip(file, gar, log);
+ U.unzip(file, pkg, log);
}
catch (IOException e) {
- throw new IgniteSpiException("IO error when unzipping GAR
file: " + file.getAbsolutePath(), e);
+ throw new IgniteSpiException("IO error when unzipping a
package: "
+ + file.getAbsolutePath(), e);
}
}
GridUriDeploymentFileProcessorResult res = null;
- if (gar.isDirectory()) {
+ if (pkg.isDirectory()) {
try {
- File xml = new File(gar, XML_DESCRIPTOR_PATH);
+ File xml = new File(pkg, XML_DESCRIPTOR_PATH);
if (!xml.exists() || xml.isDirectory()) {
U.warn(log,
"Processing deployment without descriptor file (it
will cause full classpath scan) [path="
- + XML_DESCRIPTOR_PATH + ", gar=" +
gar.getAbsolutePath() + ']');
+ + XML_DESCRIPTOR_PATH + ", package=" +
pkg.getAbsolutePath() + ']');
- res = processNoDescriptorFile(gar, uri, log);
+ res = processNoDescriptorFile(pkg, uri, log);
}
else {
InputStream in = null;
@@ -117,7 +118,7 @@ final class GridUriDeploymentFileProcessor {
assert doc != null;
- res = processWithDescriptorFile(doc, gar, uri, log);
+ res = processWithDescriptorFile(doc, pkg, uri, log);
}
finally {
U.close(in, log);
@@ -125,12 +126,13 @@ final class GridUriDeploymentFileProcessor {
}
}
catch (IOException e) {
- throw new IgniteSpiException("IO error when parsing GAR
directory: " + gar.getAbsolutePath(), e);
+ throw new IgniteSpiException("IO error when parsing a package:
"
+ + pkg.getAbsolutePath(), e);
}
}
if (res != null)
- res.setMd5(md5(gar, log));
+ res.setMd5(md5(pkg, log));
return res;
}
@@ -321,12 +323,11 @@ final class GridUriDeploymentFileProcessor {
}
/**
- * Processes given GAR file and returns back all tasks which are in
- * descriptor.
+ * Processes given package and returns back all tasks which are in its
descriptor.
*
- * @param doc GAR file descriptor.
- * @param file GAR file.
- * @param uri GAR file deployment URI.
+ * @param doc Package descriptor.
+ * @param file Package file.
+ * @param uri URI of the package file.
* @param log Logger.
* @throws org.apache.ignite.spi.IgniteSpiException Thrown if it's
impossible to open file.
* @return List of tasks from descriptor.
@@ -371,11 +372,11 @@ final class GridUriDeploymentFileProcessor {
}
/**
- * Processes GAR files which have no descriptor. It scans every class and
+ * Processes packages which have no descriptor. It scans every class and
* checks if it is a valid task or not. All valid tasks are returned back.
*
- * @param file GAR file or directory.
- * @param uri GAR file deployment URI.
+ * @param file Package file or directory.
+ * @param uri URI of the package file.
* @param log Logger.
* @throws org.apache.ignite.spi.IgniteSpiException Thrown if file reading
error happened.
* @return List of tasks from given file.
@@ -436,10 +437,10 @@ final class GridUriDeploymentFileProcessor {
}
/**
- * Make integrity check for GAR file.
- * Method returns {@code false} if GAR file has incorrect signature.
+ * Make integrity check for a package.
+ * Method returns {@code false} if the package has incorrect signature.
*
- * @param file GAR file which should be verified.
+ * @param file package which should be verified.
* @param log Logger.
* @return {@code true} if given file is a directory of verification
* completed successfully otherwise returns {@code false}.
diff --git
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorResult.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorResult.java
index cd44a61..0bb65d7 100644
---
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorResult.java
+++
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentFileProcessorResult.java
@@ -75,18 +75,18 @@ class GridUriDeploymentFileProcessorResult {
}
/**
- * Gets GAR file.
+ * Gets package file.
*
- * @return GAR file.
+ * @return Package file.
*/
public File getFile() {
return file;
}
/**
- * Sets GAR file.
+ * Sets package file.
*
- * @param file GAR file.
+ * @param file Package file.
*/
public void setFile(File file) {
this.file = file;
diff --git
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java
index fd77071..242b3f9 100644
---
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java
+++
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentJarVerifier.java
@@ -159,7 +159,7 @@ final class GridUriDeploymentJarVerifier {
Manifest manifest = jin.getManifest();
- // Manifest must be included in signed GAR file.
+ // Manifest must be included into a signed package.
if (manifest == null)
return pubKey == null;
@@ -218,7 +218,7 @@ final class GridUriDeploymentJarVerifier {
Manifest manifest = jarFile.getManifest();
- // Manifest must be included in signed GAR file.
+ // Manifest must be included into a signed package.
if (manifest == null)
return pubKey == null;
diff --git
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentSpringDocument.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentSpringDocument.java
index fd1f652..6066c9a 100644
---
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentSpringDocument.java
+++
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentSpringDocument.java
@@ -34,7 +34,7 @@ class GridUriDeploymentSpringDocument {
/** Initialized springs beans factory. */
private final XmlBeanFactory factory;
- /** List of tasks from GAR description. */
+ /** List of tasks from package description. */
private List<Class<? extends ComputeTask<?, ?>>> tasks;
/**
diff --git
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentUnitDescriptor.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentUnitDescriptor.java
index 6a29ab2..915f2a9 100644
---
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentUnitDescriptor.java
+++
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentUnitDescriptor.java
@@ -89,9 +89,9 @@ class GridUriDeploymentUnitDescriptor {
private final String md5;
/**
- * Constructs descriptor for GAR file.
+ * Constructs descriptor for a deployment unit.
*
- * @param uri GAR file URI.
+ * @param uri URI of the deployment unit.
* @param file File itself.
* @param tstamp Tasks deployment timestamp.
* @param clsLdr Class loader.
@@ -112,7 +112,8 @@ class GridUriDeploymentUnitDescriptor {
}
/**
- * Constructs deployment unit descriptor based on timestamp and {@link
org.apache.ignite.compute.ComputeTask} instances.
+ * Constructs a deployment unit descriptor based on timestamp and {@link
org.apache.ignite.compute.ComputeTask}
+ * instances.
*
* @param tstamp Tasks deployment timestamp.
* @param clsLdr Class loader.
@@ -142,17 +143,17 @@ class GridUriDeploymentUnitDescriptor {
/**
* Gets file URL.
*
- * @return {@code null} if tasks were deployed directly and reference to
the GAR file URI if tasks were deployed
- * from the file.
+ * @return {@code null} if tasks were deployed directly and reference to
the package file URI if tasks
+ * were deployed from the file.
*/
public String getUri() {
return uri;
}
/**
- * Tasks GAR file.
+ * Tasks' package file.
*
- * @return {@code null} if tasks were deployed directly and GAR file if
tasks were deployed from it.
+ * @return {@code null} if tasks were deployed directly and package file
if tasks were deployed from it.
*/
public File getFile() {
return file;
diff --git
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
index 9fcff9a..55f75d3 100644
---
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
+++
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/UriDeploymentSpi.java
@@ -88,16 +88,16 @@ import org.jetbrains.annotations.Nullable;
* <p>
* There are several deployable unit types supported:
* <ul>
+ * <li>JAR file.</li>
* <li>GAR file.</li>
- * <li>Local disk folder with structure of unpacked GAR file.</li>
+ * <li>Local disk folder with structure of an unpacked deployment archive.</li>
* <li>Local disk folder containing only compiled Java classes.</li>
* </ul>
- * <h1 class="header">GAR file</h1>
- * GAR file is a deployable unit. GAR file is based on <a
href="http://www.gzip.org/zlib/">ZLIB</a>
- * compression format like simple JAR file and its structure is similar to WAR
archive.
- * GAR file has {@code '.gar'} extension.
+ * <h1 class="header">Deployment package</h1>
+ * Deployment package can be represented as a regular JAR file with a specific
structure similar to WAR format.
+ * Package files can have {@code '.jar'} or {@code '.gar'} extension.
* <p>
- * GAR file structure (file or directory ending with {@code '.gar'}):
+ * Package structure:
* <pre class="snippet">
* META-INF/
* |
@@ -121,15 +121,15 @@ import org.jetbrains.annotations.Nullable;
* <li>
* {@code lib/} entry contains all library dependencies.
* </li>
- * <li>Compiled Java classes must be placed in the root of a GAR file.</li>
+ * <li>Compiled Java classes must be placed in the root of a package file.</li>
* </ul>
- * GAR file may be deployed without descriptor file. If there is no descriptor
file, SPI
+ * A package may be deployed without a descriptor file. If there is no
descriptor file, SPI
* will scan all classes in archive and instantiate those that implement
* {@link org.apache.ignite.compute.ComputeTask} interface. In that case, all
grid task classes must have a
* public no-argument constructor. Use {@link
org.apache.ignite.compute.ComputeTaskAdapter} adapter for
* convenience when creating grid tasks.
* <p>
- * By default, all downloaded GAR files that have digital signature in {@code
META-INF}
+ * By default, all downloaded packages that have digital signature in {@code
META-INF}
* folder will be verified and deployed only if signature is valid.
* <p>
* <h1 class="header">URI</h1>
@@ -149,7 +149,7 @@ import org.jetbrains.annotations.Nullable;
* set to {@code true}.
* <p>
* <h1 class="header">Code Example</h1>
- * The following example demonstrates how the deployment SPI can be used. It
expects that you have a GAR file
+ * The following example demonstrates how the deployment SPI can be used. It
expects that you have a package file
* in 'home/username/ignite/work/my_deployment/file' folder which contains
'myproject.HelloWorldTask' class.
* <pre name="code" class="java">
* IgniteConfiguration cfg = new IgniteConfiguration();
@@ -175,7 +175,7 @@ import org.jetbrains.annotations.Nullable;
* by implementing {@link UriDeploymentScanner} interface.
* </li>
* <li>
- * Temporary directory path where scanned GAR files and directories are
+ * Temporary directory path where scanned packages are
* copied to (see {@link #setTemporaryDirectoryPath(String)
setTemporaryDirectoryPath(String)}).
* </li>
* <li>
@@ -206,7 +206,7 @@ import org.jetbrains.annotations.Nullable;
* <p>
* <h1 class="header">File</h1>
* For this protocol SPI will scan folder specified by URI on file system and
- * download any GAR files or directories that end with .gar from source
+ * download any deplloyment files or directories that end with .jar or .gar
from source
* directory defined in URI. For file system URI must have scheme equal to
{@code file}.
* <p>
* Following parameters are supported:
@@ -235,9 +235,9 @@ import org.jetbrains.annotations.Nullable;
* <a name="classes"></a>
* <h2 class="header">HTTP/HTTPS</h2>
* URI deployment scanner tries to read DOM of the html it points to and
parses out href attributes of all <a> tags
- * - this becomes the collection of URLs to GAR files that should be deployed.
It's important that HTTP scanner
- * uses {@code URLConnection.getLastModified()} method to check if there were
any changes since last iteration
- * for each GAR-file before redeploying.
+ * - this becomes the collection of URLs to deployment package files that
should be deployed. It's important that
+ * HTTP scanner uses {@code URLConnection.getLastModified()} method to check
if there were any changes since last
+ * iteration for each deployment file before redeploying.
* <p>
* Following parameters are supported:
* <table class="doctable">
@@ -256,8 +256,8 @@ import org.jetbrains.annotations.Nullable;
* </table>
* <h2 class="header">HTTP URI Example</h2>
* The following example will download the page
`www.mysite.com/ignite/deployment`, parse it and download and deploy
- * all GAR files specified by href attributes of <a> elements on the
page using authentication
- * {@code 'username:password'} every '10000' milliseconds (only new/updated
GAR-s).
+ * all deployment packages specified by href attributes of <a> elements
on the page using authentication
+ * {@code 'username:password'} every '10000' milliseconds (only new/updated
packages).
* <blockquote class="snippet">
* {@code
http://username:password;[email protected]:110/ignite/deployment}
* </blockquote>
@@ -312,7 +312,7 @@ import org.jetbrains.annotations.Nullable;
@SuppressWarnings({"FieldAccessedSynchronizedAndUnsynchronized"})
public class UriDeploymentSpi extends IgniteSpiAdapter implements
DeploymentSpi {
/**
- * Default deployment directory where SPI will pick up GAR files. Note
that this path is relative to
+ * Default deployment directory where SPI will pick up packages. Note that
this path is relative to
* {@code IGNITE_HOME/work} folder if {@code IGNITE_HOME} system or
environment variable specified,
* otherwise it is relative to {@code work} folder under system {@code
java.io.tmpdir} folder.
*
@@ -395,7 +395,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
}
/**
- * Sets list of URI which point to GAR file and which should be
+ * Sets list of URI which point to a directory with packages and which
should be
* scanned by SPI for the new tasks.
* <p>
* If not provided, default value is list with
@@ -403,7 +403,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
* Note that system property {@code IGNITE_HOME} must be set.
* For unknown {@code IGNITE_HOME} list of URI must be provided explicitly.
*
- * @param uriList GAR file URIs.
+ * @param uriList Package file URIs.
* @return {@code this} for chaining.
*/
@IgniteSpiConfiguration(optional = true)
@@ -555,7 +555,9 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
@Override public boolean accept(File dir, String name) {
assert name != null;
- return name.toLowerCase().endsWith(".gar");
+ String nameLowerCase = name.toLowerCase();
+
+ return nameLowerCase.endsWith(".gar") ||
nameLowerCase.endsWith(".jar");
}
};
@@ -564,7 +566,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
GridUriDeploymentScannerListener lsnr = new
GridUriDeploymentScannerListener() {
@Override public void onNewOrUpdatedFile(File file, String uri,
long tstamp) {
if (log.isInfoEnabled())
- log.info("Found new or updated GAR units [uri=" +
U.hidePassword(uri) +
+ log.info("Found new or updated deployment unit [uri=" +
U.hidePassword(uri) +
", file=" + file.getAbsolutePath() + ", tstamp=" +
tstamp + ']');
if (delayOnNewOrUpdatedFile) {
@@ -607,7 +609,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
}
if (log.isInfoEnabled())
- log.info("Found deleted GAR units [uris=" + uriList +
']');
+ log.info("Found deleted deployment units [uris=" +
uriList + ']');
}
processDeletedFiles(uris);
@@ -736,7 +738,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
ClassLoader ldr = unitDesc.getClassLoader();
Class<?> cls = ldr instanceof GridUriDeploymentClassLoader
?
-
((GridUriDeploymentClassLoader)ldr).loadClassGarOnly(clsName) :
+
((GridUriDeploymentClassLoader)ldr).loadClassIsolated(clsName) :
ldr.loadClass(clsName);
assert cls != null;
@@ -989,7 +991,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
try {
in = ldr instanceof GridUriDeploymentClassLoader ?
-
((GridUriDeploymentClassLoader)ldr).getResourceAsStreamGarOnly(rsrc) :
+
((GridUriDeploymentClassLoader)ldr).getResourceAsStreamIsolated(rsrc) :
ldr.getResourceAsStream(rsrc);
return in != null;
@@ -1125,7 +1127,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
addResources(newDesc.getClassLoader(), newDesc,
clss.toArray(new Class<?>[clss.size()]));
}
catch (IgniteSpiException e) {
- U.warn(log, "Failed to register GAR class loader [newDesc=" +
newDesc +
+ U.warn(log, "Failed to register a class loader for a package
[newDesc=" + newDesc +
", msg=" + e.getMessage() + ']');
}
}
@@ -1150,9 +1152,9 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
GridUriDeploymentUnitDescriptor desc = iter.next();
assert !newDesc.getClassLoader().equals(desc.getClassLoader())
:
- "URI scanners always create new class loader for every GAR
file: " + newDesc;
+ "URI scanners always create new class loader for every
package: " + newDesc;
- // Only for GAR files. Undeploy all for overwritten GAR files.
+ // Only for deployment archives. Undeploy all for overwritten
packages.
if (desc.getType() ==
GridUriDeploymentUnitDescriptor.Type.FILE &&
newDesc.getUri().equals(desc.getUri()) &&
!newDesc.getFile().equals(desc.getFile())) {
// Remove descriptor.
@@ -1239,7 +1241,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
String rsrcName = entry.getKey();
if (rsrcsByAlias.containsKey(rsrcName)) {
- U.warn(log, "Found collision with task name in different GAR
files. " +
+ U.warn(log, "Found collision with task name in a different
package. " +
"Class loader will be removed [taskName=" + rsrcName + ",
cls1=" + rsrcsByAlias.get(rsrcName) +
", cls2=" + entry.getValue() + ", newDesc=" + newDesc + ",
existDesc=" + existDesc + ']');
@@ -1250,7 +1252,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
for (Class<?> rsrcCls : existDesc.getResources()) {
if (!ComputeTask.class.isAssignableFrom(rsrcCls) &&
isResourceExist(newDesc.getClassLoader(), rsrcCls.getName())) {
- U.warn(log, "Found collision with task class in different GAR
files. " +
+ U.warn(log, "Found collision with task class in different
deployment packages. " +
"Class loader will be removed [taskCls=" + rsrcCls +
", removedDesc=" + newDesc + ", existDesc=" + existDesc +
']');
@@ -1264,11 +1266,11 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
/**
* Deploys or redeploys given tasks.
*
- * @param uri GAR file deployment URI.
- * @param file GAR file.
+ * @param uri Package file URI.
+ * @param file Package file.
* @param tstamp File modification date.
* @param ldr Class loader.
- * @param clss List of tasks which were found in GAR file.
+ * @param clss List of tasks which were found in the package.
* @param md5 md5 of the new unit.
*/
private void newUnitReceived(String uri, File file, long tstamp,
ClassLoader ldr,
@@ -1287,7 +1289,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
}
/**
- * Removes all tasks that belong to GAR files which are on list
+ * Removes all tasks that belong to package files which are on list
* of removed files.
*
* @param uris List of removed files.
@@ -1368,7 +1370,7 @@ public class UriDeploymentSpi extends IgniteSpiAdapter
implements DeploymentSpi
}
/** {@inheritDoc} */
- public IgniteSpiAdapter setName(String name) {
+ @Override public IgniteSpiAdapter setName(String name) {
super.setName(name);
return this;
diff --git
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/file/UriDeploymentFileScanner.java
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/file/UriDeploymentFileScanner.java
index d88ed04..fca4ba8 100644
---
a/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/file/UriDeploymentFileScanner.java
+++
b/modules/urideploy/src/main/java/org/apache/ignite/spi/deployment/uri/scanners/file/UriDeploymentFileScanner.java
@@ -97,22 +97,22 @@ public class UriDeploymentFileScanner implements
UriDeploymentScanner {
throw new IgniteSpiException("URI is either not provided or is not
a directory: " +
U.hidePassword(uri.toString()));
- FileFilter garFilter = new FileFilter() {
+ FileFilter pkgFilter = new FileFilter() {
/** {@inheritDoc} */
@Override public boolean accept(File pathname) {
return scanCtx.getFilter().accept(null, pathname.getName());
}
};
- FileFilter garDirFilesFilter = new FileFilter() {
+ FileFilter pkgDirFilesFilter = new FileFilter() {
/** {@inheritDoc} */
@Override public boolean accept(File pathname) {
- // Allow all files in GAR-directory.
+ // Allow all files in package.
return pathname.isFile();
}
};
- return new URIContext(scanDir, garFilter, garDirFilesFilter);
+ return new URIContext(scanDir, pkgFilter, pkgDirFilesFilter);
}
/**
@@ -136,29 +136,29 @@ public class UriDeploymentFileScanner implements
UriDeploymentScanner {
/** Scanning directory or file. */
private final File scanDir;
- /** GAR filter. */
- private final FileFilter garFilter;
+ /** Package filter. */
+ private final FileFilter pkgFilter;
- /** GAR directory files filter. */
- private final FileFilter garDirFilesFilter;
+ /** Package directory files filter. */
+ private final FileFilter pkgDirFilesFilter;
- /** Cache of found GAR-files or GAR-directories to check if any of it
has been updated. */
+ /** Cache of found package files or directories to check if any of it
has been updated. */
private final Map<File, Long> tstampCache = new HashMap<>();
- /** Cache of found files in GAR-folder to check if any of it has been
updated. */
- private final Map<File, Map<File, Long>> garDirFilesTstampCache = new
HashMap<>();
+ /** Cache of found files in a package to check if any of it has been
updated. */
+ private final Map<File, Map<File, Long>> pkgDirFilesTstampCache = new
HashMap<>();
/**
* Constructor.
*
* @param scanDir Scan directory.
- * @param garFilter Gar filter.
- * @param garDirFilesFilter GAR directory files filter.
+ * @param pkgFilter Package file filter.
+ * @param pkgDirFilesFilter Package directory files filter.
*/
- private URIContext(File scanDir, FileFilter garFilter, FileFilter
garDirFilesFilter) {
+ private URIContext(File scanDir, FileFilter pkgFilter, FileFilter
pkgDirFilesFilter) {
this.scanDir = scanDir;
- this.garFilter = garFilter;
- this.garDirFilesFilter = garDirFilesFilter;
+ this.pkgFilter = pkgFilter;
+ this.pkgDirFilesFilter = pkgDirFilesFilter;
}
/**
@@ -180,11 +180,11 @@ public class UriDeploymentFileScanner implements
UriDeploymentScanner {
};
// Scan directory for deploy units.
- GridDeploymentFolderScannerHelper.scanFolder(scanDir, garFilter,
hnd);
+ GridDeploymentFolderScannerHelper.scanFolder(scanDir, pkgFilter,
hnd);
- // Print warning if no GAR-units found first time.
+ // Print warning if no packages found first time.
if (scanCtx.isFirstScan() && foundFiles.isEmpty())
- U.warn(scanCtx.getLogger(), "No GAR-units found in: " +
U.hidePassword(scanCtx.getUri().toString()));
+ U.warn(scanCtx.getLogger(), "No packages found in: " +
U.hidePassword(scanCtx.getUri().toString()));
if (!scanCtx.isFirstScan()) {
Collection<File> deletedFiles = new
HashSet<>(tstampCache.keySet());
@@ -201,7 +201,7 @@ public class UriDeploymentFileScanner implements
UriDeploymentScanner {
// Clear cache.
tstampCache.keySet().removeAll(deletedFiles);
- garDirFilesTstampCache.keySet().removeAll(deletedFiles);
+ pkgDirFilesTstampCache.keySet().removeAll(deletedFiles);
scanCtx.getListener().onDeletedFiles(uris);
}
@@ -224,7 +224,7 @@ public class UriDeploymentFileScanner implements
UriDeploymentScanner {
if (file.isDirectory()) {
GridTuple<Long> dirLastModified = F.t(file.lastModified());
- changed = checkGarDirectoryChanged(file, dirLastModified);
+ changed = checkPackageDirectoryChanged(file, dirLastModified);
lastMod = dirLastModified.get();
}
@@ -287,18 +287,18 @@ public class UriDeploymentFileScanner implements
UriDeploymentScanner {
* {@code false} otherwise.
*/
@SuppressWarnings("ConstantConditions")
- private boolean checkGarDirectoryChanged(File dir, final
GridTuple<Long> lastModified) {
+ private boolean checkPackageDirectoryChanged(File dir, final
GridTuple<Long> lastModified) {
final Map<File, Long> clssTstampCache;
boolean firstScan = false;
- if (!garDirFilesTstampCache.containsKey(dir)) {
+ if (!pkgDirFilesTstampCache.containsKey(dir)) {
firstScan = true;
- garDirFilesTstampCache.put(dir, clssTstampCache = new
HashMap<>());
+ pkgDirFilesTstampCache.put(dir, clssTstampCache = new
HashMap<>());
}
else
- clssTstampCache = garDirFilesTstampCache.get(dir);
+ clssTstampCache = pkgDirFilesTstampCache.get(dir);
assert clssTstampCache != null;
@@ -324,8 +324,8 @@ public class UriDeploymentFileScanner implements
UriDeploymentScanner {
}
};
- // Scan GAR-directory for changes.
- GridDeploymentFolderScannerHelper.scanFolder(dir,
garDirFilesFilter, hnd);
+ // Scan package for changes.
+ GridDeploymentFolderScannerHelper.scanFolder(dir,
pkgDirFilesFilter, hnd);
// Clear cache for deleted files.
if (!firstScan && clssTstampCache.keySet().retainAll(foundFiles))
diff --git
a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderMultiThreadedSelfTest.java
b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderMultiThreadedSelfTest.java
index a0d9d3f..4ea7990 100644
---
a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderMultiThreadedSelfTest.java
+++
b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/GridUriDeploymentClassLoaderMultiThreadedSelfTest.java
@@ -64,7 +64,7 @@ public class
GridUriDeploymentClassLoaderMultiThreadedSelfTest extends GridCommo
multithreaded(
new Callable<Object>() {
@Nullable @Override public Object call() throws Exception {
-
ldr0.loadClassGarOnly("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask0");
+
ldr0.loadClassIsolated("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask0");
return null;
}
diff --git
a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/file/GridFileDeploymentSelfTest.java
b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/file/GridFileDeploymentSelfTest.java
index f3faa07..19ec733 100644
---
a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/file/GridFileDeploymentSelfTest.java
+++
b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/file/GridFileDeploymentSelfTest.java
@@ -51,12 +51,23 @@ public class GridFileDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
}
/**
+ * Tests task from file 'deployfile.jar'.
+ *
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testDeploymentFromJar() throws Exception {
+
checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask8");
+ checkTask("GridUriDeploymentTestWithNameTask8");
+ }
+
+ /**
* Tests task from file 'deployfile.gar'.
*
* @throws Exception If failed.
*/
@Test
- public void testDeploymentFromFile() throws Exception {
+ public void testDeploymentFromGar() throws Exception {
checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3");
checkTask("GridUriDeploymentTestWithNameTask3");
}
@@ -102,6 +113,26 @@ public class GridFileDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
}
/**
+ * Tests task from file 'deployfile.jar'.
+ *
+ * Looks for task {@code GridUriDeploymentTestTask9}.
+ * That task loads resource {@code spring9.xml} and imports external class
from the same JAR
+ * External class loads resource {@code test9.properties} from the same
JAR it is loaded from.
+ *
+ * To check {@code GridDeploymentUriClassLoader} class loader need to
delete all classes
+ * and resources from Junit classpath. Note that class loader searches for
classes in a JAR
+ * file and not in the parent class loader for junits.
+ *
+ * @throws Exception If failed.
+ */
+ @Test
+ public void testDependenceJarDeployment() throws Exception {
+
checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask9");
+
getSpi().findResource("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask9")
+ .getResourceClass().newInstance();
+ }
+
+ /**
* Tests task from file 'deployfile-depend.gar'.
*
* Looks for task {@code GridUriDeploymentTestTask1} with descriptor file
from GAR-file.
@@ -115,7 +146,7 @@ public class GridFileDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
* @throws Exception If failed.
*/
@Test
- public void testDependenceDeployment() throws Exception {
+ public void testDependenceGarDeployment() throws Exception {
checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask1");
getSpi().findResource("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask1")
.getResourceClass().newInstance();
@@ -142,16 +173,17 @@ public class GridFileDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
}
/**
- * Tests task from files 'well-signed-deployfile.gar' and
'bad-signed-deployfile.gar'.
- * File 'bad-signed-deployfile.gar' contains non-signed modifications.
+ * Tests task from files 'well-signed-deployfile.gar',
'bad-signed-deployfile.gar',
+ * 'well-signed-deployfile.jar' and 'bad-signed-deployfile.jar'.
+ * Files 'bad-signed-deployfile.gar', 'bad-signed-deployfile.jar' contain
non-signed modifications.
*
* Sign JAR with command:
* $ jarsigner -keystore
$IGNITE_HOME/modules/tests/config/signeddeploy/keystore -storepass "abc123"
- * -keypass "abc123" -signedjar signed-deployfile.gar deployfile.gar
business
+ * -keypass "abc123" -signedjar signed-deployfile.jar deployfile.jar
business
*
* Verify signed JAR-file:
* $ jarsigner -verify -keystore
$IGNITE_HOME/modules/tests/config/signeddeploy/keystore -storepass "abc123"
- * -keypass "abc123" signed-deployfile.gar
+ * -keypass "abc123" signed-deployfile.jar
*
* @throws Exception If failed.
*/
@@ -159,10 +191,16 @@ public class GridFileDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
public void testSignedDeployment() throws Exception {
checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask5");
checkTask("GridUriDeploymentTestWithNameTask5");
+
checkTask("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask10");
+ checkTask("GridUriDeploymentTestWithNameTask10");
assert
getSpi().findResource("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask6")
== null :
"Task from GAR with invalid signature should not be deployed.";
- assert
getSpi().findResource("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestWithNameTask6")
+ assert
getSpi().findResource("tasks.GridUriDeploymentTestWithNameTask6")
== null : "Task from GAR with invalid signature should not be
deployed.";
+ assert
getSpi().findResource("org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask11")
== null :
+ "Task from JAR with invalid signature should not be deployed.";
+ assert getSpi().findResource("GridUriDeploymentTestWithNameTask11")
+ == null : "Task from JAR with invalid signature should not be
deployed.";
}
}
diff --git
a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
index 8529902..e5a7ec8 100644
---
a/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
+++
b/modules/urideploy/src/test/java/org/apache/ignite/spi/deployment/uri/scanners/http/GridHttpDeploymentSelfTest.java
@@ -49,6 +49,9 @@ public class GridHttpDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
/** */
public static final String ALL_GAR = "file.gar";
+ /** */
+ public static final String ALL_JAR = "file.jar";
+
/** Gar-file which contains libs. */
public static final String LIBS_GAR_FILE_PATH = U.resolveIgnitePath(
GridTestProperties.getProperty("ant.urideployment.gar.libs-file")).getPath();
@@ -61,6 +64,10 @@ public class GridHttpDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
public static final String ALL_GAR_FILE_PATH = U.resolveIgnitePath(
GridTestProperties.getProperty("ant.urideployment.gar.file")).getPath();
+ /** JAR file with tasks and dependencies. */
+ public static final String JAR_FILE_PATH = U.resolveIgnitePath(
+ GridTestProperties.getProperty("urideployment.jar.uri")).getPath();
+
/** Jetty. */
private static Server srv;
@@ -81,7 +88,7 @@ public class GridHttpDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
hnd.setDirectoriesListed(true);
- String garPathTmp =
GridTestProperties.getProperty("ant.urideployment.gar.path.tmp");
+ String garPathTmp =
GridTestProperties.getProperty("urideployment.path.tmp");
File resourseBaseDir = U.resolveIgnitePath(garPathTmp);
@@ -117,7 +124,7 @@ public class GridHttpDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
* @throws Exception If failed.
*/
@Test
- public void testDeployUndeploy2Files() throws Exception {
+ public void testDeployUndeploy2GarFiles() throws Exception {
String taskName =
"org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3";
checkNoTask(taskName);
@@ -144,6 +151,30 @@ public class GridHttpDeploymentSelfTest extends
GridUriDeploymentAbstractSelfTes
* @throws Exception If failed.
*/
@Test
+ public void testDeployUndeployJar() throws Exception {
+ String taskName =
"org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask8";
+
+ checkNoTask(taskName);
+
+ try {
+ copyToResourceBase(JAR_FILE_PATH, ALL_JAR);
+
+ waitForTask(taskName, true, FREQ + 3000);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ finally {
+ deleteFromResourceBase(ALL_JAR);
+
+ waitForTask(taskName, false, FREQ + 3000);
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ @Test
public void testSameContantFiles() throws Exception {
String taskName =
"org.apache.ignite.spi.deployment.uri.tasks.GridUriDeploymentTestTask3";