use of org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestGetTaskAssignee in project linuxtools by eclipse.
the class TestOSIORestGetTaskAssignee method testGetTaskAssignee.
@Test
public void testGetTaskAssignee() throws Exception {
TestData testData = new TestData();
TestUtils.initSpaces(requestProvider, testData);
OSIORestClient client = connector.getClient(repository, requestProvider);
AbstractTaskDataHandler taskDataHandler = connector.getTaskDataHandler();
TaskAttributeMapper mapper = taskDataHandler.getAttributeMapper(repository);
TaskData taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), "");
OSIORestTaskSchema.getDefault().initialize(taskData);
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");
OSIORestGetTaskAssignee data = new OSIORestGetTaskAssignee(client.getClient(), "USER-0001", taskData);
String bundleLocation = Activator.getContext().getBundle().getLocation();
int index = bundleLocation.indexOf('/');
String fileName = bundleLocation.substring(index) + "/testjson/assignee.data";
FileReader in = new FileReader(fileName);
TaskAttribute original = taskData.getRoot().getAttribute(OSIORestTaskSchema.getDefault().ASSIGNEES.getKey());
assertTrue(original == null || original.getValues().isEmpty());
TaskAttribute attribute = data.testParseFromJson(in);
assertEquals(1, attribute.getValues().size());
assertEquals(1, original.getValues().size());
assertEquals("user", original.getValue());
}
Aggregations