@ -127,6 +127,7 @@ type repositoryStub struct {
FailListDeployments bool
FailListDeployments bool
Created [ ] string
Created [ ] string
ManifestAdd map [ string ] * common . Manifest
ManifestAdd map [ string ] * common . Manifest
ManifestSet map [ string ] * common . Manifest
Deleted [ ] string
Deleted [ ] string
GetValid [ ] string
GetValid [ ] string
TypeInstances map [ string ] [ ] string
TypeInstances map [ string ] [ ] string
@ -140,6 +141,7 @@ func (repository *repositoryStub) reset() {
repository . FailListDeployments = false
repository . FailListDeployments = false
repository . Created = make ( [ ] string , 0 )
repository . Created = make ( [ ] string , 0 )
repository . ManifestAdd = make ( map [ string ] * common . Manifest )
repository . ManifestAdd = make ( map [ string ] * common . Manifest )
repository . ManifestSet = make ( map [ string ] * common . Manifest )
repository . Deleted = make ( [ ] string , 0 )
repository . Deleted = make ( [ ] string , 0 )
repository . GetValid = make ( [ ] string , 0 )
repository . GetValid = make ( [ ] string , 0 )
repository . TypeInstances = make ( map [ string ] [ ] string )
repository . TypeInstances = make ( map [ string ] [ ] string )
@ -194,6 +196,11 @@ func (repository *repositoryStub) AddManifest(d string, manifest *common.Manifes
return nil
return nil
}
}
func ( repository * repositoryStub ) SetManifest ( d string , manifest * common . Manifest ) error {
repository . ManifestSet [ d ] = manifest
return nil
}
func ( repository * repositoryStub ) GetLatestManifest ( d string ) ( * common . Manifest , error ) {
func ( repository * repositoryStub ) GetLatestManifest ( d string ) ( * common . Manifest , error ) {
if d == deploymentName {
if d == deploymentName {
return repository . ManifestAdd [ d ] , nil
return repository . ManifestAdd [ d ] , nil
@ -323,6 +330,11 @@ func TestCreateDeployment(t *testing.T) {
"to begin with manifest-." , testRepository . ManifestAdd [ template . Name ] . Name )
"to begin with manifest-." , testRepository . ManifestAdd [ template . Name ] . Name )
}
}
if ! strings . HasPrefix ( testRepository . ManifestSet [ template . Name ] . Name , "manifest-" ) {
t . Fatalf ( "Repository SetManifest was called with %s but expected manifest name" +
"to begin with manifest-." , testRepository . ManifestSet [ template . Name ] . Name )
}
if ! reflect . DeepEqual ( * testDeployer . Created [ 0 ] , configuration ) || err != nil {
if ! reflect . DeepEqual ( * testDeployer . Created [ 0 ] , configuration ) || err != nil {
t . Fatalf ( "Deployer CreateConfiguration was called with %s but expected %s." ,
t . Fatalf ( "Deployer CreateConfiguration was called with %s but expected %s." ,
testDeployer . Created [ 0 ] , configuration )
testDeployer . Created [ 0 ] , configuration )
@ -396,6 +408,11 @@ func TestCreateDeploymentCreationResourceFailure(t *testing.T) {
"to begin with manifest-." , testRepository . ManifestAdd [ template . Name ] . Name )
"to begin with manifest-." , testRepository . ManifestAdd [ template . Name ] . Name )
}
}
if ! strings . HasPrefix ( testRepository . ManifestSet [ template . Name ] . Name , "manifest-" ) {
t . Fatalf ( "Repository SetManifest was called with %s but expected manifest name" +
"to begin with manifest-." , testRepository . ManifestSet [ template . Name ] . Name )
}
if err != nil || ! reflect . DeepEqual ( d , & deployment ) {
if err != nil || ! reflect . DeepEqual ( d , & deployment ) {
t . Fatalf ( "Expected a different set of response values from invoking CreateDeployment.\n" +
t . Fatalf ( "Expected a different set of response values from invoking CreateDeployment.\n" +
"Received: %v, %v. Expected: %v, %v." , d , err , & deployment , "nil" )
"Received: %v, %v. Expected: %v, %v." , d , err , & deployment , "nil" )
@ -425,6 +442,11 @@ func TestDeleteDeploymentForget(t *testing.T) {
"to begin with manifest-." , testRepository . ManifestAdd [ template . Name ] . Name )
"to begin with manifest-." , testRepository . ManifestAdd [ template . Name ] . Name )
}
}
if ! strings . HasPrefix ( testRepository . ManifestSet [ template . Name ] . Name , "manifest-" ) {
t . Fatalf ( "Repository SetManifest was called with %s but expected manifest name" +
"to begin with manifest-." , testRepository . ManifestSet [ template . Name ] . Name )
}
if ! reflect . DeepEqual ( * testDeployer . Created [ 0 ] , configuration ) || err != nil {
if ! reflect . DeepEqual ( * testDeployer . Created [ 0 ] , configuration ) || err != nil {
t . Fatalf ( "Deployer CreateConfiguration was called with %s but expected %s." ,
t . Fatalf ( "Deployer CreateConfiguration was called with %s but expected %s." ,
testDeployer . Created [ 0 ] , configuration )
testDeployer . Created [ 0 ] , configuration )