Class MockBootstrapManager
- java.lang.Object
-
- it.com.atlassian.bamboo.agent.elastic.mocks.MockBootstrapManager
-
- All Implemented Interfaces:
BootstrapManager
,com.atlassian.config.bootstrap.AtlassianBootstrapManager
public class MockBootstrapManager extends Object implements BootstrapManager
Created by rstephens on 21/04/15.
-
-
Field Summary
-
Fields inherited from interface com.atlassian.bamboo.setup.BootstrapManager
INSTANCE_FINGERPRINT_PARAM, SERVER_FINGERPRINT_PARAM
-
-
Constructor Summary
Constructors Constructor Description MockBootstrapManager(URI brokerUri)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bootstrapDatabase(com.atlassian.config.db.DatabaseDetails databaseDetails, boolean b)
void
bootstrapDatasource(String s, String s1)
boolean
databaseContainsExistingData(Connection connection)
com.atlassian.config.ApplicationConfiguration
getApplicationConfig()
String
getApplicationHome()
String
getArtifactsDirectory()
This method returns the root directory underneath which the artifacts are stored.BambooSharedProperties
getBambooSharedProperties()
Shared home properties (bamboo-shared.cfg.xml)String
getBootstrapFailureReason()
URI
getBrokerClientURI()
URI
getBrokerURI()
String
getBuildDirectory()
Gets the directory where Bamboo's build files sit.String
getBuildNumber()
String
getBuildWorkingDirectory()
This method returns the root directory underneath which the build directories are located.String
getConfigDirectory()
Gets the directory where Bamboo's administration.xml file sitsString
getConfiguredApplicationHome()
String
getFilePathProperty(String s)
@NotNull ServerFingerprint
getFingerprint()
String
getH2VersionFromConfig()
com.atlassian.config.db.HibernateConfig
getHibernateConfig()
com.atlassian.config.db.HibernateConfigurator
getHibernateConfigurator()
Properties
getHibernateProperties()
String
getLocalHomePath()
Local home directory;String
getOperation()
Map
getPropertiesWithPrefix(String s)
Object
getProperty(String s)
Collection
getPropertyKeys()
@NotNull String
getRepositoryLogsDirectory()
String
getServerID()
int
getServerKey()
Returns server key used forBambooEntityOid
s of this Bamboo instance.com.atlassian.config.setup.SetupPersister
getSetupPersister()
String
getSharedHomePath()
Shared home directory;String
getString(String s)
Connection
getTestDatabaseConnection(com.atlassian.config.db.DatabaseDetails databaseDetails)
Connection
getTestDatasourceConnection(String s)
void
init()
boolean
initializeBuildNumberIfRequired()
boolean
initializeServerKey()
Initializes server key used forBambooEntityOid
s of this Bamboo instance based onserver ID
.boolean
isApplicationHomeValid()
boolean
isBootstrapped()
boolean
isPropertyTrue(String s)
boolean
isSetupComplete()
void
publishConfiguration()
void
removeProperty(String s)
boolean
resetH2Version()
void
save()
void
setArtifactsDirectory(String artifactsDir)
void
setBrokerClientURI(URI brokerURI)
void
setBrokerURI(URI brokerUri)
void
setBuildDirectory(String buildDirectory)
void
setBuildNumber(String s)
void
setBuildWorkingDirectory(String buildWorkingDirectory)
void
setConfigDirectory(String configurationDirectory)
void
setH2Version(String h2Version)
void
setHibernateConfigurator(com.atlassian.config.db.HibernateConfigurator hibernateConfigurator)
void
setOperation(String s)
void
setProperty(String s, Object o)
void
setRepositoryLogsDirectory(String repositoryLogsDirectory)
void
setServerID(String serverId)
void
setServerKey(int serverKey)
Set server key used forBambooEntityOid
s for this Bamboo instance.void
setSetupComplete(boolean b)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.setup.BootstrapManager
getIndexDirectory
-
-
-
-
Constructor Detail
-
MockBootstrapManager
public MockBootstrapManager(URI brokerUri)
-
-
Method Detail
-
getConfigDirectory
public String getConfigDirectory()
Description copied from interface:BootstrapManager
Gets the directory where Bamboo's administration.xml file sits- Specified by:
getConfigDirectory
in interfaceBootstrapManager
- Returns:
- String representing the path to the folder. Null if not configured
-
setConfigDirectory
public void setConfigDirectory(String configurationDirectory)
- Specified by:
setConfigDirectory
in interfaceBootstrapManager
-
getBuildDirectory
public String getBuildDirectory()
Description copied from interface:BootstrapManager
Gets the directory where Bamboo's build files sit. This includes artifacts and the like- Specified by:
getBuildDirectory
in interfaceBootstrapManager
- Returns:
- String representing the path to the folder. Null if not configured
-
setBuildDirectory
public void setBuildDirectory(String buildDirectory)
- Specified by:
setBuildDirectory
in interfaceBootstrapManager
-
getBuildWorkingDirectory
public String getBuildWorkingDirectory()
Description copied from interface:BootstrapManager
This method returns the root directory underneath which the build directories are located. The structure below this directory is not documented - you most likely do not want to use this method, consider using DefaultBuildDirectoryManager methods instead.- Specified by:
getBuildWorkingDirectory
in interfaceBootstrapManager
-
setBuildWorkingDirectory
public void setBuildWorkingDirectory(String buildWorkingDirectory)
- Specified by:
setBuildWorkingDirectory
in interfaceBootstrapManager
-
getArtifactsDirectory
public String getArtifactsDirectory()
Description copied from interface:BootstrapManager
This method returns the root directory underneath which the artifacts are stored. The structure below this directory is not documented - you most likely do not want to use this method, consider using com.atlassian.bamboo.fileserver.SystemDirectory methods instead.- Specified by:
getArtifactsDirectory
in interfaceBootstrapManager
-
setArtifactsDirectory
public void setArtifactsDirectory(String artifactsDir)
- Specified by:
setArtifactsDirectory
in interfaceBootstrapManager
-
getRepositoryLogsDirectory
@NotNull public @NotNull String getRepositoryLogsDirectory()
- Specified by:
getRepositoryLogsDirectory
in interfaceBootstrapManager
- Returns:
- the root directory underneath which the repositories logs directories are located.
-
setRepositoryLogsDirectory
public void setRepositoryLogsDirectory(String repositoryLogsDirectory)
- Specified by:
setRepositoryLogsDirectory
in interfaceBootstrapManager
-
getServerID
public String getServerID()
- Specified by:
getServerID
in interfaceBootstrapManager
-
setServerID
public void setServerID(String serverId)
- Specified by:
setServerID
in interfaceBootstrapManager
-
initializeServerKey
public boolean initializeServerKey()
Description copied from interface:BootstrapManager
Initializes server key used forBambooEntityOid
s of this Bamboo instance based onserver ID
. Does nothing if the server key is already configured. This method should be externally synchronized.- Specified by:
initializeServerKey
in interfaceBootstrapManager
- Returns:
- true if server key has been initialized, false otherwise
-
getServerKey
public int getServerKey()
Description copied from interface:BootstrapManager
Returns server key used forBambooEntityOid
s of this Bamboo instance.- Specified by:
getServerKey
in interfaceBootstrapManager
-
setServerKey
public void setServerKey(int serverKey)
Description copied from interface:BootstrapManager
Set server key used forBambooEntityOid
s for this Bamboo instance.- Specified by:
setServerKey
in interfaceBootstrapManager
- Parameters:
serverKey
- server key of this instance
-
getBrokerURI
public URI getBrokerURI() throws URISyntaxException
- Specified by:
getBrokerURI
in interfaceBootstrapManager
- Throws:
URISyntaxException
-
setBrokerURI
public void setBrokerURI(URI brokerUri)
- Specified by:
setBrokerURI
in interfaceBootstrapManager
-
getBrokerClientURI
public URI getBrokerClientURI() throws URISyntaxException
- Specified by:
getBrokerClientURI
in interfaceBootstrapManager
- Throws:
URISyntaxException
-
setBrokerClientURI
public void setBrokerClientURI(URI brokerURI)
- Specified by:
setBrokerClientURI
in interfaceBootstrapManager
-
getFingerprint
@NotNull public @NotNull ServerFingerprint getFingerprint()
- Specified by:
getFingerprint
in interfaceBootstrapManager
- Returns:
- a unique identifier for this startup
-
isBootstrapped
public boolean isBootstrapped()
- Specified by:
isBootstrapped
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getProperty
public Object getProperty(String s)
- Specified by:
getProperty
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
setProperty
public void setProperty(String s, Object o)
- Specified by:
setProperty
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
isPropertyTrue
public boolean isPropertyTrue(String s)
- Specified by:
isPropertyTrue
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
removeProperty
public void removeProperty(String s)
- Specified by:
removeProperty
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getString
public String getString(String s)
- Specified by:
getString
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getFilePathProperty
public String getFilePathProperty(String s)
- Specified by:
getFilePathProperty
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getPropertyKeys
public Collection getPropertyKeys()
- Specified by:
getPropertyKeys
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getPropertiesWithPrefix
public Map getPropertiesWithPrefix(String s)
- Specified by:
getPropertiesWithPrefix
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getBuildNumber
public String getBuildNumber()
- Specified by:
getBuildNumber
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
setBuildNumber
public void setBuildNumber(String s)
- Specified by:
setBuildNumber
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
isApplicationHomeValid
public boolean isApplicationHomeValid()
- Specified by:
isApplicationHomeValid
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getHibernateProperties
public Properties getHibernateProperties()
- Specified by:
getHibernateProperties
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
save
public void save() throws com.atlassian.config.ConfigurationException
- Specified by:
save
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
- Throws:
com.atlassian.config.ConfigurationException
-
isSetupComplete
public boolean isSetupComplete()
- Specified by:
isSetupComplete
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getOperation
public String getOperation()
- Specified by:
getOperation
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
setOperation
public void setOperation(String s)
- Specified by:
setOperation
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
setSetupComplete
public void setSetupComplete(boolean b)
- Specified by:
setSetupComplete
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
bootstrapDatasource
public void bootstrapDatasource(String s, String s1) throws com.atlassian.config.bootstrap.BootstrapException
- Specified by:
bootstrapDatasource
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
- Throws:
com.atlassian.config.bootstrap.BootstrapException
-
getSetupPersister
public com.atlassian.config.setup.SetupPersister getSetupPersister()
- Specified by:
getSetupPersister
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getApplicationConfig
public com.atlassian.config.ApplicationConfiguration getApplicationConfig()
- Specified by:
getApplicationConfig
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getApplicationHome
public String getApplicationHome()
- Specified by:
getApplicationHome
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getConfiguredApplicationHome
public String getConfiguredApplicationHome()
- Specified by:
getConfiguredApplicationHome
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getBootstrapFailureReason
public String getBootstrapFailureReason()
- Specified by:
getBootstrapFailureReason
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
init
public void init() throws com.atlassian.config.bootstrap.BootstrapException
- Specified by:
init
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
- Throws:
com.atlassian.config.bootstrap.BootstrapException
-
publishConfiguration
public void publishConfiguration()
- Specified by:
publishConfiguration
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
bootstrapDatabase
public void bootstrapDatabase(com.atlassian.config.db.DatabaseDetails databaseDetails, boolean b) throws com.atlassian.config.bootstrap.BootstrapException
- Specified by:
bootstrapDatabase
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
- Throws:
com.atlassian.config.bootstrap.BootstrapException
-
getHibernateConfigurator
public com.atlassian.config.db.HibernateConfigurator getHibernateConfigurator()
- Specified by:
getHibernateConfigurator
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
setHibernateConfigurator
public void setHibernateConfigurator(com.atlassian.config.db.HibernateConfigurator hibernateConfigurator)
- Specified by:
setHibernateConfigurator
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getHibernateConfig
public com.atlassian.config.db.HibernateConfig getHibernateConfig()
- Specified by:
getHibernateConfig
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getTestDatasourceConnection
public Connection getTestDatasourceConnection(String s) throws com.atlassian.config.bootstrap.BootstrapException
- Specified by:
getTestDatasourceConnection
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
- Throws:
com.atlassian.config.bootstrap.BootstrapException
-
databaseContainsExistingData
public boolean databaseContainsExistingData(Connection connection)
- Specified by:
databaseContainsExistingData
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
-
getTestDatabaseConnection
public Connection getTestDatabaseConnection(com.atlassian.config.db.DatabaseDetails databaseDetails) throws com.atlassian.config.bootstrap.BootstrapException
- Specified by:
getTestDatabaseConnection
in interfacecom.atlassian.config.bootstrap.AtlassianBootstrapManager
- Throws:
com.atlassian.config.bootstrap.BootstrapException
-
getH2VersionFromConfig
public String getH2VersionFromConfig()
- Specified by:
getH2VersionFromConfig
in interfaceBootstrapManager
-
resetH2Version
public boolean resetH2Version()
- Specified by:
resetH2Version
in interfaceBootstrapManager
-
setH2Version
public void setH2Version(String h2Version)
- Specified by:
setH2Version
in interfaceBootstrapManager
-
getLocalHomePath
public String getLocalHomePath()
Description copied from interface:BootstrapManager
Local home directory;- Specified by:
getLocalHomePath
in interfaceBootstrapManager
-
getSharedHomePath
public String getSharedHomePath()
Description copied from interface:BootstrapManager
Shared home directory;- Specified by:
getSharedHomePath
in interfaceBootstrapManager
-
getBambooSharedProperties
public BambooSharedProperties getBambooSharedProperties()
Description copied from interface:BootstrapManager
Shared home properties (bamboo-shared.cfg.xml)- Specified by:
getBambooSharedProperties
in interfaceBootstrapManager
- Returns:
- BambooSharedProperties
-
initializeBuildNumberIfRequired
public boolean initializeBuildNumberIfRequired() throws com.atlassian.config.ConfigurationException
- Specified by:
initializeBuildNumberIfRequired
in interfaceBootstrapManager
- Throws:
com.atlassian.config.ConfigurationException
-
-