Ejemplo n.º 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void rejects_non_procedure_methods()
        public virtual void RejectsNonProcedureMethods()
        {
            Element element = _elementTestUtils.findMethodElement(typeof(PerformsWriteProcedures), "missingProcedureAnnotation");

            Stream <CompilationMessage> errors = _visitor.visit(element);

//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            assertThat(errors).hasSize(1).extracting(CompilationMessage::getCategory, CompilationMessage::getElement, CompilationMessage::getContents).contains(tuple(Diagnostic.Kind.ERROR, element, "@PerformsWrites usage error: missing @Procedure annotation on method"));
        }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void aggregation_functions_with_specified_name_cannot_be_in_root_namespace()
        public virtual void AggregationFunctionsWithSpecifiedNameCannotBeInRootNamespace()
        {
            Element function = _elementTestUtils.findMethodElement(typeof(UserAggregationFunctionsExamples), "functionWithName");

            Stream <CompilationMessage> errors = _visitor.visit(function);

//JAVA TO C# CONVERTER TODO TASK: Method reference arbitrary object instance method syntax is not converted by Java to C# Converter:
            assertThat(errors).hasSize(1).extracting(CompilationMessage::getCategory, CompilationMessage::getElement, CompilationMessage::getContents).contains(tuple(Diagnostic.Kind.ERROR, function, "Function <in_root_namespace> cannot be defined in the root namespace. Valid name example: com.acme.my_function"));
        }
Ejemplo n.º 3
0
 private Stream <CompilationMessage> ValidatePerformsWriteUsage(ExecutableElement executableElement)
 {
     if (executableElement.getAnnotation(typeof(PerformsWrites)) != null)
     {
         return(_performsWriteVisitor.visit(executableElement));
     }
     return(Stream.empty());
 }
Ejemplo n.º 4
0
        /**
         * Walks child nodes of the given node.
         * @param element
         * @param visitors Map of tag names to visitors for that tag.
         */
        private static void walk(XmlElement element, Dictionary <String, ElementVisitor> visitors)
        {
            XmlNodeList children = element.ChildNodes;

            for (int i = 0, j = children.Count; i < j; ++i)
            {
                XmlNode        child   = children[i];
                ElementVisitor visitor = visitors[child.Name];
                if (visitor != null)
                {
                    visitor.visit((XmlElement)child);
                }
            }
        }
Ejemplo n.º 5
0
 public virtual Stream <CompilationMessage> ValidateEnclosingClass(ExecutableElement method)
 {
     return(_classVisitor.visit(method.EnclosingElement));
 }
Ejemplo n.º 6
0
 private Stream <CompilationMessage> Validate(Element element)
 {
     return(_visitor.visit(element));
 }
Ejemplo n.º 7
0
 private AggregationError MissingAnnotation(ExecutableElement aggregationFunction, Element returnType, IList <ExecutableElement> updateMethods, Type annotation)
 {
     return(new AggregationError(aggregationFunction, "@%s usage error: expected aggregation type <%s> to define exactly 1 method with this annotation. %s.", annotation.Name, _typeVisitor.visit(returnType), updateMethods.Count == 0 ? "Found none" : "Several methods found: " + MethodNames(updateMethods)));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Validates method parameters and return type
 /// </summary>
 public override Stream <CompilationMessage> VisitExecutable(ExecutableElement executableElement, Void ignored)
 {
     return(Stream.of(_classVisitor.visit(executableElement.EnclosingElement), ValidateParameters(executableElement.Parameters), ValidateReturnType(executableElement), ValidatePerformsWriteUsage(executableElement)).flatMap(System.Func.identity()));
 }