Yaks on Camel K does not find the integration .groovy file - apache-camel

I'm using camel k on a project and I've tried use yaks framework for testing integrations routes.
When I execute the command to begin the test which is written in a .feature file the .groovy file is not found.
Does anyone have a clue about it?
helloworld.feature
Feature: Hello
Scenario: Print hello message
Given load Camel K integration myIntegration.groovy
Given Camel K integration myIntegration is running
Then Camel K integration myIntegration should print Hello world from Camel K!
integration myIntegration.groovy
from('timer:tick?period=10000')
.setBody()
.constant('Hello world from Camel K!')
.to('log:info')
CLI command
yaks test helloworld.feature -n dev-camelk
Logs:
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] 1 Scenarios (1 failed)
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] 3 Steps (1 failed, 2 skipped)
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] 0m1.987s
**[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] com.consol.citrus.exceptions.CitrusRuntimeException: Failed to load Camel K integration from resource mob2.groovy**
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] at org.citrusframework.yaks.camelk.CamelKSteps.loadIntegrationFromFile(CamelKSteps.java:141)
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] at ✽.load Camel K integration mob2.groovy(classpath:org/citrusframework/yaks/helloworld.feature:3)
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] Caused by: **java.io.FileNotFoundException: class path resource [myIntegration.groovy] cannot be opened because it does not exist**
[test-helloworld-c91h513v71u96jkmfqbg-g56mw test-1] at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:199)
Thank you!

There are a couple of problems in the way you call it. The integration name is generally kebab case for Camel K integration, so, your feature must be:
Feature: Hello
Scenario: Print hello message
Given load Camel K integration myIntegration.groovy
Given Camel K integration my-integration is running
Then Camel K integration my-integration should print Hello world from Camel K!
Then, you must provide the integration file resource via --resource option, such as:
yaks run helloworld.feature --resource myIntegration.groovy
Hope it helps!

Related

Camel JBang Error : imported package/class does not exist in the Camel Router program

I am using CXF SOAP to invoke a SOAP webservice. Here I am attaching the sample code from GitHub. and the command i use to run is as below.
Git Repository
https://github.com/gtata007/camel-k-soap/tree/develop
JBang run command below :
camel run TestWeb.java --deps=camel-cxf:3.14.0
While I am trying to build/run the application with the camel Jbang command to test this webservice locally, it started throwing an error. Because it is unable to reference the java package/classes from in my route builder java code. What are the possible ways to build this application by referring to the class files?
Below is the error stack trace for reference.
org.joor.ReflectException: Compilation error:
/TestWeb.java:5: error: package org.oorsprong.websamples_countryinfo does not exist
import org.oorsprong.websamples_countryinfo.CountryInfoService;
^
at org.apache.camel.dsl.java.joor.MultiCompile.compileUnit(MultiCompile.java:144)
at org.apache.camel.dsl.java.joor.JavaRoutesBuilderLoader.doLoadRoutesBuilders(JavaRoutesBuilderLoader.java:122)
at org.apache.camel.dsl.support.ExtendedRouteBuilderLoaderSupport.loadRoutesBuilders(ExtendedRouteBuilderLoaderSupport.java:48)
at org.apache.camel.impl.engine.DefaultRoutesLoader.findRoutesBuilders(DefaultRoutesLoader.java:119)
at org.apache.camel.main.DefaultRoutesCollector.collectRoutesFromDirectory(DefaultRoutesCollector.java:148)
at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:187)
at org.apache.camel.main.BaseMainSupport.configureRoutes(BaseMainSupport.java:652)
at org.apache.camel.main.MainSupport.initCamelContext(MainSupport.java:404)
at org.apache.camel.main.KameletMain.doInit(KameletMain.java:265)
at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
at org.apache.camel.dsl.jbang.core.commands.Run.run(Run.java:560)
at org.apache.camel.dsl.jbang.core.commands.Run.call(Run.java:208)
at org.apache.camel.dsl.jbang.core.commands.Run.call(Run.java:75)
at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
at picocli.CommandLine.access$1500(CommandLine.java:148)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
at picocli.CommandLine.execute(CommandLine.java:2170)
at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:129)
at main.CamelJBang.main(CamelJBang.java:36)
For your information, I have completed the setup of Camel Jbang in my system to test my Camel routes locally before it is deployed to the container. I am using CamelK version 1.10.2.

Cucumber BDD, call gRPC

I am new to BDD, want to call gRPC.
gRPC is working without BDD by following way
command:
./grpcurl -vv -proto functionsNservices_file_java.proto -plaintext localhost:8080 service_in_proto.func
output: exactly what I need
Where
functionsNservices_file_java.proto is a java file
localhost:8080 is deamon
service_in_proto.func is defined in functionsNservices_file_java.proto file
Problem:
is how can i call gRPC using BDD script. as BDD supports camel and camel supports gRPC.

Setting up a Flink cluster with Podman for a beampipeline with flinkrunner

My goal is to create a streaming pipeline to read data from Apache Kafka, process the data, and write back to it.
Because of security reasons, I want to avoid Docker and use Podman.
I have set up a minimal cluster via a docker-compose.yml with a jobmanager, taskmanager and a Python SDK harness worker. The SDK harness worker seems to get stuck when i try to execute a pipeline.
Running the pipeline (reading a multi-line .txt file and writing it back in a file) it gets transferred to the jobmanager and taskmanager correctly, but then goes idle. When I look in the pythonsdk container, the logs show the following message repeatedly:
2022/12/04 16:13:02 Starting worker pool 1: python -m
apache_beam.runners.worker.worker_pool_main --service_port=50000
--container_executable=/opt/apache/beam/boot
Starting worker with command ['/opt/apache/beam/boot', '--id=1-1',
'--logging_endpoint=localhost:45087',
'--artifact_endpoint=localhost:35323',
'--provision_endpoint=localhost:36435',
'--control_endpoint=localhost:33237']
2022/12/04 16:16:31 Failed to obtain provisioning information: failed to
dial server at localhost:36435
caused by:
context deadline exceeded
Here is a link to a test pipeline that was created:
Example on github
Environment:
Debian 11;
Podman;
Python 3.2.9;
apache-beam==2.38.0; and
podman-compose
The setup of the cluster defined in:
docker-compose.yml
1x flink-jobmanager (flink version 1.14)
1x flink-taskmanager
1x Python Harness SDK
I chose to create a SDK container manually because I don't have Docker installed and Flink fails when it tries to create a container
over Docker.
I suspect that I have made a mistake in the network setup or there are some configurations missing for the harness worker, but I could not figure out the problem. Any thoughts?
Crossposted in user mailing list of beam.apache.org

How to deploy an adf web application that contains j2ee components on tomee?

Firstly, I installed tomcat 7, then i could deploy adf application acc to following url: https://blogs.oracle.com/adfthoughts/entry/running_adf_essentials_in_tomcat
But i want server to run a j2ee application which has model project with jpa and hibernate etc, so i need to TomEE for that. I installed TomEE 1.5.2 version on my win7 system, i applied the same steps that already done for tomcat 7, result is failure.
Plz help me, I am getting following errors:
Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Cannot unmarshall the JSP tag library definition file: jar:file:/u02/RTE/apache-tomee-plus-1.5.2/webapps/rcf-dvt-demo/WEB-INF/lib/adf-richclient-impl-12-abrams-SNAPSHOT.jar!/META-INF/afu.tld: unexpected element (uri:"http://java.sun.com/xml/ns/javaee", local:"code"). Expected elements are <{^#}text>
at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:1903)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1073)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1033)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:124)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
I believe the problem is not in ADF, your problem is in the implementation that Tomee is using for EJB (JPA) which is openEJB, see if you configured your EJB Layer correctly?

WSDL2Java tool error Apache CXF

We get the following error when we use WSDL2Java tool to generate stubs. The webservice is up and running.
WSDLToJava Error: org.apache.cxf.wsdl11.WSDLRuntimeException: Fail to create wsd
l definition from : http://scheduler.heartbeatsoftware.com/scheduler/WebServices
/SampleSNMWebService?wsdl
Caused by : WSDLException: faultCode=PARSER_ERROR: java.lang.IllegalArgumentExce
ption: InputSource must have a ByteStream or CharacterStream
If we donwload the wsdl and generate stubs from that wsdl, they are generated. But the java client using those stubs throws the same exception as above
Strangely when we deploy the same webservice on our LAN such a problem is not encountered stubs are generated sucessfully and the subsequent java client works well.
The webservice is created using apache cxf version 2.2.5 and hosted on tomcat 6
Any pointers would be appreciated
regards
Sameer
Found solution. Just need to modify the wsdl.java.bat to include proxy settings
-Dhttp.proxyHost= -Dhttp.proxyPort=8080

Resources