Return-Path: X-Original-To: apmail-ace-commits-archive@www.apache.org Delivered-To: apmail-ace-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 844AFDF14 for ; Thu, 5 Jul 2012 12:11:42 +0000 (UTC) Received: (qmail 98550 invoked by uid 500); 5 Jul 2012 12:11:42 -0000 Delivered-To: apmail-ace-commits-archive@ace.apache.org Received: (qmail 98487 invoked by uid 500); 5 Jul 2012 12:11:41 -0000 Mailing-List: contact commits-help@ace.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ace.apache.org Delivered-To: mailing list commits@ace.apache.org Received: (qmail 98461 invoked by uid 99); 5 Jul 2012 12:11:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2012 12:11:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Jul 2012 12:11:24 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5E6EE2388AA9 for ; Thu, 5 Jul 2012 12:10:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1357570 [10/34] - in /ace/sandbox/marrs: cnf/ cnf/ext/ cnf/lib/ cnf/releaserepo/ cnf/repo/ cnf/repo/.obrcache/ cnf/repo/.obrcache/http%3A%2F%2Fbundles.bndtools.org.s3.amazonaws.com%2Fcom.jcraft.jsch/ cnf/repo/.obrcache/http%3A%2F%2Fbundles... Date: Thu, 05 Jul 2012 12:10:06 -0000 To: commits@ace.apache.org From: marrs@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120705121036.5E6EE2388AA9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/.classpath URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/.classpath?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/.classpath (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/.classpath Thu Jul 5 12:09:30 2012 @@ -0,0 +1,9 @@ + + + + + + + + + Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/.project URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/.project?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/.project (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/.project Thu Jul 5 12:09:30 2012 @@ -0,0 +1,23 @@ + + + org.apache.ace.client.repository.helper.base + + + + + + org.eclipse.jdt.core.javabuilder + + + + + bndtools.core.bndbuilder + + + + + + org.eclipse.jdt.core.javanature + bndtools.core.bndnature + + Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/bnd.bnd URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/bnd.bnd?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/bnd.bnd (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/bnd.bnd Thu Jul 5 12:09:30 2012 @@ -0,0 +1,92 @@ +-buildpath: osgi.core,\ + osgi.cmpn,\ + org.apache.ace.client.repository.api;version=latest,\ + org.apache.ace.deployment.provider.api;version=latest,\ + org.apache.ace.log;version=latest,\ + org.apache.ace.connectionfactory;version=latest,\ + ../cnf/lib/commons-lang-2.4.jar;version=file,\ + ../cnf/lib/commons-collections-3.2.1.jar;version=file,\ + ../cnf/lib/velocity-1.6.2.jar;version=file,\ + ../cnf/lib/xpp3-1.1.4c.jar;version=file +Private-Package: org.apache.commons.lang,\ + javax.xml.namespace,\ + org.xmlpull.mxp1,\ + org.xmlpull.mxp1_serializer,\ + org.xmlpull.v1,\ + org.xmlpull.v1.builder,\ + org.xmlpull.v1.builder.adapter,\ + org.xmlpull.v1.builder.impl,\ + org.xmlpull.v1.dom2_builder,\ + org.xmlpull.v1.parser_pool,\ + org.xmlpull.v1.sax2,\ + org.xmlpull.v1.util,\ + org.xmlpull.v1.wrapper,\ + org.xmlpull.v1.wrapper.classic,\ + org.apache.velocity,\ + org.apache.velocity.anakia,\ + org.apache.velocity.app,\ + org.apache.velocity.app.event,\ + org.apache.velocity.app.event.implement,\ + org.apache.velocity.app.tools,\ + org.apache.velocity.context,\ + org.apache.velocity.convert,\ + org.apache.velocity.exception,\ + org.apache.velocity.io,\ + org.apache.velocity.runtime,\ + org.apache.velocity.runtime.defaults,\ + org.apache.velocity.runtime.directive,\ + org.apache.velocity.runtime.log,\ + org.apache.velocity.runtime.parser,\ + org.apache.velocity.runtime.parser.node,\ + org.apache.velocity.runtime.resource,\ + org.apache.velocity.runtime.resource.loader,\ + org.apache.velocity.runtime.resource.util,\ + org.apache.velocity.runtime.visitor,\ + org.apache.velocity.servlet,\ + org.apache.velocity.texen,\ + org.apache.velocity.texen.ant,\ + org.apache.velocity.texen.defaults,\ + org.apache.velocity.texen.util,\ + org.apache.velocity.util,\ + org.apache.velocity.util.introspection,\ + org.apache.commons.lang.builder,\ + org.apache.commons.lang.enums,\ + org.apache.commons.lang.exception,\ + org.apache.commons.lang.math,\ + org.apache.commons.lang.mutable,\ + org.apache.commons.lang.text,\ + org.apache.commons.lang.time,\ + org.apache.commons.collections,\ + org.apache.commons.collections.bag,\ + org.apache.commons.collections.bidimap,\ + org.apache.commons.collections.buffer,\ + org.apache.commons.collections.collection,\ + org.apache.commons.collections.comparators,\ + org.apache.commons.collections.functors,\ + org.apache.commons.collections.iterators,\ + org.apache.commons.collections.keyvalue,\ + org.apache.commons.collections.list,\ + org.apache.commons.collections.map,\ + org.apache.commons.collections.set +Export-Package: org.apache.ace.client.repository.helper.base +Import-Package: !javax.servlet,\ + !javax.servlet.http,\ + !com.werken.xpath,\ + !javax.naming,\ + !javax.sql,\ + !javax.xml.parsers,\ + !org.apache.log,\ + !org.apache.log.format,\ + !org.apache.log.output.io,\ + !org.apache.log4j,\ + !org.apache.tools.ant,\ + !org.apache.tools.ant.taskdefs,\ + !org.jdom,\ + !org.jdom.input,\ + !org.jdom.output,\ + !org.w3c.dom,\ + !org.xml.sax,\ + !org.xml.sax.helpers,\ + !org.apache.commons.logging,\ + !org.apache.oro.text.perl,\ + * \ No newline at end of file Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/build.xml URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/build.xml?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/build.xml (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/build.xml Thu Jul 5 12:09:30 2012 @@ -0,0 +1,4 @@ + + + + Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/old/main/appended-resources/META-INF/LICENSE.vm URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/old/main/appended-resources/META-INF/LICENSE.vm?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/old/main/appended-resources/META-INF/LICENSE.vm (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/old/main/appended-resources/META-INF/LICENSE.vm Thu Jul 5 12:09:30 2012 @@ -0,0 +1,66 @@ +## +## 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. +## + +XPP3 License +------------ +* The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/old/main/appended-resources/META-INF/NOTICE.vm URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/old/main/appended-resources/META-INF/NOTICE.vm?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/old/main/appended-resources/META-INF/NOTICE.vm (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/old/main/appended-resources/META-INF/NOTICE.vm Thu Jul 5 12:09:30 2012 @@ -0,0 +1,24 @@ +## +## 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. +## +This product includes software developed at +'Extreme! Lab, Indiana University' (http://www.extreme.indiana.edu/) +Copyright (c) all rights reserved +Licensed under Apache Software License, version 1.1 + + Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/pom.xml URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/pom.xml?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/pom.xml (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/pom.xml Thu Jul 5 12:09:30 2012 @@ -0,0 +1,140 @@ + + + + + + 4.0.0 + + + org.apache.ace + ace-pom + 0.8.1-SNAPSHOT + ../pom/pom.xml + + + 0.8.1-SNAPSHOT + org.apache.ace.client.repository.helper.base + bundle + + Apache ACE :: Client :: Repository :: Helper :: Base + Base implementation and Apache Velocity based artifact preprocessor that allows you to create artifacts that have placeholders in them that can be replaced with entity specific values. + + + scm:svn:http://svn.apache.org/repos/asf/ace/trunk/ace-client-repository-helper-base + scm:svn:https://svn.apache.org/repos/asf/ace/trunk/ace-client-repository-helper-base + http://svn.apache.org/repos/asf/ace/trunk/ace-client-repository-helper-base + + + + + org.apache.ace.client.repository.helper.base;version=${project.version} + + + !org.apache.ace.client.repository.helper.base, + !javax.security.auth, + !javax.swing.plaf, + !javax.xml.parsers, + !javax.xml.stream, + !javax.xml.transform.sax, + !net.sf.cglib.proxy, + !nu.xom, + !org.codehaus.jettison.mapped, + !org.dom4j, + !org.dom4j.io, + !org.dom4j.tree, + !org.jdom, + !org.jdom.input, + !org.joda.time, + !org.joda.time.format, + !org.w3c.dom, + !org.xml.sax, + !org.xml.sax.helpers, + !sun.misc, + !sun.reflect, + !com.werken.xpath, + !javax.naming, + !javax.servlet, + !javax.servlet.http, + !javax.sql, + !org.apache.commons.collections, + !org.apache.commons.collections.map, + !org.apache.commons.lang, + !org.apache.commons.lang.builder, + !org.apache.commons.lang.text, + !org.apache.commons.logging, + !org.apache.log, + !org.apache.log.format, + !org.apache.log.output.io, + !org.apache.log4j, + !org.apache.oro.text.perl, + !org.apache.tools.ant, + !org.apache.tools.ant.taskdefs, + !org.jdom.output, + org.apache.ace.client.repository.helper;version=${project.version}, + org.apache.ace.connectionfactory;version=${project.version} + + + velocity, xpp3, commons-collections, commons-lang + + + + + + org.apache.ace + org.apache.ace.log + + + org.apache.ace + org.apache.ace.deployment.provider.api + + + org.apache.ace + org.apache.ace.client.repository.api + + + org.apache.ace + org.apache.ace.connectionfactory + + + org.osgi + org.osgi.core + + + org.osgi + org.osgi.compendium + + + org.apache.velocity + velocity + + + commons-collections + commons-collections + + + commons-lang + commons-lang + + + xpp3 + xpp3 + + + + Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/ArtifactPreprocessorBase.java URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/ArtifactPreprocessorBase.java?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/ArtifactPreprocessorBase.java (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/ArtifactPreprocessorBase.java Thu Jul 5 12:09:30 2012 @@ -0,0 +1,250 @@ +/* + * 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.ace.client.repository.helper.base; + +import java.io.Closeable; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.net.URLConnection; + +import org.apache.ace.client.repository.helper.ArtifactPreprocessor; +import org.apache.ace.client.repository.helper.PropertyResolver; +import org.apache.ace.connectionfactory.ConnectionFactory; + +/** + * This class can be used as a base class for artifact preprocessors. It comes with its + * own upload() method, which will be used by all artifact preprocessors anyway. + */ +public abstract class ArtifactPreprocessorBase implements ArtifactPreprocessor { + + protected static final int BUFFER_SIZE = 4 * 1024; + + protected final ConnectionFactory m_connectionFactory; + + /** + * @param connectionFactory + */ + protected ArtifactPreprocessorBase(ConnectionFactory connectionFactory) { + m_connectionFactory = connectionFactory; + } + + /** + * Uploads an artifact to an OBR. + * + * @param input A inputstream from which the artifact can be read. + * @param name The name of the artifact. If the name is not unique, an IOException will be thrown. + * @param obrBase The base URL of the obr to which this artifact should be written. + * @return A URL to the uploaded artifact; this is identical to calling determineNewUrl(name, obrBase) + * @throws IOException If there was an error reading from input, or if there was a problem communicating + * with the OBR. + */ + protected URL upload(InputStream input, String name, URL obrBase) throws IOException { + if (obrBase == null) { + throw new IOException("There is no storage available for this artifact."); + } + if ((name == null) || (input == null)) { + throw new IllegalArgumentException("None of the parameters can be null."); + } + + URL url = null; + try { + url = determineNewUrl(name, obrBase); + + if ("file".equals(url.getProtocol())) { + uploadToFile(input, url); + } + else { + uploadToRemote(input, url); + } + } + catch (IOException ioe) { + throw new IOException("Error uploading " + name + ": " + ioe.getMessage()); + } + finally { + silentlyClose(input); + } + + return url; + } + + /** + * Gets a stream to write an artifact to, which will be uploaded to the OBR. + * + * @param name The name of the artifact. + * @param obrBase The base URL of the obr to which this artifact should be written. + * @return An outputstream, to which the artifact can be written. + * @throws IOException If there is a problem setting up the outputstream. + */ + protected OutputStream upload(final String name, final URL obrBase) throws IOException { + /* + * This function works by starting a thread which reads from the outputstream which is passed out, + * and writing it to another stream, which is read by a thread that does the Upload. + */ + final PipedOutputStream externalOutput = new PipedOutputStream(); + final PipedInputStream externalInput = new PipedInputStream(externalOutput); + + final PipedOutputStream internalOutput = new PipedOutputStream(); + final PipedInputStream internalInput = new PipedInputStream(internalOutput); + + new Thread(new Runnable() { + public void run() { + try { + byte[] buffer = new byte[BUFFER_SIZE]; + for (int count = externalInput.read(buffer); count != -1; count = externalInput.read(buffer)) { + internalOutput.write(buffer, 0, count); + } + } + catch (IOException e) { + // We cannot signal this to the user, but he will notice (in the original thread) + // that the pipe has been broken. + e.printStackTrace(); + } + finally { + silentlyClose(internalOutput); + silentlyClose(externalInput); + } + } + }, "upload-Outputstream(" + name + ")").start(); + + new Thread(new Runnable() { + public void run() { + try { + upload(internalInput, name, obrBase); + } + catch (IOException e) { + // We cannot signal this to the user, but he will notice (in the original thread) + // that the pipe has been broken. + e.printStackTrace(); + } + finally { + silentlyClose(internalInput); + silentlyClose(externalOutput); + } + } + }, "upload-Inputstream(" + name + ")").start(); + + return externalOutput; + } + + protected URL determineNewUrl(String name, URL obrBase) throws MalformedURLException { + return new URL(obrBase, name); + } + + public abstract String preprocess(String url, PropertyResolver props, String targetID, String version, URL obrBase) throws IOException; + + public abstract boolean needsNewVersion(String url, PropertyResolver props, String targetID, String fromVersion); + + /** + * @param closable + * @throws IOException + */ + protected final void silentlyClose(Closeable closable) { + if (closable != null) { + try { + closable.close(); + } + catch (IOException e) { + // Ignore; nothing we can/will do about here... + } + } + } + + /** + * Uploads an artifact to a local file location. + * + * @param input the input stream of the (local) artifact to upload. + * @param url the URL of the (file) artifact to upload to. + * @throws IOException in case of I/O problems. + */ + private void uploadToFile(InputStream input, URL url) throws IOException { + File file; + try { + file = new File(url.toURI()); + } + catch (URISyntaxException e) { + file = new File(url.getPath()); + } + + OutputStream output = null; + + try { + output = new FileOutputStream(file); + + byte[] buffer = new byte[BUFFER_SIZE]; + for (int count = input.read(buffer); count != -1; count = input.read(buffer)) { + output.write(buffer, 0, count); + } + } + finally { + silentlyClose(output); + } + } + + /** + * Uploads an artifact to a remote location. + * + * @param input the input stream of the (local) artifact to upload. + * @param url the URL of the (remote) artifact to upload to. + * @throws IOException in case of I/O problems, or when the upload was refused by the remote. + */ + private void uploadToRemote(InputStream input, URL url) throws IOException { + OutputStream output = null; + + try { + URLConnection connection = m_connectionFactory.createConnection(url); + + connection.setDoOutput(true); + connection.setDoInput(true); + output = connection.getOutputStream(); + + byte[] buffer = new byte[BUFFER_SIZE]; + for (int count = input.read(buffer); count != -1; count = input.read(buffer)) { + output.write(buffer, 0, count); + } + output.close(); + + if (connection instanceof HttpURLConnection) { + int responseCode = ((HttpURLConnection) connection).getResponseCode(); + switch (responseCode) { + case HttpURLConnection.HTTP_OK: + break; + case HttpURLConnection.HTTP_CONFLICT: + throw new IOException("Artifact already exists in storage."); + case HttpURLConnection.HTTP_INTERNAL_ERROR: + throw new IOException("The storage server returned an internal server error."); + default: + throw new IOException("The storage server returned code " + responseCode + " writing to " + + url.toString()); + } + } + } + finally { + silentlyClose(output); + } + } +} Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/VelocityArtifactPreprocessor.java Thu Jul 5 12:09:30 2012 @@ -0,0 +1,321 @@ +/* + * 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.ace.client.repository.helper.base; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; +import java.net.MalformedURLException; +import java.net.URL; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import org.apache.ace.client.repository.helper.PropertyResolver; +import org.apache.ace.connectionfactory.ConnectionFactory; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.Velocity; + +/** + * This class can be used as a 'default' artifact preprocessor, using the Velocity template engine to preprocess + * the artifact. + */ +public class VelocityArtifactPreprocessor extends ArtifactPreprocessorBase { + + private static Object m_initLock = new Object(); + private static boolean m_velocityInitialized = false; + + private final Map> m_cachedArtifacts; + private final Map> m_cachedHashes; + private final MessageDigest m_md5; + + /** + * Creates a new {@link VelocityArtifactPreprocessor} instance. + * @param connectionFactory + */ + public VelocityArtifactPreprocessor(ConnectionFactory connectionFactory) { + super(connectionFactory); + + try { + m_md5 = MessageDigest.getInstance("MD5"); + } + catch (NoSuchAlgorithmException e) { + throw new RuntimeException("Failed to create VelocityArtifactPreprocessor instance!", e); + } + + m_cachedArtifacts = new ConcurrentHashMap>(); + m_cachedHashes = new ConcurrentHashMap>(); + } + + @Override + public boolean needsNewVersion(String url, PropertyResolver props, String targetID, String fromVersion) { + // get the template + byte[] input = null; + byte[] result = null; + + try { + init(); + + input = getArtifactAsBytes(url); + result = process(input, props); + } + catch (IOException ioe) { + // problem initializing velocity, or we cannot retrieve the + // original artifact, or process it; we can't say anything now. + return true; + } + + // process the template + // first check: did we need any processing at all? + if (Arrays.equals(result, input)) { + return false; + } + + // hash the processed template + String newHash = hash(result); + + // find the hash for the previous version + String oldHash = getHashForVersion(url, targetID, fromVersion); + + // Note: we do not cache any previously created processed templates, since the call that asks us to approve a new version + // may cross a pending needsNewVersion call. + return !newHash.equals(oldHash); + } + + @Override + public String preprocess(String url, PropertyResolver props, String targetID, String version, URL obrBase) throws IOException { + init(); + + // first, get the original data. + byte[] input = getArtifactAsBytes(url); + // process the template + byte[] result = process(input, props); + + // first check: did we need any processing at all? + if (Arrays.equals(result, input)) { + // template isn't modified; use direct URL instead... + return url; + } + + setHashForVersion(url, targetID, version, hash(result)); + + String name = getFilename(url, targetID, version); + + OutputStream output = upload(name, obrBase); + output.write(result); + output.close(); + + return determineNewUrl(name, obrBase).toString(); + } + + /** + * Initializes this preprocessor by making sure {@link Velocity#init()} is called. + *

This method may be called multiple times.

+ * + * @throws IOException in case of problems initializing Velocity. + */ + private void init() throws IOException { + if (m_velocityInitialized) { + return; + } + else { + synchronized (m_initLock) { + if (!m_velocityInitialized) { + try { + Velocity.init(); + m_velocityInitialized = true; + } + catch (Exception e) { + // Something went seriously bad initializing velocity. + throw new IOException("Error initializing Velocity: " + e.getMessage()); + } + } + } + } + } + + /** + * @param url + * @param targetID + * @param version + * @return + * @throws MalformedURLException + */ + private String getFilename(String url, String targetID, String version) throws MalformedURLException { + return new File(new URL(url).getFile()).getName() + "-" + targetID + "-" + version; + } + + /** + * @param url + * @param targetID + * @param version + * @return + * @throws MalformedURLException + */ + private String getFullUrl(String url, String targetID, String version) throws MalformedURLException { + return url + "-" + targetID + "-" + version; + } + + /** + * @param url + * @param target + * @param version + * @return + */ + private String getHashForVersion(String url, String target, String version) { + String key = createHashKey(url, target, version); + + Reference ref = m_cachedHashes.get(key); + String hash = (ref != null) ? ref.get() : null; + if (hash == null) { + try { + hash = hash(getBytesFromUrl(getFullUrl(url, target, version))); + + m_cachedHashes.put(key, new WeakReference(hash)); + } + catch (IOException e) { + // we cannot retrieve the artifact, so we cannot say anything about it. + } + } + + return hash; + } + + /** + * @param url + * @param target + * @param version + * @param hash + */ + private void setHashForVersion(String url, String target, String version, String hash) { + String key = createHashKey(url, target, version); + + m_cachedHashes.put(key, new WeakReference(hash)); + } + + /** + * Applies the template processor to the given byte array. + * + * @param input the template (as byte array) to process; + * @param props the {@link PropertyResolver} to use. + * @return the processed template, never null. + * @throws IOException in case of I/O problems. + */ + private byte[] process(byte[] input, PropertyResolver props) throws IOException { + VelocityContext context = new VelocityContext(); + context.put("context", props); + + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + Writer writer = new OutputStreamWriter(baos); + Velocity.evaluate(context, writer, "", new InputStreamReader(new ByteArrayInputStream(input))); + writer.flush(); + return baos.toByteArray(); + } + catch (IOException ioe) { + throw new IOException("Error processing the artifact: " + ioe.getMessage()); + } + } + + /** + * Reads all information from a given URL, and returns that as a byte array. The byte array is not to be changed, and could be potentially come from a cache. + * + * @param url the URL to read the artifact from, cannot be null. + * @return the read (or cached) bytes, can be null. + * @throws IOException in case of I/O problems. + */ + private byte[] getArtifactAsBytes(String url) throws IOException { + byte[] result = null; + + Reference ref = m_cachedArtifacts.get(url); + if (ref == null || ((result = ref.get()) == null)) { + result = getBytesFromUrl(url); + } + return result; + } + + /** + * Reads all bytes from the given URL and caches its result. + * + * @param url the URL to read the bytes for, cannot be null. + * @return the read bytes from the given URL, can be null if the reading failed. + * @throws IOException in case of I/O problems. + */ + private byte[] getBytesFromUrl(String url) throws IOException { + byte[] result = null; + + // ACE-267 + InputStream in = m_connectionFactory.createConnection(new URL(url)).getInputStream(); + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + byte[] buf = new byte[BUFFER_SIZE]; + for (int count = in.read(buf); count != -1; count = in.read(buf)) { + baos.write(buf, 0, count); + } + + result = baos.toByteArray(); + + m_cachedArtifacts.put(url, new WeakReference(result)); + } + finally { + silentlyClose(in); + } + + return result; + } + + /** + * Creates a key for storing/retrieving a hash. + * + * @param url + * @param target + * @param version + * @return a hash key, never null. + */ + private String createHashKey(String url, String target, String version) { + return new StringBuilder().append('[') + .append(url) + .append("][") + .append(target) + .append("][") + .append(version) + .append(']').toString(); + } + + /** + * Computes a hash for a given byte array. + * + * @param input the byte array to compute the hash for. + * @return a hash for the given byte array, never null. + */ + private String hash(byte[] input) { + return new String(m_md5.digest(input)); + } +} Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/packageinfo URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/packageinfo?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/packageinfo (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/src/org/apache/ace/client/repository/helper/base/packageinfo Thu Jul 5 12:09:30 2012 @@ -0,0 +1 @@ +version 1.0 \ No newline at end of file Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/Default suite/Default test.html URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/Default%20suite/Default%20test.html?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/Default suite/Default test.html (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/Default suite/Default test.html Thu Jul 5 12:09:30 2012 @@ -0,0 +1,183 @@ + + +TestNG: Default test + + + + + + + + +

Default test

+ + + + + + + + + + + +
Tests passed/Failed/Skipped:7/0/0
Started on:Wed Jul 04 23:13:36 CEST 2012
Total time:0 seconds (238 ms)
Included groups:
Excluded groups:

+(Hover the method name to see the test class name)

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PASSED TESTS
Test methodExceptionTime (seconds)Instance
testNeedsNewVersionChangedTemplateOk
Test class: org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest
0org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest@64633e5e
testNeedsNewVersionEmptyTemplateOk
Test class: org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest
0org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest@64633e5e
testNeedsNewVersionNonExistingTemplateOk
Test class: org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest
0org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest@64633e5e
testNeedsNewVersionUnchangedTemplateOk
Test class: org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest
0org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest@64633e5e
testPreprocessExistingNoTemplateOk
Test class: org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest
0org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest@64633e5e
testPreprocessExistingRealTemplateOk
Test class: org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest
0org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest@64633e5e
testPreprocessNonExistingTemplateOk
Test class: org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest
java.io.FileNotFoundException: /path/to/nowhere-1341436417162 (No such file or directory)
+	at java.io.FileInputStream.open(Native Method)
+	at java.io.FileInputStream.<init>(FileInputStream.java:120)
+	at java.io.FileInputStream.<init>(FileInputStream.java:79)
+	at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
+	at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
+	at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor.getBytesFromUrl(VelocityArtifactPreprocessor.java:274)
+	at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor.getArtifactAsBytes(VelocityArtifactPreprocessor.java:258)
+	at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor.preprocess(VelocityArtifactPreprocessor.java:116)
+	at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest.testPreprocessNonExistingTemplateOk(VelocityArtifactPreprocessorTest.java:164)
+	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
+	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
+	at java.lang.reflect.Method.invoke(Method.java:597)
+	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
+	at org.testng.internal.Invoker.invokeMethod(Invoker.java:702)
+	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:894)
+	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1219)
+	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
+	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
+	at org.testng.TestRunner.privateRun(TestRunner.java:767)
+	at org.testng.TestRunner.run(TestRunner.java:617)
+	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
+	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
+	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
+	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
+	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
+	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)
+	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1192)
+	at org.testng.TestNG.runSuitesLocally(TestNG.java:1117)
+	at org.testng.TestNG.run(TestNG.java:1025)
+	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
+	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
+	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
+
Click to show all stack frames +
java.io.FileNotFoundException: /path/to/nowhere-1341436417162 (No such file or directory)
+	at java.io.FileInputStream.open(Native Method)
+	at java.io.FileInputStream.<init>(FileInputStream.java:120)
+	at java.io.FileInputStream.<init>(FileInputStream.java:79)
+	at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
+	at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161)
+	at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor.getBytesFromUrl(VelocityArtifactPreprocessor.java:274)
+	at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor.getArtifactAsBytes(VelocityArtifactPreprocessor.java:258)
+	at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor.preprocess(VelocityArtifactPreprocessor.java:116)
+	at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest.testPreprocessNonExistingTemplateOk(VelocityArtifactPreprocessorTest.java:164)
+	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
+	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
+	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
+	at java.lang.reflect.Method.invoke(Method.java:597)
+	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
+	at org.testng.internal.Invoker.invokeMethod(Invoker.java:702)
+	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:894)
+	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1219)
+	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
+	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
+	at org.testng.TestRunner.privateRun(TestRunner.java:767)
+	at org.testng.TestRunner.run(TestRunner.java:617)
+	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
+	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
+	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
+	at org.testng.SuiteRunner.run(SuiteRunner.java:240)
+	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
+	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)
+	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1192)
+	at org.testng.TestNG.runSuitesLocally(TestNG.java:1117)
+	at org.testng.TestNG.run(TestNG.java:1025)
+	at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:109)
+	at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:202)
+	at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:173)
+
0org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest@64633e5e

+ + \ No newline at end of file Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/Default suite/Default test.xml URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/Default%20suite/Default%20test.xml?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/Default suite/Default test.xml (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/Default suite/Default test.xml Thu Jul 5 12:09:30 2012 @@ -0,0 +1,11 @@ + + + + + + + + + + + Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/bullet_point.png URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/bullet_point.png?rev=1357570&view=auto ============================================================================== Binary file - no diff available. Propchange: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/bullet_point.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/collapseall.gif URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/collapseall.gif?rev=1357570&view=auto ============================================================================== Binary file - no diff available. Propchange: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/collapseall.gif ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/emailable-report.html URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/emailable-report.html?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/emailable-report.html (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/emailable-report.html Thu Jul 5 12:09:30 2012 @@ -0,0 +1,68 @@ + + + +TestNG: Unit Test + + + + + + +
TestMethods
Passed
Scenarios
Passed
# skipped# failedTotal
Time
Included
Groups
Excluded
Groups
Default test77000.2 seconds
+ + + + + +
ClassMethod# of
Scenarios
StartTime
(ms)
Default test — passed
org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTesttestNeedsNewVersionChangedTemplateOk (unit) 11341436416943202
testNeedsNewVersionEmptyTemplateOk (unit) 113414364171461
testNeedsNewVersionNonExistingTemplateOk (unit) 113414364171491
testNeedsNewVersionUnchangedTemplateOk (unit) 113414364171512
testPreprocessExistingNoTemplateOk (unit) 113414364171552
< a href="#m6">testPreprocessExistingRealTemplateOk (unit) 113414364171582
testPreprocessNonExistingTemplateOk (unit) 113414364171621
+

Default test

+

org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest:testNeedsNewVersionChangedTemplateOk

+

back to summary

+

org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest:testPreprocessExistingRealTemplateOk

+

back to summary

+

org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest:testNeedsNewVersionEmptyTemplateOk

+

back to summary

+

org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest:testNeedsNewVersionUnchangedTemplateOk

+

back to summary

+

org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest:testPreprocessExistingNoTemplateOk

+

back to summary

+

org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest:testPreprocessNonExistingTemplateOk

+
+

/path/to/nowhere-1341436417162 (No such file or directory)

+java.io.FileInputStream.open(Native Method) +
at java.io.FileInputStream.<init>(FileInputStream.java:120) +
at java.io.FileInputStream.<init>(FileInputStream.java:79) +
at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70) +
at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161) +
at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor.getBytesFromUrl(VelocityArtifactPreprocessor.java:274) +
at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor.getArtifactAsBytes(VelocityArtifactPreprocessor.java:258) +
at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor.preprocess(VelocityArtifactPreprocessor.java:116) +
at org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest.testPreprocessNonExistingTemplateOk(VelocityArtifactPreprocessorTest.java:164) +
25 lines not shown +
+

back to summary

+

org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest:testNeedsNewVersionNonExistingTemplateOk

+

back to summary

+ Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/failed.png URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/failed.png?rev=1357570&view=auto ============================================================================== Binary file - no diff available. Propchange: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/failed.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/index.html URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/index.html?rev=1357570&view=auto ============================================================================== --- ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/index.html (added) +++ ace/sandbox/marrs/org.apache.ace.client.repository.helper.base/test-output/index.html Thu Jul 5 12:09:30 2012 @@ -0,0 +1,389 @@ + + + + + TestNG new reports + + + + + + + + + + +
+ Test results +
+ 1 suite +
+ +
+
+
+
+
+ + org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest +
+
+
+
+ + + testNeedsNewVersionChangedTemplateOk +
+
+
+
+ + + testNeedsNewVersionEmptyTemplateOk +
+
+
+
+ + + testNeedsNewVersionNonExistingTemplateOk +
+
+
+
+ + + testNeedsNewVersionUnchangedTemplateOk +
+
+
+
+ + + testPreprocessExistingNoTemplateOk +
+
+
+
+ + + testPreprocessExistingRealTemplateOk +
+
+
+
+ + + testPreprocessNonExistingTemplateOk +
+
+
+
+
+
+
+ /private/var/folders/4k/58plh09n605ffjkhv0kpcx540000gn/T/testng-eclipse-1729083164/testng-customsuite.xml +
+
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="Default suite">
+  <test verbose="2" name="Default test" preserve-order="true">
+    <classes>
+      <class name="org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessor"/>
+      <class name="org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest"/>
+      <class name="org.apache.ace.client.repository.helper.base.ArtifactPreprocessorBase"/>
+    </classes>
+  </test> <!-- Default test -->
+</suite> <!-- Default suite -->
+            
+
+
+
+
+ Tests for Default suite +
+
+
    +
  • + Default test (3 classes) +
  • +
+
+
+
+
+ Groups for Default suite +
+
+
+ unit +
+
+ testNeedsNewVersionChangedTemplateOk +
+
+
+ testNeedsNewVersionEmptyTemplateOk +
+
+
+ testNeedsNewVersionNonExistingTemplateOk +
+
+
+ testNeedsNewVersionUnchangedTemplateOk +
+
+
+ testPreprocessExistingNoTemplateOk +
+
+
+ testPreprocessExistingRealTemplateOk +
+
+
+ testPreprocessNonExistingTemplateOk +
+
+
+
+
+
+
+ Times for Default suite +
+
+
+ + Total running time: 211 ms +
+
+
+
+
+
+
+ Reporter output for Default suite +
+
+
+
+
+
+ 0 ignored methods +
+
+
+
+
+
+ Methods in chronological order +
+
+
+
org.apache.ace.client.repository.helper.base.VelocityArtifactPreprocessorTest
+
+ setUp + 0 ms +
+
+ testNeedsNewVersionChangedTemplateOk + 13 ms +
+
+ testNeedsNewVersionEmptyTemplateOk + 216 ms +
+
+ testNeedsNewVersionNonExistingTemplateOk + 219 ms +
+
+ testNeedsNewVersionUnchangedTemplateOk + 221 ms +
+
+ testPreprocessExistingNoTemplateOk + 225 ms +
+
+ testPreprocessExistingRealTemplateOk + 228 ms +
+
+ testPreprocessNonExistingTemplateOk + 232 ms +
+
+
+
+
+ +