Uploaded image for project: 'Fuse Tooling'
  1. Fuse Tooling
  2. FUSETOOLS-3481

cvc-complex-type.3.2.2: Attribute 'headerName' is not allowed to appear in element 'setHeader'.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Critical
    • 11.11.0
    • None
    • None
    • None

    Description

      3 tests of templates are failing spotting the issue:

      Error Message
      Expecting empty but was:<[{"lspDiagnostic"=Diagnostic [
        range = Range [
          start = Position [
            line = 48
            character = 49
          ]
          end = Position [
            line = 48
            character = 59
          ]
        ]
        severity = Error
        code = Either [
          left = cvc-complex-type.3.2.2
          right = null
        ]
        codeDescription = null
        source = "xml"
        message = "cvc-complex-type.3.2.2: Attribute 'headerName' is not allowed to appear in element 'setHeader'."
        tags = null
        relatedInformation = null
        data = null
      ], "severity"=2, "charStart"=2386, "languageServerId"="org.eclipse.wildwebdeveloper.xml", "Creation time: "=1623413595644L, "charEnd"=2396, "resource affected"="/jenkins/pullrequest-fuse-templates/editor/tests/org.fusesource.ide.projecttemplates.tests.integration/target/work sp@cé/FuseIntegrationProjectCreatorRunnableForAMQIT-AMQSpringProject-2.18.1.redhat-000026/src/main/resources/META-INF/spring/camel-context.xml", "message"="cvc-complex-type.3.2.2: Attribute 'headerName' is not allowed to appear in element 'setHeader'.", "lineNumber"=49, "resource affected content"="<?xml version="1.0" encoding="UTF-8"?>
      <!-- Configures the Camel Context-->
      <beans xmlns="http://www.springframework.org/schema/beans"    
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
              http://camel.apache.org/schema/spring 
              https://camel.apache.org/schema/spring/camel-spring.xsd
              http://www.springframework.org/schema/beans 
              https://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/context 
              http://www.springframework.org/schema/context/spring-context.xsd">
      
          <bean id="orderGenerator" class="com.mycompany.templates.camel.activemq.OrderGenerator"/>
      
          <!-- 
               Lets connect the Camel ActiveMQ component to the broker.
          -->
          <bean class="org.apache.activemq.ActiveMQConnectionFactory" id="activemq-connection-factory">
              <property name="brokerURL" value="${broker.url}"/>
              <property name="userName" value="${broker.username}"/>
              <property name="password" value="${broker.password}"/>
          </bean>
          <bean class="org.apache.activemq.camel.component.ActiveMQComponent" id="activemq">
              <property name="configuration">
                  <bean class="org.apache.activemq.camel.component.ActiveMQConfiguration">
                      <property name="connectionFactory" ref="activemq-connection-factory"/>
                  </bean>
              </property>
          </bean>
      
          <!--
              The namespace for the camelContext element in Blueprint is 'http://camel.apache.org/schema/blueprint'. 
              Additionally,  we can also define namespace prefixes we want to use them 
              in the XPath expressions in our CBR.
      
              While it is not required to assign id's to the <camelContext/> and <route/> 
              elements, it is a good idea to set those for runtime management purposes 
              (logging, JMX MBeans, ...)
          -->
          <camelContext 
              xmlns="http://camel.apache.org/schema/spring"
              xmlns:order="http://com.mycompany/examples/order"
              id="amq-example-context">
      
              <!-- a route to generate a random order every 5th second -->
              <route id="generate-order">
                  <from id="timerToGenerateOrder" uri="timer:order?period=5000&amp;delay=2000&amp;fixedRate=true"/>
                  <bean id="generatorOrder" ref="orderGenerator" method="generateOrder"/>
                  <setHeader id="updateFileNameHeader" headerName="Exchange.FILE_NAME">
                      <method ref="orderGenerator" method="generateFileName"/>
                  </setHeader>
                  <to id="initializerFolder" uri="file:work/in"/>
              </route>
      
              <!--
                When this route is started, it will automatically create the work/jms/input 
                directory where you can drop thefile that need to be processed.
      
                The <log/> elements are used to add human-friendly business logging statements. 
                They make it easier to see what the route is doing.
      
                Files that are consumed from the work/jms/input directory, are then sent 
                to the JMS queue incomingOrders on the ActiveMQ broker.
              -->
              <route id="file-to-jms-route">
                  <from id="incomingFolder" uri="file:work/in"/>
                  <log id="logReceivingOrder" message="Receiving order ${file:name}"/>
                  <to id="sendIncomingOrder" uri="activemq:incomingOrders"/>
              </route>
      
              <!--
                This route consumes messages from the JMS queue incomingOrders on the 
                ActiveMQ broker within the ESB.
      
                The <choice/> element contains the content based router. The two <when/> 
                clauses use XPath to define the criteria for entering that part of the 
                route. When the country in the XML message is set to UK or US, the file 
                will be moved to a directory for that country. The <otherwise/> element 
                ensures that any file that does not meet the requirements for either of 
                the <when/> elements will be moved to the work/jms/output/others directory.
              -->
              <route id="jms-cbr-route" streamCache="true">
                  <from id="listenToIncomingOrder" uri="activemq:incomingOrders"/>
                  <choice id="countrySelection">
                      <when id="UKCustomer">
                          <xpath id="_xpath1">/order:order/order:customer/order:country = 'UK'</xpath>
                          <log id="logUK" message="Sending order ${file:name} to the UK"/>
                          <to id="outputUKFolder" uri="file:work/out/uk"/>
                      </when>
                      <when id="USCustomer">
                          <xpath id="_xpath2">/order:order/order:customer/order:country = 'US'</xpath>
                          <log id="logUS" message="Sending order ${file:name} to the US"/>
                          <to id="outputUSFolder" uri="file:work/out/us"/>
                      </when>
                      <otherwise id="OtherCustomer">
                          <log id="logOtherCountry" message="Sending order ${file:name} to another country"/>
                          <to id="outputOtherCountryFolder" uri="file:work/out/others"/>
                      </otherwise>
                  </choice>
                  <log id="logEndProcessing" message="Done processing ${file:name}"/>
              </route>
          </camelContext>
      </beans>", "type: "="org.eclipse.lsp4e.diagnostic"},
          {"lspDiagnostic"=Diagnostic [
        range = Range [
          start = Position [
            line = 48
            character = 13
          ]
          end = Position [
            line = 48
            character = 22
          ]
        ]
        severity = Error
        code = Either [
          left = cvc-complex-type.4
          right = null
        ]
        codeDescription = null
        source = "xml"
        message = "Attribute:\n - name\nis required in element:\n - setHeader\n\nCode:"
        tags = null
        relatedInformation = null
        data = null
      ], "severity"=2, "charStart"=2350, "languageServerId"="org.eclipse.wildwebdeveloper.xml", "Creation time: "=1623413595645L, "charEnd"=2359, "resource affected"="/jenkins/pullrequest-fuse-templates/editor/tests/org.fusesource.ide.projecttemplates.tests.integration/target/work sp@cé/FuseIntegrationProjectCreatorRunnableForAMQIT-AMQSpringProject-2.18.1.redhat-000026/src/main/resources/META-INF/spring/camel-context.xml", "message"="Attribute:
       - name
      is required in element:
       - setHeader
      
      Code:", "lineNumber"=49, "resource affected content"="<?xml version="1.0" encoding="UTF-8"?>
      <!-- Configures the Camel Context-->
      <beans xmlns="http://www.springframework.org/schema/beans"    
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
              http://camel.apache.org/schema/spring 
              https://camel.apache.org/schema/spring/camel-spring.xsd
              http://www.springframework.org/schema/beans 
              https://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/context 
              http://www.springframework.org/schema/context/spring-context.xsd">
      
          <bean id="orderGenerator" class="com.mycompany.templates.camel.activemq.OrderGenerator"/>
      
          <!-- 
               Lets connect the Camel ActiveMQ component to the broker.
          -->
          <bean class="org.apache.activemq.ActiveMQConnectionFactory" id="activemq-connection-factory">
              <property name="brokerURL" value="${broker.url}"/>
              <property name="userName" value="${broker.username}"/>
              <property name="password" value="${broker.password}"/>
          </bean>
          <bean class="org.apache.activemq.camel.component.ActiveMQComponent" id="activemq">
              <property name="configuration">
                  <bean class="org.apache.activemq.camel.component.ActiveMQConfiguration">
                      <property name="connectionFactory" ref="activemq-connection-factory"/>
                  </bean>
              </property>
          </bean>
      
          <!--
              The namespace for the camelContext element in Blueprint is 'http://camel.apache.org/schema/blueprint'. 
              Additionally,  we can also define namespace prefixes we want to use them 
              in the XPath expressions in our CBR.
      
              While it is not required to assign id's to the <camelContext/> and <route/> 
              elements, it is a good idea to set those for runtime management purposes 
              (logging, JMX MBeans, ...)
          -->
          <camelContext 
              xmlns="http://camel.apache.org/schema/spring"
              xmlns:order="http://com.mycompany/examples/order"
              id="amq-example-context">
      
              <!-- a route to generate a random order every 5th second -->
              <route id="generate-order">
                  <from id="timerToGenerateOrder" uri="timer:order?period=5000&amp;delay=2000&amp;fixedRate=true"/>
                  <bean id="generatorOrder" ref="orderGenerator" method="generateOrder"/>
                  <setHeader id="updateFileNameHeader" headerName="Exchange.FILE_NAME">
                      <method ref="orderGenerator" method="generateFileName"/>
                  </setHeader>
                  <to id="initializerFolder" uri="file:work/in"/>
              </route>
      
              <!--
                When this route is started, it will automatically create the work/jms/input 
                directory where you can drop thefile that need to be processed.
      
                The <log/> elements are used to add human-friendly business logging statements. 
                They make it easier to see what the route is doing.
      
                Files that are consumed from the work/jms/input directory, are then sent 
                to the JMS queue incomingOrders on the ActiveMQ broker.
              -->
              <route id="file-to-jms-route">
                  <from id="incomingFolder" uri="file:work/in"/>
                  <log id="logReceivingOrder" message="Receiving order ${file:name}"/>
                  <to id="sendIncomingOrder" uri="activemq:incomingOrders"/>
              </route>
      
              <!--
                This route consumes messages from the JMS queue incomingOrders on the 
                ActiveMQ broker within the ESB.
      
                The <choice/> element contains the content based router. The two <when/> 
                clauses use XPath to define the criteria for entering that part of the 
                route. When the country in the XML message is set to UK or US, the file 
                will be moved to a directory for that country. The <otherwise/> element 
                ensures that any file that does not meet the requirements for either of 
                the <when/> elements will be moved to the work/jms/output/others directory.
              -->
              <route id="jms-cbr-route" streamCache="true">
                  <from id="listenToIncomingOrder" uri="activemq:incomingOrders"/>
                  <choice id="countrySelection">
                      <when id="UKCustomer">
                          <xpath id="_xpath1">/order:order/order:customer/order:country = 'UK'</xpath>
                          <log id="logUK" message="Sending order ${file:name} to the UK"/>
                          <to id="outputUKFolder" uri="file:work/out/uk"/>
                      </when>
                      <when id="USCustomer">
                          <xpath id="_xpath2">/order:order/order:customer/order:country = 'US'</xpath>
                          <log id="logUS" message="Sending order ${file:name} to the US"/>
                          <to id="outputUSFolder" uri="file:work/out/us"/>
                      </when>
                      <otherwise id="OtherCustomer">
                          <log id="logOtherCountry" message="Sending order ${file:name} to another country"/>
                          <to id="outputOtherCountryFolder" uri="file:work/out/others"/>
                      </otherwise>
                  </choice>
                  <log id="logEndProcessing" message="Done processing ${file:name}"/>
              </route>
          </camelContext>
      </beans>", "type: "="org.eclipse.lsp4e.diagnostic"}]>
      Stacktrace
      java.lang.AssertionError: 
      
      Expecting empty but was:<[{"lspDiagnostic"=Diagnostic [
        range = Range [
          start = Position [
            line = 48
            character = 49
          ]
          end = Position [
            line = 48
            character = 59
          ]
        ]
        severity = Error
        code = Either [
          left = cvc-complex-type.3.2.2
          right = null
        ]
        codeDescription = null
        source = "xml"
        message = "cvc-complex-type.3.2.2: Attribute 'headerName' is not allowed to appear in element 'setHeader'."
        tags = null
        relatedInformation = null
        data = null
      ], "severity"=2, "charStart"=2386, "languageServerId"="org.eclipse.wildwebdeveloper.xml", "Creation time: "=1623413595644L, "charEnd"=2396, "resource affected"="/jenkins/pullrequest-fuse-templates/editor/tests/org.fusesource.ide.projecttemplates.tests.integration/target/work sp@cé/FuseIntegrationProjectCreatorRunnableForAMQIT-AMQSpringProject-2.18.1.redhat-000026/src/main/resources/META-INF/spring/camel-context.xml", "message"="cvc-complex-type.3.2.2: Attribute 'headerName' is not allowed to appear in element 'setHeader'.", "lineNumber"=49, "resource affected content"="<?xml version="1.0" encoding="UTF-8"?>
      <!-- Configures the Camel Context-->
      <beans xmlns="http://www.springframework.org/schema/beans"    
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
              http://camel.apache.org/schema/spring 
              https://camel.apache.org/schema/spring/camel-spring.xsd
              http://www.springframework.org/schema/beans 
              https://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/context 
              http://www.springframework.org/schema/context/spring-context.xsd">
      
          <bean id="orderGenerator" class="com.mycompany.templates.camel.activemq.OrderGenerator"/>
      
          <!-- 
               Lets connect the Camel ActiveMQ component to the broker.
          -->
          <bean class="org.apache.activemq.ActiveMQConnectionFactory" id="activemq-connection-factory">
              <property name="brokerURL" value="${broker.url}"/>
              <property name="userName" value="${broker.username}"/>
              <property name="password" value="${broker.password}"/>
          </bean>
          <bean class="org.apache.activemq.camel.component.ActiveMQComponent" id="activemq">
              <property name="configuration">
                  <bean class="org.apache.activemq.camel.component.ActiveMQConfiguration">
                      <property name="connectionFactory" ref="activemq-connection-factory"/>
                  </bean>
              </property>
          </bean>
      
          <!--
              The namespace for the camelContext element in Blueprint is 'http://camel.apache.org/schema/blueprint'. 
              Additionally,  we can also define namespace prefixes we want to use them 
              in the XPath expressions in our CBR.
      
              While it is not required to assign id's to the <camelContext/> and <route/> 
              elements, it is a good idea to set those for runtime management purposes 
              (logging, JMX MBeans, ...)
          -->
          <camelContext 
              xmlns="http://camel.apache.org/schema/spring"
              xmlns:order="http://com.mycompany/examples/order"
              id="amq-example-context">
      
              <!-- a route to generate a random order every 5th second -->
              <route id="generate-order">
                  <from id="timerToGenerateOrder" uri="timer:order?period=5000&amp;delay=2000&amp;fixedRate=true"/>
                  <bean id="generatorOrder" ref="orderGenerator" method="generateOrder"/>
                  <setHeader id="updateFileNameHeader" headerName="Exchange.FILE_NAME">
                      <method ref="orderGenerator" method="generateFileName"/>
                  </setHeader>
                  <to id="initializerFolder" uri="file:work/in"/>
              </route>
      
              <!--
                When this route is started, it will automatically create the work/jms/input 
                directory where you can drop thefile that need to be processed.
      
                The <log/> elements are used to add human-friendly business logging statements. 
                They make it easier to see what the route is doing.
      
                Files that are consumed from the work/jms/input directory, are then sent 
                to the JMS queue incomingOrders on the ActiveMQ broker.
              -->
              <route id="file-to-jms-route">
                  <from id="incomingFolder" uri="file:work/in"/>
                  <log id="logReceivingOrder" message="Receiving order ${file:name}"/>
                  <to id="sendIncomingOrder" uri="activemq:incomingOrders"/>
              </route>
      
              <!--
                This route consumes messages from the JMS queue incomingOrders on the 
                ActiveMQ broker within the ESB.
      
                The <choice/> element contains the content based router. The two <when/> 
                clauses use XPath to define the criteria for entering that part of the 
                route. When the country in the XML message is set to UK or US, the file 
                will be moved to a directory for that country. The <otherwise/> element 
                ensures that any file that does not meet the requirements for either of 
                the <when/> elements will be moved to the work/jms/output/others directory.
              -->
              <route id="jms-cbr-route" streamCache="true">
                  <from id="listenToIncomingOrder" uri="activemq:incomingOrders"/>
                  <choice id="countrySelection">
                      <when id="UKCustomer">
                          <xpath id="_xpath1">/order:order/order:customer/order:country = 'UK'</xpath>
                          <log id="logUK" message="Sending order ${file:name} to the UK"/>
                          <to id="outputUKFolder" uri="file:work/out/uk"/>
                      </when>
                      <when id="USCustomer">
                          <xpath id="_xpath2">/order:order/order:customer/order:country = 'US'</xpath>
                          <log id="logUS" message="Sending order ${file:name} to the US"/>
                          <to id="outputUSFolder" uri="file:work/out/us"/>
                      </when>
                      <otherwise id="OtherCustomer">
                          <log id="logOtherCountry" message="Sending order ${file:name} to another country"/>
                          <to id="outputOtherCountryFolder" uri="file:work/out/others"/>
                      </otherwise>
                  </choice>
                  <log id="logEndProcessing" message="Done processing ${file:name}"/>
              </route>
          </camelContext>
      </beans>", "type: "="org.eclipse.lsp4e.diagnostic"},
          {"lspDiagnostic"=Diagnostic [
        range = Range [
          start = Position [
            line = 48
            character = 13
          ]
          end = Position [
            line = 48
            character = 22
          ]
        ]
        severity = Error
        code = Either [
          left = cvc-complex-type.4
          right = null
        ]
        codeDescription = null
        source = "xml"
        message = "Attribute:\n - name\nis required in element:\n - setHeader\n\nCode:"
        tags = null
        relatedInformation = null
        data = null
      ], "severity"=2, "charStart"=2350, "languageServerId"="org.eclipse.wildwebdeveloper.xml", "Creation time: "=1623413595645L, "charEnd"=2359, "resource affected"="/jenkins/pullrequest-fuse-templates/editor/tests/org.fusesource.ide.projecttemplates.tests.integration/target/work sp@cé/FuseIntegrationProjectCreatorRunnableForAMQIT-AMQSpringProject-2.18.1.redhat-000026/src/main/resources/META-INF/spring/camel-context.xml", "message"="Attribute:
       - name
      is required in element:
       - setHeader
      
      Code:", "lineNumber"=49, "resource affected content"="<?xml version="1.0" encoding="UTF-8"?>
      <!-- Configures the Camel Context-->
      <beans xmlns="http://www.springframework.org/schema/beans"    
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="
              http://camel.apache.org/schema/spring 
              https://camel.apache.org/schema/spring/camel-spring.xsd
              http://www.springframework.org/schema/beans 
              https://www.springframework.org/schema/beans/spring-beans.xsd
              http://www.springframework.org/schema/context 
              http://www.springframework.org/schema/context/spring-context.xsd">
      
          <bean id="orderGenerator" class="com.mycompany.templates.camel.activemq.OrderGenerator"/>
      
          <!-- 
               Lets connect the Camel ActiveMQ component to the broker.
          -->
          <bean class="org.apache.activemq.ActiveMQConnectionFactory" id="activemq-connection-factory">
              <property name="brokerURL" value="${broker.url}"/>
              <property name="userName" value="${broker.username}"/>
              <property name="password" value="${broker.password}"/>
          </bean>
          <bean class="org.apache.activemq.camel.component.ActiveMQComponent" id="activemq">
              <property name="configuration">
                  <bean class="org.apache.activemq.camel.component.ActiveMQConfiguration">
                      <property name="connectionFactory" ref="activemq-connection-factory"/>
                  </bean>
              </property>
          </bean>
      
          <!--
              The namespace for the camelContext element in Blueprint is 'http://camel.apache.org/schema/blueprint'. 
              Additionally,  we can also define namespace prefixes we want to use them 
              in the XPath expressions in our CBR.
      
              While it is not required to assign id's to the <camelContext/> and <route/> 
              elements, it is a good idea to set those for runtime management purposes 
              (logging, JMX MBeans, ...)
          -->
          <camelContext 
              xmlns="http://camel.apache.org/schema/spring"
              xmlns:order="http://com.mycompany/examples/order"
              id="amq-example-context">
      
              <!-- a route to generate a random order every 5th second -->
              <route id="generate-order">
                  <from id="timerToGenerateOrder" uri="timer:order?period=5000&amp;delay=2000&amp;fixedRate=true"/>
                  <bean id="generatorOrder" ref="orderGenerator" method="generateOrder"/>
                  <setHeader id="updateFileNameHeader" headerName="Exchange.FILE_NAME">
                      <method ref="orderGenerator" method="generateFileName"/>
                  </setHeader>
                  <to id="initializerFolder" uri="file:work/in"/>
              </route>
      
              <!--
                When this route is started, it will automatically create the work/jms/input 
                directory where you can drop thefile that need to be processed.
      
                The <log/> elements are used to add human-friendly business logging statements. 
                They make it easier to see what the route is doing.
      
                Files that are consumed from the work/jms/input directory, are then sent 
                to the JMS queue incomingOrders on the ActiveMQ broker.
              -->
              <route id="file-to-jms-route">
                  <from id="incomingFolder" uri="file:work/in"/>
                  <log id="logReceivingOrder" message="Receiving order ${file:name}"/>
                  <to id="sendIncomingOrder" uri="activemq:incomingOrders"/>
              </route>
      
              <!--
                This route consumes messages from the JMS queue incomingOrders on the 
                ActiveMQ broker within the ESB.
      
                The <choice/> element contains the content based router. The two <when/> 
                clauses use XPath to define the criteria for entering that part of the 
                route. When the country in the XML message is set to UK or US, the file 
                will be moved to a directory for that country. The <otherwise/> element 
                ensures that any file that does not meet the requirements for either of 
                the <when/> elements will be moved to the work/jms/output/others directory.
              -->
              <route id="jms-cbr-route" streamCache="true">
                  <from id="listenToIncomingOrder" uri="activemq:incomingOrders"/>
                  <choice id="countrySelection">
                      <when id="UKCustomer">
                          <xpath id="_xpath1">/order:order/order:customer/order:country = 'UK'</xpath>
                          <log id="logUK" message="Sending order ${file:name} to the UK"/>
                          <to id="outputUKFolder" uri="file:work/out/uk"/>
                      </when>
                      <when id="USCustomer">
                          <xpath id="_xpath2">/order:order/order:customer/order:country = 'US'</xpath>
                          <log id="logUS" message="Sending order ${file:name} to the US"/>
                          <to id="outputUSFolder" uri="file:work/out/us"/>
                      </when>
                      <otherwise id="OtherCustomer">
                          <log id="logOtherCountry" message="Sending order ${file:name} to another country"/>
                          <to id="outputOtherCountryFolder" uri="file:work/out/others"/>
                      </otherwise>
                  </choice>
                  <log id="logEndProcessing" message="Done processing ${file:name}"/>
              </route>
          </camelContext>
      </beans>", "type: "="org.eclipse.lsp4e.diagnostic"}]>
      

      it seems like "latest" xsd has been updated and is no more compatible with Fuse 7.x.

      Potential solutions:

      • specify a specific version of Camel xsd in templates 'like the latest one used for Fuse). This is the uglier but easiest solution and more accurate anyway than current state which is using 3.x xsds for 2.x based templates
      • ask for a 2.x "latest" stream and use this one in template
      • have a mechanism to detect the exact xsd version correspondign to Camel version and set it

      Attachments

        Issue Links

          Activity

            People

              apupier@redhat.com Aurélien Pupier
              apupier@redhat.com Aurélien Pupier
              Dominik Jelínek Dominik Jelínek
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: