You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2007/07/28 03:26:57 UTC
svn commit: r560435 [2/2] - in
/incubator/tuscany/java/sca/modules/contribution-impl: ./
src/main/java/org/apache/tuscany/sca/contribution/impl/
src/main/java/org/apache/tuscany/sca/contribution/processor/impl/
src/main/java/org/apache/tuscany/sca/cont...
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java Fri Jul 27 18:26:55 2007
@@ -1,266 +1,266 @@
-/*
- * 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.tuscany.sca.contribution.service.impl;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.MalformedURLException;
-import java.net.URI;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.tuscany.sca.contribution.service.ContributionRepository;
-import org.apache.tuscany.sca.contribution.service.util.FileHelper;
-import org.apache.tuscany.sca.contribution.service.util.IOHelper;
-
-/**
- * The default implementation of ContributionRepository
- *
- * @version $Rev$ $Date$
- */
-public class ContributionRepositoryImpl implements ContributionRepository {
- private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
- private static final String DOMAIN_INDEX_FILENAME = "sca-domain.xml";
- private final File rootFile;
- private Map<String, String> contributionMap = new HashMap<String, String>();
-
- private URI domain;
- private XMLInputFactory factory;
-
- /**
- * Constructor with repository root
- *
- * @param repository
- */
- public ContributionRepositoryImpl(final String repository) throws IOException {
- String root = repository;
- if (repository == null) {
- root = AccessController.doPrivileged(new PrivilegedAction<String>() {
- public String run() {
- // Default to <user.home>/.tuscany/domains/local/
- String userHome = System.getProperty("user.home");
- String slash = File.separator;
- return userHome + slash + ".tuscany" + slash + "domains" + slash + "local" + slash;
- }
- });
- }
- this.rootFile = new File(root);
- this.domain = rootFile.toURI();
- FileHelper.forceMkdir(rootFile);
- if (!rootFile.exists() || !rootFile.isDirectory() || !rootFile.canRead()) {
- throw new IOException("The root is not a directory: " + repository);
- }
- factory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
- }
-
- public URI getDomain() {
- return domain;
- }
-
- /**
- * Resolve contribution location in the repository -> root repository /
- * contribution file -> contribution group id / artifact id / version
- *
- * @param contribution
- * @return
- */
- private File mapToFile(URL sourceURL) {
- String fileName = FileHelper.toFile(sourceURL).getName();
- return new File(rootFile, "contributions" + File.separator + fileName);
- }
-
- /**
- * Write a specific source inputstream to a file on disk
- *
- * @param source contents of the file to be written to disk
- * @param target file to be written
- * @throws IOException
- */
- public static void copy(InputStream source, File target) throws IOException {
- BufferedOutputStream out = null;
- BufferedInputStream in = null;
-
- try {
- out = new BufferedOutputStream(new FileOutputStream(target));
- in = new BufferedInputStream(source);
- IOHelper.copy(in, out);
- } finally {
- IOHelper.closeQuietly(out);
- IOHelper.closeQuietly(in);
- }
- }
-
- public URL store(String contribution, URL sourceURL, InputStream contributionStream) throws IOException {
- // where the file should be stored in the repository
- File location = mapToFile(sourceURL);
- FileHelper.forceMkdir(location.getParentFile());
-
- copy(contributionStream, location);
-
- // add contribution to repositoryContent
- URL contributionURL = location.toURL();
- URI relative = rootFile.toURI().relativize(location.toURI());
- contributionMap.put(contribution, relative.toString());
- saveMap();
-
- return contributionURL;
- }
-
- public URL store(String contribution, URL sourceURL) throws IOException {
- // where the file should be stored in the repository
- File location = mapToFile(sourceURL);
- File source = FileHelper.toFile(sourceURL);
- if (source == null || source.isFile()) {
- InputStream is = sourceURL.openStream();
- try {
- return store(contribution, sourceURL, is);
- } finally {
- IOHelper.closeQuietly(is);
- }
- }
-
- FileHelper.forceMkdir(location);
- FileHelper.copyDirectory(source, location);
-
- // add contribution to repositoryContent
- URI relative = rootFile.toURI().relativize(location.toURI());
- contributionMap.put(contribution, relative.toString());
- saveMap();
-
- return location.toURL();
- }
-
- public URL find(String contribution) {
- if (contribution == null) {
- return null;
- }
- String location = contributionMap.get(contribution);
- if (location == null) {
- return null;
- }
- try {
- return new File(rootFile, location).toURL();
- } catch (MalformedURLException e) {
- // Should not happen
- throw new AssertionError(e);
- }
- }
-
- public void remove(String contribution) {
- URL contributionURL = this.find(contribution);
- if (contributionURL != null) {
- // remove
- try {
- FileHelper.forceDelete(FileHelper.toFile(contributionURL));
- this.contributionMap.remove(contribution);
- saveMap();
- } catch (IOException ioe) {
- // handle file could not be removed
- }
- }
- }
-
- public List<String> list() {
- return new ArrayList<String>(contributionMap.keySet());
- }
-
- public void init() {
- File domainFile = new File(rootFile, "sca-domain.xml");
- if (!domainFile.isFile()) {
- return;
- }
- FileInputStream is;
- try {
- is = new FileInputStream(domainFile);
- } catch (FileNotFoundException e) {
- return;
- }
- try {
- XMLStreamReader reader = factory.createXMLStreamReader(new InputStreamReader(is, "UTF-8"));
- while (reader.hasNext()) {
- switch (reader.getEventType()) {
- case XMLStreamConstants.START_ELEMENT:
- String name = reader.getName().getLocalPart();
- if ("domain".equals(name)) {
- String uri = reader.getAttributeValue(null, "uri");
- if (uri != null) {
- domain = URI.create(uri);
- }
- }
- if ("contribution".equals(name)) {
- String uri = reader.getAttributeValue(null, "uri");
- String location = reader.getAttributeValue(null, "location");
- contributionMap.put(uri, location);
- }
- break;
- default:
- break;
- }
- reader.next();
- }
- } catch (Exception e) {
- // Ignore
- } finally {
- IOHelper.closeQuietly(is);
- }
- }
-
- private void saveMap() {
- File domainFile = new File(rootFile, DOMAIN_INDEX_FILENAME);
- FileOutputStream os = null;
- try {
- os = new FileOutputStream(domainFile);
- PrintWriter writer = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
- writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
- writer.println("<domain uri=\"" + getDomain() + "\" xmlns=\"" + NS + "\">");
- for (Map.Entry<String, String> e : contributionMap.entrySet()) {
- writer.println(" <contribution uri=\"" + e.getKey() + "\" location=\"" + e.getValue() + "\"/>");
- }
- writer.println("</domain>");
- writer.flush();
- } catch (IOException e) {
- throw new IllegalArgumentException(e);
- } finally {
- IOHelper.closeQuietly(os);
- }
- }
-
- public void destroy() {
- }
-
-}
+/*
+ * 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.tuscany.sca.contribution.service.impl;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.sca.contribution.service.ContributionRepository;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+
+/**
+ * The default implementation of ContributionRepository
+ *
+ * @version $Rev$ $Date$
+ */
+public class ContributionRepositoryImpl implements ContributionRepository {
+ private static final String NS = "http://tuscany.apache.org/xmlns/1.0-SNAPSHOT";
+ private static final String DOMAIN_INDEX_FILENAME = "sca-domain.xml";
+ private final File rootFile;
+ private Map<String, String> contributionMap = new HashMap<String, String>();
+
+ private URI domain;
+ private XMLInputFactory factory;
+
+ /**
+ * Constructor with repository root
+ *
+ * @param repository
+ */
+ public ContributionRepositoryImpl(final String repository) throws IOException {
+ String root = repository;
+ if (repository == null) {
+ root = AccessController.doPrivileged(new PrivilegedAction<String>() {
+ public String run() {
+ // Default to <user.home>/.tuscany/domains/local/
+ String userHome = System.getProperty("user.home");
+ String slash = File.separator;
+ return userHome + slash + ".tuscany" + slash + "domains" + slash + "local" + slash;
+ }
+ });
+ }
+ this.rootFile = new File(root);
+ this.domain = rootFile.toURI();
+ FileHelper.forceMkdir(rootFile);
+ if (!rootFile.exists() || !rootFile.isDirectory() || !rootFile.canRead()) {
+ throw new IOException("The root is not a directory: " + repository);
+ }
+ factory = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory", getClass().getClassLoader());
+ }
+
+ public URI getDomain() {
+ return domain;
+ }
+
+ /**
+ * Resolve contribution location in the repository -> root repository /
+ * contribution file -> contribution group id / artifact id / version
+ *
+ * @param contribution
+ * @return
+ */
+ private File mapToFile(URL sourceURL) {
+ String fileName = FileHelper.toFile(sourceURL).getName();
+ return new File(rootFile, "contributions" + File.separator + fileName);
+ }
+
+ /**
+ * Write a specific source inputstream to a file on disk
+ *
+ * @param source contents of the file to be written to disk
+ * @param target file to be written
+ * @throws IOException
+ */
+ public static void copy(InputStream source, File target) throws IOException {
+ BufferedOutputStream out = null;
+ BufferedInputStream in = null;
+
+ try {
+ out = new BufferedOutputStream(new FileOutputStream(target));
+ in = new BufferedInputStream(source);
+ IOHelper.copy(in, out);
+ } finally {
+ IOHelper.closeQuietly(out);
+ IOHelper.closeQuietly(in);
+ }
+ }
+
+ public URL store(String contribution, URL sourceURL, InputStream contributionStream) throws IOException {
+ // where the file should be stored in the repository
+ File location = mapToFile(sourceURL);
+ FileHelper.forceMkdir(location.getParentFile());
+
+ copy(contributionStream, location);
+
+ // add contribution to repositoryContent
+ URL contributionURL = location.toURL();
+ URI relative = rootFile.toURI().relativize(location.toURI());
+ contributionMap.put(contribution, relative.toString());
+ saveMap();
+
+ return contributionURL;
+ }
+
+ public URL store(String contribution, URL sourceURL) throws IOException {
+ // where the file should be stored in the repository
+ File location = mapToFile(sourceURL);
+ File source = FileHelper.toFile(sourceURL);
+ if (source == null || source.isFile()) {
+ InputStream is = sourceURL.openStream();
+ try {
+ return store(contribution, sourceURL, is);
+ } finally {
+ IOHelper.closeQuietly(is);
+ }
+ }
+
+ FileHelper.forceMkdir(location);
+ FileHelper.copyDirectory(source, location);
+
+ // add contribution to repositoryContent
+ URI relative = rootFile.toURI().relativize(location.toURI());
+ contributionMap.put(contribution, relative.toString());
+ saveMap();
+
+ return location.toURL();
+ }
+
+ public URL find(String contribution) {
+ if (contribution == null) {
+ return null;
+ }
+ String location = contributionMap.get(contribution);
+ if (location == null) {
+ return null;
+ }
+ try {
+ return new File(rootFile, location).toURL();
+ } catch (MalformedURLException e) {
+ // Should not happen
+ throw new AssertionError(e);
+ }
+ }
+
+ public void remove(String contribution) {
+ URL contributionURL = this.find(contribution);
+ if (contributionURL != null) {
+ // remove
+ try {
+ FileHelper.forceDelete(FileHelper.toFile(contributionURL));
+ this.contributionMap.remove(contribution);
+ saveMap();
+ } catch (IOException ioe) {
+ // handle file could not be removed
+ }
+ }
+ }
+
+ public List<String> list() {
+ return new ArrayList<String>(contributionMap.keySet());
+ }
+
+ public void init() {
+ File domainFile = new File(rootFile, "sca-domain.xml");
+ if (!domainFile.isFile()) {
+ return;
+ }
+ FileInputStream is;
+ try {
+ is = new FileInputStream(domainFile);
+ } catch (FileNotFoundException e) {
+ return;
+ }
+ try {
+ XMLStreamReader reader = factory.createXMLStreamReader(new InputStreamReader(is, "UTF-8"));
+ while (reader.hasNext()) {
+ switch (reader.getEventType()) {
+ case XMLStreamConstants.START_ELEMENT:
+ String name = reader.getName().getLocalPart();
+ if ("domain".equals(name)) {
+ String uri = reader.getAttributeValue(null, "uri");
+ if (uri != null) {
+ domain = URI.create(uri);
+ }
+ }
+ if ("contribution".equals(name)) {
+ String uri = reader.getAttributeValue(null, "uri");
+ String location = reader.getAttributeValue(null, "location");
+ contributionMap.put(uri, location);
+ }
+ break;
+ default:
+ break;
+ }
+ reader.next();
+ }
+ } catch (Exception e) {
+ // Ignore
+ } finally {
+ IOHelper.closeQuietly(is);
+ }
+ }
+
+ private void saveMap() {
+ File domainFile = new File(rootFile, DOMAIN_INDEX_FILENAME);
+ FileOutputStream os = null;
+ try {
+ os = new FileOutputStream(domainFile);
+ PrintWriter writer = new PrintWriter(new OutputStreamWriter(os, "UTF-8"));
+ writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+ writer.println("<domain uri=\"" + getDomain() + "\" xmlns=\"" + NS + "\">");
+ for (Map.Entry<String, String> e : contributionMap.entrySet()) {
+ writer.println(" <contribution uri=\"" + e.getKey() + "\" location=\"" + e.getValue() + "\"/>");
+ }
+ writer.println("</domain>");
+ writer.flush();
+ } catch (IOException e) {
+ throw new IllegalArgumentException(e);
+ } finally {
+ IOHelper.closeQuietly(os);
+ }
+ }
+
+ public void destroy() {
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/ContributionRepositoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java Fri Jul 27 18:26:55 2007
@@ -1,57 +1,57 @@
-/*
- * 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.tuscany.sca.contribution.service.impl;
-
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-
-/**
- * Exception that indicates that the supplied XML Document invalid.
- *
- * @version $Rev: 511466 $ $Date: 2007-02-25 00:45:22 -0800 (Sun, 25 Feb 2007) $
- */
-public class InvalidContributionMetadataException extends ContributionException {
-
- /**
- *
- */
- private static final long serialVersionUID = -3184477070625689942L;
-
- protected InvalidContributionMetadataException() {
- }
-
- protected InvalidContributionMetadataException(String message) {
- super(message);
- }
-
- protected InvalidContributionMetadataException(String message, String identifier) {
- super(message, identifier);
- }
-
- protected InvalidContributionMetadataException(String message, Throwable cause) {
- super(message, cause);
- }
-
- protected InvalidContributionMetadataException(String message, String identifier, Throwable cause) {
- super(message, identifier, cause);
- }
-
- protected InvalidContributionMetadataException(Throwable cause) {
- super(cause);
- }
-}
+/*
+ * 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.tuscany.sca.contribution.service.impl;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Exception that indicates that the supplied XML Document invalid.
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidContributionMetadataException extends ContributionException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3184477070625689942L;
+
+ protected InvalidContributionMetadataException() {
+ }
+
+ protected InvalidContributionMetadataException(String message) {
+ super(message);
+ }
+
+ protected InvalidContributionMetadataException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected InvalidContributionMetadataException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected InvalidContributionMetadataException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected InvalidContributionMetadataException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionMetadataException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java Fri Jul 27 18:26:55 2007
@@ -1,57 +1,57 @@
-/*
- * 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.tuscany.sca.contribution.service.impl;
-
-import org.apache.tuscany.sca.contribution.service.ContributionException;
-
-/**
- * Exception that indicates that the supplied contribution URI is invalid or inexistent.
- *
- * @version $Rev: 511466 $ $Date: 2007-02-25 00:45:22 -0800 (Sun, 25 Feb 2007) $
- */
-public class InvalidContributionURIException extends ContributionException {
-
- /**
- *
- */
- private static final long serialVersionUID = -3184477070625689942L;
-
- protected InvalidContributionURIException() {
- }
-
- protected InvalidContributionURIException(String message) {
- super(message);
- }
-
- protected InvalidContributionURIException(String message, String identifier) {
- super(message, identifier);
- }
-
- protected InvalidContributionURIException(String message, Throwable cause) {
- super(message, cause);
- }
-
- protected InvalidContributionURIException(String message, String identifier, Throwable cause) {
- super(message, identifier, cause);
- }
-
- protected InvalidContributionURIException(Throwable cause) {
- super(cause);
- }
-}
+/*
+ * 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.tuscany.sca.contribution.service.impl;
+
+import org.apache.tuscany.sca.contribution.service.ContributionException;
+
+/**
+ * Exception that indicates that the supplied contribution URI is invalid or inexistent.
+ *
+ * @version $Rev$ $Date$
+ */
+public class InvalidContributionURIException extends ContributionException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3184477070625689942L;
+
+ protected InvalidContributionURIException() {
+ }
+
+ protected InvalidContributionURIException(String message) {
+ super(message);
+ }
+
+ protected InvalidContributionURIException(String message, String identifier) {
+ super(message, identifier);
+ }
+
+ protected InvalidContributionURIException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ protected InvalidContributionURIException(String message, String identifier, Throwable cause) {
+ super(message, identifier, cause);
+ }
+
+ protected InvalidContributionURIException(Throwable cause) {
+ super(cause);
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/impl/InvalidContributionURIException.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/ConcurrentHashList.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/ConcurrentHashList.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/ConcurrentHashList.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/ConcurrentHashList.java Fri Jul 27 18:26:55 2007
@@ -1,76 +1,76 @@
-/*
- * 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.tuscany.sca.contribution.service.util;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-public class ConcurrentHashList <K,T> {
- private Map<K, List<T>> hashList;
-
- public ConcurrentHashList() {
- hashList = new ConcurrentHashMap<K, List<T>>();
- }
-
- public ConcurrentHashList(int initialCapacity) {
- hashList = new ConcurrentHashMap<K, List<T>>(initialCapacity);
- }
-
- public void clear() {
- hashList.clear();
- }
-
- public List<T> get(K key) {
- List<T> resultList = hashList.get(key);
- if( resultList == null) {
- resultList = new ArrayList<T>();
- hashList.put(key, resultList);
- }
- return resultList;
- }
-
- public boolean isEmpty() {
- return hashList.isEmpty();
- }
-
- public T put(K key, T value) {
- this.get(key).add(value);
- return value;
- }
-
- public int size() {
- return hashList.size();
- }
-
-
- public static void main(String args[]) {
- ConcurrentHashList<String, String> list = new ConcurrentHashList<String, String>();
- list.put("a", "a1");
- list.put("a", "a2");
- list.put("a", "a3");
-
- for(String s : list.get("a")) {
- System.out.println("Key a - " + s);
- }
- }
-
-}
+/*
+ * 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.tuscany.sca.contribution.service.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class ConcurrentHashList <K,T> {
+ private Map<K, List<T>> hashList;
+
+ public ConcurrentHashList() {
+ hashList = new ConcurrentHashMap<K, List<T>>();
+ }
+
+ public ConcurrentHashList(int initialCapacity) {
+ hashList = new ConcurrentHashMap<K, List<T>>(initialCapacity);
+ }
+
+ public void clear() {
+ hashList.clear();
+ }
+
+ public List<T> get(K key) {
+ List<T> resultList = hashList.get(key);
+ if( resultList == null) {
+ resultList = new ArrayList<T>();
+ hashList.put(key, resultList);
+ }
+ return resultList;
+ }
+
+ public boolean isEmpty() {
+ return hashList.isEmpty();
+ }
+
+ public T put(K key, T value) {
+ this.get(key).add(value);
+ return value;
+ }
+
+ public int size() {
+ return hashList.size();
+ }
+
+
+ public static void main(String args[]) {
+ ConcurrentHashList<String, String> list = new ConcurrentHashList<String, String>();
+ list.put("a", "a1");
+ list.put("a", "a2");
+ list.put("a", "a3");
+
+ for(String s : list.get("a")) {
+ System.out.println("Key a - " + s);
+ }
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/ConcurrentHashList.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/ConcurrentHashList.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/FileHelper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/main/java/org/apache/tuscany/sca/contribution/service/util/IOHelper.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java Fri Jul 27 18:26:55 2007
@@ -1,45 +1,45 @@
-/*
- * 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.tuscany.sca.contribution.processor;
-
-import java.io.File;
-import java.net.URI;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
-
-public class FolderContributionPackageProcessorTestCase extends TestCase {
- private static final String FOLDER_CONTRIBUTION = ".";
-
- private File contributionRoot;
-
- protected void setUp() throws Exception {
- super.setUp();
- this.contributionRoot = new File(FOLDER_CONTRIBUTION);
- }
-
- public final void testProcessPackageArtifacts() throws Exception {
- FolderContributionProcessor folderProcessor = new FolderContributionProcessor();
-
- List<URI> artifacts = folderProcessor.getArtifacts(contributionRoot.toURL(), null);
- assertNotNull(artifacts);
- }
-}
+/*
+ * 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.tuscany.sca.contribution.processor;
+
+import java.io.File;
+import java.net.URI;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.impl.FolderContributionProcessor;
+
+public class FolderContributionPackageProcessorTestCase extends TestCase {
+ private static final String FOLDER_CONTRIBUTION = ".";
+
+ private File contributionRoot;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.contributionRoot = new File(FOLDER_CONTRIBUTION);
+ }
+
+ public final void testProcessPackageArtifacts() throws Exception {
+ FolderContributionProcessor folderProcessor = new FolderContributionProcessor();
+
+ List<URI> artifacts = folderProcessor.getArtifacts(contributionRoot.toURL(), null);
+ assertNotNull(artifacts);
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/FolderContributionPackageProcessorTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java Fri Jul 27 18:26:55 2007
@@ -1,52 +1,52 @@
-/*
- * 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.tuscany.sca.contribution.processor;
-
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
-import org.apache.tuscany.sca.contribution.service.util.IOHelper;
-
-public class JarContributionPackageProcessorTestCase extends TestCase {
- private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
-
- protected void setUp() throws Exception {
- super.setUp();
- }
-
- public final void testProcessPackageArtifacts() throws Exception {
- JarContributionProcessor jarProcessor = new JarContributionProcessor();
-
- URL jarURL = getClass().getResource(JAR_CONTRIBUTION);
- InputStream jarStream = jarURL.openStream();
- List<URI> artifacts = null;
- try {
- artifacts = jarProcessor.getArtifacts(jarURL, jarStream);
- } finally {
- IOHelper.closeQuietly(jarStream);
- }
-
- assertNotNull(artifacts);
- }
-}
+/*
+ * 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.tuscany.sca.contribution.processor;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.processor.impl.JarContributionProcessor;
+import org.apache.tuscany.sca.contribution.service.util.IOHelper;
+
+public class JarContributionPackageProcessorTestCase extends TestCase {
+ private static final String JAR_CONTRIBUTION = "/repository/sample-calculator.jar";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ public final void testProcessPackageArtifacts() throws Exception {
+ JarContributionProcessor jarProcessor = new JarContributionProcessor();
+
+ URL jarURL = getClass().getResource(JAR_CONTRIBUTION);
+ InputStream jarStream = jarURL.openStream();
+ List<URI> artifacts = null;
+ try {
+ artifacts = jarProcessor.getArtifacts(jarURL, jarStream);
+ } finally {
+ IOHelper.closeQuietly(jarStream);
+ }
+
+ assertNotNull(artifacts);
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/processor/JarContributionPackageProcessorTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleArtifactResolverTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleArtifactResolverTestCase.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleArtifactResolverTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleArtifactResolverTestCase.java Fri Jul 27 18:26:55 2007
@@ -1,138 +1,138 @@
- /*
- * 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.tuscany.sca.contribution.resolver;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.ContributionFactory;
-import org.apache.tuscany.sca.contribution.DeployedArtifact;
-import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
-
-/**
- * Test DefaultArtifactResolver.
- *
- * @version $Rev: 548560 $ $Date: 2007-06-18 19:25:19 -0700 (Mon, 18 Jun 2007) $
- */
-public class ExtensibleArtifactResolverTestCase extends TestCase {
- private ModelResolverExtensionPoint resolverExtensionPoint;
- private ExtensibleModelResolver resolver;
-
- private ContributionFactory factory;
-
- protected void setUp() throws Exception {
-
- resolverExtensionPoint = new DefaultModelResolverExtensionPoint();
- resolverExtensionPoint.addResolver(Model.class, DefaultModelResolver.class);
-
- resolver = new ExtensibleModelResolver(null, resolverExtensionPoint);
-
- factory = new ContributionFactoryImpl();
- }
-
- protected void tearDown() throws Exception {
- resolverExtensionPoint.removeResolver(Model.class);
- resolverExtensionPoint = null;
- resolver = null;
- factory = null;
- }
-
- public void testResolvedDefault() {
- OtherModel a = new OtherModel("a");
- resolver.addModel(a);
- OtherModel x = new OtherModel("a");
- x = resolver.resolveModel(OtherModel.class, x);
- assertTrue(x == a);
- }
-
- public void testResolvedRegisteredClass() {
- Model a = new Model("a");
- resolver.addModel(a);
- Model x = new Model("a");
- x = resolver.resolveModel(Model.class, x);
- assertTrue(x == a);
- }
-
- public void testUnresolvedDefault() {
- OtherModel x = new OtherModel("a");
- OtherModel y = resolver.resolveModel(OtherModel.class, x);
- assertTrue(x == y);
- }
-
- public void testUnresolved() {
- Model x = new Model("a");
- Model y = resolver.resolveModel(Model.class, x);
- assertTrue(x == y);
- }
-
- public void testResolveClass() {
- ClassReference ref = new ClassReference(getClass().getName());
- ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
- assertTrue(clazz.getJavaClass() == getClass());
- }
-
- public void testUnresolvedClass() {
- ClassReference ref = new ClassReference("NonExistentClass");
- ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
- assertTrue(clazz.isUnresolved());
- assertTrue(clazz.getJavaClass() == null);
- }
-
- public void testResolvedArtifact() {
- DeployedArtifact artifact = factory.createDeployedArtifact();
- artifact.setURI("foo/bar");
- resolver.addModel(artifact);
- DeployedArtifact x = factory.createDeployedArtifact();
- x.setURI("foo/bar");
- x = resolver.resolveModel(DeployedArtifact.class, x);
- assertTrue(x == artifact);
- }
-
- class Model {
- private String name;
-
- Model(String name) {
- this.name = name;
- }
-
- public int hashCode() {
- return name.hashCode();
- }
-
- public boolean equals(Object obj) {
- return name.equals(((Model)obj).name);
- }
- }
-
- class OtherModel {
- private String name;
-
- OtherModel(String name) {
- this.name = name;
- }
-
- public int hashCode() {
- return name.hashCode();
- }
-
- public boolean equals(Object obj) {
- return name.equals(((OtherModel)obj).name);
- }
- }
-}
+ /*
+ * 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.tuscany.sca.contribution.resolver;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.ContributionFactory;
+import org.apache.tuscany.sca.contribution.DeployedArtifact;
+import org.apache.tuscany.sca.contribution.impl.ContributionFactoryImpl;
+
+/**
+ * Test DefaultArtifactResolver.
+ *
+ * @version $Rev$ $Date$
+ */
+public class ExtensibleArtifactResolverTestCase extends TestCase {
+ private ModelResolverExtensionPoint resolverExtensionPoint;
+ private ExtensibleModelResolver resolver;
+
+ private ContributionFactory factory;
+
+ protected void setUp() throws Exception {
+
+ resolverExtensionPoint = new DefaultModelResolverExtensionPoint();
+ resolverExtensionPoint.addResolver(Model.class, DefaultModelResolver.class);
+
+ resolver = new ExtensibleModelResolver(null, resolverExtensionPoint);
+
+ factory = new ContributionFactoryImpl();
+ }
+
+ protected void tearDown() throws Exception {
+ resolverExtensionPoint.removeResolver(Model.class);
+ resolverExtensionPoint = null;
+ resolver = null;
+ factory = null;
+ }
+
+ public void testResolvedDefault() {
+ OtherModel a = new OtherModel("a");
+ resolver.addModel(a);
+ OtherModel x = new OtherModel("a");
+ x = resolver.resolveModel(OtherModel.class, x);
+ assertTrue(x == a);
+ }
+
+ public void testResolvedRegisteredClass() {
+ Model a = new Model("a");
+ resolver.addModel(a);
+ Model x = new Model("a");
+ x = resolver.resolveModel(Model.class, x);
+ assertTrue(x == a);
+ }
+
+ public void testUnresolvedDefault() {
+ OtherModel x = new OtherModel("a");
+ OtherModel y = resolver.resolveModel(OtherModel.class, x);
+ assertTrue(x == y);
+ }
+
+ public void testUnresolved() {
+ Model x = new Model("a");
+ Model y = resolver.resolveModel(Model.class, x);
+ assertTrue(x == y);
+ }
+
+ public void testResolveClass() {
+ ClassReference ref = new ClassReference(getClass().getName());
+ ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
+ assertTrue(clazz.getJavaClass() == getClass());
+ }
+
+ public void testUnresolvedClass() {
+ ClassReference ref = new ClassReference("NonExistentClass");
+ ClassReference clazz = resolver.resolveModel(ClassReference.class, ref);
+ assertTrue(clazz.isUnresolved());
+ assertTrue(clazz.getJavaClass() == null);
+ }
+
+ public void testResolvedArtifact() {
+ DeployedArtifact artifact = factory.createDeployedArtifact();
+ artifact.setURI("foo/bar");
+ resolver.addModel(artifact);
+ DeployedArtifact x = factory.createDeployedArtifact();
+ x.setURI("foo/bar");
+ x = resolver.resolveModel(DeployedArtifact.class, x);
+ assertTrue(x == artifact);
+ }
+
+ class Model {
+ private String name;
+
+ Model(String name) {
+ this.name = name;
+ }
+
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ public boolean equals(Object obj) {
+ return name.equals(((Model)obj).name);
+ }
+ }
+
+ class OtherModel {
+ private String name;
+
+ OtherModel(String name) {
+ this.name = name;
+ }
+
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ public boolean equals(Object obj) {
+ return name.equals(((OtherModel)obj).name);
+ }
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleArtifactResolverTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleArtifactResolverTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java Fri Jul 27 18:26:55 2007
@@ -1,53 +1,53 @@
-/*
- * 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.tuscany.sca.contribution.services;
-
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.ContentType;
-import org.apache.tuscany.sca.contribution.service.impl.ArtifactTypeDescriberImpl;
-
-public class ContentTypeDescriberImplTestCase extends TestCase {
- private ArtifactTypeDescriberImpl contentTypeDescriber;
-
- public void testResolveContentType() throws Exception {
- URL artifactURL = getClass().getResource("/test.composite");
- assertEquals(ContentType.COMPOSITE, contentTypeDescriber.getType(artifactURL, null));
- }
-
-
- public void testResolveUnknownContentType() throws Exception {
- URL artifactURL = getClass().getResource("/test.ext");
- assertNull(contentTypeDescriber.getType(artifactURL, null));
- }
-
- public void testDefaultContentType() throws Exception {
- URL artifactURL = getClass().getResource("/test.ext");
- assertEquals("application/vnd.tuscany.ext",
- contentTypeDescriber.getType(artifactURL, "application/vnd.tuscany.ext"));
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- contentTypeDescriber = new ArtifactTypeDescriberImpl();
- }
-
-}
+/*
+ * 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.tuscany.sca.contribution.services;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.ContentType;
+import org.apache.tuscany.sca.contribution.service.impl.ArtifactTypeDescriberImpl;
+
+public class ContentTypeDescriberImplTestCase extends TestCase {
+ private ArtifactTypeDescriberImpl contentTypeDescriber;
+
+ public void testResolveContentType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.composite");
+ assertEquals(ContentType.COMPOSITE, contentTypeDescriber.getType(artifactURL, null));
+ }
+
+
+ public void testResolveUnknownContentType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.ext");
+ assertNull(contentTypeDescriber.getType(artifactURL, null));
+ }
+
+ public void testDefaultContentType() throws Exception {
+ URL artifactURL = getClass().getResource("/test.ext");
+ assertEquals("application/vnd.tuscany.ext",
+ contentTypeDescriber.getType(artifactURL, "application/vnd.tuscany.ext"));
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ contentTypeDescriber = new ArtifactTypeDescriberImpl();
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContentTypeDescriberImplTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java Fri Jul 27 18:26:55 2007
@@ -1,85 +1,85 @@
-/*
- * 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.tuscany.sca.contribution.services;
-
-import javax.xml.stream.XMLInputFactory;
-
-import junit.framework.TestCase;
-
-/**
- * @version $Rev: 538445 $ $Date: 2007-05-15 23:20:37 -0700 (Tue, 15 May 2007) $
- */
-public class ContributionMetadataDocumentProcessorTestCase extends TestCase {
-
- private static final String VALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
- + "<deployable composite=\"ns:Composite1\"/>"
- + "<deployable composite=\"ns:Composite2\"/>"
- + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
- + "<export namespace=\"http://ns1\"/>"
- + "</contribution>";
-
- private static final String INVALID_XML =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
- + "<deployable composite=\"ns:Composite1\"/>"
- + "<deployable composite=\"ns3:Composite1\"/>"
- + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
- + "<export namespace=\"http://ns1\"/>"
- + "</contribution>";
-
- private XMLInputFactory xmlFactory;
-
- protected void setUp() throws Exception {
- super.setUp();
-// xmlFactory = XMLInputFactory.newInstance();
- }
-
- public void testLoad() throws Exception {
-// XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
-//
-// ContributionFactory factory = new ContributionFactoryImpl();
-// ContributionMetadataLoaderImpl loader =
-// new ContributionMetadataLoaderImpl(new DefaultAssemblyFactory(), factory);
-// Contribution contribution = factory.createContribution();
-// contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
-// loader.load(contribution, reader);
-// assertNotNull(contribution);
-// assertEquals(1, contribution.getImports().size());
-// assertEquals(1, contribution.getExports().size());
-// assertEquals(2, contribution.getDeployables().size());
- }
-
- public void testLoadInvalid() throws Exception {
-// XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
-// ContributionFactory factory = new ContributionFactoryImpl();
-// ContributionMetadataLoaderImpl loader =
-// new ContributionMetadataLoaderImpl(new DefaultAssemblyFactory(), factory);
-// Contribution contribution = factory.createContribution();
-// contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
-// try {
-// loader.load(contribution, reader);
-// fail("InvalidException should have been thrown");
-// } catch (InvalidValueException e) {
-// assertTrue(true);
-// }
- }
-}
+/*
+ * 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.tuscany.sca.contribution.services;
+
+import javax.xml.stream.XMLInputFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ContributionMetadataDocumentProcessorTestCase extends TestCase {
+
+ private static final String VALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable composite=\"ns:Composite2\"/>"
+ + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
+ + "<export namespace=\"http://ns1\"/>"
+ + "</contribution>";
+
+ private static final String INVALID_XML =
+ "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
+ + "<contribution xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" xmlns:ns=\"http://ns\">"
+ + "<deployable composite=\"ns:Composite1\"/>"
+ + "<deployable composite=\"ns3:Composite1\"/>"
+ + "<import namespace=\"http://ns2\" location=\"sca://contributions/002/\"/>"
+ + "<export namespace=\"http://ns1\"/>"
+ + "</contribution>";
+
+ private XMLInputFactory xmlFactory;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+// xmlFactory = XMLInputFactory.newInstance();
+ }
+
+ public void testLoad() throws Exception {
+// XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(VALID_XML));
+//
+// ContributionFactory factory = new ContributionFactoryImpl();
+// ContributionMetadataLoaderImpl loader =
+// new ContributionMetadataLoaderImpl(new DefaultAssemblyFactory(), factory);
+// Contribution contribution = factory.createContribution();
+// contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
+// loader.load(contribution, reader);
+// assertNotNull(contribution);
+// assertEquals(1, contribution.getImports().size());
+// assertEquals(1, contribution.getExports().size());
+// assertEquals(2, contribution.getDeployables().size());
+ }
+
+ public void testLoadInvalid() throws Exception {
+// XMLStreamReader reader = xmlFactory.createXMLStreamReader(new StringReader(INVALID_XML));
+// ContributionFactory factory = new ContributionFactoryImpl();
+// ContributionMetadataLoaderImpl loader =
+// new ContributionMetadataLoaderImpl(new DefaultAssemblyFactory(), factory);
+// Contribution contribution = factory.createContribution();
+// contribution.setModelResolver(new ModelResolverImpl(getClass().getClassLoader()));
+// try {
+// loader.load(contribution, reader);
+// fail("InvalidException should have been thrown");
+// } catch (InvalidValueException e) {
+// assertTrue(true);
+// }
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionMetadataDocumentProcessorTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java?view=diff&rev=560435&r1=560434&r2=560435
==============================================================================
--- incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java Fri Jul 27 18:26:55 2007
@@ -1,79 +1,79 @@
-/*
- * 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.tuscany.sca.contribution.services;
-
-import java.io.File;
-import java.io.InputStream;
-import java.net.URL;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
-import org.apache.tuscany.sca.contribution.service.util.FileHelper;
-
-public class ContributionRepositoryTestCase extends TestCase {
- private ContributionRepositoryImpl repository;
-
- protected void setUp() throws Exception {
- super.setUp();
- // create repository (this should re-create the root directory)
- this.repository = new ContributionRepositoryImpl("target/repository/");
- repository.init();
- }
-
- public void testStore() throws Exception {
- String resourceLocation = "/repository/sample-calculator.jar";
- String contribution = "sample-calculator.jar";
- URL contributionLocation = getClass().getResource(resourceLocation);
- InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
- repository.store(contribution, contributionLocation, contributionStream);
-
- URL contributionURL = repository.find(contribution);
- assertNotNull(contributionURL);
- }
-
- public void testRemove() throws Exception {
- String resourceLocation = "/repository/sample-calculator.jar";
- String contribution = "sample-calculator.jar";
- URL contributionLocation = getClass().getResource(resourceLocation);
- InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
- repository.store(contribution, contributionLocation, contributionStream);
-
- repository.remove(contribution);
- URL contributionURL = repository.find(contribution);
- assertNull(contributionURL);
- }
-
- public void testList() throws Exception {
- String resourceLocation = "/repository/sample-calculator.jar";
- String contribution = "sample-calculator.jar";
- URL contributionLocation = getClass().getResource(resourceLocation);
- InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
- repository.store(contribution, contributionLocation, contributionStream);
-
- assertEquals(1, repository.list().size());
- }
-
- @Override
- protected void tearDown() throws Exception {
- super.tearDown();
- FileHelper.deleteDirectory(new File("target/repository"));
- }
-}
+/*
+ * 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.tuscany.sca.contribution.services;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.contribution.service.impl.ContributionRepositoryImpl;
+import org.apache.tuscany.sca.contribution.service.util.FileHelper;
+
+public class ContributionRepositoryTestCase extends TestCase {
+ private ContributionRepositoryImpl repository;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ // create repository (this should re-create the root directory)
+ this.repository = new ContributionRepositoryImpl("target/repository/");
+ repository.init();
+ }
+
+ public void testStore() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ String contribution = "sample-calculator.jar";
+ URL contributionLocation = getClass().getResource(resourceLocation);
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionLocation, contributionStream);
+
+ URL contributionURL = repository.find(contribution);
+ assertNotNull(contributionURL);
+ }
+
+ public void testRemove() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ String contribution = "sample-calculator.jar";
+ URL contributionLocation = getClass().getResource(resourceLocation);
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionLocation, contributionStream);
+
+ repository.remove(contribution);
+ URL contributionURL = repository.find(contribution);
+ assertNull(contributionURL);
+ }
+
+ public void testList() throws Exception {
+ String resourceLocation = "/repository/sample-calculator.jar";
+ String contribution = "sample-calculator.jar";
+ URL contributionLocation = getClass().getResource(resourceLocation);
+ InputStream contributionStream = getClass().getResourceAsStream(resourceLocation);
+ repository.store(contribution, contributionLocation, contributionStream);
+
+ assertEquals(1, repository.list().size());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ FileHelper.deleteDirectory(new File("target/repository"));
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/ContributionRepositoryTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/tuscany/java/sca/modules/contribution-impl/src/test/java/org/apache/tuscany/sca/contribution/services/PackageTypeDescriberImplTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org