use of org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestGetTaskCreator in project linuxtools by eclipse.
the class TestOSIORestGetTaskCreator method testGetTaskCreator.
@Test
public void testGetTaskCreator() throws Exception {
TestData spaceData = new TestData();
TestUtils.initSpaces(requestProvider, spaceData);
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(spaceData.spaceMap);
connector.setConfiguration(config);
RepositoryLocation location = client.getClient().getLocation();
location.setProperty(IOSIORestConstants.REPOSITORY_AUTH_ID, "user");
location.setProperty(IOSIORestConstants.REPOSITORY_AUTH_TOKEN, "xxxxxxTokenxxxxxx");
taskData.getRoot().getAttribute(OSIORestTaskSchema.getDefault().CREATOR_ID.getKey()).setValue("USER-0001");
OSIORestGetTaskCreator data = new OSIORestGetTaskCreator(client.getClient(), taskData);
String bundleLocation = Activator.getContext().getBundle().getLocation();
int index = bundleLocation.indexOf('/');
String fileName = bundleLocation.substring(index) + "/testjson/user.data";
FileReader in = new FileReader(fileName);
TaskAttribute attr = data.testParseFromJson(in);
assertEquals(OSIORestTaskSchema.getDefault().CREATOR.getKey(), attr.getId());
assertEquals("User 1", attr.getValue());
}
Aggregations