use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.
the class SchedulerClientTest method testPushFileWithNonAdminUserPwdShouldSucceed.
@Test(timeout = MAX_WAIT_TIME)
public void testPushFileWithNonAdminUserPwdShouldSucceed() throws Exception {
File tmpFile = testFolder.newFile();
Files.write("non_admin_user_push_file_contents".getBytes(), tmpFile);
ISchedulerClient client = SchedulerClient.createInstance();
client.init(new ConnectionInfo(getRestServerUrl(), getNonAdminLogin(), getNonAdminLoginPassword(), null, true));
client.pushFile("USERSPACE", "/test_non_admin_user_push_file", "tmpfile.tmp", tmpFile.getAbsolutePath());
String destDirPath = URI.create(client.getUserSpaceURIs().get(0)).getPath();
File destFile = new File(destDirPath, "test_non_admin_user_push_file/tmpfile.tmp");
assertTrue(Files.equal(tmpFile, destFile));
}
use of org.ow2.proactive.authentication.ConnectionInfo in project scheduling by ow2-proactive.
the class SmartProxyImpl method init.
@Override
public void init(ConnectionInfo connectionInfo) throws SchedulerException, LoginException {
this.connectionInfo = connectionInfo;
if (connectionInfo.getCredentialFile() != null) {
try {
Credentials credentials = Credentials.getCredentials(connectionInfo.getCredentialFile().getAbsolutePath());
init(connectionInfo.getUrl(), credentials);
} catch (KeyException e) {
throw new LoginException(e.getMessage());
}
} else {
CredData cred = new CredData(CredData.parseLogin(connectionInfo.getLogin()), CredData.parseDomain(connectionInfo.getLogin()), connectionInfo.getPassword());
init(connectionInfo.getUrl(), cred);
}
}
Aggregations