diff options
Diffstat (limited to 'org.eclipse.virgo.kernel.stubs')
16 files changed, 492 insertions, 0 deletions
diff --git a/org.eclipse.virgo.kernel.stubs/.classpath b/org.eclipse.virgo.kernel.stubs/.classpath new file mode 100644 index 00000000..75f5b8b0 --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/.classpath @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src/main/java"> + <attributes> + <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/> + </attributes> + </classpathentry> + <classpathentry kind="src" path="src/main/resources"> + <attributes> + <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/java"> + <attributes> + <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="src" output="target/test-classes" path="src/test/resources"> + <attributes> + <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.deployer"/> + <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.1.R35x_v20091005/org.eclipse.osgi-3.5.1.R35x_v20091005.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.5.1.R35x_v20091005/org.eclipse.osgi-sources-3.5.1.R35x_v20091005.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.core"/> + <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.1.0.D-20100420091708/org.eclipse.virgo.util.osgi-2.1.0.D-20100420091708.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi/2.1.0.D-20100420091708/org.eclipse.virgo.util.osgi-sources-2.1.0.D-20100420091708.jar"/> + <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.1.0.D-20100420091708/org.eclipse.virgo.util.common-2.1.0.D-20100420091708.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.common/2.1.0.D-20100420091708/org.eclipse.virgo.util.common-sources-2.1.0.D-20100420091708.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.artifact"/> + <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.osgi"/> + <classpathentry kind="output" path="target/classes"/> +</classpath> diff --git a/org.eclipse.virgo.kernel.stubs/.project b/org.eclipse.virgo.kernel.stubs/.project new file mode 100644 index 00000000..31b4c3b6 --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.virgo.kernel.stubs</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.wst.common.project.facet.core.builder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.springsource.server.dev.eclipse.serverdevelopmentbuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>com.springsource.server.ide.bundlor.core.builder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + <nature>com.springsource.server.dev.eclipse.serverdevelopmentnature</nature> + <nature>org.eclipse.wst.common.project.facet.core.nature</nature> + </natures> +</projectDescription> diff --git a/org.eclipse.virgo.kernel.stubs/.settings/com.springsource.server.ide.bundlor.core.prefs b/org.eclipse.virgo.kernel.stubs/.settings/com.springsource.server.ide.bundlor.core.prefs new file mode 100644 index 00000000..2fe7581e --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/.settings/com.springsource.server.ide.bundlor.core.prefs @@ -0,0 +1,3 @@ +#Mon Jul 06 09:07:01 BST 2009 +com.springsource.server.ide.bundlor.core.template.properties.files=../build.versions +eclipse.preferences.version=1 diff --git a/org.eclipse.virgo.kernel.stubs/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.virgo.kernel.stubs/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000..7c79913b --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Wed Nov 26 10:58:15 GMT 2008 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/org.eclipse.virgo.kernel.stubs/.settings/org.eclipse.wst.common.project.facet.core.xml b/org.eclipse.virgo.kernel.stubs/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 00000000..88ceb05c --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,3 @@ +<?xml version="1.0" encoding="UTF-8"?> +<faceted-project> +</faceted-project> diff --git a/org.eclipse.virgo.kernel.stubs/.springBeans b/org.eclipse.virgo.kernel.stubs/.springBeans new file mode 100644 index 00000000..8058887d --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/.springBeans @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<beansProjectDescription> + <version>1</version> + <pluginVersion><![CDATA[2.2.6.200908051215-RELEASE]]></pluginVersion> + <configSuffixes> + <configSuffix><![CDATA[xml]]></configSuffix> + </configSuffixes> + <enableImports><![CDATA[false]]></enableImports> + <configs> + </configs> + <configSets> + </configSets> +</beansProjectDescription> diff --git a/org.eclipse.virgo.kernel.stubs/build.xml b/org.eclipse.virgo.kernel.stubs/build.xml new file mode 100644 index 00000000..4f076442 --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/build.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project name="org.eclipse.virgo.kernel.stubs"> + + <property file="${basedir}/../build.properties"/> + <property file="${basedir}/../build.versions"/> + <import file="${basedir}/../virgo-build/weaving/default.xml"/> + +</project> diff --git a/org.eclipse.virgo.kernel.stubs/ivy.xml b/org.eclipse.virgo.kernel.stubs/ivy.xml new file mode 100644 index 00000000..973aa0b1 --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/ivy.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?xml-stylesheet type="text/xsl" href="http://ivyrep.jayasoft.org/ivy-doc.xsl"?> +<ivy-module + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd" + version="1.3"> + + <info organisation="org.eclipse.virgo.kernel" module="${ant.project.name}"/> + + <configurations> + <include file="${virgo.build.dir}/common/default-ivy-configurations.xml"/> + </configurations> + + <publications> + <artifact name="${ant.project.name}"/> + <artifact name="${ant.project.name}-sources" type="src" ext="jar"/> + </publications> + + <dependencies> + <dependency org="org.eclipse.virgo.kernel" name="org.eclipse.virgo.kernel.deployer" rev="latest.integration" conf="compile->compile"/> + <override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/> + </dependencies> + +</ivy-module> diff --git a/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubArtifactFS.java b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubArtifactFS.java new file mode 100644 index 00000000..713b0695 --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubArtifactFS.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2008, 2010 VMware Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VMware Inc. - initial contribution + *******************************************************************************/ + +package org.eclipse.virgo.kernel.stubs; + +import java.io.File; +import java.net.URI; + +import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS; +import org.eclipse.virgo.kernel.artifact.fs.ArtifactFSEntry; + + +/** + * <code>StubArtifactFS</code> implements the {@link ArtifactFS} interface for testing. + * <p /> + * + * <strong>Concurrent Semantics</strong><br /> + * thread-safe + * + */ +public class StubArtifactFS implements ArtifactFS { + + private final URI sourceURI; + + private final File location; + + private final String name; + + public StubArtifactFS(URI sourceURI, File location, String name) { + this.sourceURI = sourceURI; + this.location = location; + this.name = name; + } + + public File getLocation() { + return this.location; + } + + public String getName() { + return this.name; + } + + public URI getSourceURI() { + return this.sourceURI; + } + + /** + * {@inheritDoc} + */ + public File getFile() { + return this.location; + } + + public ArtifactFSEntry getEntry(String name) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubBundleInstallArtifact.java b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubBundleInstallArtifact.java new file mode 100644 index 00000000..507c3fee --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubBundleInstallArtifact.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * Copyright (c) 2008, 2010 VMware Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VMware Inc. - initial contribution + *******************************************************************************/ + +package org.eclipse.virgo.kernel.stubs; + +import java.io.IOException; +import java.net.URI; +import java.util.Collections; +import java.util.Map; + +import org.osgi.framework.Bundle; + +import org.eclipse.virgo.kernel.install.artifact.ArtifactIdentityDeterminer; +import org.eclipse.virgo.kernel.install.artifact.BundleInstallArtifact; +import org.eclipse.virgo.kernel.osgi.quasi.QuasiBundle; + +import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS; +import org.eclipse.virgo.util.osgi.manifest.BundleManifest; + +/** + * <code>StubBundleInstallArtifact</code> implements {@link BundleInstallArtifact} interface for testing. + * <p /> + * + * <strong>Concurrent Semantics</strong><br /> + * thread-safe + * + */ +public class StubBundleInstallArtifact extends StubInstallArtifact implements BundleInstallArtifact { + + private final Bundle bundle; + + private final BundleManifest bundleManifest; + + private QuasiBundle quasiBundle; + + public StubBundleInstallArtifact(ArtifactFS artifactFS, Bundle bundle, BundleManifest bundleManifest) { + super(artifactFS, ArtifactIdentityDeterminer.BUNDLE_TYPE, bundleManifest.getBundleSymbolicName().getSymbolicName(), + bundleManifest.getBundleVersion()); + this.bundle = bundle; + this.bundleManifest = bundleManifest; + } + + /** + * {@inheritDoc} + */ + public Bundle getBundle() { + return this.bundle; + } + + /** + * {@inheritDoc} + */ + public BundleManifest getBundleManifest() throws IOException { + return this.bundleManifest; + } + + /** + * {@inheritDoc} + */ + public QuasiBundle getQuasiBundle() { + return quasiBundle; + } + + /** + * {@inheritDoc} + */ + public void setQuasiBundle(QuasiBundle quasiBundle) { + this.quasiBundle = quasiBundle; + } + + /** + * {@inheritDoc} + */ + public Map<String, String> getDeploymentProperties() { + return Collections.<String, String> emptyMap(); + } + + public void deleteEntry(String targetPath) { + } + + public void updateEntry(URI inputPath, String targetPath) { + } +} diff --git a/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubInstallArtifact.java b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubInstallArtifact.java new file mode 100644 index 00000000..bc69b5d6 --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubInstallArtifact.java @@ -0,0 +1,151 @@ +/******************************************************************************* + * Copyright (c) 2008, 2010 VMware Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VMware Inc. - initial contribution + *******************************************************************************/ + +package org.eclipse.virgo.kernel.stubs; + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.osgi.framework.Version; + +import org.eclipse.virgo.kernel.install.artifact.InstallArtifact; + +import org.eclipse.virgo.kernel.artifact.fs.ArtifactFS; +import org.eclipse.virgo.kernel.core.Signal; +import org.eclipse.virgo.kernel.deployer.core.DeploymentException; +import org.eclipse.virgo.kernel.serviceability.NonNull; +import org.eclipse.virgo.util.common.ThreadSafeArrayListTree; +import org.eclipse.virgo.util.common.Tree; + +public class StubInstallArtifact implements InstallArtifact { + + private final ArtifactFS artifactFS; + + private final String name; + + private final Version version; + + private final String type; + + private final Map<String, String> properties = new HashMap<String, String>(); + + private final Tree<InstallArtifact> tree; + + private final String scopeName; + + public StubInstallArtifact() { + this(null, null, null, null); + } + + public StubInstallArtifact(String type) { + this(null, type, null, null); + } + + public StubInstallArtifact(ArtifactFS artifactFS, String name, Version version) { + this(artifactFS, null, name, version); + } + + public StubInstallArtifact(ArtifactFS artifactFS, String type, String name, Version version) { + this(artifactFS, type, name, version, new InstallArtifact[0]); + } + + public StubInstallArtifact(ArtifactFS artifactFS, String type, String name, Version version, String scopeName) { + this(artifactFS, type, name, version, scopeName, new InstallArtifact[0]); + } + + public StubInstallArtifact(ArtifactFS artifactFS, String type, String name, Version version, InstallArtifact... children) { + this(artifactFS, type, name, version, null, children); + } + + public StubInstallArtifact(ArtifactFS artifactFS, String type, String name, Version version, String scopeName, InstallArtifact... children) { + this.type = type == null ? "stub" : type; + this.name = name == null ? "the-stub" : name; + this.version = version == null ? Version.emptyVersion : version; + this.scopeName = scopeName; + + this.artifactFS = artifactFS; + + this.tree = new ThreadSafeArrayListTree<InstallArtifact>(this); + + for (InstallArtifact child : children) { + this.tree.addChild(new ThreadSafeArrayListTree<InstallArtifact>(child)); + } + } + + public ArtifactFS getArtifactFS() { + return this.artifactFS; + } + + public String getName() { + return this.name; + } + + public State getState() { + throw new UnsupportedOperationException(); + } + + public String getType() { + return this.type; + } + + public Version getVersion() { + return this.version; + } + + public String getScopeName() { + return this.scopeName; + } + + public void stop() throws DeploymentException { + } + + public void uninstall() throws DeploymentException { + } + + public boolean refresh() { + return false; + } + + public String getProperty(@NonNull String name) { + return this.properties.get(name); + } + + public Set<String> getPropertyNames() { + HashSet<String> propertyNames = new HashSet<String>(this.properties.keySet()); + return Collections.unmodifiableSet(propertyNames); + } + + public String setProperty(String name, String value) { + return this.properties.put(name, value); + } + + public String getRepositoryName() { + throw new UnsupportedOperationException(); + } + + public Tree<InstallArtifact> getTree() { + return this.tree; + } + + public void start() throws DeploymentException { + start(null); + } + + public void start(Signal signal) throws DeploymentException { + if (signal != null) { + signal.signalSuccessfulCompletion(); + } + } + +} diff --git a/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubPlanInstallArtifact.java b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubPlanInstallArtifact.java new file mode 100644 index 00000000..933829f2 --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/src/main/java/org/eclipse/virgo/kernel/stubs/StubPlanInstallArtifact.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2008, 2010 VMware Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VMware Inc. - initial contribution + *******************************************************************************/ + +package org.eclipse.virgo.kernel.stubs; + +import java.util.List; + +import org.eclipse.virgo.kernel.artifact.ArtifactSpecification; +import org.eclipse.virgo.kernel.deployer.core.DeploymentException; + +import org.eclipse.virgo.kernel.install.artifact.PlanInstallArtifact; + +public class StubPlanInstallArtifact extends StubInstallArtifact implements PlanInstallArtifact { + + public String getType() { + return "plan"; + } + + public boolean isAtomic() { + return false; + } + + public boolean isScoped() { + return false; + } + + public boolean refresh(String symbolicName) throws DeploymentException { + return false; + } + + public boolean refreshScope() { + return false; + } + + public List<ArtifactSpecification> getArtifactSpecifications() { + return null; + } +} diff --git a/org.eclipse.virgo.kernel.stubs/src/main/resources/.gitignore b/org.eclipse.virgo.kernel.stubs/src/main/resources/.gitignore new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/src/main/resources/.gitignore diff --git a/org.eclipse.virgo.kernel.stubs/src/test/java/.gitignore b/org.eclipse.virgo.kernel.stubs/src/test/java/.gitignore new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/src/test/java/.gitignore diff --git a/org.eclipse.virgo.kernel.stubs/src/test/resources/.gitignore b/org.eclipse.virgo.kernel.stubs/src/test/resources/.gitignore new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/src/test/resources/.gitignore diff --git a/org.eclipse.virgo.kernel.stubs/template.mf b/org.eclipse.virgo.kernel.stubs/template.mf new file mode 100644 index 00000000..8d53cb9b --- /dev/null +++ b/org.eclipse.virgo.kernel.stubs/template.mf @@ -0,0 +1,9 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Virgo Kernel Unit Test Stubs +Bundle-SymbolicName: org.eclipse.virgo.kernel.stubs +Bundle-Version: 2.1.0 +Import-Template: + org.eclipse.virgo.kernel.*;version="${version:[=.=.=, =.+1)}", + org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}", + org.osgi.framework.*;version="0" |