@Test public void testTemplateComplete() throws IOException, PrivateEc2ParserException { InputStream templateStream = ClassLoader.getSystemResourceAsStream("./cfn_templates/complete.template"); ToStringBuilder.setDefaultStyle(ToStringStyle.SHORT_PREFIX_STYLE); PrivateEc2Template template = ParserUtils.mapJson(PrivateEc2Template.class, templateStream); assertNotNull(template); }
@Test public void testTemplateWithTags() throws IOException, PrivateEc2ParserException { InputStream templateStream = ClassLoader.getSystemResourceAsStream("./cfn_templates/tags.template"); PrivateEc2Template template = ParserUtils.mapJson(PrivateEc2Template.class, templateStream); assertNotNull(template); assertNotNull(template.getEC2Instance().getProperties().getTags()); assertFalse(template.getEC2Instance().getProperties().getTags().isEmpty()); }
@Test public void test() throws Exception { String templateFile = "./cfn_templates/WordPress_Single_Instance_With_RDS.template"; InputStream templateStream = ClassLoader.getSystemResourceAsStream(templateFile); PrivateEc2Template template = ParserUtils.mapJson(PrivateEc2Template.class, templateStream); assertNotNull(template); assertNotNull(template.getEC2Instance()); assertNotNull(template.getEC2Instance().getProperties()); assertNotNull(template.getEC2Instance().getProperties().getImageId().getValue()); assertNull(template.getEC2Volume(null)); }
@Test public void testJoinTemplate() throws IOException, PrivateEc2ParserException { InputStream templateStream = ClassLoader.getSystemResourceAsStream("./cfn_templates/join.template"); PrivateEc2Template template = ParserUtils.mapJson(PrivateEc2Template.class, templateStream); assertNotNull(template); assertNotNull(template); assertNotNull(template.getEC2Instance()); assertNotNull(template.getEC2Instance().getProperties()); assertNotNull(template.getEC2Instance().getProperties().getAvailabilityZone()); assertNotNull(template.getEC2Instance().getProperties().getUserData()); assertEquals( "export NIC_ADDR=`hostname`\nexport JAVA_HOME=/home/ubuntu/java\n", template.getEC2Instance().getProperties().getUserData().getValue()); }
/** * @throws IOException * @throws PrivateEc2ParserException */ @Test public void testTemplateWithEBS() throws IOException, PrivateEc2ParserException { InputStream templateStream = ClassLoader.getSystemResourceAsStream("./cfn_templates/EC2WithEBSSample.template"); PrivateEc2Template template = ParserUtils.mapJson(PrivateEc2Template.class, templateStream); assertNotNull(template); assertNotNull(template.getEC2Instance()); assertNotNull(template.getEC2Instance().getProperties()); assertNotNull(template.getEC2Instance().getProperties().getVolumes()); assertEquals(1, template.getEC2Instance().getProperties().getVolumes().size()); assertNotNull(template.getEC2Instance().getProperties().getVolumes().get(0).getVolumeId()); assertNotNull( "NewVolume", template.getEC2Instance().getProperties().getVolumes().get(0).getVolumeId().getValue()); assertNotNull(template.getEC2Volume("NewVolume")); }