Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfullbright2010-12-31 13:36:50 -0500
committerpfullbright2010-12-31 13:36:50 -0500
commita6f284ce1f692bbf56d15d7fa56bdb4a0ddd3b47 (patch)
treebddad92addb7f57e17883a2fe15e2f5d6d1e1dcc
parent49b7009fc409667c4df4e0af9c2235ae9483a7ba (diff)
downloadwebtools.dali-a6f284ce1f692bbf56d15d7fa56bdb4a0ddd3b47.tar.gz
webtools.dali-a6f284ce1f692bbf56d15d7fa56bdb4a0ddd3b47.tar.xz
webtools.dali-a6f284ce1f692bbf56d15d7fa56bdb4a0ddd3b47.zip
basic schema loading support
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF5
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/SchemaLibrary.java11
-rw-r--r--jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java122
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF1
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java1
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java67
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/SchemaLibraryTests.java122
-rw-r--r--jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbContextModelTestCase.java43
8 files changed, 331 insertions, 41 deletions
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
index 4087ee44f2..cf3c314efb 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF
@@ -20,7 +20,10 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)",
org.eclipse.jst.j2ee.core;bundle-version="[1.2.100,2.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
- org.eclipse.wst.validation;bundle-version="[1.2.200,2.0.0)"
+ org.eclipse.wst.validation;bundle-version="[1.2.200,2.0.0)",
+ org.eclipse.wst.xml.core;bundle-version="[1.1.600,2.0.0)",
+ org.eclipse.wst.xsd.core;bundle-version="[1.1.600,2.0.0)",
+ org.eclipse.xsd;bundle-version="[2.6.0,3.0.0)"
Export-Package: org.eclipse.jpt.jaxb.core,
org.eclipse.jpt.jaxb.core.context,
org.eclipse.jpt.jaxb.core.internal;x-internal:=true,
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/SchemaLibrary.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/SchemaLibrary.java
index 462ebd29ea..fe52356cbc 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/SchemaLibrary.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/SchemaLibrary.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.jaxb.core;
import java.util.Map;
+import org.eclipse.xsd.XSDSchema;
/**
* Entry point for accessing project schema resources
@@ -25,7 +26,17 @@ import java.util.Map;
*/
public interface SchemaLibrary {
+ public XSDSchema getSchema(String namespace);
+
+ /**
+ * Return the project settings that indicate how schema keys are mapped to actual
+ * resolvable schemas
+ */
public Map<String, String> getSchemaLocations();
+ /**
+ * Set the project settings that indicate how schema keys are mapped to actual
+ * resolvable schemas.
+ */
public void setSchemaLocations(Map<String, String> schemaLocations);
}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java
index dd01f4a807..c75942cac0 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java
@@ -9,28 +9,135 @@
*******************************************************************************/
package org.eclipse.jpt.jaxb.core.internal;
+import java.io.IOException;
+import java.net.MalformedURLException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.jpt.jaxb.core.JaxbProject;
import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.SchemaLibrary;
+import org.eclipse.jpt.utility.internal.StringTools;
+import org.eclipse.wst.xml.core.internal.XMLCorePlugin;
+import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog;
+import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.util.XSDResourceImpl;
public class SchemaLibraryImpl
implements SchemaLibrary {
private JaxbProject project;
- private final Map<String, String> schemaLocations;
+ private final Map<String, String> schemaLocations;
+
+ private final Map<String, XSDResourceImpl> schemaResources;
+
+ private Adapter schemaResourceAdapter = new SchemaResourceAdapter();
SchemaLibraryImpl(JaxbProject project) {
this.project = project;
this.schemaLocations = new HashMap<String, String>();
+ this.schemaResources = new HashMap<String, XSDResourceImpl>();
readProjectPreferences();
}
+ public XSDSchema getSchema(String namespace) {
+ String resolvedUri = getResolvedUri(namespace);
+ if (resolvedUri == null) {
+ return null;
+ }
+
+ XSDResourceImpl schemaResource = this.schemaResources.get(namespace);
+ XSDSchema schema = (schemaResource == null) ? null : schemaResource.getSchema();
+ if (schemaResource != null) {
+ if (schema != null && schemaResource.getURI().toString().equals(resolvedUri) && schemaResource.isLoaded()) {
+ return schema;
+ }
+ else {
+ removeSchemaResource(namespace, schemaResource);
+ }
+ }
+
+ return addSchema(namespace, resolvedUri);
+ }
+
+ protected String getResolvedUri(String namespace) {
+ String resolvedUri = null;
+ String location = this.schemaLocations.get(namespace);
+
+ ICatalog catalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog();
+
+ if (! StringTools.stringIsEmpty(location)) {
+ try {
+ resolvedUri = catalog.resolveSystem(location);
+ if (resolvedUri == null) {
+ resolvedUri = catalog.resolveURI(location);
+ }
+ }
+ catch (MalformedURLException me) {
+ JptJaxbCorePlugin.log(me);
+ resolvedUri = null;
+ }
+ catch (IOException ie) {
+ JptJaxbCorePlugin.log(ie);
+ resolvedUri = null;
+ }
+ }
+
+ if (resolvedUri == null && namespace != null) {
+ if ( ! (location != null && location.endsWith(".xsd"))) { //$NON-NLS-1$
+ try {
+ resolvedUri = catalog.resolvePublic(namespace, location);
+ if (resolvedUri == null) {
+ resolvedUri = catalog.resolveURI(namespace);
+ }
+ }
+ catch (MalformedURLException me) {
+ JptJaxbCorePlugin.log(me);
+ resolvedUri = null;
+ }
+ catch (IOException ie) {
+ JptJaxbCorePlugin.log(ie);
+ resolvedUri = null;
+ }
+ }
+ }
+
+ // if resolvedUri is null, assume the location is resolved
+ return (resolvedUri != null) ? resolvedUri : location;
+ }
+
+ protected XSDSchema addSchema(String namespace, String resolvedUri) {
+ XSDSchema schema = XSDImpl.buildXSDModel(resolvedUri);
+ XSDResourceImpl schemaResource = (XSDResourceImpl) schema.eResource();
+ if (schemaResource != null) {
+ schemaResource.eAdapters().add(this.schemaResourceAdapter);
+ this.schemaResources.put(namespace, schemaResource);
+ return schema;
+ }
+ return null;
+ }
+
+ protected void removeSchemaResource(XSDResourceImpl schemaResource) {
+ for (String namespace : this.schemaResources.keySet()) {
+ if (schemaResource.equals(this.schemaResources.get(namespace))) {
+ removeSchemaResource(namespace, schemaResource);
+ }
+ }
+ }
+
+ protected void removeSchemaResource(String namespace, XSDResourceImpl schemaResource) {
+ schemaResource.eAdapters().remove(this.schemaResourceAdapter);
+ this.schemaResources.remove(namespace);
+ }
+
protected void readProjectPreferences() {
Map<String, String> schemaMap = JptJaxbCorePlugin.getSchemaLocationMap(this.project.getProject());
this.schemaLocations.putAll(schemaMap);
@@ -45,4 +152,17 @@ public class SchemaLibraryImpl
JptJaxbCorePlugin.setSchemaLocationMap(this.project.getProject(), schemaLocations);
readProjectPreferences();
}
+
+
+ private class SchemaResourceAdapter
+ extends AdapterImpl {
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ if (msg.getFeatureID(Resource.class) == Resource.RESOURCE__IS_LOADED
+ && msg.getNewBooleanValue() == false) {
+ removeSchemaResource((XSDResourceImpl) msg.getNotifier());
+ }
+ }
+ }
}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF
index 5baa1e13d7..a8d0400b08 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF
@@ -18,4 +18,5 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.6.100,4.0.0)",
org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
org.eclipse.wst.common.frameworks;bundle-version="[1.2.0,2.0.0)",
org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)",
+ org.eclipse.xsd;bundle-version="[2.6.0,3.0.0)",
org.junit;bundle-version="3.8.0"
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java
index 4aa0cef7f9..a018d17d59 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java
@@ -18,6 +18,7 @@ public class JaxbCoreTests {
public static Test suite() {
TestSuite suite = new TestSuite(JaxbCoreTests.class.getPackage().getName());
+ suite.addTestSuite(SchemaLibraryTests.class);
suite.addTest(JaxbCoreResourceModelTests.suite());
suite.addTest(JaxbCoreContextModelTests.suite());
return suite;
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java
new file mode 100644
index 0000000000..c088a58b15
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. 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:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal;
+
+import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
+import org.eclipse.jpt.core.tests.internal.utility.jdt.AnnotationTestCase;
+import org.eclipse.jpt.jaxb.core.JaxbFacet;
+import org.eclipse.jpt.jaxb.core.JaxbProject;
+import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
+import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfig;
+import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
+import org.eclipse.jpt.jaxb.core.tests.internal.projects.TestJaxbProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+
+
+public class JaxbTestCase
+ extends AnnotationTestCase {
+
+ protected static final String BASE_PROJECT_NAME = "JaxbTestProject";
+
+ protected JaxbTestCase(String name) {
+ super(name);
+ }
+
+
+ @Override
+ protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception {
+ return buildJaxbProject(BASE_PROJECT_NAME, autoBuild, buildJaxbFacetInstallConfig());
+ }
+
+ protected TestJaxbProject buildJaxbProject(
+ String projectName, boolean autoBuild, JaxbFacetInstallConfig jaxbConfig)
+ throws Exception {
+ return TestJaxbProject.buildJaxbProject(projectName, autoBuild, jaxbConfig);
+ }
+
+ protected JaxbFacetInstallConfig buildJaxbFacetInstallConfig() {
+ JaxbFacetInstallConfig config = new JaxbFacetInstallConfig();
+ config.setProjectFacetVersion(getProjectFacetVersion());
+ config.setPlatform(getPlatform());
+ return config;
+ }
+
+ protected JaxbPlatformDescription getPlatform() {
+ return JptJaxbCorePlugin.getDefaultPlatform(getProjectFacetVersion());
+ }
+
+ protected IProjectFacetVersion getProjectFacetVersion() {
+ return JaxbFacet.VERSION_2_1;
+ }
+
+ @Override
+ protected TestJaxbProject getJavaProject() {
+ return (TestJaxbProject) super.getJavaProject();
+ }
+
+ protected JaxbProject getJaxbProject() {
+ return this.getJavaProject().getJaxbProject();
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/SchemaLibraryTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/SchemaLibraryTests.java
new file mode 100644
index 0000000000..219a879f1a
--- /dev/null
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/SchemaLibraryTests.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Oracle. 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:
+ * Oracle - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jpt.jaxb.core.tests.internal;
+
+import java.io.ByteArrayInputStream;
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.xsd.XSDSchema;
+
+
+
+public class SchemaLibraryTests
+ extends JaxbTestCase {
+
+ public SchemaLibraryTests(String name) {
+ super(name);
+ }
+
+ // tests schema for namespace that is set in catalog, but not in project properties
+ public void testUnsetNamespace() {
+ String namespace = "http://www.eclipse.org/eclipselink/xsds/persistence/orm";
+
+ // test initial load
+ XSDSchema schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+
+ // test cached load
+ schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+
+ // test unload/reload
+ schema.eResource().unload();
+ schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+ }
+
+ // tests schema for registered uri that is set in project properties (namespace not registered in catalog)
+ public void testSetRegisteredUriUnregisteredNamespace() {
+ String namespace = "http://java.sun.com/xml/ns/persistence/orm";
+
+ // set namespace in project properties\
+ Map<String, String> schemaLocations = new HashMap<String, String>();
+ schemaLocations.put(namespace, "http://java.sun.com/xml/ns/persistence/orm_2_0.xsd");
+ getJaxbProject().getSchemaLibrary().setSchemaLocations(schemaLocations);
+
+ // test initial load
+ XSDSchema schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+
+ // test cached load
+ schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+
+ // test unload/reload
+ schema.eResource().unload();
+ schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+ }
+
+ // tests schema for registerd uri that is set in project properties (namespace already registered in catalog)
+ public void testSetRegisteredUriRegisteredNamespace() {
+ String namespace = "http://www.eclipse.org/eclipselink/xsds/persistence/orm";
+
+ // set namespace in project properties\
+ Map<String, String> schemaLocations = new HashMap<String, String>();
+ schemaLocations.put(namespace, "http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_1_0.xsd");
+ getJaxbProject().getSchemaLibrary().setSchemaLocations(schemaLocations);
+
+ // test initial load
+ XSDSchema schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+
+ // test cached load
+ schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+
+ // test unload/reload
+ schema.eResource().unload();
+ schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+ }
+
+ // tests schema for unregistered uri that is set in project properties (local file)
+ public void testSetUnregisterdUri() throws Exception {
+ IFile schemaFile = getJaxbProject().getProject().getFile(new Path("customer.xsd"));
+ String contents =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\""
+ + " targetNamespace=\"http://www.example.org/customer-example\">"
+ + "</xs:schema>";
+ schemaFile.create(new ByteArrayInputStream(contents.getBytes()), true, null);
+
+ String namespace = "http://www.example.org/customer-example";
+
+ // set namespace in project properties\
+ Map<String, String> schemaLocations = new HashMap<String, String>();
+ schemaLocations.put(namespace, "platform:/resource/" + BASE_PROJECT_NAME + "/customer.xsd");
+ getJaxbProject().getSchemaLibrary().setSchemaLocations(schemaLocations);
+
+ // test initial load
+ XSDSchema schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+
+ // test cached load
+ schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+
+ // test unload/reload
+ schema.eResource().unload();
+ schema = getJaxbProject().getSchemaLibrary().getSchema(namespace);
+ assertNotNull(schema);
+ }
+}
diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbContextModelTestCase.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbContextModelTestCase.java
index 1b950d382f..2dfa40302e 100644
--- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbContextModelTestCase.java
+++ b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbContextModelTestCase.java
@@ -10,22 +10,16 @@
package org.eclipse.jpt.jaxb.core.tests.internal.context;
import org.eclipse.jpt.core.tests.internal.projects.TestJavaProject;
-import org.eclipse.jpt.core.tests.internal.utility.jdt.AnnotationTestCase;
import org.eclipse.jpt.core.utility.jdt.AnnotatedElement;
-import org.eclipse.jpt.jaxb.core.JaxbFacet;
-import org.eclipse.jpt.jaxb.core.JaxbProject;
-import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin;
import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot;
-import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallConfig;
-import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription;
import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement;
-import org.eclipse.jpt.jaxb.core.tests.internal.projects.TestJaxbProject;
+import org.eclipse.jpt.jaxb.core.tests.internal.JaxbTestCase;
import org.eclipse.jpt.utility.internal.ReflectionTools;
-import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
@SuppressWarnings("nls")
-public abstract class JaxbContextModelTestCase extends AnnotationTestCase
-{
+public abstract class JaxbContextModelTestCase
+ extends JaxbTestCase {
+
protected static final String BASE_PROJECT_NAME = "JaxbContextModelTestProject";
@@ -38,26 +32,6 @@ public abstract class JaxbContextModelTestCase extends AnnotationTestCase
return buildJaxbProject(BASE_PROJECT_NAME, autoBuild, buildJaxbFacetInstallConfig());
}
- protected TestJaxbProject buildJaxbProject(String projectName, boolean autoBuild, JaxbFacetInstallConfig jaxbConfig)
- throws Exception {
- return TestJaxbProject.buildJaxbProject(projectName, autoBuild, jaxbConfig);
- }
-
- protected JaxbFacetInstallConfig buildJaxbFacetInstallConfig() {
- JaxbFacetInstallConfig config = new JaxbFacetInstallConfig();
- config.setProjectFacetVersion(getProjectFacetVersion());
- config.setPlatform(getPlatform());
- return config;
- }
-
- protected JaxbPlatformDescription getPlatform() {
- return JptJaxbCorePlugin.getDefaultPlatform(getProjectFacetVersion());
- }
-
- protected IProjectFacetVersion getProjectFacetVersion() {
- return JaxbFacet.VERSION_2_1;
- }
-
protected JaxbContextRoot getContextRoot() {
return this.getJaxbProject().getContextRoot();
}
@@ -65,13 +39,4 @@ public abstract class JaxbContextModelTestCase extends AnnotationTestCase
protected AnnotatedElement annotatedElement(JavaResourceAnnotatedElement resource) {
return (AnnotatedElement) ReflectionTools.getFieldValue(resource, "annotatedElement");
}
-
- @Override
- protected TestJaxbProject getJavaProject() {
- return (TestJaxbProject) super.getJavaProject();
- }
-
- protected JaxbProject getJaxbProject() {
- return this.getJavaProject().getJaxbProject();
- }
}

Back to the top