org.aludratest.service.gitclient
Class GitClient

java.lang.Object
  extended by org.aludratest.service.gitclient.GitClient
All Implemented Interfaces:
ActionWordLibrary<GitClient>

public class GitClient
extends Object
implements ActionWordLibrary<GitClient>

Provides access to a git command line client using the CommandLineService.

Author:
Volker Bergmann

Constructor Summary
GitClient(CommandLineService service)
           
GitClient(CommandLineService service, int processTimeout, int responseTimeout)
           
 
Method Summary
 GitClient add(AddData data)
          Adds files to the index
 GitClient checkout(CheckoutData data)
          Checks out a branch or paths to the working tree.
 GitClient cloneRepository(CloneRepositoryData data)
          Clones a repository into a new directory.
 GitClient commit(CommitData data)
          Records changes to the repository.
 GitClient config(ConfigData data)
          Calls git's config feature.
 GitClient createBranch(BranchCreationData data)
          Creates a branch.
 GitClient deleteBranch(BranchDeletionData data)
          Deletes a branch.
 GitClient fetch(FetchData data)
          Downloads objects and refs from another repository.
 String getBaseDirectory()
           
 GitClient getCurrentBranch(StringData data)
          Provides the name of the current branch.
 StringData getRelativeWorkingDirectory()
          Returns the working directory of the process.
 GitClient init()
          Creates an empty git repository or reinitializes an existing one.
 GitClient invokeGenerically(InvocationData data)
          Provides individually parameterized git invocations.
 GitClient listBranches(BranchListData data)
          Lists branches.
 GitClient log(LogData data)
          Provides the git log.
 GitClient merge(MergeData data)
          Join two or more development histories together.
 GitClient mv(MvData data)
          Moves or renames a file, directory, or symlink
 GitClient pull(PullData data)
          Fetches from and merges with another repository or a local branch
 GitClient push(PushData data)
          Updates remote refs along with associated objects.
 GitClient rebase(RebaseData data)
          Forward-ports local commits to the updated upstream head.
 GitClient resetHard(ResetData data)
          Resets the current HEAD to the specified state.
 GitClient resetMixed(ResetData data)
          Resets the current HEAD to the specified state.
 GitClient resetSoft(ResetData data)
          Resets the current HEAD to the specified state.
 GitClient rm(RmData data)
          Removes files from the working tree and from the index.
 GitClient setRelativeWorkingDirectory(StringData relativeWorkingDirectory)
          Sets the working directory.
 GitClient stashPop()
          Puts back previously stashed contents to the workspace.
 GitClient stashSave()
          Saves the workspace to the stash.
 GitClient status(StatusData data)
          Provides the status.
 GitClient verifyState()
          Verifies the state.
 GitClient version(VersionData data)
          Queries the git client for its version number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GitClient

public GitClient(CommandLineService service)
Parameters:
service -

GitClient

public GitClient(CommandLineService service,
                 int processTimeout,
                 int responseTimeout)
Parameters:
service -
processTimeout -
responseTimeout -
Method Detail

getRelativeWorkingDirectory

public StringData getRelativeWorkingDirectory()
Returns the working directory of the process.

Returns:
the working directory of the process

setRelativeWorkingDirectory

public GitClient setRelativeWorkingDirectory(StringData relativeWorkingDirectory)
Sets the working directory.

Parameters:
relativeWorkingDirectory - the workingDirectory to set.
Returns:
a reference to this

getBaseDirectory

public String getBaseDirectory()
Returns:
the associated CommandLineService's configured base.directory

config

public GitClient config(ConfigData data)
Calls git's config feature.

Parameters:
data - the settings to apply
Returns:
a reference to this

version

public GitClient version(VersionData data)
Queries the git client for its version number.

Parameters:
data - an instance of the data class that receives the query result
Returns:
a reference to this

status

public GitClient status(StatusData data)
Provides the status.

Parameters:
data -
Returns:
a reference to this

log

public GitClient log(LogData data)
Provides the git log.

Parameters:
data -
Returns:

add

public GitClient add(AddData data)
Adds files to the index

Parameters:
data -
Returns:
a reference to this

getCurrentBranch

public GitClient getCurrentBranch(StringData data)
Provides the name of the current branch.

Parameters:
data - a StringData object that receives the operations result
Returns:
a reference to this

listBranches

public GitClient listBranches(BranchListData data)
Lists branches.

Parameters:
data -
Returns:
a reference to this

createBranch

public GitClient createBranch(BranchCreationData data)
Creates a branch.

Parameters:
data -
Returns:
a reference to this

deleteBranch

public GitClient deleteBranch(BranchDeletionData data)
Deletes a branch.

Parameters:
data -
Returns:
a reference to this

checkout

public GitClient checkout(CheckoutData data)
Checks out a branch or paths to the working tree.

Parameters:
data -
Returns:
a reference to this

cloneRepository

public GitClient cloneRepository(CloneRepositoryData data)
Clones a repository into a new directory.

Parameters:
data -
Returns:
a reference to this

commit

public GitClient commit(CommitData data)
Records changes to the repository.

Parameters:
data -
Returns:
a reference to this

fetch

public GitClient fetch(FetchData data)
Downloads objects and refs from another repository.

Parameters:
data -
Returns:
a reference to this

init

public GitClient init()
Creates an empty git repository or reinitializes an existing one.

Returns:
a reference to this

merge

public GitClient merge(MergeData data)
Join two or more development histories together.

Parameters:
data -
Returns:
a reference to this

mv

public GitClient mv(MvData data)
Moves or renames a file, directory, or symlink

Parameters:
data -
Returns:
a reference to this

pull

public GitClient pull(PullData data)
Fetches from and merges with another repository or a local branch

Parameters:
data -
Returns:
a reference to this

push

public GitClient push(PushData data)
Updates remote refs along with associated objects.

Parameters:
data -
Returns:
a reference to this

rebase

public GitClient rebase(RebaseData data)
Forward-ports local commits to the updated upstream head.

Parameters:
data -
Returns:
a reference to this

resetSoft

public GitClient resetSoft(ResetData data)
Resets the current HEAD to the specified state. It does not touch the index file nor the working tree at all (but resets the head to the specified commit, just like all modes do). This leaves all your changed files "Changes to be committed", as git status would put it.

Parameters:
data -
Returns:
a reference to this

resetMixed

public GitClient resetMixed(ResetData data)
Resets the current HEAD to the specified state. Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action.

Parameters:
data -
Returns:
a reference to this

resetHard

public GitClient resetHard(ResetData data)
Resets the current HEAD to the specified state. Resets the index and working tree. Any changes to tracked files in the working tree since the specified commit are discarded.

Parameters:
data -
Returns:
a reference to this

rm

public GitClient rm(RmData data)
Removes files from the working tree and from the index.

Parameters:
data -
Returns:
a reference to this

stashSave

public GitClient stashSave()
Saves the workspace to the stash.

Returns:
a reference to this

stashPop

public GitClient stashPop()
Puts back previously stashed contents to the workspace.

Returns:
a reference to this

invokeGenerically

public GitClient invokeGenerically(InvocationData data)
Provides individually parameterized git invocations.

Parameters:
data - the invocation data
Returns:
the process' output to stdout

verifyState

public GitClient verifyState()
Description copied from interface: ActionWordLibrary
Verifies the state. If the state is wrong, the implementor shall call an appropriate service method for reporting the inconsistency. GUIInteraction.wrongPageFlow(String)

Specified by:
verifyState in interface ActionWordLibrary<GitClient>
Returns:
a reference to itself (this).


Copyright © 2015 aludratest.org. All rights reserved.