use of org.apache.maven.scm.command.login.LoginScmResult in project maven-scm by apache.
the class AccuRevLoginCommandTest method testWhenAlreadyLoggedInAsRequiredUser.
@Test
public void testWhenAlreadyLoggedInAsRequiredUser() throws Exception {
repo.setUser("myUser");
repo.setPassword("aPassword");
info.setUser("myUser");
when(accurev.info(any(File.class))).thenReturn(info);
AccuRevLoginCommand command = new AccuRevLoginCommand(getLogger());
LoginScmResult result = command.login(repo, new ScmFileSet(basedir), new CommandParameters());
assertThat(result.isSuccess(), is(true));
// This is an important case as logging in will start an expiry timer
// that might be shorter than the current expiry timer!
verify(accurev, never()).login(eq("myUser"), anyString());
}
use of org.apache.maven.scm.command.login.LoginScmResult in project maven-scm by apache.
the class AccuRevLoginCommandTest method testWhenAlreadyLoggedInAsSomeoneElse.
@Test
public void testWhenAlreadyLoggedInAsSomeoneElse() throws Exception {
repo.setUser("myUser");
repo.setPassword("aPassword");
info.setUser("A.N.Other");
when(accurev.info(any(File.class))).thenReturn(info);
when(accurev.login("myUser", "aPassword")).thenReturn(true);
AccuRevLoginCommand command = new AccuRevLoginCommand(getLogger());
LoginScmResult result = command.login(repo, new ScmFileSet(basedir), new CommandParameters());
assertThat(result.isSuccess(), is(true));
verify(accurev).login("myUser", "aPassword");
}
use of org.apache.maven.scm.command.login.LoginScmResult in project maven-scm by apache.
the class PerforceScmProvider method login.
protected LoginScmResult login(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
PerforceLoginCommand command = new PerforceLoginCommand();
command.setLogger(getLogger());
return (LoginScmResult) command.execute(repository, fileSet, params);
}
use of org.apache.maven.scm.command.login.LoginScmResult in project maven-scm by apache.
the class IntegrityScmProvider method login.
/**
* Maps to si connect and initialization of the project with si projectinfo
*/
@Override
protected LoginScmResult login(ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters params) throws ScmException {
IntegrityLoginCommand command = new IntegrityLoginCommand();
command.setLogger(getLogger());
return (LoginScmResult) command.execute(repository, fileSet, params);
}
use of org.apache.maven.scm.command.login.LoginScmResult in project maven-scm by apache.
the class AccuRevLoginCommandTest method testWhenNotLoggedIn.
@Test
public void testWhenNotLoggedIn() throws Exception {
repo.setUser("myUser");
repo.setPassword("aPassword");
info.setUser("(not logged in)");
when(accurev.info(any(File.class))).thenReturn(info);
when(accurev.login("myUser", "aPassword")).thenReturn(true);
AccuRevLoginCommand command = new AccuRevLoginCommand(getLogger());
LoginScmResult result = command.login(repo, new ScmFileSet(basedir), new CommandParameters());
assertThat(result.isSuccess(), is(true));
verify(accurev).login("myUser", "aPassword");
}
Aggregations