From ad1c9458ea08eb593be252b706a88568f17c494c Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 19 Nov 2008 00:07:37 +0000 Subject: Moving current trunk modules to contrib, before starting the Equinox branch merge git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@718812 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultNamespaceImportExportFactory.java | 30 ---- .../contribution/namespace/NamespaceExport.java | 46 ------ .../contribution/namespace/NamespaceImport.java | 59 -------- .../namespace/NamespaceImportExportFactory.java | 42 ------ .../namespace/impl/NamespaceExportImpl.java | 54 ------- .../impl/NamespaceExportModelResolver.java | 54 ------- .../namespace/impl/NamespaceExportProcessor.java | 162 -------------------- .../impl/NamespaceImportExportFactoryImpl.java | 41 ----- .../impl/NamespaceImportExportListener.java | 98 ------------ .../namespace/impl/NamespaceImportImpl.java | 92 ----------- .../namespace/impl/NamespaceImportProcessor.java | 168 --------------------- ...ribution.namespace.NamespaceImportExportFactory | 18 --- ...ca.contribution.processor.StAXArtifactProcessor | 19 --- ...y.sca.contribution.service.ContributionListener | 18 --- ...bution-namespace-validation-messages.properties | 23 --- .../impl/NamespaceExportProcessorTestCase.java | 103 ------------- .../impl/NamespaceImportProcessorTestCase.java | 108 ------------- 17 files changed, 1135 deletions(-) delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportModelResolver.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java delete mode 100644 java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory delete mode 100644 java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor delete mode 100644 java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener delete mode 100644 java/sca/modules/contribution-namespace/src/main/resources/contribution-namespace-validation-messages.properties delete mode 100644 java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java delete mode 100644 java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java (limited to 'java/sca/modules/contribution-namespace/src') diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java deleted file mode 100644 index a71fa61a54..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/DefaultNamespaceImportExportFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace; - -import org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportFactoryImpl; - -/** - * Default Namespace Import/Export model factory implementation - * - * @version $Rev$ $Date$ - */ -public class DefaultNamespaceImportExportFactory extends NamespaceImportExportFactoryImpl implements NamespaceImportExportFactory { -} diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java deleted file mode 100644 index c68aee8521..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceExport.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace; - -import org.apache.tuscany.sca.contribution.Export; - - -/** - * The representation of an XML namespace export. - * - * @version $Rev$ $Date$ - */ -public interface NamespaceExport extends Export { - - /** - * Get Namespace that identifies the export - * - * @return The exported namespace - */ - String getNamespace(); - - /** - * Set Namespace that identifies the export - * - * @param namespace The exported namespace - */ - void setNamespace(String namespace); - -} diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java deleted file mode 100644 index 8af36d7da0..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImport.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace; - -import org.apache.tuscany.sca.contribution.Import; - -/** - * The representation of an XML namespace import. - * - * @version $Rev$ $Date$ - */ -public interface NamespaceImport extends Import { - - /** - * Get the location used to resolve the definitions for this import - * - * @return The import location - */ - String getLocation(); - - /** - * Set the location used to resolve the definitions for this import - * - * @param location The import location - */ - void setLocation(String location); - - /** - * Get Namespace that identifies the import - * - * @return The namespace - */ - String getNamespace(); - - /** - * Set Namespace that identifies the import - * - * @param namespace The namespace - */ - void setNamespace(String namespace); - -} \ No newline at end of file diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java deleted file mode 100644 index cfbac8bb1f..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/NamespaceImportExportFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace; - -/** - * Base Namespace import/export model factory - * - * @version $Rev$ $Date$ - */ -public interface NamespaceImportExportFactory { - - /** - * Create a namespace import model object - * - * @return The new NamespaceImport model object - */ - NamespaceImport createNamespaceImport(); - - /** - * Create a namespace export model object - * - * @return The new NamespaceExport model object - */ - NamespaceExport createNamespaceExport(); -} diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java deleted file mode 100644 index 8991585d32..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace.impl; - -import org.apache.tuscany.sca.contribution.namespace.NamespaceExport; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; - -/** - * The representation of an export for the contribution - * - * @version $Rev$ $Date$ - */ -public class NamespaceExportImpl implements NamespaceExport { - private String namespace; - private ModelResolver modelResolver; - - protected NamespaceExportImpl() { - super(); - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - public ModelResolver getModelResolver() { - return modelResolver; - } - - public void setModelResolver(ModelResolver modelResolver) { - this.modelResolver = modelResolver; - } - -} diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportModelResolver.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportModelResolver.java deleted file mode 100644 index 5c5ae22f77..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportModelResolver.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace.impl; - -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; - -/** - * A model resolver for namespace exports. - * - * @version $Rev$ $Date$ - */ -public class NamespaceExportModelResolver implements ModelResolver { - - private ModelResolver resolver; - - public NamespaceExportModelResolver(ModelResolver resolver) { - this.resolver = resolver; - } - - public void addModel(Object resolved) { - throw new IllegalStateException(); - } - - public Object removeModel(Object resolved) { - throw new IllegalStateException(); - } - - public T resolveModel(Class modelClass, T unresolved) { - - // Just delegate to the contribution's model resolver, namespace - // based filtering is implemented in the model specific model - // resolver, which know how to get the namespace of the particular - // type of model that they handle - return resolver.resolveModel(modelClass, unresolved); - } - -} diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java deleted file mode 100644 index a316818b0f..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessor.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace.impl; - -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.namespace.NamespaceExport; -import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.Problem.Severity; - -/** - * Artifact processor for Namespace export - * - * @version $Rev$ $Date$ - */ -public class NamespaceExportProcessor implements StAXArtifactProcessor { - - private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0"; - private static final QName EXPORT = new QName(SCA10_NS, "export"); - private static final String NAMESPACE = "namespace"; - - private final NamespaceImportExportFactory factory; - private final Monitor monitor; - - public NamespaceExportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - this.factory = modelFactories.getFactory(NamespaceImportExportFactory.class); - this.monitor = monitor; - } - - /** - * Report a warning. - * - * @param problems - * @param message - * @param model - */ - private void error(String message, Object model, Object... messageParameters) { - if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-namespace-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters); - monitor.problem(problem); - } - } - - /** - * Report a exception. - * - * @param problems - * @param message - * @param model - */ - private void error(String message, Object model, Exception ex) { - if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-namespace-validation-messages", Severity.ERROR, model, message, ex); - monitor.problem(problem); - } - } - - public QName getArtifactType() { - return EXPORT; - } - - public Class getModelType() { - return NamespaceExport.class; - } - - /** - * Process - */ - public NamespaceExport read(XMLStreamReader reader) throws ContributionReadException { - NamespaceExport namespaceExport = this.factory.createNamespaceExport(); - QName element = null; - - try { - while (reader.hasNext()) { - int event = reader.getEventType(); - switch (event) { - case START_ELEMENT: - element = reader.getName(); - - // Read - if (EXPORT.equals(element)) { - String ns = reader.getAttributeValue(null, NAMESPACE); - if (ns == null) { - error("AttributeNameSpaceMissing", reader); - //throw new ContributionReadException("Attribute 'namespace' is missing"); - } else - namespaceExport.setNamespace(ns); - } - - break; - case XMLStreamConstants.END_ELEMENT: - if (EXPORT.equals(reader.getName())) { - return namespaceExport; - } - break; - } - - // Read the next element - if (reader.hasNext()) { - reader.next(); - } - } - } - catch (XMLStreamException e) { - ContributionReadException ex = new ContributionReadException(e); - error("XMLStreamException", reader, ex); - } - - return namespaceExport; - } - - public void write(NamespaceExport namespaceExport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - - // Write - writer.writeStartElement(EXPORT.getNamespaceURI(), EXPORT.getLocalPart()); - - if (namespaceExport.getNamespace() != null) { - writer.writeAttribute(NAMESPACE, namespaceExport.getNamespace()); - } - - writer.writeEndElement(); - } - - public void resolve(NamespaceExport namespaceExport, ModelResolver resolver) throws ContributionResolveException { - - if (namespaceExport.getNamespace() != null) - // Initialize the export's resolver - namespaceExport.setModelResolver(new NamespaceExportModelResolver(resolver)); - } -} diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java deleted file mode 100644 index 1146e593a9..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportFactoryImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace.impl; - -import org.apache.tuscany.sca.contribution.namespace.NamespaceExport; -import org.apache.tuscany.sca.contribution.namespace.NamespaceImport; -import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory; - -/** - * Namespace Import/Export model factory implementation - * - * @version $Rev$ $Date$ - */ -public class NamespaceImportExportFactoryImpl implements NamespaceImportExportFactory { - - public NamespaceImport createNamespaceImport() { - return new NamespaceImportImpl(); - } - - public NamespaceExport createNamespaceExport() { - return new NamespaceExportImpl(); - } - -} diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java deleted file mode 100644 index 7ea09a47c7..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportExportListener.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace.impl; - -import org.apache.tuscany.sca.contribution.Contribution; -import org.apache.tuscany.sca.contribution.Export; -import org.apache.tuscany.sca.contribution.Import; -import org.apache.tuscany.sca.contribution.namespace.NamespaceExport; -import org.apache.tuscany.sca.contribution.namespace.NamespaceImport; -import org.apache.tuscany.sca.contribution.resolver.DefaultImportAllModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionListener; -import org.apache.tuscany.sca.contribution.service.ContributionRepository; - -/** - * Namespace Import/Export contribution listener - * The listener would process all import/export from a given contribution - * and initialize the model resolvers properly - * - * @version $Rev$ $Date$ - */ -public class NamespaceImportExportListener implements ContributionListener { - - /** - * Initialize the import/export model resolvers - * Export model resolvers are same as Contribution model resolver - * Import model resolvers are matched to a specific contribution if a location URI is specified, - * otherwise it try to resolve against all the other contributions - * Also set the exporting contributions used by contribution ClassLoaders to - * match import/export for class loading. - */ - public void contributionAdded(ContributionRepository repository, Contribution contribution) { - // Initialize the contribution exports - for (Export export: contribution.getExports()) { - export.setModelResolver(contribution.getModelResolver()); - } - - // Initialize the contribution imports - for (Import import_: contribution.getImports()) { - boolean initialized = false; - - if (import_ instanceof NamespaceImport) { - NamespaceImport namespaceImport = (NamespaceImport)import_; - - // Find a matching contribution - if (namespaceImport.getLocation() != null) { - Contribution targetContribution = repository.getContribution(namespaceImport.getLocation()); - if (targetContribution != null) { - - // Find a matching contribution export - for (Export export: targetContribution.getExports()) { - if (export instanceof NamespaceExport) { - NamespaceExport namespaceExport = (NamespaceExport)export; - if (namespaceImport.getNamespace().equals(namespaceExport.getNamespace())) { - namespaceImport.setModelResolver(namespaceExport.getModelResolver()); - initialized = true; - break; - } - } - } - } - } - - //if no location was specified, try to resolve with any contribution - if( !initialized ) { - // Use a resolver that will consider all contributions - import_.setModelResolver(new DefaultImportAllModelResolver(import_, repository.getContributions())); - } - } - } - - } - - public void contributionRemoved(ContributionRepository repository, Contribution contribution) { - - } - - public void contributionUpdated(ContributionRepository repository, Contribution oldContribution, Contribution contribution) { - - } - -} diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java deleted file mode 100644 index 6d2a31f702..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportImpl.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace.impl; - -import org.apache.tuscany.sca.contribution.Export; -import org.apache.tuscany.sca.contribution.namespace.NamespaceExport; -import org.apache.tuscany.sca.contribution.namespace.NamespaceImport; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; - -/** - * The representation of an import for the contribution - * - * @version $Rev$ $Date$ - */ -public class NamespaceImportImpl implements NamespaceImport { - private ModelResolver modelResolver; - - /** - * The namespace to be imported - */ - private String namespace; - /** - * Optional location URI pointing to a Contribution that exports the namespace - */ - private String location; - - - protected NamespaceImportImpl() { - super(); - } - - public String getLocation() { - return location; - } - - public void setLocation(String location) { - this.location = location; - } - - public String getNamespace() { - return namespace; - } - - public void setNamespace(String namespace) { - this.namespace = namespace; - } - - public ModelResolver getModelResolver() { - return modelResolver; - } - - public void setModelResolver(ModelResolver modelResolver) { - this.modelResolver = modelResolver; - } - - - /** - * Match a NamespaceImport to a given NamespaceExport based on : - * location is not provided - * import and export namespaces match - */ - public boolean match(Export export) { - if (export instanceof NamespaceExport) { - if (this.getNamespace().equals(((NamespaceExport)export).getNamespace())) { - return true; - } - } - return false; - } - - @Override - public String toString() { - return String.valueOf(namespace); - } -} diff --git a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java b/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java deleted file mode 100644 index a364823256..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessor.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace.impl; - -import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; - -import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl; -import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint; -import org.apache.tuscany.sca.contribution.namespace.NamespaceImport; -import org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.resolver.ModelResolver; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.contribution.service.ContributionResolveException; -import org.apache.tuscany.sca.contribution.service.ContributionWriteException; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.Problem.Severity; - -/** - * Artifact processor for Namespace import - * - * @version $Rev$ $Date$ - */ -public class NamespaceImportProcessor implements StAXArtifactProcessor { - private static final String SCA10_NS = "http://www.osoa.org/xmlns/sca/1.0"; - - private static final QName IMPORT = new QName(SCA10_NS, "import"); - - private static final String NAMESPACE = "namespace"; - private static final String LOCATION = "location"; - - private final NamespaceImportExportFactory factory; - private final Monitor monitor; - - public NamespaceImportProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) { - this.factory = modelFactories.getFactory(NamespaceImportExportFactory.class); - this.monitor = monitor; - } - - /** - * Report a warning. - * - * @param problems - * @param message - * @param model - */ - private void error(String message, Object model, Object... messageParameters) { - if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-namespace-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters); - monitor.problem(problem); - } - } - - /** - * Report a exception. - * - * @param problems - * @param message - * @param model - */ - private void error(String message, Object model, Exception ex) { - if (monitor != null) { - Problem problem = new ProblemImpl(this.getClass().getName(), "contribution-namespace-validation-messages", Severity.ERROR, model, message, ex); - monitor.problem(problem); - } - } - - public QName getArtifactType() { - return IMPORT; - } - - public Class getModelType() { - return NamespaceImport.class; - } - - /** - * Process - */ - public NamespaceImport read(XMLStreamReader reader) throws ContributionReadException { - NamespaceImport namespaceImport = this.factory.createNamespaceImport(); - QName element; - - try { - while (reader.hasNext()) { - int event = reader.getEventType(); - switch (event) { - case START_ELEMENT: - element = reader.getName(); - - // Read - if (IMPORT.equals(element)) { - String ns = reader.getAttributeValue(null, NAMESPACE); - if (ns == null) { - error("AttributeNameSpaceMissing", reader); - //throw new ContributionReadException("Attribute 'namespace' is missing"); - } else - namespaceImport.setNamespace(ns); - - String location = reader.getAttributeValue(null, LOCATION); - if (location != null) { - namespaceImport.setLocation(location); - } - } - break; - case XMLStreamConstants.END_ELEMENT: - if (IMPORT.equals(reader.getName())) { - return namespaceImport; - } - break; - } - - // Read the next element - if (reader.hasNext()) { - reader.next(); - } - } - } - catch (XMLStreamException e) { - ContributionReadException ex = new ContributionReadException(e); - error("XMLStreamException", reader, ex); - } - - return namespaceImport; - } - - public void write(NamespaceImport namespaceImport, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException { - - // Write - writer.writeStartElement(IMPORT.getNamespaceURI(), IMPORT.getLocalPart()); - - if (namespaceImport.getNamespace() != null) { - writer.writeAttribute(NAMESPACE, namespaceImport.getNamespace()); - } - if (namespaceImport.getLocation() != null) { - writer.writeAttribute(LOCATION, namespaceImport.getLocation()); - } - - writer.writeEndElement(); - } - - - public void resolve(NamespaceImport model, ModelResolver resolver) throws ContributionResolveException { - } -} diff --git a/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory b/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory deleted file mode 100644 index 095866fb6f..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.namespace.NamespaceImportExportFactory +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportFactoryImpl diff --git a/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor deleted file mode 100644 index 86f199368b..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor +++ /dev/null @@ -1,19 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#import,model=org.apache.tuscany.sca.contribution.namespace.NamespaceImport -org.apache.tuscany.sca.contribution.namespace.impl.NamespaceExportProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#export,model=org.apache.tuscany.sca.contribution.namespace.NamespaceExport diff --git a/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener b/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener deleted file mode 100644 index cdf16a383f..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.service.ContributionListener +++ /dev/null @@ -1,18 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -org.apache.tuscany.sca.contribution.namespace.impl.NamespaceImportExportListener diff --git a/java/sca/modules/contribution-namespace/src/main/resources/contribution-namespace-validation-messages.properties b/java/sca/modules/contribution-namespace/src/main/resources/contribution-namespace-validation-messages.properties deleted file mode 100644 index c1cbd06e7f..0000000000 --- a/java/sca/modules/contribution-namespace/src/main/resources/contribution-namespace-validation-messages.properties +++ /dev/null @@ -1,23 +0,0 @@ -# -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -# -AttributeNameSpaceMissing = Attribute 'namespace' is missing -XMLStreamException = XMLStreamException occured due to : {0} - diff --git a/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java b/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java deleted file mode 100644 index 1f508d6a4a..0000000000 --- a/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceExportProcessorTestCase.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace.impl; - -import java.io.StringReader; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.contribution.namespace.NamespaceExport; -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl; -import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl; - -/** - * Test NamespaceExportProcessorTestCase - * - * @version $Rev$ $Date$ - */ -public class NamespaceExportProcessorTestCase extends TestCase { - - private static final String VALID_XML = - "" - + ""; - - private static final String INVALID_XML = - "" - + ""; - - private XMLInputFactory inputFactory; - private StAXArtifactProcessor staxProcessor; - private Monitor monitor; - - @Override - protected void setUp() throws Exception { - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - inputFactory = XMLInputFactory.newInstance(); - // Create a monitor - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl(); - if (monitorFactory != null) { - monitor = monitorFactory.createMonitor(); - utilities.addUtility(monitorFactory); - } - StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor); - } - - /** - * Test loading a valid export element from a contribution metadata stream - * @throws Exception - */ - public void testLoad() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML)); - NamespaceExport namespaceExport = (NamespaceExport)staxProcessor.read(reader); - assertEquals("http://foo", namespaceExport.getNamespace()); - } - - /** - * Test loading an INVALID export element from a contribution metadata stream - * @throws Exception - */ - public void testLoadInvalid() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML)); - /*try { - staxProcessor.read(reader); - fail("readerException should have been thrown"); - } catch (ContributionReadException e) { - assertTrue(true); - }*/ - staxProcessor.read(reader); - Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); - assertNotNull(problem); - assertEquals("AttributeNameSpaceMissing", problem.getMessageId()); - } -} diff --git a/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java b/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java deleted file mode 100644 index 71ac33bf68..0000000000 --- a/java/sca/modules/contribution-namespace/src/test/java/org/apache/tuscany/sca/contribution/namespace/impl/NamespaceImportProcessorTestCase.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.contribution.namespace.impl; - - - -import java.io.StringReader; - -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLStreamReader; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.contribution.namespace.NamespaceImport; -import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor; -import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint; -import org.apache.tuscany.sca.contribution.service.ContributionReadException; -import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry; -import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; -import org.apache.tuscany.sca.monitor.Monitor; -import org.apache.tuscany.sca.monitor.MonitorFactory; -import org.apache.tuscany.sca.monitor.Problem; -import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl; -import org.apache.tuscany.sca.monitor.impl.DefaultMonitorImpl; - -/** - * Test NamespaceImportProcessorTestCase - * - * @version $Rev$ $Date$ - */ -public class NamespaceImportProcessorTestCase extends TestCase { - - private static final String VALID_XML = - "" - + ""; - - private static final String INVALID_XML = - "" - + ""; - - private XMLInputFactory inputFactory; - private StAXArtifactProcessor staxProcessor; - private Monitor monitor; - - @Override - protected void setUp() throws Exception { - ExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry(); - inputFactory = XMLInputFactory.newInstance(); - // Create a monitor - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl(); - if (monitorFactory != null) { - monitor = monitorFactory.createMonitor(); - utilities.addUtility(monitorFactory); - } - StAXArtifactProcessorExtensionPoint staxProcessors = extensionPoints.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class); - staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor); - } - - /** - * Test loading a valid import element from a contribution metadata stream - * @throws Exception - */ - public void testLoad() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(VALID_XML)); - NamespaceImport namespaceImport = (NamespaceImport)staxProcessor.read(reader); - - assertEquals("http://foo", namespaceImport.getNamespace()); - assertEquals("sca://contributions/001", namespaceImport.getLocation()); - } - - /** - * Test loading a INVALID import element from a contribution metadata stream - * @throws Exception - */ - public void testLoadInvalid() throws Exception { - XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(INVALID_XML)); - /*try { - staxProcessor.read(reader); - fail("readerException should have been thrown"); - } catch (ContributionReadException e) { - assertTrue(true); - }*/ - staxProcessor.read(reader); - Problem problem = ((DefaultMonitorImpl)monitor).getLastLoggedProblem(); - assertNotNull(problem); - assertEquals("AttributeNameSpaceMissing", problem.getMessageId()); - } -} -- cgit v1.2.3