Calling shell script from adobe livecycle workbench? - livecycle

Is there anyway to call shell script from Adobe livecycle workbench?
I tried with executescript service and used command exec(scriptname) in beanshell.
If there is, please provide a example.

Yes you can use an executeScript activity for that.
import java.util.*;
import java.io.*;
Process proc = Runtime.getRuntime().exec("executablecommand");
int exitValue = proc.waitFor();
The above script would wait for the command to finish. You can also grab the output and error streams by using the process reference.
Here is a very useful post about Runtime.exec. http://www.javaworld.com/jw-12-2000/jw-1229-traps.html
If you wish to be able to do better exception handling you can still use Runtime.exec but create a custom java component for executing shell commands to wrap that functionality. You might even build a scripting engine component to execute groovy scripts or so.

Related

Trigger selenium project without human intervention

I have completed automation script of my project. Now client wants to run selenium test case using URL or API. Client is not interested in Jenkins as well since they should need access for my project.
Overall client wants to trigger selenium without human intervention.
Any other idea than above is also welcome.
Thanks in Advance!!
You can provide command line or batch file depends on TestFramework(TestNg, Nunit, MsTest).
For e.g. You can use Mstest/TestContainer:Dll_Name ......some more parameters.
For TestNg, You can use Java "Jar file path" org.testing.TestNG testconfig.xml
Here i am just giving hints to you. Correct way to do it will depend on test framework used.

How to redirect Teamcity to read from a file instead of standard output?

I am trying to add a Matlab unit test suite to team city. The matlab tests use the TAPPlugin, which is outputting the TAP output to a file. There is too much logging to the standard output to be able to use that successfully.
I've added the TAP plugin to Teamcity, which works when the standard output is TAP. Now, how do I get TeamCity to read from the file instead of the standard output so the tests results are updated in Teamcity on the fly?
I'm thinking I could pipe the std out to a log file, then just redirect the output of the file? Is there a better way, using Teamcity's Service Messages perhaps?
What I do for on my side, is writing both in a file and in TeamCity output. You can do on the fly, or at the end of writing file, dump it on stdout.
A couple options I see solving this on the MATLAB side (I may not be able to speak to TeamCity's apis as well):
Redirect MATLAB's TAPPlugin to some file and then as a subsequent build step print that file to stdout. Perhaps this way you would at least be able to keep the MATLAB TAP Stream together in one contiguous chunk of the TeamCity log.
Use MATLAB's XML plugin to produce JUnit style output. Then you create the appropriate xml file from your MATLAB run and then add a build feature (not a build step, its a different page in your build configuration) in TeamCity to process the JUnit style XML. The build feature you want is XML report processing.
There are pros/cons to consider between JUnit and the TAP format, but if your verbose TeamCity log is causing problems with your TAP output the JUnit support in TeamCity is independent from the build log and that may be a big plus for you.
This is how I dit it, and it works just fine:
my MATLAB test file (runTestSuiteTeamCity.m):
close all;
clear all; %#ok
import matlab.unittest.TestRunner
import matlab.unittest.TestSuite.*
import matlab.unittest.plugins.TAPPlugin
import matlab.unittest.plugins.ToFile
filename = 'TapDump.tap';
if exist(filename, 'file')
delete(filename);
end
plugin = TAPPlugin.producingOriginalFormat(ToFile(filename));
suite = matlab.unittest.TestSuite.fromPackage('Test');
runner = TestRunner.withTextOutput;
runner.addPlugin(plugin);
results = runner.run(suite);
disp(results);
disp(fileread(filename))
exit;
On TeamCity, I am using a Build Step with Command Line and the following Custom Script:
set mllogfile="c:\temp\test_log.txt"
matlab -wait -r "runTestSuiteTeamCity" -logfile %%mllogfile%%
set mlerror=%%errorlevel%%
type %%mllogfile%%
exit %%mlerror%%

Create a program that generate a Unity3D application

I'm trying to develop a simple program that should create a Unity3D application. I read the Unity manual in the section of Command line arguments and I wrote a simple C program in which the user can choose the Operating System and execute some Unity command.
I tried to use the command to create a new project and build the application for a target device and I saw that it works.
Now I designed a 3D model by using Sketchup and I generate a .obj file to import it in Unity. I've to import this model in Unity by using command line arguments, but I don't know how I can import this .obj file.
Does anyone know how I can to solve this problem?
I've just found this in the Unity Manual.
using UnityEngine;
using UnityEditor;
public class ImportAsset {
[MenuItem ("AssetDatabase/ImportExample")]
static void ImportExample ()
{
AssetDatabase.ImportAsset("Assets/Textures/texture.jpg", ImportAssetOptions.Default);
}
}
Massive assumption, especially given LearnCocos2D comment. If the commandline can run editor scripts, which this is one of, then you might be able to try the above out as a part of your build process.

Running console app with parameters from NSIS installer

I am creating one installer for my project. Deployment of project needs some changes that are too complex with NSIS.
So for making it easy I have written one console app in C#. This app will do all the complex changes required with use of some parameters.
I just want to ask what is the way to call this console app with some parameters from my installer?
Is it possible by creating some batch file or what?
ExecWait '"$instdir\myapp.exe" /foo "hello world" /bar' is the basic method.
Use nsExec if you want to hide the console window and ExecDos or ExecCmd if you need more control...
You have several options to execute programs from NSIS, as documented here: http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.2
Exec : Execute the specified program and continue immediately
ExecShell: Execute the specified program using ShellExecute
ExecWait: Execute the specified program and wait for the executed process to quit
the last solution is probably what you need.

Suspend weblogic datasource on command line

I was Wondering if there is anyway of suspending / resuming weblogic 10 jdbc datasources via the command line. I am aware that i can do this in the admin console, but because our app has many different datasources it is a bit of a pain.
The reason behind this is that our testers are doing error flow tests and have to simulate the db going down. Ideally i would like to give then a bat file for suspending all datasources and another one for resuming all datasources.
Any ideas?
Thanks
You can use the WLST scripting to do that. From the command line, run $BEA_HOME/wlserver10.0/common/bin/wlst.sh (.cmd on Windows):
Connect to the running server. Use the managed server port as this is a server runtime property:
wls:/offline> connect('weblogic','weblogic','t3://localhost:7002')
Go to the serverRuntime tree:
wls:/mydomain/serverConfig> serverRuntime()
Navigate to the JDBCService, to your managed server name, the JDBCDataSource Runtime and finally to your datasource name:
wls:/mydomain/serverRuntime> cd('JDBCServiceRuntime/managedsrv1/JDBCDataSourceRuntimeMBeans/MyDS')
Then just suspend and resume it:
wls:/mydomain/serverRuntime/JDBCServiceRuntime/managedsrv1/JDBCDataSourceRuntimeMBeans/MyDS> cmo.suspend()
wls:/mydomain/serverRuntime/JDBCServiceRuntime/managedsrv1/JDBCDataSourceRuntimeMBeans/MyDS> cmo.resume()
use command ls() to see the the other variables and operations.
You can record your script... might be easier than writing the batch file in some cases.
You can get help with the methods via javadocs.

Resources