-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from aniketbhatnagar/issue#81-DBSubnetGroup-Su…
…bnetIds-As-ParameterRef Subnet list can now be passed as ParameterRef to DBSubnetGroup
- Loading branch information
Showing
4 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...test/scala/com/monsanto/arch/cloudformation/model/resource/Subnet_Parameter_List_UT.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.monsanto.arch.cloudformation.model.resource | ||
|
||
import com.monsanto.arch.cloudformation.model._ | ||
import org.scalatest.{FunSpec, Matchers} | ||
import spray.json.{JsNumber, JsString, _} | ||
|
||
class Subnet_Parameter_List_UT extends FunSpec with Matchers { | ||
describe("AWS::EC2::Subnet_Parameter_List") { | ||
|
||
it("should serialize into valid json") { | ||
val subnetListParam = `AWS::EC2::Subnet_Parameter_List`("subnets", "Select subnets where the RDS instances should be created") | ||
val expectedJson = JsObject( | ||
"subnets" -> JsObject( | ||
"Description" -> JsString("Select subnets where the RDS instances should be created"), | ||
"Type" -> JsString("List<AWS::EC2::Subnet::Id>") | ||
) | ||
) | ||
Seq[Parameter](subnetListParam).toJson should be (expectedJson) | ||
} | ||
|
||
it("should serialize into valid json as InputParameter") { | ||
val subnetListParam = `AWS::EC2::Subnet_Parameter_List`("subnets", "Select subnets where the RDS instances should be created") | ||
val expectedJson = JsObject( | ||
"ParameterKey" -> JsString("subnets"), | ||
"ParameterValue" -> JsString("") | ||
) | ||
val inputParam = InputParameter.templateParameterToInputParameter(Some(Seq(subnetListParam))) | ||
inputParam.get(0).toJson should be (expectedJson) | ||
} | ||
|
||
it("can be passed as ParameterRef to AWS::RDS::DBSubnetGroup") { | ||
val subnetListParam = `AWS::EC2::Subnet_Parameter_List`("subnets", "Select subnets where the RDS instances should be created") | ||
val dbSubnetGroup = `AWS::RDS::DBSubnetGroup`( | ||
name = "dbSubnetGroup", | ||
DBSubnetGroupDescription = "DB subnet group", | ||
SubnetIds = ParameterRef(subnetListParam) | ||
) | ||
val expected = JsObject( | ||
"dbSubnetGroup" -> JsObject( | ||
"Type" -> JsString("AWS::RDS::DBSubnetGroup"), | ||
"Properties" -> JsObject( | ||
"DBSubnetGroupDescription" -> JsString("DB subnet group"), | ||
"SubnetIds" -> JsObject("Ref" -> JsString("subnets")) | ||
) | ||
) | ||
) | ||
Seq[Resource[_]](dbSubnetGroup).toJson should be (expected) | ||
} | ||
} | ||
} |