How to build a SWC with documentation - actionscript-3

UPDATE
solved: embed doc with swc
solved: weird param names: param0, param1, etc.
I created a swc lib using compc.
Then I created the lib doc with asdoc.
But I dont know how to bind them together, since when I use the .swc in another project params names are weird (like myMethod(param0:Number)) and there is no doc description.
I'm using Ant, this is my config file:
<?xml version="1.0" encoding="utf-8" ?>
<project name="uil" default="compile" basedir=".">
<property name="flexsdk" location="C:/sdks/flex_sdk_4.6/bin"/>
<property name="compc" location="${flexsdk}/compc.exe"/>
<property name="asdoc" location="${flexsdk}/asdoc.exe"/>
<property name="src" location="../src"/>
<property name="bin" location="../bin"/>
<target name="compile" depends="doc">
<exec executable="${compc}" failonerror="true">
<arg line="-debug=false" />
<arg line="-optimize=true" />
<arg line="-strict=true" />
<arg line="-locale=en_US" />
<arg line="-include-sources=${src}" />
<arg line="-output=${bin}/uil.swc" />
</exec>
</target>
<target name="doc">
<exec executable="${asdoc}" failonerror="true">
<arg line="-main-title 'UIL API Documentation'" />
<arg line="-window-title 'UIL API Documentation'" />
<arg line="-source-path ${src} -doc-sources ${src}" />
<arg line="-output ${bin}/uil-asdoc" />
</exec>
</target>
</project>
Edit: How it was solved
The line that make all the magic is this:
<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar" />
Then I replaced all my <exec> tags to <compc> and <asdoc> and everything worked. You can see the entire code here.

Try to use zip ant target as in the build.xml of the Starling framework:
<!-- call asdoc to generate dita xml files -->
<asdoc output="${temp.dir}" lenient="true" failonerror="true" keep-xml="true" skip-xsl="true" fork="true">
<compiler.source-path path-element="${basedir}/src" />
<doc-sources path-element="${basedir}/src" />
</asdoc>
<!-- update swc with asdoc xml -->
<zip destfile="${deploy.dir}/${ant.project.name}.swc" update="true">
<zipfileset dir="${temp.dir}/tempdita" prefix="docs">
<include name="*.*"/>
<exclude name="ASDoc_Config.xml" />
<exclude name="overviews.xml" />
</zipfileset>
</zip>

Related

WSO2 API Manager Tool: Unable to convert JSONtoSOAP and then SOAPtoJSON to communicate between mock backend and API

Following the guidelines from WSO2 Documentation at: https://docs.wso2.com/display/AM260/Convert+a+JSON+Message+to+SOAP+and+SOAP+to+JSON
The intended response was
I revised it a couple times but keep getting "400: bad request error"
my curl and the error
EDIT¹: After running tests I found out that the issue is just with the SOAPtoJSON conversion. When I POST without the OUT (SOAPtoJSON) sequence, I get the XML answer exactly as intended as shown here
Thats my JSONtoSOAP.xml:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="JSONtoSOAP" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap12:Body>
<CheckPhoneNumber xmlns="http://ws.cdyne.com/PhoneVerify/query">
<PhoneNumber>$1</PhoneNumber>
<LicenseKey>$2</LicenseKey>
</CheckPhoneNumber>
</soap12:Body>
</soap12:Envelope>
</format>
<args>
<arg evaluator="xml" expression="//request/PhoneNumber" literal="true"/>
<arg evaluator="xml" expression="//request/LicenseKey" literal="true"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>
</sequence>
Thats my SOAPtoJSON.xml:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="SOAPtoJSON" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<log level="custom" separator=",">
<property name="TRACE" value="Global Mediation Extension"/>
</log>
<payloadFactory media-type="xml">
<format>
<CheckPhoneNumber xmlns="http://ws.cdyne.com/PhoneVerify/query">
<PhoneNumber>$1</PhoneNumber>
<LicenseKey>$2</LicenseKey>
</CheckPhoneNumber>
</format>
<args>
<arg evaluator="xml" expression="//request/PhoneNumber"/>
<arg evaluator="xml" expression="//request/LicenseKey"/>
</args>
</payloadFactory>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
</sequence>
I'm really new to the technology. And I just followed the steps from the documentation as mentioned. Maybe is was just a silly mistake (even though I revised it several times)
Maybe someone got the same problem and can help me out.
Thanks in advance.
Here is a new feature which generates a REST interface for your SOAP service. Try that. It supports SOAP-REST conversion automatically.
https://docs.wso2.com/display/AM260/Generate+REST+APIs+from+SOAP+Backends

Executing Junit Tests in ant - noclassdeffounderror wrong name

I'm trying to execute a few junit test suits with ant.
Here's my folder structure
bin
lib
src
test
build.xml
First of all I compile all files in source location, later on java files in test folder.
Whole structure of test folder (compiled .class files) are saved in bin folder which looks like this inside.
bin-test-alltests
|
-suites - SetupSuite.class
- StartSuite.class
in allTests folder are tests that are used in suites in suites folder
I'm trying to start those suites but constantly I've got an error:
ant junit java.lang.noclassdeffounderror wrong name
I'm pretty sure that's something wrong with the class path but I don't know what. I've tried to changed
<test name="SetupSuite"/>
to
<test name="SetupSuite.class"/>
and I get another error:
java.lang.ClassNotFoundException: SetupSuite.class
Here's my build.xml file
<project name="MyTest" basedir=".">
<!--Common properties -->
<property name="src.dirname" value="src" />
<property name="test.dirname" value="test" />
<property name="lib.dirname" value="lib" />
<property name="bin.dirname" value="bin" />
<property name="src.encoding" value="utf8" />
<property name="src.version" value="1.7" />
<property environment="env" />
<!-- Paths for MyTest -->
<property name="MyTest.dir" value="${basedir}" />
<property name="MyTest.src.dir" value="${MyTest.dir}\${src.dirname}" />
<property name="MyTest.test.dir" value="${MyTest.dir}\${test.dirname}" />
<property name="MyTest.dest.dir" value="${MyTest.dir}\${bin.dirname}" />
<property name="MyTest.lib.dir" value="${MyTest.dir}\${lib.dirname}" />
<path id="classpath">
<pathelement location="${MyTest.lib.dir}\junit.jar" />
<pathelement location="${MyTest.test.dir}\test\suites\" />
</path>
<target name="compile-MyTest-src" >
<myjavac srcdir="${MyTest.src.dir}" destdir="${MyTest.dest.dir}" classpath="{MyTest.lib.dir}\junit.jar"/>
</target>
<target name="compile-MyTest-test" depends="compile-MyTest-src">
<path id='libs'>
<fileset dir= "${MyTest.lib.dir}\" includes="**/*.jar"/>
</path>
<myjavac srcdir="${MyTest.test.dir}\" destdir="${MyTest.dest.dir}" classpathref = 'libs'/>
</target>
<target name="execute-tests" depends="compile-MyTest-src,compile-MyTest-test">
<junit printsummary="yes" haltonfailure="no" showoutput="yes">
<formatter type = "brief" usefile = "false" />
<classpath refid="classpath" />
<test name="SetupSuite"/>
</junit>
</target>
<!-- General compiler settings -->
<presetdef name="myjavac">
<javac classpathref="classpath" debug="on" includeantruntime="false" encoding="${src.encoding}" source="${src.version}" target="${src.version}" />
</presetdef>
</project>
Solved. I had to add hamcrest-core-1.3.jar file to classpath
You need to set test name to full name of your SetupSuite:
<test name="alltests.suites.SetupSuite"/>

java.lang.NoClassDefFoundError: org.eclipse.core.launcher.Main error while installing an EAR on Webshpere 8.0

I am trying to auto deploy an EAR using hudson on Websphere 8.0. I have written a script for it and while executing the script it shows the following error.
I am using hudson and have configured a job which executes the following build.xml. I tried to install the ear generated from admin console of websphere and it works fine when installed manually but fails when trying to install from hudson it throws the above error.
[wsInstallApp] Installing Application [C:\Users\.hudson\jobs\Websphere Deploy\workspace\ESREAR-1.0-SNAPSHOT.ear]...
[wsadmin] Exception in thread "main" java.lang.NoClassDefFoundError: org.eclipse.core.launcher.Main
[wsadmin] at com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:371)
[wsadmin] at com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:142)
[wsadmin] Caused by: java.lang.ClassNotFoundException: org.eclipse.core.launcher.Main
[wsadmin] at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
[wsadmin] at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:665)
[wsadmin] at java.lang.ClassLoader.loadClass(ClassLoader.java:644)
[wsadmin] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
[wsadmin] at java.lang.ClassLoader.loadClass(ClassLoader.java:627)
[wsadmin] ... 2 more
my build.xml is as follows
<?xml version="1.0" encoding="iso-8859-1" ?>
<project name="Auto Deployer for Jenkins" default="deploy" basedir=".">
<!-- Ant-Contrib (if, foreach, etc.) -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties">
<classpath>
<pathelement location="C:/autobuild/WebSphere/Builder/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<!-- WebSphere admin task -->
<taskdef name="wsAdmin" classname="com.ibm.websphere.ant.tasks.WsAdmin" />
<!-- Convert workspace path to forward slashes -->
<path id="toConvert1">
<pathelement location="${workspace}"/>
</path>
<pathconvert dirsep="/" property="workspaceConvert" refid="toConvert1"/>
<property name="wasroot" value="c:/opt/IBM/WebSphere/Profiles/base" />
<property name="user" value="iapawas01" />
<property name="password" value="IAPawas01" />
<target name="install">
<propertyregex property="appname" input="${earfile}"
regexp="([A-Za-z_]*)-(.*)"
select="\1"
defaultvalue=""
override="true"/>
<echo message="Application file ${earfile}"/>
<echo message="Application name ${appname}"/>
<echo message="Uninstalling application" />
<wsAdmin wasHome="${wasroot}" conntype="SOAP" host="${was_soaphost}" port="${was_soapport}" user="${user}" password="${password}" lang="jacl" script="deploy.jacl" failonError="false">
<arg value="uninstall"/>
<arg value="${workspaceConvert}"/>
<arg value="${appname}"/>
<arg value="${earfile}"/>
<arg value="${was_cell}"/>
<arg value="${was_node}"/>
<arg value="${was_server}"/>
<arg value="${was_vhost}"/>
</wsAdmin>
<echo message="Installing application" />
<wsAdmin wasHome="${wasroot}" conntype="SOAP" host="${was_soaphost}" port="${was_soapport}" user="${user}" password="${password}" lang="jacl" script="deploy.jacl" failonError="true">
<arg value="install"/>
<arg value="${workspaceConvert}"/>
<arg value="${appname}"/>
<arg value="${earfile}"/>
<arg value="${was_cell}"/>
<arg value="${was_node}"/>
<arg value="${was_server}"/>
<arg value="${was_vhost}"/>
</wsAdmin>
</target>
<target name="deploy">
<fileset dir="${workspace}" id="earfiles.list">
<include name="**/*.ear"/>
</fileset>
<pathconvert property="earfiles" refid="earfiles.list" pathsep=",">
<map from="${workspace}\" to=""/>
</pathconvert>
<foreach
list="${earfiles}"
target="install"
param="earfile"/>
</target>
</project>
What fix pack are you currently on?
There is a similar defect which was fixed in v8.0.0.3:
http://www-01.ibm.com/support/docview.wss?uid=swg1PM50904
If you're below 8.0.0.3 then you may want to try and apply fix pack 3 or even the latest release (fix pack 9) to see if it helps.

Example of using a TraceSource with Common.Logging

I've read this question and I know its possible:
Common.Logging for TraceSource
Can someone please post an example.
Also it could be helpfull if it can be configured to use the TraceSource in code instead of using the .config file.
Thanks
If your goal is to have Common.Logging forward messages to a TraceSource, then your logger name and tracesource name have to match.
<configuration>
<configSections>
<sectionGroup name="common">
<section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
</sectionGroup>
</configSections>
<common>
<logging>
<factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging">
<arg key="level" value="ALL" />
<arg key="showLogName" value="true" />
<arg key="showDataTime" value="true" />
<arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" />
<arg key="useTraceSource" value="true" />
</factoryAdapter>
</logging>
</common>
<system.diagnostics>
<sources>
<source name="SomeSourceName" switchName="YourSwitch">
<listeners>
<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="Application"/>
</listeners>
</source>
</sources>
<switches>
<add name="YourSwitch" value="Information"/>
</switches>
</system.diagnostics>
</configuration>
And from code you write:
var logger = Common.Logging.LogManager.GetLogger("SomeSourceName");
Hope this helps even though the post is 2 months old and the tracesouce is setup via .config.

How to reduce development cycles when building BlackBerry WebWorks or PhoneGap applications?

I'm interested in hearing how WebWorks developers are saving time during their development cycles by using any clever build processes / testing techniques.
What tips & tricks would you recommend to help reduce the amount of time it takes to build & test a WebWorks (or PhoneGap) application?
For example, here's a great suggestion (http://dborba.com/?p=274) from Demian Borba:
Build your app once, but configure it to load its start page from your dev web server
Make changes in that content, and they will be reflected when you re-launch your app (no need to recompile / redeploy the app)
Can even use Livereloader to make it even faster
If you use ant, here some target you will find useful:
<target name="zip" depends="init" description="Archive your files before building the bar" >
<zip
destfile="${build.dir}/${type.name}.zip"
basedir="${basedir}"
excludes="*.project,*.settings/,.*properties,*.svn,*.svn/*, builder/, .gitignore, .git/*"
includes="*,WebContent/"
/>
</target>
<target name="bar" depends="zip" description="create the bar file" >
<exec executable="${bbwp}">
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="${build.dir}/${type.name}.zip"/>
<arg line="-o '${build.dir}'" />
<arg line="-v" />
<!-- Allows debugging on port 1337 -->
<arg line="-d" />
<!-- Sign to Appworld -->
<!-- <arg line="-g ${keyPass} - -buildId 10" /> -->
</exec>
</target>
<target name="install" depends="bar" description="Deploy the the .bar file to your simulator. The old application is automatically uninstalled." >
<java jar="${BarDeploy.dir}/BarDeploy.jar"
fork="true"
maxmemory="512M"
>
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="-installApp" />
<arg value="-launchApp" />
<arg value="-password" />
<arg value="${password}" />
<arg value="-device" />
<arg value="${simIP}" />
<arg value="-package" />
<arg value="${bar.file}" />
</java>
</target>
<target name="uninstall" description="Uninstall an application from the Simulator. " >
<java jar="${BarDeploy.dir}/BarDeploy.jar"
fork="true"
maxmemory="512M"
>
<env key="JAVA_HOME" path="${sdk.JAVA_HOME}" />
<arg value="-uninstallApp" />
<arg value="-password" />
<arg value="${password}" />
<arg value="-device" />
<arg value="${simIP}" />
<arg value="-package" />
<arg value="${bar.file}" />
</java>
</target>
Here an exemple of the variable for a windows environment:
<property name="password" value=""/>
<property name="simIP" value="169.254.0.1" />
<property name="keyPass" value="" />
<property name="sdk.HOME" location="C:\Program Files\Research In Motion\BlackBerry 10 WebWorks SDK 1.0.1.8" />
<property name="build.dir" location="${basedir}\build" />
<property name="bar.file" location="${build.dir}\device\${type.name}.bar" />
<property name="sdk.JAVA_HOME" location="C:\Program Files\Java\jre6" />
<property name="bbwp" location="${sdk.HOME}\bbwp.bat" />
<property name="BarDeploy.dir" location="${sdk.HOME}\dependencies\tools\lib" />
Blackberry has just released the official Ant build script