use of org.ballerinalang.util.codegen.AnnAttachmentInfo in project ballerina by ballerina-lang.
the class AnnotationTest method testConnectorAnnotation.
@Test(description = "Test connector annotation", enabled = false)
public void testConnectorAnnotation() {
AnnotationAttributeInfo annotationInfo = (AnnotationAttributeInfo) compileResult.getProgFile().getEntryPackage().getConnectorInfoEntries()[0].getAttributeInfo(AttributeInfo.Kind.ANNOTATIONS_ATTRIBUTE);
AnnAttachmentInfo[] attachmentInfos = annotationInfo.getAttachmentInfoEntries();
String attributeValue = attachmentInfos[0].getAttributeValue("value").getStringValue();
Assert.assertEquals(attributeValue, "Test connector");
}
use of org.ballerinalang.util.codegen.AnnAttachmentInfo in project ballerina by ballerina-lang.
the class AnnotationTest method testResourceAnnotation.
@Test(description = "Test resource annotation", enabled = false)
public void testResourceAnnotation() {
AnnotationAttributeInfo annotationInfo = (AnnotationAttributeInfo) compileResult.getProgFile().getEntryPackage().getServiceInfo("PizzaService").getResourceInfoEntries()[1].getAttributeInfo(AttributeInfo.Kind.ANNOTATIONS_ATTRIBUTE);
AnnAttachmentInfo[] attachmentInfos = annotationInfo.getAttachmentInfoEntries();
String attributeValue = attachmentInfos[0].getAttributeValue("value").getStringValue();
Assert.assertEquals(attributeValue, "Order pizza");
annotationInfo = (AnnotationAttributeInfo) compileResult.getProgFile().getEntryPackage().getServiceInfo("PizzaService").getResourceInfoEntries()[0].getAttributeInfo(AttributeInfo.Kind.ANNOTATIONS_ATTRIBUTE);
attachmentInfos = annotationInfo.getAttachmentInfoEntries();
attributeValue = attachmentInfos[0].getAttributeValue("value").getStringValue();
Assert.assertEquals(attributeValue, "Check order status");
// TODO ParamDef AnnAttachmentInfo are not available at AnnotationAttributeInfo
// String paramAnnotVal = orderPizzaResource.getParameterDefs()[0].getAnnotations()[0].getValue();
// Assert.assertEquals(paramAnnotVal, "input parameter for oderPizza resource");
}
use of org.ballerinalang.util.codegen.AnnAttachmentInfo in project ballerina by ballerina-lang.
the class AnnotationTest method testStructAnnotation.
@Test(description = "Test struct annotation", enabled = false)
public void testStructAnnotation() {
AnnotationAttributeInfo annotationInfo = (AnnotationAttributeInfo) compileResult.getProgFile().getEntryPackage().getStructInfo("Person").getAttributeInfo(AttributeInfo.Kind.ANNOTATIONS_ATTRIBUTE);
AnnAttachmentInfo[] attachmentInfos = annotationInfo.getAttachmentInfoEntries();
String attributeValue = attachmentInfos[0].getAttributeValue("value").getStringValue();
Assert.assertEquals(attributeValue, "User defined struct : Person");
}
use of org.ballerinalang.util.codegen.AnnAttachmentInfo in project ballerina by ballerina-lang.
the class AnnotationTest method testParameterAnnotation.
@Test(description = "Test function parameter annotation", enabled = false)
public void testParameterAnnotation() {
AnnotationAttributeInfo annotationInfo = (AnnotationAttributeInfo) compileResult.getProgFile().getEntryPackage().getFunctionInfo("foo").getAttributeInfo(AttributeInfo.Kind.ANNOTATIONS_ATTRIBUTE);
AnnAttachmentInfo[] attachmentInfos = annotationInfo.getAttachmentInfoEntries();
// TODO ParamDef AnnAttachmentInfo are not available at AnnotationAttributeInfo
// String attributeValue = annottations[0].getAttribute("value").getLiteralValue().stringValue();
// Assert.assertEquals(attributeValue, "args: input parameter : type string");
}
use of org.ballerinalang.util.codegen.AnnAttachmentInfo in project ballerina by ballerina-lang.
the class AnnotationTest method testTransformerAnnotation.
@Test(description = "Test transformer annotation", enabled = false)
public void testTransformerAnnotation() {
AnnotationAttributeInfo annotationInfo = (AnnotationAttributeInfo) compileResult.getProgFile().getEntryPackage().getTransformerInfo("Bar").getAttributeInfo(AttributeInfo.Kind.ANNOTATIONS_ATTRIBUTE);
AnnAttachmentInfo[] attachmentInfos = annotationInfo.getAttachmentInfoEntries();
String attributeValue = attachmentInfos[0].getAttributeValue("value").getStringValue();
Assert.assertEquals(attributeValue, "User defined transformer: from string to Person");
}
Aggregations