Search in sources :

Example 1 with OSIORestGetWorkItem

use of org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestGetWorkItem in project linuxtools by eclipse.

the class TestOSIORestGetWorkItem method testGetWorkItem.

@Test
public void testGetWorkItem() throws Exception {
    TestData testData = new TestData();
    TestUtils.initSpaces(requestProvider, testData);
    OSIORestClient client = connector.getClient(repository, requestProvider);
    OSIORestConfiguration config = client.getConfiguration(repository, new NullOperationMonitor());
    config.setSpaces(testData.spaceMap);
    connector.setConfiguration(config);
    RepositoryLocation location = client.getClient().getLocation();
    location.setProperty(IOSIORestConstants.REPOSITORY_AUTH_ID, "user");
    location.setProperty(IOSIORestConstants.REPOSITORY_AUTH_TOKEN, "xxxxxxTokenxxxxxx");
    OSIORestGetWorkItem data = new OSIORestGetWorkItem(client.getClient(), "WORKITEM-0001");
    String bundleLocation = Activator.getContext().getBundle().getLocation();
    int index = bundleLocation.indexOf('/');
    String fileName = bundleLocation.substring(index) + "/testjson/workitem.data";
    FileReader in = new FileReader(fileName);
    WorkItem workitem = data.testParseFromJson(in);
    assertEquals("WORKITEM-0001", workitem.getId());
    assertEquals("00001", workitem.getTitle());
    assertEquals("SPACE-0001", workitem.getSpaceId());
    assertEquals("1", workitem.getNumber());
}
Also used : TestData(org.eclipse.linuxtools.mylyn.osio.rest.test.support.TestData) OSIORestClient(org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestClient) OSIORestGetWorkItem(org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestGetWorkItem) OSIORestConfiguration(org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestConfiguration) FileReader(java.io.FileReader) OSIORestGetWorkItem(org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestGetWorkItem) WorkItem(org.eclipse.linuxtools.internal.mylyn.osio.rest.core.response.data.WorkItem) RepositoryLocation(org.eclipse.mylyn.commons.repositories.core.RepositoryLocation) NullOperationMonitor(org.eclipse.linuxtools.internal.mylyn.osio.rest.core.NullOperationMonitor) Test(org.junit.Test)

Aggregations

FileReader (java.io.FileReader)1 NullOperationMonitor (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.NullOperationMonitor)1 OSIORestClient (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestClient)1 OSIORestConfiguration (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestConfiguration)1 OSIORestGetWorkItem (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestGetWorkItem)1 WorkItem (org.eclipse.linuxtools.internal.mylyn.osio.rest.core.response.data.WorkItem)1 TestData (org.eclipse.linuxtools.mylyn.osio.rest.test.support.TestData)1 RepositoryLocation (org.eclipse.mylyn.commons.repositories.core.RepositoryLocation)1 Test (org.junit.Test)1