FreeMarker FMPP Failed to evaluate function "csv" - csv

Using FMPP version 0.9.15, I'm following the documentation examples to pull data from a CSV file. If I use command line with config.fmpp:
sourceRoot: src
outputRoot: out
data: {tdd(data/style.tdd), birds:csv(data/birds.csv)}
Or ANT config:
<project name="FMPP test" default="build">
<taskdef name="fmpp" classname="fmpp.tools.AntTask">
<classpath>
<pathelement location="lib/fmpp.jar"/>
</classpath>
</taskdef>
<target name="build">
<fmpp
sourceRoot="src" outputRoot="out"
data="tdd(data/style.tdd), birds:csv(data/birds.csv)"
/>
</target>
</project>
I receive the following error either way:
TDD error: Failed to evaluate function "csv".
tdd(data/style.tdd), birds:csv(data/birds.csv)
^
On the other hand, If I switch to "birds:text..." or "birds:splitText..." I do not get the evaluation error. It looks like csv is still supported in the code. Any idea why the TDD data source is not recognizing the csv function?

Did you try adding a space between birds: and csv(data/birds.csv)?
data: {
tdd(data/style.tdd)
birds: csv(data/birds.csv)
}

Related

DS Fault Message: Error in 'createProcessedPreparedStatement' in WSO2 DataService

I have created a Dataservice in WSO2 to execute SQL Query TRUNCATE TABLE Student and expose it as an API , but i got this error
[2022-12-07 16:33:57,222] ERROR {DBInOnlyMessageReceiver} - Error in
in-only message receiver DS Fault Message: Error in DS non result
invoke. DS Code: DATABASE_ERROR Nested Exception:-
javax.xml.stream.XMLStreamException: DS Fault Message: Error in
'SQLQuery.processStoredProcQuery': DS Fault Message: Error in
'createProcessedPreparedStatement' DS Code: UNKNOWN_ERROR Nested
Exception:- java.sql.SQLException: Unable to retrieve metadata for
procedure.
DS Code: DATABASE_ERROR Source Data Service:- Name: RADMINDataService
Location:
/home/master/Downloads/IntegrationStudio/runtime/microesb/tmp/carbonapps/-1234/1670427210936TestCompositeApplication_1.0.0.car/RADMINDataService_1.0.0/RADMINDataService-1.0.0.dbs
Description: Exposing the radmin data service as a REST service
Default Namespace: http://ws.wso2.org/dataservice/samples/json_sample
Current Request Name: _gettruncatenumseq Current Params: {} Nested
Exception:- DS Fault Message: Error in
'createProcessedPreparedStatement' DS Code: UNKNOWN_ERROR Nested
Exception:- java.sql.SQLException: Unable to retrieve metadata for
procedure.
at
org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processSingleRequest(SingleDataServiceRequest.java:117)
at
org.wso2.micro.integrator.dataservices.core.dispatch.SingleDataServiceRequest.processRequest(SingleDataServiceRequest.java:66)
at
org.wso2.micro.integrator.dataservices.core.dispatch.DataServiceRequest.dispatch(DataServiceRequest.java:358)
at
org.wso2.micro.integrator.dataservices.core.DataServiceProcessor.dispatch(DataServiceProcessor.java:40)
at
org.wso2.micro.integrator.dataservices.core.DBInOnlyMessageReceiver.invokeBusinessLogic(DBInOnlyMessageReceiver.java:52)
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:376)
at
org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:190)
at
org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at
java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at
java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834) Caused by:
javax.xml.stream.XMLStreamException: DS Fault Message: Error in
'SQLQuery.processStoredProcQuery': DS Fault Message: Error in
'createProcessedPreparedStatement' DS Code: UNKNOWN_ERROR Nested
Exception:- java.sql.SQLException: Unable to retrieve metadata for
procedure.
This is my configuration file
<query id="truncatenum" useConfig="mysql">
<sql><![CDATA[TRUNCATE TABLE Student]]></sql>
</query>
<resource method="GET" path="truncatenum">
<description />
<call-query href="truncatenum"/>
</resource>
I don't think the error is caused by the code snippet you shared. The following seems correct.
<query id="truncatenum" useConfig="mysql">
<sql><![CDATA[TRUNCATE TABLE Student]]></sql>
</query>
<resource method="GET" path="truncatenum">
<description />
<call-query href="truncatenum"/>
</resource>
Probably one of the queries you have doesn't match the input parameters you are providing. Hence double check all the other queries you have.
Update
You are correct the TRUNCATE query is executed as a STOREDPROC. I had a closer look at the source-code and it seems if the QUERY String doesn't start with one of the following it's inferred as a STOREDPROC. This is definitely a bug in WSO2.
The weird thing is, in my case the TRUNCATE query is executed as a Stored Procedure successfully. So I assume there is a difference in your Dataeervice from the one I'm trying. Can you create the following Dataservice as it is and try it out? (Just change the connection parameters)
Dataservice
<data name="RESTDataService" serviceNamespace="http://ws.wso2.org/dataservice/samples/json_sample" transports="http https">
<description>Exposing the data service as a REST service.</description>
<config id="default">
<property name="driverClassName">com.mysql.jdbc.Driver</property>
<property name="url">jdbc:mysql://localhost:3306/school_db</property>
<property name="org.wso2.ws.dataservice.user">root</property>
<property name="org.wso2.ws.dataservice.password">root123456</property>
</config>
<resource method="GET" path="truncatenum">
<description />
<call-query href="truncatenum" />
</resource>
<query id="truncatenum" useConfig="default">
<sql><![CDATA[TRUNCATE TABLE students]]></sql>
</query>
</data>
Request
curl --location --request GET 'http://localhost:8290/services/RESTDataService/truncatenum'
If you still get the error. Please enable DEBUG logs for the package org.wso2.micro.integrator.dataservices and share the logs.

Angular app being able to access json file under assets folder in Microsoft Azure

Currently i have an angular 9 app which is able to access config.json file placed under assets folder.I have config service which is responsible for reading from this file. This works with no issues when i run locallly. The file path is /dist/assets/config.json.
However when i deploy this app on azure as Azure App Service (windows OS) strangely the app cannot find this config.json file even though i can clearly see the file is under assets folder. Below are the relevant code from each file. The code fails when the config service tries to grab the file config.json with an error message
Error occured while grabbing config files
config.service.ts:65 TypeError: You provided 'undefined' where a stream was expected. You can provide
an Observable, Promise, Array, or Iterable.
at subscribeTo (subscribeTo.js:27)
at subscribeToResult (subscribeToResult.js:11)
at MergeMapSubscriber._innerSub (mergeMap.js:59)
at MergeMapSubscriber._tryNext (mergeMap.js:53)
at MergeMapSubscriber._next (mergeMap.js:36)
at MergeMapSubscriber.next (Subscriber.js:49)
at Observable._subscribe (subscribeToArray.js:3)
at Observable._trySubscribe (Observable.js:42)
at Observable.subscribe (Observable.js:28)
at MergeMapOperator.call (mergeMap.js:21)
appmodule.ts
function configFactory(configService: ConfigService) {
return () => configService.loadConfig();
}
providers: [
{
provide: APP_INITIALIZER,
deps: [ConfigService],
multi: true,
useFactory: configFactory
},
ConfigService.ts
loadConfig() {
return this.http.get<Config>("assets/config.json").subscribe(x=>{
console.log("Successfully grabbed config files");
this.config=x;
},error=>{
console.log("Error in grabbing config files");
console.log(error);
});
}
web.config
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<system.webServer>
<staticContent>
<!-- this is so that app can find json file when deployed in azure -->
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
angular.json
"assets": [
"src/favicon.ico",
"src/assets",
"src/web.config"
],
I also referred to this link Angular app unable to find asset files on Azure but the solution proposed there doesnt work in my case. I have also set "allowSyntheticDefaultImports": true in my tsconfig.app.json file.
ng build --prod --base-href /unrc-willis-web/
Or Try
ng build --prod --base-href "./"
Also interceptor had issues. interceptor was getting used for a non required call

Autodesk Forge: WorkItem failing due to AppPackage Issues

My AppPackage fails to load, and I'm unable to find the exact answer in the documentation or by the error message/code.
I tested the bundle by unzipping it into the "C:\Program Files\Autodesk\ApplicationPlugins" on my local machine, and it runs/loads as expected.
The AppPackage indicates that it is created successfully, which I'm sure is the most up-to-date version.
The addin is a .NET DLL file.
Error Report Message
[02/15/2019 18:44:48] Starting work item ffbcfc1ca50546fc9a6372424b2cdae1
[02/15/2019 18:44:48] Start download phase.
[02/15/2019 18:44:48] Start downloading file <CENSORED>.
[02/15/2019 18:44:48] Start preparing AppPackage <CENSORED>.
[02/15/2019 18:44:48] Download bits and install app to local cache.
[02/15/2019 18:44:48] End downloading file <CENSORED>.
[02/15/2019 18:44:48] End download phase.
[02/15/2019 18:44:48] Error: Failed to prepare app package(s).
[02/15/2019 18:44:48] Error: An unexpected error happened during phase Downloading of job.
[02/15/2019 18:44:48] Job finished with result FailedEnvironmentSetup
PackageContents.XML
<?xml version="1.0" encoding="utf-8" ?>
<ApplicationPackage SchemaVersion="1.0" AutodeskProduct="AutoCAD"
AppVersion="0.1.0"
ProductType="Application"
Name="CENSORED"
Description="CENSORED"
Author="CENSORED"
FriendlyVersion="0.1.0"
ProductCode="{CENSORED}"
UpgradeCode="{CENSORED}"
Helpfile="./help.html"
Icon="./my-icon.jpeg">
<CompanyDetails Name="CENSORED" Phone="CENSORED" Email="CENSORED"/>
<Components>
<RuntimeRequirements SeriesMin="R22.0" Platform="AutoCAD*" OS="Win64"/>
<ComponentEntry AppName="CENSORED" Version="0.1.0" ModuleName="./CENSORED.dll" AppType=".Net"
AppDescription="CENSORED" LoadOnAutoCADStartup="True">
</ComponentEntry>
</Components>
</ApplicationPackage>
Activity Definition:
Note I had to manually expand some inline functions here, since I have this broken into multiple parts. If I have a typo, rest assured the code actually runs syntactically.
let activity = <CreateActivityRequest>{
Id: id,
Version: 1,
IsPublic: false,
AppPackages: ['PACKAGE_NAME'],
Instruction: {Script: 'D6 '},
RequiredEngineVersion: '22.0',
Parameters: {
InputParameters: [{Name: 'HostDwg', LocalFileName: '$(HostDwg)'}],
OutputParameters: [{Name: 'output', LocalFileName: `output.json`}]
},
HostApplication: undefined,
AllowedChildProcesses: []
};
Entry from AppPackages Listing:
{
References: [],
Resource: '...',
RequiredEngineVersion: '22.0',
IsPublic: false,
IsObjectEnabler: false,
Version: 1,
Timestamp: '2019-02-15T19:32:33.527Z',
Description: '',
Id: 'CENSORED'
},
Make sure to double check how you zipped the AppPackage you uploaded. If you look inside your zip file, make sure you have a folder with the name PACKAGE_NAME.bundle and the PackageContents.XML file is inside that PACKAGE_NAME.bundle folder.

The type or namespace name 'Dts' does not exist in the namespace 'Microsoft.SqlServer' (are you missing an assembly reference?)

I am writing BIML file and added scripttask project. The code snippet is as below
<ScriptTaskProject Name="CollectRecordIds" ProjectCoreName="ST_39671a219bda455a9ac64f4384d10901" EntryPoint="Main">
<AssemblyReferences>
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ManagedDTS.dll"/>
<AssemblyReference AssemblyPath="Microsoft.SqlServer.ScriptTask.dll"/>
<AssemblyReference AssemblyPath="System.dll"/>
<AssemblyReference AssemblyPath="System.Data.dll"/>
<AssemblyReference AssemblyPath="System.Windows.Forms.dll"/>
<AssemblyReference AssemblyPath="System.Xml.dll"/>
</AssemblyReferences>
<ReadOnlyVariables>
<Variable DataType="String" VariableName="rootFolder"/>
</ReadOnlyVariables>
<ReadWriteVariables>
<Variable DataType="String" VariableName="recordids"/>
</ReadWriteVariables>
<Files>
<File Path="ScriptMain.cs">
using System;
using System.Data;
using Microsoft.SqlServer.Dts.Runtime;
using System.Data.OleDb;
using System.IO;
namespace ST_39671a219bda455a9ac64f4384d10901
{
[Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute]
public partial class ScriptMain : Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase
{
public void Main()
{
Dts.TaskResult = (int)ScriptResults.Success;
}
enum ScriptResults
{
Success = DTSExecResult.Success,
Failure = DTSExecResult.Failure
};
}
}
</File>
</Files>
</ScriptTaskProject>
On BI Project Visual Studio 2015, I am successfully able to generate SSIS Package from this BIML code.
From SSIS packages when I try to open the the generated package I getting an error as below.
Severity Code Description Project File Line Suppression State
Error Error loading package.dtsx: CS0234 - The type or namespace name
'Dts' does not exist in the namespace 'Microsoft.SqlServer' (are you
missing an assembly reference?), ScriptMain.cs, 9,
76 C:\Users\user\Documents\Visual Studio
2015\Projects\Project\CollectIDs\package.dtsx 1
The issue gets resolved when I go Script task Editor and click OK and save package. I have some 1000 packages, I can't do this manual task even though it resolves my issue.
I have tried AssemblyReferences with relative and absolute path, but nothing worked. Why I am getting this error just after package generated from BIML?
Check the Compiler Error... there is a good chance that with a later version you'll need to upgrade to a more recent version of MicrosoftSQLServerManagedDTS using NuGet. My error for the DTS was removed when I did so but it added a new error about the namespace "Tasks"

Choose arquillian container during gradle build

I am running arquillian tests with junit and gradle. How do I choose which container gets started?
At the moment I am defining the container qualifier in a file with name arquillian.launch.
My arquillian.xml looks as follows:
<?xml version="1.0" encoding="UTF-8" ?>
<arquillian ...>
<container qualifier="glassfish3-embedded" default="true">
<configuration>
...
</configuration>
</container>
<container qualifier="wls">
<configuration>
...
</configuration>
</container>
</arquillian>
My build.gradle looks as follows:
[...]
configurations {
glassfishEmbeddedTestRuntime { extendsFrom testRuntime }
weblogic10RemoteTestRuntime { extendsFrom testRuntime }
}
dependencies {
glassfishEmbeddedTestRuntime group: 'org.jboss.arquillian.container', name: 'arquillian-glassfish-embedded-3.1', version: '1.0.0.CR4'
glassfishEmbeddedTestRuntime group: 'org.glassfish.main.extras', name: 'glassfish-embedded-all', version: libraryVersions.glassfish
weblogic10RemoteTestRuntime group: 'org.jboss.arquillian.container', name: 'arquillian-wls-remote-10.3', version: '1.0.0.Alpha2'
}
task glassfishEmbeddedTest(type: Test)
task weblogic10RemoteTest(type: Test)
tasks.withType(Test).matching({ t-> t.name.endsWith('Test') } as Spec).each { t ->
t.classpath = project.configurations.getByName(t.name + 'Runtime') + project.sourceSets.main.output + project.sourceSets.test.output
}
How can I expand the definition for weblogic10RemoteTest, so that I can choose the container, and I don't have to edit the arquillian.launch file or the arquillian.xml file by changing the xml before executing the tests?
I thought about doing it like here: https://github.com/seam/solder/blob/develop/testsuite/pom.xml#L123
But I don't know the equivalent of this statement in gradle.
The POM you linked to sets system properties for the JVM running the tests. You can do the same in Gradle by configuring your Test task(s):
test { // or: tasks.withType(Test) {
systemProperty "one", "foo"
systemProperty "two", "bar"
}
(Note that Gradle always runs tests in a separate JVM.)
For further information, see Test in the Gradle Build Language Reference.