Commit 2afdff6b authored by Arpad Lovassy's avatar Arpad Lovassy
Browse files

fixed indentation


Signed-off-by: Arpad Lovassy's avatarzlovarp <arpad.lovassy@semcon.com>
parent 5aa8b31d
###############################################################################
# Copyright (c) 2000-2019 Ericsson Telecom AB
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
#
# Contributors:
# Lovassy, Arpad
#
###############################################################################
# EDIT THESE LINES TO SET CORRECT JAR LOCATIONS
#---------------------------------------------------------------------
# DO NOT EDIT AFTER THIS LINE
# check if JAVA exists
# http://stackoverflow.com/questions/7334754/correct-way-to-check-java-version-from-bash-script
if type -p java; then
echo found java executable in PATH
_java=java
elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
echo found java executable in JAVA_HOME
_java="$JAVA_HOME/bin/java"
else
echo "no java, exiting"; exit 1;
fi
# check java version (>=1.7)
if [[ "$_java" ]]; then
version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
echo version "$version"
if [[ "$version" > "1.7" ]]; then
echo "version is at least 1.7, OK";
else
echo "version is less than 1.7, NOT OK, exiting"; exit 1;
fi
fi
# check java version (>=1.7) in another way
[ $(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q') -ge 17 ] && echo "version is at least 1.7, OK" || { echo "version is less than 1.7, NOT OK, exiting"; exit 1; }
# checks if file exists, exits if not
# @param $1 file full path
function file_exist {
[ -f "$1" ] && echo "$1 FOUND, OK" || { echo "$1 NOT FOUND, exiting"; exit 1; }
}
# checks if directory exists, exits if not
# @param $1 directory full path
function dir_exist {
[ -d "$1" ] && echo "$1 DIRECTORY FOUND, OK" || { echo "$1 DIRECTORY NOT FOUND, exiting"; exit 1; }
}
# check TITAN dependencies
[ ! -z "${TTCN3_DIR}" ] && echo "\$TTCN3_DIR is set to ${TTCN3_DIR}, OK" \
|| { echo "\$TTCN3_DIR is not set, NOT OK, exiting"; exit 1; }
dir_exist ${TTCN3_DIR}
file_exist ${TTCN3_DIR}/lib/libmctrjninative.so
[[ "${LD_LIBRARY_PATH}" == *"${TTCN3_DIR}/lib"* ]] && echo "\$TTCN3_DIR/lib is added to \$LD_LIBRARY_PATH=${LD_LIBRARY_PATH}, OK" \
|| { echo "\$TTCN3_DIR is NOT added to \$LD_LIBRARY_PATH=${LD_LIBRARY_PATH}, NOT OK, exiting"; exit 1; }
# make sure, that the demo is compiled, which is cleaned in make install
pushd ${TTCN3_DIR}/demo
make
popd
file_exist ${TTCN3_DIR}/demo/MyExample
# Check if HelloWorld demo binary is compiled in parallel mode: output of MyExample -v contains "(parallel mode)"
[ `${TTCN3_DIR}/demo/MyExample -v 2>&1 | grep "(parallel mode)" | wc -l` != 0 ] && echo "${TTCN3_DIR}/demo/MyExample is compiled in parallel mode, OK" \
|| { echo "${TTCN3_DIR}/demo/MyExample is compiled in single mode, NOT in parallel mode, NOT OK, exiting"; exit 1; }
# run demo (and build its dependencies if needed)
BASEDIR=$(dirname $0)
echo BASEDIR: $BASEDIR
ant \
-f $BASEDIR/build.xml \
Main
...@@ -16,7 +16,7 @@ import java.io.File; ...@@ -16,7 +16,7 @@ import java.io.File;
public class CommonData { public class CommonData {
// default values // default values
private static final String WORKSPACE = "../../titan/Install/"; private static final String WORKSPACE = "../../titan/Install/";
private static final String CFG_FILE = "demo/MyExample.cfg"; private static final String CFG_FILE = "demo/MyExample.cfg";
static final String LOCALHOST = "NULL"; static final String LOCALHOST = "NULL";
...@@ -28,17 +28,17 @@ public class CommonData { ...@@ -28,17 +28,17 @@ public class CommonData {
private static String getDefaultWorkspaceDir() { private static String getDefaultWorkspaceDir() {
String ttcn3_dir = System.getenv().get("TTCN3_DIR"); String ttcn3_dir = System.getenv().get("TTCN3_DIR");
String workspace = WORKSPACE; String workspace = WORKSPACE;
if (ttcn3_dir != null && ttcn3_dir.length() > 0) { if (ttcn3_dir != null && ttcn3_dir.length() > 0) {
workspace = ttcn3_dir; workspace = ttcn3_dir;
} }
workspace += ( workspace.endsWith( File.separator ) ? "" : File.separator ); workspace += ( workspace.endsWith( File.separator ) ? "" : File.separator );
return workspace; return workspace;
} }
public static String getDefaultWorkingDir() { public static String getDefaultWorkingDir() {
return getDefaultWorkspaceDir() + WORKINGDIR; return getDefaultWorkspaceDir() + WORKINGDIR;
} }
public static String getDefaultCfgFile() { public static String getDefaultCfgFile() {
return getDefaultWorkspaceDir() + CFG_FILE; return getDefaultWorkspaceDir() + CFG_FILE;
} }
......
...@@ -35,17 +35,17 @@ public class ExecuteCfgDialog extends JDialog { ...@@ -35,17 +35,17 @@ public class ExecuteCfgDialog extends JDialog {
/** Generated serial version ID to avoid warning */ /** Generated serial version ID to avoid warning */
private static final long serialVersionUID = -2926485859174706529L; private static final long serialVersionUID = -2926485859174706529L;
private JTextField mTextFieldIndex = new JTextField(); private JTextField mTextFieldIndex = new JTextField();
private JButton mButtonExecute = new JButton("Execute"); private JButton mButtonExecute = new JButton("Execute");
public ExecuteCfgDialog( final DemoFrame aParent ) { public ExecuteCfgDialog( final DemoFrame aParent ) {
super( aParent, "Execute config file", true ); super( aParent, "Execute config file", true );
// init ui elements // init ui elements
// default values // default values
mTextFieldIndex.setText("0"); mTextFieldIndex.setText("0");
mButtonExecute.addActionListener(new ActionListener() { mButtonExecute.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final JniExecutor je = JniExecutor.getInstance(); final JniExecutor je = JniExecutor.getInstance();
...@@ -59,42 +59,42 @@ public class ExecuteCfgDialog extends JDialog { ...@@ -59,42 +59,42 @@ public class ExecuteCfgDialog extends JDialog {
} }
}); });
// add ui elements to layout // add ui elements to layout
setLayout( new GridBagLayout() ); setLayout( new GridBagLayout() );
GridBagConstraints c = new GridBagConstraints(); GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH; c.fill = GridBagConstraints.BOTH;
c.insets = new Insets(10, 10, 10, 10); c.insets = new Insets(10, 10, 10, 10);
c.gridx = 0; c.gridx = 0;
c.gridy = 0; c.gridy = 0;
add( new JLabel("Number of testcases:"), c); add( new JLabel("Number of testcases:"), c);
c.gridy++; c.gridy++;
add( new JLabel("Testcase index:"), c); add( new JLabel("Testcase index:"), c);
c.weightx = 1.0; c.weightx = 1.0;
c.weighty = 0.0; c.weighty = 0.0;
c.gridx = 1; c.gridx = 1;
c.gridy = 0; c.gridy = 0;
int numTestcases = 0; int numTestcases = 0;
try { try {
numTestcases = JniExecutor.getInstance().getExecuteCfgLen(); numTestcases = JniExecutor.getInstance().getExecuteCfgLen();
} catch (JniExecutorWrongStateException e1) { } catch (JniExecutorWrongStateException e1) {
JOptionPane.showMessageDialog(ExecuteCfgDialog.this, e1.toString(), "Error", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(ExecuteCfgDialog.this, e1.toString(), "Error", JOptionPane.ERROR_MESSAGE);
} }
add( new JLabel( "" + numTestcases ), c ); add( new JLabel( "" + numTestcases ), c );
c.gridy++; c.gridy++;
add( mTextFieldIndex, c); add( mTextFieldIndex, c);
c.gridx = 0; c.gridx = 0;
c.gridy++; c.gridy++;
c.gridwidth = 2; c.gridwidth = 2;
c.fill = GridBagConstraints.NONE; c.fill = GridBagConstraints.NONE;
add(mButtonExecute, c); add(mButtonExecute, c);
setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE ); setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
setSize( 600, 200 ); setSize( 600, 200 );
// place to the middle of the screen // place to the middle of the screen
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2); setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
} }
} }
...@@ -36,17 +36,17 @@ public class ExecuteControlDialog extends JDialog { ...@@ -36,17 +36,17 @@ public class ExecuteControlDialog extends JDialog {
/** Generated serial version ID to avoid warning */ /** Generated serial version ID to avoid warning */
private static final long serialVersionUID = 1564013318895605288L; private static final long serialVersionUID = 1564013318895605288L;
private JTextField mTextFieldModule = new JTextField(); private JTextField mTextFieldModule = new JTextField();
private JButton mButtonExecute = new JButton("Execute"); private JButton mButtonExecute = new JButton("Execute");
public ExecuteControlDialog( final DemoFrame aParent ) { public ExecuteControlDialog( final DemoFrame aParent ) {
super( aParent, "Execute control", true ); super( aParent, "Execute control", true );
// init ui elements // init ui elements
// default values // default values
mTextFieldModule.setText(CommonData.MODULE); mTextFieldModule.setText(CommonData.MODULE);
mButtonExecute.addActionListener(new ActionListener() { mButtonExecute.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final JniExecutor je = JniExecutor.getInstance(); final JniExecutor je = JniExecutor.getInstance();
...@@ -60,32 +60,32 @@ public class ExecuteControlDialog extends JDialog { ...@@ -60,32 +60,32 @@ public class ExecuteControlDialog extends JDialog {
} }
}); });
// add ui elements to layout // add ui elements to layout
setLayout( new GridBagLayout() ); setLayout( new GridBagLayout() );
GridBagConstraints c = new GridBagConstraints(); GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH; c.fill = GridBagConstraints.BOTH;
c.insets = new Insets(10, 10, 10, 10); c.insets = new Insets(10, 10, 10, 10);
c.gridx = 0;
c.gridy = 0;
add( new JLabel("Module:"), c);
c.weightx = 1.0;
c.weighty = 0.0;
c.gridx = 1;
c.gridy = 0;
add( mTextFieldModule, c);
c.gridx = 0;
c.gridy++;
c.gridwidth = 2;
c.fill = GridBagConstraints.NONE;
add(mButtonExecute, c);
c.gridx = 0; setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
c.gridy = 0; setSize( 600, 200 );
add( new JLabel("Module:"), c); // place to the middle of the screen
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
c.weightx = 1.0; setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
c.weighty = 0.0; }
c.gridx = 1;
c.gridy = 0;
add( mTextFieldModule, c);
c.gridx = 0;
c.gridy++;
c.gridwidth = 2;
c.fill = GridBagConstraints.NONE;
add(mButtonExecute, c);
setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
setSize( 600, 200 );
// place to the middle of the screen
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
}
} }
...@@ -36,19 +36,19 @@ public class ExecuteTestcaseDialog extends JDialog { ...@@ -36,19 +36,19 @@ public class ExecuteTestcaseDialog extends JDialog {
/** Generated serial version ID to avoid warning */ /** Generated serial version ID to avoid warning */
private static final long serialVersionUID = 9090176653704431781L; private static final long serialVersionUID = 9090176653704431781L;
private JTextField mTextFieldModule = new JTextField(); private JTextField mTextFieldModule = new JTextField();
private JTextField mTextFieldTestcase = new JTextField(); private JTextField mTextFieldTestcase = new JTextField();
private JButton mButtonExecute = new JButton("Execute"); private JButton mButtonExecute = new JButton("Execute");
public ExecuteTestcaseDialog( final DemoFrame aParent ) { public ExecuteTestcaseDialog( final DemoFrame aParent ) {
super( aParent, "Execute testcase", true ); super( aParent, "Execute testcase", true );
// init ui elements // init ui elements
// default values // default values
mTextFieldModule.setText(CommonData.MODULE); mTextFieldModule.setText(CommonData.MODULE);
mTextFieldTestcase.setText(CommonData.TESTCASE); mTextFieldTestcase.setText(CommonData.TESTCASE);
mButtonExecute.addActionListener(new ActionListener() { mButtonExecute.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
final JniExecutor je = JniExecutor.getInstance(); final JniExecutor je = JniExecutor.getInstance();
...@@ -62,36 +62,36 @@ public class ExecuteTestcaseDialog extends JDialog { ...@@ -62,36 +62,36 @@ public class ExecuteTestcaseDialog extends JDialog {
} }
}); });
// add ui elements to layout // add ui elements to layout
setLayout( new GridBagLayout() ); setLayout( new GridBagLayout() );
GridBagConstraints c = new GridBagConstraints(); GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH; c.fill = GridBagConstraints.BOTH;
c.insets = new Insets(10, 10, 10, 10); c.insets = new Insets(10, 10, 10, 10);
c.gridx = 0;
c.gridy = 0;
add( new JLabel("Module:"), c);
c.gridy++;
add( new JLabel("Testcase:"), c);
c.weightx = 1.0;
c.weighty = 0.0;
c.gridx = 1;
c.gridy = 0;
add( mTextFieldModule, c);
c.gridy++;
add( mTextFieldTestcase, c);
c.gridx = 0;
c.gridy++;
c.gridwidth = 2;
c.fill = GridBagConstraints.NONE;
add(mButtonExecute, c);
c.gridx = 0; setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
c.gridy = 0; setSize( 600, 200 );
add( new JLabel("Module:"), c); // place to the middle of the screen
c.gridy++; Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
add( new JLabel("Testcase:"), c); setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
}
c.weightx = 1.0;
c.weighty = 0.0;
c.gridx = 1;
c.gridy = 0;
add( mTextFieldModule, c);
c.gridy++;
add( mTextFieldTestcase, c);
c.gridx = 0;
c.gridy++;
c.gridwidth = 2;
c.fill = GridBagConstraints.NONE;
add(mButtonExecute, c);
setDefaultCloseOperation( JFrame.DISPOSE_ON_CLOSE );
setSize( 600, 200 );
// place to the middle of the screen
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2);
}
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
package org.eclipse.titan.executorapi.demo; package org.eclipse.titan.executorapi.demo;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
new DemoFrame().setVisible( true ); new DemoFrame().setVisible( true );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment