use of org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestGetUser in project linuxtools by eclipse.
the class TestOSIORestGetUser method testGetUser.
@Test
public void testGetUser() 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");
OSIORestGetUser data = new OSIORestGetUser(client.getClient(), "USER-0001");
String bundleLocation = Activator.getContext().getBundle().getLocation();
int index = bundleLocation.indexOf('/');
String fileName = bundleLocation.substring(index) + "/testjson/user.data";
FileReader in = new FileReader(fileName);
Identity user = data.testParseFromJson(in);
assertEquals("User.org", user.getCompany());
assertEquals("user@user.org", user.getEmail());
assertEquals("User 1", user.getFullName());
assertEquals("IDENTITY-0001", user.getIdentityID());
assertEquals("https://www.gravatar.com/avatar/user.jpg", user.getImageURL());
assertEquals("USER-0001", user.getUserID());
assertEquals("user", user.getUsername());
assertEquals("IDENTITY-0001", user.getId());
}
Aggregations