Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2009-11-25 16:44:39 -0500
committerrelves2009-11-25 16:44:39 -0500
commit7eac740e3cb1005806c795dde4f7f0ac7fe34e94 (patch)
treeffb75748b51f567041fb4965e270588d7191bac9
parent89815bf11a7b49fd2d241ae96d8a38a2325cee1b (diff)
downloadorg.eclipse.mylyn.tasks-7eac740e3cb1005806c795dde4f7f0ac7fe34e94.tar.gz
org.eclipse.mylyn.tasks-7eac740e3cb1005806c795dde4f7f0ac7fe34e94.tar.xz
org.eclipse.mylyn.tasks-7eac740e3cb1005806c795dde4f7f0ac7fe34e94.zip
NEW - bug 281711: produce Java API for OSLC CM 1.0
https://bugs.eclipse.org/bugs/show_bug.cgi?id=281711
-rw-r--r--org.eclipse.mylyn.oslc.tests/.settings/org.eclipse.jdt.core.prefs9
-rw-r--r--org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/ServiceDiscoveryTest.java94
-rw-r--r--org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/SimpleQueryTest.java63
-rw-r--r--org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider.java5
-rw-r--r--org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceLabelProvider.java1
5 files changed, 124 insertions, 48 deletions
diff --git a/org.eclipse.mylyn.oslc.tests/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.mylyn.oslc.tests/.settings/org.eclipse.jdt.core.prefs
index fbac23913..0b3b1ffa1 100644
--- a/org.eclipse.mylyn.oslc.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.mylyn.oslc.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue May 12 20:42:44 PDT 2009
+#Wed Nov 25 13:43:10 PST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -18,6 +18,8 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
@@ -37,11 +39,14 @@ org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=error
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/ServiceDiscoveryTest.java b/org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/ServiceDiscoveryTest.java
index b75156563..ff2ce4c0a 100644
--- a/org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/ServiceDiscoveryTest.java
+++ b/org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/ServiceDiscoveryTest.java
@@ -14,87 +14,123 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Set;
import junit.framework.TestCase;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylyn.commons.net.AbstractWebLocation;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.tests.support.CommonTestUtil;
-import org.eclipse.mylyn.internal.oslc.cm.ui.OslcClient;
import org.eclipse.mylyn.internal.oslc.core.OslcCreationDialogDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcSelectionDialogDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceDescriptor;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceProvider;
import org.eclipse.mylyn.internal.oslc.core.client.AbstractOslcClient;
+import org.eclipse.mylyn.internal.oslc.core.cm.AbstractChangeRequest;
+import org.eclipse.mylyn.tasks.core.RepositoryResponse;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.TaskRepositoryLocationFactory;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
/**
* @author Robert Elves
*/
+@SuppressWarnings("restriction")
public class ServiceDiscoveryTest extends TestCase {
private TaskRepository repository;
+
private AbstractWebLocation location;
+
private AbstractOslcClient client;
@Override
protected void setUp() throws Exception {
super.setUp();
- this.repository = new TaskRepository("myoslcconnetorkind"
- ,
- "http://mylyn.eclipse.org/oslc/cqrest");
- this.repository.setCredentials(AuthenticationType.REPOSITORY,
- new AuthenticationCredentials("xxx", "xxx"), false);
- this.location = new TaskRepositoryLocationFactory()
- .createWebLocation(repository);
- this.client = new OslcClient(location,
- new OslcServiceDescriptor("http://mylyn.eclipse.org/oslc/cqrest"));
+ this.repository = new TaskRepository("myoslcconnetorkind", "http://mylyn.eclipse.org/oslc/cqrest");
+ this.repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials("xxx", "xxx"),
+ false);
+ this.location = new TaskRepositoryLocationFactory().createWebLocation(repository);
+ this.client = new AbstractOslcClient(location,
+ new OslcServiceDescriptor("http://mylyn.eclipse.org/oslc/cqrest")) {
+
+ @Override
+ public RepositoryResponse putTaskData(TaskData taskData, Set<TaskAttribute> oldValues,
+ IProgressMonitor monitor) throws CoreException {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public String getUserAgent() {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public TaskData getTaskData(String encodedTaskId, TaskAttributeMapper mapper, IProgressMonitor monitor)
+ throws CoreException {
+ // ignore
+ return null;
+ }
+
+ @Override
+ protected AbstractChangeRequest createChangeRequest(String id, String title) {
+ return new AbstractChangeRequest(id, title) {
+ };
+ }
+ };
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
-
- public void testServiceCatalogParsing() throws IOException, CoreException {
+ public void testServiceCatalogParsing() throws IOException, CoreException {
File file = CommonTestUtil.getFile(ServiceDiscoveryTest.class, "xml/service-provider-catalog.xml");
FileInputStream inStream = new FileInputStream(file);
- ArrayList list = new ArrayList();
+ ArrayList<OslcServiceProvider> list = new ArrayList<OslcServiceProvider>();
client.parseServices(inStream, list, new NullProgressMonitor());
assertEquals(1, list.size());
- OslcServiceProvider desc = (OslcServiceProvider)list.get(0);
+ OslcServiceProvider desc = list.get(0);
assertEquals("http://mylyn.eclipse.org/oslc/cqrest/repo/7.0.0/db/SAMPL", desc.getUrl());
}
-
+
public void testServiceDescriptorParsing() throws IOException, CoreException {
File file = CommonTestUtil.getFile(ServiceDiscoveryTest.class, "xml/service-descriptor.xml");
FileInputStream inStream = new FileInputStream(file);
- ArrayList list = new ArrayList();
- OslcServiceDescriptor desc = new OslcServiceDescriptor("http://mylyn.eclipse.org/oslc/cqrest/repo/7.0.0/db/SAMPL");
+ OslcServiceDescriptor desc = new OslcServiceDescriptor(
+ "http://mylyn.eclipse.org/oslc/cqrest/repo/7.0.0/db/SAMPL");
client.parseServiceDescriptor(inStream, desc, new NullProgressMonitor());
-
+
assertEquals("RCM/CQ OSLC CM Service Description Document", desc.getTitle());
- assertEquals("Rational Change Management/ClearQuest OSLC CM Services available for 7.0.0/SAMPL.", desc.getDescription());
-
+ assertEquals("Rational Change Management/ClearQuest OSLC CM Services available for 7.0.0/SAMPL.",
+ desc.getDescription());
+
// ServiceHome
assertEquals("Change Requests", desc.getHome().getTitle());
assertEquals("http://mylyn.eclipse.org/cqweb/restapi/7.0.0/SAMPL?format=html", desc.getHome().getUrl());
-
+
// Creation Dialogs
OslcCreationDialogDescriptor creationDialog = desc.getDefaultCreationDialog();
assertEquals("New Defect - IBM Rational ClearQuest", creationDialog.getTitle());
- assertEquals("http://mylyn.eclipse.org/oslc/cqrest/repo/7.0.0/db/SAMPL/record-type/16777224/creationDialog?dc%3Atype=Defect", creationDialog.getUrl());
-
+ assertEquals(
+ "http://mylyn.eclipse.org/oslc/cqrest/repo/7.0.0/db/SAMPL/record-type/16777224/creationDialog?dc%3Atype=Defect",
+ creationDialog.getUrl());
+
// Factory
assertEquals("Unattended location for the creation of ClearQuest Records", desc.getDefaultFactory().getTitle());
- assertEquals("http://mylyn.eclipse.org/oslc/cqrest/repo/7.0.0/db/SAMPL/record", desc.getDefaultFactory().getUrl());
-
+ assertEquals("http://mylyn.eclipse.org/oslc/cqrest/repo/7.0.0/db/SAMPL/record", desc.getDefaultFactory()
+ .getUrl());
+
// Selection Dialogs
-
+
assertTrue(desc.getSelectionDialogs().size() > 0);
OslcSelectionDialogDescriptor selectionDialog = desc.getDefaultSelectionDialog();
assertNotNull(selectionDialog);
@@ -102,9 +138,9 @@ public class ServiceDiscoveryTest extends TestCase {
assertEquals("540px", selectionDialog.getHintHeight());
assertEquals("Choose ClearQuest Record - IBM Rational ClearQuest", selectionDialog.getTitle());
assertEquals("ClearQuest Record", selectionDialog.getLabel());
- assertEquals("http://mylyn.eclipse.org/cqweb/chooseRecord.cq?type=cq.repo.cq-rectype%3A16777224%407.0.0%2FSAMPL&restrictType=false", selectionDialog.getUrl());
+ assertEquals(
+ "http://mylyn.eclipse.org/cqweb/chooseRecord.cq?type=cq.repo.cq-rectype%3A16777224%407.0.0%2FSAMPL&restrictType=false",
+ selectionDialog.getUrl());
}
-
-
}
diff --git a/org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/SimpleQueryTest.java b/org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/SimpleQueryTest.java
index a5bcecec1..b1c7f9cb3 100644
--- a/org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/SimpleQueryTest.java
+++ b/org.eclipse.mylyn.oslc.tests/src/org/eclipse/mylyn/oslc/cm/tests/SimpleQueryTest.java
@@ -13,62 +13,95 @@ package org.eclipse.mylyn.oslc.cm.tests;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
+import java.util.Set;
import junit.framework.TestCase;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.mylyn.commons.net.AbstractWebLocation;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.tests.support.CommonTestUtil;
-import org.eclipse.mylyn.internal.oslc.cm.ui.OslcClient;
import org.eclipse.mylyn.internal.oslc.core.IOslcCoreConstants;
import org.eclipse.mylyn.internal.oslc.core.OslcServiceDescriptor;
import org.eclipse.mylyn.internal.oslc.core.client.AbstractOslcClient;
import org.eclipse.mylyn.internal.oslc.core.cm.AbstractChangeRequest;
+import org.eclipse.mylyn.tasks.core.RepositoryResponse;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.TaskRepositoryLocationFactory;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
/**
* @author Robert Elves
*/
+@SuppressWarnings("restriction")
public class SimpleQueryTest extends TestCase {
private TaskRepository repository;
+
private AbstractWebLocation location;
+
private AbstractOslcClient client;
+
@Override
protected void setUp() throws Exception {
super.setUp();
- this.repository = new TaskRepository(
- IOslcCoreConstants.ID_PLUGIN,
- "http://mylyn.eclipse.org/oslc/cqrest");
- this.repository.setCredentials(AuthenticationType.REPOSITORY,
- new AuthenticationCredentials("xxx", "xxx"), false);
- this.location = new TaskRepositoryLocationFactory()
- .createWebLocation(repository);
- this.client = new OslcClient(location,
- new OslcServiceDescriptor("http://mylyn.eclipse.org/oslc/cqrest"));
+ this.repository = new TaskRepository(IOslcCoreConstants.ID_PLUGIN, "http://mylyn.eclipse.org/oslc/cqrest");
+ this.repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials("xxx", "xxx"),
+ false);
+ this.location = new TaskRepositoryLocationFactory().createWebLocation(repository);
+ this.client = new AbstractOslcClient(location,
+ new OslcServiceDescriptor("http://mylyn.eclipse.org/oslc/cqrest")) {
+
+ @Override
+ public RepositoryResponse putTaskData(TaskData taskData, Set<TaskAttribute> oldValues,
+ IProgressMonitor monitor) throws CoreException {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public String getUserAgent() {
+ // ignore
+ return null;
+ }
+
+ @Override
+ public TaskData getTaskData(String encodedTaskId, TaskAttributeMapper mapper, IProgressMonitor monitor)
+ throws CoreException {
+ // ignore
+ return null;
+ }
+
+ @Override
+ protected AbstractChangeRequest createChangeRequest(String id, String title) {
+ return new AbstractChangeRequest(id, title) {
+ };
+ }
+ };
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
}
-
-
+
public void testParseQueryResponse() throws Exception {
File file = CommonTestUtil.getFile(ServiceDiscoveryTest.class, "xml/query-response.xml");
FileInputStream inStream = new FileInputStream(file);
- ArrayList list = new ArrayList();
+ ArrayList<AbstractChangeRequest> list = new ArrayList<AbstractChangeRequest>();
client.parseQueryResponse(inStream, list, new NullProgressMonitor());
assertEquals(1, list.size());
- AbstractChangeRequest desc = (AbstractChangeRequest)list.get(0);
+ AbstractChangeRequest desc = list.get(0);
assertEquals("test bug", desc.getTitle());
assertEquals("10", desc.getIdentifier());
assertEquals("", desc.getType()); // rdf:resource
assertEquals("test description", desc.getDescription());
assertEquals("", desc.getSubject());
- assertEquals("", desc.getCreator()); // rdf:resource
+ assertEquals("", desc.getCreator()); // rdf:resource
assertEquals("2009-10-12T08:58:20.588Z", desc.getModified());
}
diff --git a/org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider.java b/org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider.java
index 0277ea251..7e78208b3 100644
--- a/org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider.java
+++ b/org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceDiscoveryProvider.java
@@ -67,9 +67,10 @@ public class OslcServiceDiscoveryProvider implements ITreeContentProvider {
return manager.mayHaveChildren(element);
}
+ @SuppressWarnings("unchecked")
public Object[] getElements(Object inputElement) {
- if (inputElement instanceof List) {
- List<OslcServiceProvider> rootProviders = ((List) inputElement);
+ if (inputElement instanceof List<?>) {
+ List<OslcServiceProvider> rootProviders = (List<OslcServiceProvider>) inputElement;
Object[] result = new Object[rootProviders.size()];
for (int x = 0; x < rootProviders.size(); x++) {
result[x] = new ServiceProviderCatalogWrapper(rootProviders.get(x));
diff --git a/org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceLabelProvider.java b/org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceLabelProvider.java
index 7a53da4eb..e0dbc5aec 100644
--- a/org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceLabelProvider.java
+++ b/org.eclipse.mylyn.oslc.ui/src/org/eclipse/mylyn/internal/oslc/ui/OslcServiceLabelProvider.java
@@ -24,6 +24,7 @@ import org.eclipse.swt.graphics.Image;
/**
* @author Robert Elves
*/
+@SuppressWarnings("restriction")
public class OslcServiceLabelProvider extends LabelProvider {
@Override

Back to the top