Interoperatividad .Net-J2EE mediante WS e IIOP. Javier Viguera

Anuncio
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
9. Anexos
9.1. Código de las aplicaciones
9.1.1. Herramienta Java-.Net
9.1.1.1. Clases
paquete es.viguera.javatonet
Clase MainFrame
package es.viguera.javatonet;
import
import
import
import
import
import
import
java.awt.Color;
java.awt.Dimension;
java.awt.GridBagConstraints;
java.awt.GridBagLayout;
java.awt.Insets;
java.awt.Toolkit;
java.io.File;
import
import
import
import
import
import
import
import
import
import
import
import
import
javax.swing.JButton;
javax.swing.JCheckBox;
javax.swing.JFileChooser;
javax.swing.JFrame;
javax.swing.JLabel;
javax.swing.JOptionPane;
javax.swing.JPanel;
javax.swing.JScrollPane;
javax.swing.JTextArea;
javax.swing.JTextField;
javax.swing.SwingConstants;
javax.swing.UIManager;
javax.swing.UnsupportedLookAndFeelException;
public class MainFrame extends JFrame {
private JPanel jContentPane = null;
private JPanel rutasPanel = null;
private JButton examinarHomeButton = null;
private JTextField rutaDestinoTF = null;
private JButton examinarDestioDLLButton = null;
private JLabel rutaDestinoLabel = null;
private JScrollPane jScrollPane = null;
private JTextArea logsTextArea = null;
private JButton generarDllButton = null;
// Crea un selector de ficheros
JFileChooser fc =null;
private
private
private
/**
* This
*/
JLabel outputFolderLabel = null;
JTextField outputEJBFolderTF = null;
JButton examOutputFolderButton = null;
is the default constructor
180
Javier Viguera Muñoz
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
private JTextArea interfacesTA = null;
private JScrollPane jScrollPane1 = null;
private JLabel InterfacesLabel = null;
private JCheckBox borrarIDLCB = null;
private JLabel borrarIDLLabel = null;
private JLabel classpathLabel = null;
private JScrollPane jScrollPane2 = null;
private JTextArea classpathTA = null;
private JButton jButton = null;
public MainFrame() {
super();
initialize();
}
/**
* This method initializes rutaInterfacesPanel
*
* @return javax.swing.JPanel
*/
private JPanel getRutasPanel() {
if (rutasPanel == null) {
GridBagConstraints gridBagConstraints24 = new
GridBagConstraints();
gridBagConstraints24.gridx = 2;
gridBagConstraints24.anchor =
java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints24.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints24.gridy = 3;
GridBagConstraints gridBagConstraints23 = new
GridBagConstraints();
gridBagConstraints23.fill =
java.awt.GridBagConstraints.BOTH;
gridBagConstraints23.gridy = 3;
gridBagConstraints23.weightx = 1.0;
gridBagConstraints23.weighty = 2.0D;
gridBagConstraints23.ipady = 30;
gridBagConstraints23.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints23.gridx = 1;
GridBagConstraints gridBagConstraints22 = new
GridBagConstraints();
gridBagConstraints22.gridx = 0;
gridBagConstraints22.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints22.anchor =
java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints22.gridy = 3;
classpathLabel = new JLabel();
classpathLabel.setText("Classpath:");
classpathLabel.setToolTipText("Librerías (.jar) que
usen los interfaces que no sean las normales de los EJB");
GridBagConstraints gridBagConstraints21 = new
GridBagConstraints();
gridBagConstraints21.gridx = 0;
gridBagConstraints21.anchor =
java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints21.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints21.gridy = 4;
borrarIDLLabel = new JLabel();
181
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
borrarIDLLabel.setText("Borrar ficheros IDL:");
borrarIDLLabel.setToolTipText("Borra los ficheros IDL
intermedios");
GridBagConstraints gridBagConstraints20 = new
GridBagConstraints();
gridBagConstraints20.gridx = 1;
gridBagConstraints20.anchor =
java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints20.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints20.gridy = 4;
GridBagConstraints gridBagConstraints18 = new
GridBagConstraints();
gridBagConstraints18.gridx = 2;
gridBagConstraints18.anchor =
java.awt.GridBagConstraints.NORTH;
gridBagConstraints18.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints18.gridy = 2;
GridBagConstraints gridBagConstraints17 = new
GridBagConstraints();
gridBagConstraints17.fill = GridBagConstraints.BOTH;
gridBagConstraints17.gridx = 1;
gridBagConstraints17.gridy = 2;
gridBagConstraints17.weightx = 1.0;
gridBagConstraints17.weighty = 1.0;
gridBagConstraints17.ipadx = 0;
gridBagConstraints17.ipady = 100;
gridBagConstraints17.insets = new Insets(3, 3, 3, 3);
GridBagConstraints gridBagConstraints19 = new
GridBagConstraints();
gridBagConstraints19.gridx = 0;
gridBagConstraints19.anchor =
java.awt.GridBagConstraints.NORTHWEST;
gridBagConstraints19.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints19.gridy = 2;
InterfacesLabel = new JLabel();
InterfacesLabel.setText("Ruta de las interfaces:");
InterfacesLabel.setToolTipText("Interfaces Home y
Remote correspondientes a los EJBs");
GridBagConstraints gridBagConstraints16 = new
GridBagConstraints();
gridBagConstraints16.gridx = 2;
gridBagConstraints16.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints16.gridy = 0;
GridBagConstraints gridBagConstraints15 = new
GridBagConstraints();
gridBagConstraints15.fill =
java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints15.gridy = 0;
gridBagConstraints15.weightx = 1.0;
gridBagConstraints15.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints15.ipadx = 700;
gridBagConstraints15.gridx = 1;
GridBagConstraints gridBagConstraints14 = new
GridBagConstraints();
gridBagConstraints14.gridx = 0;
182
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
gridBagConstraints14.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints14.anchor =
java.awt.GridBagConstraints.WEST;
gridBagConstraints14.gridy = 0;
outputFolderLabel = new JLabel();
outputFolderLabel.setText("Carpeta \"bin\" del
EJB:");
outputFolderLabel.setToolTipText("Ruta de la carpeta
donde está el EJB compilado");
GridBagConstraints gridBagConstraints13 = new
GridBagConstraints();
gridBagConstraints13.gridx = 2;
gridBagConstraints13.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints13.gridy = 2;
GridBagConstraints gridBagConstraints12 = new
GridBagConstraints();
gridBagConstraints12.fill =
java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints12.gridy = 2;
gridBagConstraints12.weightx = 1.0;
gridBagConstraints12.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints12.gridx = 1;
GridBagConstraints gridBagConstraints5 = new
GridBagConstraints();
gridBagConstraints5.gridx = 0;
gridBagConstraints5.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints5.anchor =
java.awt.GridBagConstraints.WEST;
gridBagConstraints5.gridy = 2;
GridBagConstraints gridBagConstraints6 = new
GridBagConstraints();
gridBagConstraints6.gridx = 0;
gridBagConstraints6.anchor =
java.awt.GridBagConstraints.WEST;
gridBagConstraints6.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints6.gridy = 1;
rutaDestinoLabel = new JLabel();
rutaDestinoLabel.setText("Librería dll resultante:");
rutaDestinoLabel.setToolTipText("Ruta y nombre de la
librería que nos va a generar");
GridBagConstraints gridBagConstraints8 = new
GridBagConstraints();
gridBagConstraints8.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints8.gridy = 1;
gridBagConstraints8.gridx = 2;
GridBagConstraints gridBagConstraints7 = new
GridBagConstraints();
gridBagConstraints7.fill =
java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints7.gridx = 1;
gridBagConstraints7.gridy = 1;
gridBagConstraints7.weightx = 10.0D;
gridBagConstraints7.insets = new
java.awt.Insets(3,3,3,3);
183
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
GridBagConstraints gridBagConstraints4 = new
GridBagConstraints();
gridBagConstraints4.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints4.gridy = 1;
gridBagConstraints4.gridx = 2;
GridBagConstraints gridBagConstraints3 = new
GridBagConstraints();
gridBagConstraints3.fill =
java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints3.gridx = 1;
gridBagConstraints3.gridy = 1;
gridBagConstraints3.weightx = 10.0D;
gridBagConstraints3.ipadx = 0;
gridBagConstraints3.insets = new
java.awt.Insets(3,3,3,3);
GridBagConstraints gridBagConstraints2 = new
GridBagConstraints();
gridBagConstraints2.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints2.gridy = 1;
gridBagConstraints2.anchor =
java.awt.GridBagConstraints.WEST;
gridBagConstraints2.gridx = 0;
rutasPanel = new JPanel();
rutasPanel.setLayout(new GridBagLayout());
rutasPanel.add(getRutaDestinoTF(),
gridBagConstraints7);
rutasPanel.add(getExaminarDestioDLLButton(),
gridBagConstraints8);
rutasPanel.add(rutaDestinoLabel,
gridBagConstraints6);
rutasPanel.add(outputFolderLabel,
gridBagConstraints14);
rutasPanel.add(getOutputEJBFolderTF(),
gridBagConstraints15);
rutasPanel.add(getExamOutputFolderButton(),
gridBagConstraints16);
rutasPanel.add(InterfacesLabel,
gridBagConstraints19);
rutasPanel.add(getJScrollPane1(),
gridBagConstraints17);
rutasPanel.add(getExaminarHomeButton(),
gridBagConstraints18);
rutasPanel.add(getBorrarIDLCB(),
gridBagConstraints20);
rutasPanel.add(borrarIDLLabel, gridBagConstraints21);
rutasPanel.add(classpathLabel, gridBagConstraints22);
rutasPanel.add(getJScrollPane2(),
gridBagConstraints23);
rutasPanel.add(getExamClasspathButton(),
gridBagConstraints24);
}
return rutasPanel;
}
/**
* This method initializes examinarButton
*
* @return javax.swing.JButton
*/
private JButton getExaminarHomeButton() {
184
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
if (examinarHomeButton == null) {
examinarHomeButton = new JButton();
examinarHomeButton.setText("Examinar...");
examinarHomeButton.setHorizontalAlignment(javax.swing.SwingConst
ants.LEADING);
examinarHomeButton.setPreferredSize(new
java.awt.Dimension(97,19));
final MyFileFilter filter = new
MyFileFilter("class");
examinarHomeButton.addActionListener(new
java.awt.event.ActionListener() {
File last = null;
public void
actionPerformed(java.awt.event.ActionEvent e) {
if(fc==null){
fc = new JFileChooser();
}
if(last!=null && last.exists()){
fc.setCurrentDirectory(last);
}
fc.setFileFilter(filter);
fc.setMultiSelectionEnabled(true);
fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
fc.setDialogTitle("Selecciona los
interfaces Home y Remote de los EJBs");
int returnVal =
fc.showDialog(examinarHomeButton,"Aceptar");
if(returnVal==JFileChooser.APPROVE_OPTION){
for(int
i=0;i<fc.getSelectedFiles().length;i++){
interfacesTA.append(fc.getSelectedFiles()[i].getAbsolutePath());
interfacesTA.append("\n");
}
}
last = fc.getCurrentDirectory();
}
});
}
return examinarHomeButton;
}
/**
* This method initializes rutaDestinoTF
*
* @return javax.swing.JTextField
*/
private JTextField getRutaDestinoTF() {
if (rutaDestinoTF == null) {
rutaDestinoTF = new JTextField();
rutaDestinoTF.setText("");
rutaDestinoTF.setToolTipText("Ruta y nombre de la
librería que nos va a generar");
}
return rutaDestinoTF;
}
/**
185
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
* This method initializes examinar2Button
*
* @return javax.swing.JButton
*/
private JButton getExaminarDestioDLLButton() {
if (examinarDestioDLLButton == null) {
examinarDestioDLLButton = new JButton();
examinarDestioDLLButton.setText("Examinar...");
examinarDestioDLLButton.setPreferredSize(new
java.awt.Dimension(97,19));
final MyFileFilter filter = new MyFileFilter("dll");
examinarDestioDLLButton.addActionListener(new
java.awt.event.ActionListener() {
File last = null;
public void
actionPerformed(java.awt.event.ActionEvent e) {
if(fc==null){
fc = new JFileChooser();
}
if(last!=null && last.exists()){
fc.setCurrentDirectory(last);
}
fc.setMultiSelectionEnabled(false);
fc.setDialogTitle("Ruta y nombre de la
DLL a generar");
fc.setFileFilter(filter);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
int returnVal =
fc.showSaveDialog(examinarHomeButton);
if(returnVal==JFileChooser.APPROVE_OPTION){
if(fc.getSelectedFile().getName().endsWith(".dll")){
rutaDestinoTF.setText(fc.getSelectedFile().getAbsolutePath());
}else{
rutaDestinoTF.setText(fc.getSelectedFile().getAbsolutePath()+".d
ll");
}
}
last = fc.getCurrentDirectory();
}
});
}
return examinarDestioDLLButton;
}
/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
186
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
jScrollPane.setViewportView(getLogsTextArea());
}
return jScrollPane;
}
/**
* This method initializes logsTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getLogsTextArea() {
if (logsTextArea == null) {
logsTextArea = new JTextArea();
logsTextArea.setSize(609,609);
logsTextArea.setRows(20);
}
return logsTextArea;
}
/**
* This method initializes generarDllButton
*
* @return javax.swing.JButton
*/
private JButton getGenerarDllButton() {
if (generarDllButton == null) {
generarDllButton = new JButton();
generarDllButton.setText("Generar DLL");
generarDllButton.setPreferredSize(new
java.awt.Dimension(105,19));
generarDllButton.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent e) {
StringConverter.getInstance().setJavaOutputFolder(outputEJBFolde
rTF.getText());
StringConverter.getInstance().setDllFilePath(rutaDestinoTF.getTe
xt());
StringConverter.getInstance().setInterfacesAndClasesPaths(interf
acesTA.getText());
StringConverter.getInstance().setClasspathPaths(classpathTA.getT
ext());
StringConverter.getInstance().setDeleteIDLFiles(borrarIDLCB.isSe
lected());
StringConverter.getInstance().generaDll(borrarIDLCB.isSelected()
);
boolean executionOk =
StringConverter.getInstance().generateDll();
if(!executionOk){
JOptionPane.showMessageDialog(generarDllButton,"El formato de
alguna ruta no es correcto");
}
}
187
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
});
}
return generarDllButton;
}
/**
* This method initializes jTextField
*
* @return javax.swing.JTextField
*/
private JTextField getOutputEJBFolderTF() {
if (outputEJBFolderTF == null) {
outputEJBFolderTF = new JTextField();
outputEJBFolderTF.setText("");
outputEJBFolderTF.setEditable(true);
outputEJBFolderTF.setToolTipText("Ruta de la carpeta
donde está el EJB compilado");
}
return outputEJBFolderTF;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getExamOutputFolderButton() {
if (examOutputFolderButton == null) {
examOutputFolderButton = new JButton();
examOutputFolderButton.setPreferredSize(new
java.awt.Dimension(97,19));
examOutputFolderButton.setText("Examinar...");
examOutputFolderButton.addActionListener(new
java.awt.event.ActionListener() {
File last = null;
public void
actionPerformed(java.awt.event.ActionEvent e) {
if(fc==null){
fc = new JFileChooser();
}
if(last!=null && last.exists()){
fc.setCurrentDirectory(last);
}
fc.setMultiSelectionEnabled(false);
fc.setFileFilter(null);
fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal =
fc.showDialog(rutaDestinoTF,"Aceptar");
if(returnVal==JFileChooser.APPROVE_OPTION){
outputEJBFolderTF.setText(fc.getSelectedFile().getAbsolutePath()
);
}
last = fc.getCurrentDirectory();
}
});
188
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
return examOutputFolderButton;
}
/**
* This method initializes interfacesTA
*
* @return javax.swing.JTextArea
*/
private JTextArea getInterfacesTA() {
if (interfacesTA == null) {
interfacesTA = new JTextArea();
interfacesTA.setRows(4);
interfacesTA.setToolTipText("Interfaces Home y Remote
correspondientes a los EJBs");
}
return interfacesTA;
}
/**
* This method initializes jScrollPane1
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane1() {
if (jScrollPane1 == null) {
jScrollPane1 = new JScrollPane();
jScrollPane1.setViewportView(getInterfacesTA());
jScrollPane1.getViewport().setView(interfacesTA);
}
return jScrollPane1;
}
/**
* This method initializes borrarIDLCB
*
* @return javax.swing.JCheckBox
*/
private JCheckBox getBorrarIDLCB() {
if (borrarIDLCB == null) {
borrarIDLCB = new JCheckBox();
borrarIDLCB.setSelected(true);
borrarIDLCB.setToolTipText("Borra los ficheros IDL
intermedios");
}
return borrarIDLCB;
}
/**
* This method initializes jScrollPane2
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane2() {
if (jScrollPane2 == null) {
jScrollPane2 = new JScrollPane();
jScrollPane2.setViewportView(getClasspathTA());
}
return jScrollPane2;
}
/**
189
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
* This method initializes classpathTA
*
* @return javax.swing.JTextArea
*/
private JTextArea getClasspathTA() {
if (classpathTA == null) {
classpathTA = new JTextArea();
classpathTA.setToolTipText("Librerías (.jar) que usen
los interfaces que no sean las normales de los EJB");
}
return classpathTA;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getExamClasspathButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setPreferredSize(new Dimension(97, 19));
jButton.setText("Examinar...");
final MyFileFilter filter = new MyFileFilter("jar");
jButton.setHorizontalAlignment(SwingConstants.LEADING);
jButton.addActionListener(new
java.awt.event.ActionListener() {
File last = null;
public void
actionPerformed(java.awt.event.ActionEvent e) {
if(fc==null){
fc = new JFileChooser();
}
if(last!=null && last.exists()){
fc.setCurrentDirectory(last);
}
fc.setFileFilter(filter);
fc.setMultiSelectionEnabled(true);
fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
fc.setDialogTitle("Selecciona las
librerías necesarias");
int returnVal =
fc.showDialog(examinarHomeButton,"Aceptar");
if(returnVal==JFileChooser.APPROVE_OPTION){
for(int
i=0;i<fc.getSelectedFiles().length;i++){
classpathTA.append(fc.getSelectedFiles()[i].getAbsolutePath());
classpathTA.append("\n");
}
}
last = fc.getCurrentDirectory();
}
});
}
return jButton;
}
190
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
public static void main(String[] args) {
try {
// Set System L&F
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
}catch (UnsupportedLookAndFeelException e) {
e.printStackTrace();
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
catch (InstantiationException e) {
e.printStackTrace();
}
catch (IllegalAccessException e) {
e.printStackTrace();
}
if(args.length == 0){
MainFrame frame = new MainFrame();
frame.setVisible(true);
}
else{
StringConverter.getInstance().generateFromCommnadLine(args);
}
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(962, 513);
this.setIconImage(Toolkit.getDefaultToolkit().getImage(".\\commo
n\\bonsai.jpg"));
this.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
this.setContentPane(getJContentPane());
this.setTitle("Generador de dll's para EJB's");
this.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent
e) {
System.exit(0);
}
});
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
GridBagConstraints gridBagConstraints61 = new
GridBagConstraints();
191
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
gridBagConstraints61.fill =
java.awt.GridBagConstraints.BOTH;
gridBagConstraints61.gridy = 2;
gridBagConstraints61.weightx = 1.0;
gridBagConstraints61.weighty = 1.0;
gridBagConstraints61.gridx = 2;
GridBagConstraints gridBagConstraints10 = new
GridBagConstraints();
gridBagConstraints10.gridx = 0;
gridBagConstraints10.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints10.gridy = 3;
GridBagConstraints gridBagConstraints9 = new
GridBagConstraints();
gridBagConstraints9.fill =
java.awt.GridBagConstraints.BOTH;
gridBagConstraints9.gridy = 2;
gridBagConstraints9.weightx = 1.0;
gridBagConstraints9.weighty = 1.0;
gridBagConstraints9.insets = new
java.awt.Insets(3,3,3,3);
gridBagConstraints9.gridx = 0;
GridBagConstraints gridBagConstraints11 = new
GridBagConstraints();
gridBagConstraints11.gridx = 0;
gridBagConstraints11.ipadx = 272;
gridBagConstraints11.anchor =
java.awt.GridBagConstraints.WEST;
gridBagConstraints11.gridy = 0;
GridBagConstraints gridBagConstraints1 = new
GridBagConstraints();
gridBagConstraints1.gridx = 0;
gridBagConstraints1.gridy = 1;
GridBagConstraints gridBagConstraints = new
GridBagConstraints();
gridBagConstraints.gridx = 0;
gridBagConstraints.gridy = 0;
jContentPane = new JPanel();
jContentPane.setLayout(new GridBagLayout());
jContentPane.add(getRutasPanel(),
gridBagConstraints11);
jContentPane.add(getJScrollPane(),
gridBagConstraints9);
jContentPane.add(getGenerarDllButton(),
gridBagConstraints10);
}
return jContentPane;
}
/**
* Metodo que muestra en el area de texto de la aplicación los
mensajes que
* se pasen como parámetros.
*
* @param cad
*
Cadena que se va a mostrar.
*/
public void messageMyLog(String cad)
{
logsTextArea.setForeground(Color.BLUE);
logsTextArea.append(cad+"\n");
192
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
public void messageMyLogError(String cad)
{
logsTextArea.setForeground(Color.RED);
logsTextArea.append(cad+"\n");
}
public void messageMyLog(String[] cad)
{
for(int i=0;i<cad.length;i++){
logsTextArea.setForeground(Color.BLUE);
logsTextArea.append(cad[i]+" ");
}
logsTextArea.append("\n");
}
public void messageMyLog(String[] cad, Color color)
{
for(int i=0;i<cad.length;i++){
logsTextArea.setForeground(color);
logsTextArea.append(cad[i]+" ");
}
logsTextArea.append("\n");
}
public void messageMyLogError(String[] cad)
{
for(int i=0;i<cad.length;i++){
logsTextArea.setForeground(Color.RED);
logsTextArea.append(cad[i]+" ");
}
logsTextArea.append("\n");
}
}
//
@jve:decl-index=0:visual-constraint="90,17"
Clase MyFileFilter
package es.viguera.javatonet;
import
import
import
import
java.io.File;
java.util.Enumeration;
java.util.Hashtable;
javax.swing.filechooser.FileFilter;
public class MyFileFilter extends FileFilter {
private static String TYPE_UNKNOWN = "Type Unknown";
private static String HIDDEN_FILE = "Hidden File";
private
private
private
private
Hashtable<String, MyFileFilter> filters = null;
String description = null;
String fullDescription = null;
boolean useExtensionsInDescription = true;
/**
* Creates a file filter. If no filters are added, then all
* files are accepted.
193
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
*
* @see #addExtension
*/
public MyFileFilter() {
this.filters = new Hashtable<String, MyFileFilter>();
}
/**
* Creates a file filter that accepts files with the given
extension.
* Example: new MyFileFilter("jpg");
*
* @see #addExtension
*/
public MyFileFilter(String extension) {
this(extension,null);
}
/**
* Creates a file filter that accepts the given file type.
* Example: new MyFileFilter("jpg", "JPEG Image Images");
*
* Note that the "." before the extension is not needed. If
* provided, it will be ignored.
*
* @see #addExtension
*/
public MyFileFilter(String extension, String description) {
this();
if(extension!=null) addExtension(extension);
if(description!=null) setDescription(description);
}
/**
* Creates a file filter from the given string array.
* Example: new MyFileFilter(String {"gif", "jpg"});
*
* Note that the "." before the extension is not needed adn
* will be ignored.
*
* @see #addExtension
*/
public MyFileFilter(String[] filters) {
this(filters, null);
}
/**
* Creates a file filter from the given string array and
description.
* Example: new MyFileFilter(String {"gif", "jpg"}, "Gif and JPG
Images");
*
* Note that the "." before the extension is not needed and will
be ignored.
*
* @see #addExtension
*/
public MyFileFilter(String[] filters, String description) {
this();
for (int i = 0; i < filters.length; i++) {
// add filters one by one
194
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
addExtension(filters[i]);
}
if(description!=null) setDescription(description);
}
/**
* Return true if this file should be shown in the directory pane,
* false if it shouldn't.
*
* Files that begin with "." are ignored.
*
* @see #getExtension
* @see FileFilter#accepts
*/
public boolean accept(File f) {
if(f != null) {
if(f.isDirectory()) {
return true;
}
String extension = getExtension(f);
if(extension != null && filters.get(getExtension(f)) !=
null) {
return true;
};
}
return false;
}
/**
* Return the extension portion of the file's name .
*
* @see #getExtension
* @see FileFilter#accept
*/
public String getExtension(File f) {
if(f != null) {
String filename = f.getName();
int i = filename.lastIndexOf('.');
if(i>0 && i<filename.length()-1) {
return filename.substring(i+1).toLowerCase();
};
}
return null;
}
/**
* Adds a filetype "dot" extension to filter against.
*
* For example: the following code will create a filter that
filters
* out all files except those that end in ".jpg" and ".tif":
*
*
MyFileFilter filter = new MyFileFilter();
*
filter.addExtension("jpg");
*
filter.addExtension("tif");
*
* Note that the "." before the extension is not needed and will
be ignored.
*/
public void addExtension(String extension) {
if(filters == null) {
195
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
filters = new Hashtable<String, MyFileFilter>(5);
}
filters.put(extension.toLowerCase(), this);
fullDescription = null;
}
/**
* Returns the human readable description of this filter. For
* example: "JPEG and GIF Image Files (*.jpg, *.gif)"
*
* @see setDescription
* @see setExtensionListInDescription
* @see isExtensionListInDescription
* @see FileFilter#getDescription
*/
public String getDescription() {
if(fullDescription == null) {
if(description == null || isExtensionListInDescription()) {
fullDescription = description==null ? "(" : description + "
(";
// build the description from the extension list
Enumeration<String> extensions = filters.keys();
if(extensions != null) {
fullDescription += "." + extensions.nextElement();
while (extensions.hasMoreElements()) {
fullDescription += ", ." + extensions.nextElement();
}
}
fullDescription += ")";
} else {
fullDescription = description;
}
}
return fullDescription;
}
/**
* Sets the human readable description of this filter. For
* example: filter.setDescription("Gif and JPG Images");
*
* @see setDescription
* @see setExtensionListInDescription
* @see isExtensionListInDescription
*/
public void setDescription(String description) {
this.description = description;
fullDescription = null;
}
/**
* Determines whether the extension list (.jpg, .gif, etc) should
* show up in the human readable description.
*
* Only relevent if a description was provided in the constructor
* or using setDescription();
*
* @see getDescription
* @see setDescription
* @see isExtensionListInDescription
*/
196
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
public void setExtensionListInDescription(boolean b) {
useExtensionsInDescription = b;
fullDescription = null;
}
/**
* Returns whether the extension list (.jpg, .gif, etc) should
* show up in the human readable description.
*
* Only relevent if a description was provided in the constructor
* or using setDescription();
*
* @see getDescription
* @see setDescription
* @see setExtensionListInDescription
*/
public boolean isExtensionListInDescription() {
return useExtensionsInDescription;
}
}
Clase StringConverter.java
package es.viguera.javatonet;
import
import
import
import
import
java.io.BufferedReader;
java.io.IOException;
java.io.InputStream;
java.io.InputStreamReader;
java.util.ArrayList;
import es.viguera.javatonet.utils.ManageStrings;
/**
* Genera la dll a partir de clase e interfaces java.
*/
public class StringConverter {
private static StringConverter instance = new StringConverter();
public static StringConverter getInstance(){
if(instance == null){
instance = new StringConverter();
}
return instance;
}
/*
* Constantes
*/
private static String IDL = "\\IDL";
/**
*Estos serán los string que almacenan tal cual los texbox con
las rutas, clases, etc.
*/
private String javaOutputFolder = null;
private String dllFilePath = null;
private String interfacesAndClasesPaths = null;
private String classpathPaths = null;
private boolean deleteIDLFiles = false;
197
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
/**
* Estos serán los strings auxiliares obtenidos a partir de los
primarios
*/
private String diskJava = null;
private String diskDll = null;
private String outputDllFolder = null;
private String outputIDLFolder = null;
private String dllFile = null;
private String classpath = null;
private ArrayList<String> outputIDLFilePaths = new
ArrayList<String> ();
private ArrayList<String> IDLFilesPackage = new
ArrayList<String> ();
private boolean classpathExist;
/**
* Genera una libería dll de clases .net a partir de clases e
interfaces java. Con el parámetro
* a true se borraran los ficheros IDL intermedios generados.
* @param deleteIDLFiles
* @return
*/
public boolean generaDll(boolean deleteIDLFiles) {
Runtime runTime = Runtime.getRuntime();
try {
javaVersionInfo(runTime);
generateIDLFiles(runTime);
generateDllFile(runTime);
if(deleteIDLFiles){
deleteIDLFiles(runTime);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
return false;
}
/**
* Borra los ficheros IDL generados en la creación de la
librería dll
* @param runTime
*/
private void deleteIDLFiles(Runtime runTime) {
String[] argumentos = new
String[]{".\\borraIDL.bat",diskDll,outputIDLFolder};
try {
Process proc = runTime.exec(argumentos);
showRunTimeInfo(proc);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
/**
* Crea la librería dll a partir de los ficheros IDL
* @param runTime
*/
private void generateDllFile(Runtime runTime) {
String[] aux = new
String[]{".\\common\\IDLToCLSCompiler.exe","c",".\\common\\customMappingJavaToCls.xml", "-r",
198
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
".\\lib\\CommonEJBClasses.dll","-r", ".\\lib\\javaCollections.dll","idir",outputIDLFolder, "-o", outputDllFolder, dllFile};
String[] argumentos = new
String[aux.length+outputIDLFilePaths.size()];
int j =0;
for(j=0;j<aux.length;j++){
argumentos[j]=aux[j];
}
int i=0;
for(;j<argumentos.length;j++)
{
argumentos[j]=outputIDLFilePaths.get(i);
i++;
}
System.out.println(argumentos);
try {
Process proc2 = runTime.exec(argumentos);
showRunTimeInfo(proc2);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
/**
* Genera los ficheros IDL a partir de las clases e interfaces
Java
* @param runTime
*/
private void generateIDLFiles(Runtime runTime) {
for(int i=0;i<outputIDLFilePaths.size();i++)
{
System.out.println(classpath);
String[] argumentos = new String[]
{".\\idlgenerator.bat",javaOutputFolder,outputIDLFolder,IDLFilesPackag
e.get(i),outputDllFolder,diskJava,classpath};
try {
Process proc = runTime.exec(argumentos);
System.out.println("classpaht"+argumentos[6]);
showRunTimeInfo(proc);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
/**
* Obtiene la versión de la JVM que se está usando.
* @param runTime
*/
private void javaVersionInfo(Runtime runTime) {
String[] argumentos = new String[]{"java","-version"};
try {
Process proc = runTime.exec(argumentos);
showRunTimeInfo(proc);
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
199
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
/**
* Convierte las rutas y los ficheros obtenidos del IHM a un
formato adecuado
* para la generación de los ficheros IDL
* @return
*/
public boolean managePaths() {
try {
diskJava =
ManageStrings.getInstance().getUnitOfPath(javaOutputFolder);
outputDllFolder =
ManageStrings.getInstance().getFolderOfFilePath(dllFilePath);
outputIDLFolder = outputDllFolder+IDL;
diskDll = dllFilePath.substring(0,2);
dllFile =
ManageStrings.getInstance().removeExtension(dllFilePath.substring(dllF
ilePath.lastIndexOf("\\")+1,dllFilePath.length()));
ArrayList<String> classAndInterfacesList =
ManageStrings.getInstance().splitInLines(interfacesAndClasesPaths);
for (String filePath : classAndInterfacesList) {
String outputIDLFilePath =
convertJavaFilePathToOutputIDLFilePath(filePath);
String IDLFilePackage =
convertOutputIDLFilePathToIDLFilePackage(outputIDLFilePath);
outputIDLFilePaths.add(outputIDLFilePath);
IDLFilesPackage.add(IDLFilePackage);
}
classpath =
ManageStrings.getInstance().replaceCharacterByString(classpathPaths,
'\n', "");
} catch (Exception e) {
System.out.println(e.getMessage());
return false;
}
return true;
}
/**
* Convierte las rutas y los ficheros obtenidos desde la línea
de comandos a un formato adecuado
* para la generación de los ficheros IDL
* @return
*/
public boolean managePathsFromCommandLine(String[] args) {
int auxIndex;
if(classpathExist){
auxIndex=0;
if(args[0].equals("-classpath")){
classpath = args[1];
}
}else{
auxIndex=2;
}
200
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
if(args[2-auxIndex].equals("-binpath") ){
javaOutputFolder = args[3-auxIndex];
}
if(args[4-auxIndex].equals("-out")){
outputDllFolder = args[5auxIndex].substring(0,args[5-auxIndex].lastIndexOf("\\"));
}
diskJava = outputDllFolder.substring(0,2);
outputIDLFolder = outputDllFolder+IDL;
diskDll = outputIDLFolder.substring(0,2);
dllFile =
ManageStrings.getInstance().removeExtension(args[5auxIndex].substring(args[5-auxIndex].lastIndexOf("\\")+1,args[5auxIndex].length()));
//String outputEJBReplaced =
replaceCharacter(args[6],'\\','/');
if(args[6-auxIndex].equals("-interfaces")){
for(int i=7-auxIndex;i<args.length;i++){
IDLFilesPackage.add(ManageStrings.getInstance().removeExtension(
args[i]));
String aux =
ManageStrings.getInstance().replaceCharacter(ManageStrings.getInstance
().removeExtension(args[i]),'.','\\');
outputIDLFilePaths.add(aux+".idl");
}
}
return false;
}
/**
* Obtiene la ruta del fichero IDL a partir de la ruta de la
clase Java
* @param filePath
* @return
*/
public String convertJavaFilePathToOutputIDLFilePath(String
filePath){
String result = null;
String aux = null;
String outputEJBReplaced =
ManageStrings.getInstance().replaceCharacter(javaOutputFolder,'\\','/'
);
aux =
ManageStrings.getInstance().replaceCharacter(filePath,'\\','/');
aux = aux.replaceFirst(outputEJBReplaced,"");
aux =
ManageStrings.getInstance().removeExtension(aux)+".idl";
aux =
ManageStrings.getInstance().replaceCharacter(aux,'/','\\');
result = outputIDLFolder+aux;
return result;
}
/**
* Transforma la ruta de un fichero IDL a un formato para la
herramiento IDLToCLSCompiler
* @param idlFilePath
* @return
*/
public String convertOutputIDLFilePathToIDLFilePackage(String
idlFilePath){
201
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
String aux =
ManageStrings.getInstance().removeExtension(idlFilePath);
aux = ManageStrings.getInstance().replaceCharacter(aux,
'\\', '/');
String aux2 =
ManageStrings.getInstance().replaceCharacter(outputIDLFolder, '\\',
'/');
aux = aux.replaceFirst(aux2,"");
aux = ManageStrings.getInstance().replaceCharacter(aux,
'/', '\\');
aux =
ManageStrings.getInstance().replaceCharacter(aux,'\\','.').substring(1
);
return aux;
}
/**
* Muestra la información resultante de los procesos ejecutados
en la generación de la
* librería dll.
* @param proc
* @return
*/
public boolean showRunTimeInfo(Process proc){
InputStream errorstream = proc.getErrorStream();
InputStreamReader errorstreamreader = new
InputStreamReader(errorstream);
BufferedReader errorbufferedreader = new
BufferedReader(errorstreamreader);
InputStream inputstream = proc.getInputStream();
InputStreamReader inputstreamreader = new
InputStreamReader(inputstream);
BufferedReader inputbufferedreader = new
BufferedReader(inputstreamreader);
// read the ls output
String line;
try {
while ((line = inputbufferedreader.readLine())!= null) {
System.out.println(line);
}
while ((line = errorbufferedreader.readLine()) != null) {
System.out.println(line);
}
inputstream.close();
errorstream.close();
} catch (IOException e) {
e.printStackTrace();
}
return true;
}
public String getClasspathPaths() {
return classpathPaths;
}
public void setClasspathPaths(String classpathPaths) {
this.classpathPaths = classpathPaths;
}
public String getDllFilePath() {
return dllFilePath;
}
public void setDllFilePath(String dllFilePath) {
202
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.dllFilePath = dllFilePath;
}
public String getInterfacesAndClasesPaths() {
return interfacesAndClasesPaths;
}
public void setInterfacesAndClasesPaths(String
interfacesAndClasesPaths) {
this.interfacesAndClasesPaths = interfacesAndClasesPaths;
}
public String getJavaOutputFolder() {
return javaOutputFolder;
}
public void setJavaOutputFolder(String javaOutputFolder) {
this.javaOutputFolder = javaOutputFolder;
}
public boolean generateFromCommnadLine(String[] args){
if(parseCommandLineArgs(args)){
if(managePathsFromCommandLine(args)){
generaDll(false);
return true;
}else{
return false;
}
}else{
return false;
}
}
/**
* Genera una libería dll de clases .net a partir de clases e
interfaces java. Con el parámetro
* a true se borraran los ficheros IDL intermedios generados.
* @param deleteIDLFiles
* @return
*/
public boolean generateDll(){
if(managePaths()){
generaDll(deleteIDLFiles);
return true;
}else{
return false;
}
}
/**
* Analiza los argumentos introducidos desde la línea de
comandos para ver si son correctos. *
* @param args
* @return
*/
private boolean parseCommandLineArgs(String[] args){
boolean rightFormat = true;
if(!args[0].equals("-classpath") && !args[0].equals("binpath") && !args[0].equals("-help")){
System.out.println();
System.out.println("Formato incorrecto");
System.out.println();
System.out.println(args[0]+" no es ni \"-classpath\" ni \"binpath\"");
203
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
printRightFormat();
System.exit(0);
rightFormat =false;
}
if(args[0].equals("-help")){
printRightFormat();
System.exit(0);
rightFormat =false;
}
if(args[0].equals("-classpath")){
classpathExist = true;
}
if(classpathExist && (!args[2].equals("-binpath") ||
!args[4].equals("-out") || !args[6].equals("-interfaces"))){
System.out.println();
System.out.println("Formato incorrecto");
printRightFormat();
System.exit(0);
rightFormat =false;
}
if(!classpathExist && (!args[0].equals("-binpath") ||
!args[2].equals("-out") || !args[4].equals("-interfaces"))){
System.out.println();
System.out.println("Formato incorrecto");
printRightFormat();
System.exit(0);
rightFormat =false;
}
return rightFormat;
}
/**
* Muestra el formato correcto de los parámetros desde la línea
de comandos.
*
*/
public void printRightFormat(){
System.out.println();
System.out.println("El formato correcto es:");
System.out.println();
System.out.println("launch.bat [[-classpath xxx] -binpath
yyy -out zzz -interfaces aaa bbb]");
System.out.println();
System.out.println("Donde");
System.out.println();
System.out.println("-classpath
--> classpath necesario
para los interfaces.
Ejemplo: \"C:\\lib\\ejemplo.jar\"");
System.out.println();
System.out.println("-binpath --> Carpeta \"bin\" con los
interfaces compilados. Ejemplo: \"C:\\misEJb\\bin\"");
System.out.println();
System.out.println("-out
--> Ruta y nombre de la
dll que se va a generar.
Ejemplo: \"C:\\misDLL\\ejemplo1.dll\"");
System.out.println();
System.out.println("-interfaces
--> Interfaces a partir
de las cuales generar la DDL.
Ejemplo:
\"pack1.pack2.interfaz1.class pack1.pack2.interfaz2.class\"");
System.out.println();
}
/**
204
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
* Indica si se van a borrar
* @return
*/
Javier Viguera Muñoz
los ficheros IDL intermedios
public boolean isDeleteIDLFiles() {
return deleteIDLFiles;
}
public void setDeleteIDLFiles(boolean deleteIDLFiles) {
this.deleteIDLFiles = deleteIDLFiles;
}
}
paquete es.viguera.javatonet.utils
Clase ManageStrings.java
package es.viguera.javatonet.utils;
import java.util.ArrayList;
public class ManageStrings {
private static ManageStrings instance = new ManageStrings();
public static ManageStrings getInstance(){
if(instance == null){
instance = new ManageStrings();
}
return instance;
}
/**
* Obtiene la unidad de disco de una ruta
* @param path
* @return
*/
public String getUnitOfPath(String path){
if(path!=null && path.length()>2){
return path.substring(0,2);
}else{
return null;
}
}
/**
* Extrae la ruta de la carpeta de la ruta completa de un
fichero
* @param path
* @return
*/
public String getFolderOfFilePath(String path){
return path.substring(0,path.lastIndexOf("\\"));
}
/**
* Elimina la extensión de la ruta de un fichero
* @param file
* @return
*/
public String removeExtension(String file) {
return file.substring(0,file.lastIndexOf("."));
205
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
/**
* Reemplaza dentro de una cadena el caracter c por el caracter
d
* @param string
* @param c
* @param d
* @return
*/
public String replaceCharacter(String string,char c, char d) {
// messageMyLog(string);
String replaced ="";
for(int i=0;i<string.length();i++){
if(string.charAt(i)==c){
replaced+=d;
}else{
replaced+=string.charAt(i);
}
}
// messageMyLog(replaced);
return replaced;
}
/**
* Reemplaza en una cadena el caracter c por la cadena d
* @param string
* @param c
* @param d
* @return
*/
public String replaceCharacterByString(String string,char c,
String d) {
// messageMyLog(string);
String replaced ="";
for(int i=0;i<string.length();i++){
if(string.charAt(i)==c){
replaced+=d;
i+=d.length();
}else{
replaced+=string.charAt(i);
}
}
// messageMyLog(replaced);
return replaced;
}
/**
* Separa en líneas una cadena
* @param text
* @return
*/
public ArrayList<String> splitInLines(String text){
ArrayList<String> lines = new ArrayList<String>();
text.trim();
String [] aux = text.split("\n");
for(int i=0;i<aux.length;i++){
lines.add(aux[i].trim());
}
return lines;
}
}
206
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
9.1.1.2. Ficheros de auxiliares
borraIDL.bat
@echo Borrando los IDL
cd %1
del /s /q %2
rmdir /s /q %2
idlGenerator.bat
set SERVICE_HOME=%CD%
@echo Creando los IDL
mkdir %2
%5
cd %1
@echo %6
"%JAVA_HOME%\bin\rmic" -idl -classpath ".;%SERVICE_HOME%\lib\jbossj2ee.jar;%6" -d "%2" "%3"
@echo Creando la dll
copy "%SERVICE_HOME%\common\orb.idl" "%2"
9.1.2. Entorno de pruebas de rendimiento
9.1.2.1. Parte servidora
9.1.2.1.1. Clases
Paquete: es.viguera.ejb.intefaces
Clase BytesArray.java
package es.viguera.ejb.interfaces;
/**
* Remote interface for BytesArray.
*/
public interface BytesArray
extends javax.ejb.EJBObject
{
/**
* Business method
*/
public byte[] getBytesArray( int bytes )
throws java.rmi.RemoteException;
/**
* Business method
*/
public byte[] getAndSetBytesArray( byte[] array )
throws java.rmi.RemoteException;
207
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
/**
* Business method
*/
public boolean setBytesArray( byte[] array )
throws java.rmi.RemoteException;
}
Clase BytesArrayHome.java
package es.viguera.ejb.interfaces;
/**
* Home interface for BytesArray.
*/
public interface BytesArrayHome
extends javax.ejb.EJBHome
{
public static final String
COMP_NAME="java:comp/env/ejb/BytesArray";
public static final String JNDI_NAME="ejb/BytesArray";
public es.viguera.ejb.interfaces.BytesArray create()
throws javax.ejb.CreateException,java.rmi.RemoteException;
}
Clase BytesArrayWS.java
package es.viguera.ejb.interfaces;
/**
* Home interface for BytesArray.
*/
public interface BytesArrayHome
extends javax.ejb.EJBHome
{
public static final String
COMP_NAME="java:comp/env/ejb/BytesArray";
public static final String JNDI_NAME="ejb/BytesArray";
public es.viguera.ejb.interfaces.BytesArray create()
throws javax.ejb.CreateException,java.rmi.RemoteException;
}
Paquete: es.viguera.ejb.business
Clase BytesArrayBean.java
package es.viguera.ejb.business;
import
import
import
import
import
java.rmi.RemoteException;
javax.ejb.CreateException;
javax.ejb.EJBException;
javax.ejb.SessionBean;
javax.ejb.SessionContext;
208
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
import javax.naming.InitialContext;
/**
* @ejb.bean
*
*
*
*
*
*/
public class
name="BytesArray"
display-name="BytesArray"
description="BytesArray"
jndi-name="ejb/BytesArray"
type="Stateless"
view-type="remote"
BytesArrayBean implements SessionBean {
//SessionContext sc;
InitialContext ctx;
public BytesArrayBean() throws Exception {
}
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
public void ejbPassivate() throws EJBException, RemoteException
{
// TODO Auto-generated method stub
}
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
public void setSessionContext(SessionContext ctx)
throws EJBException,
RemoteException {
// TODO Auto-generated method stub
//sc = ctx;
}
/**
* Default create method
*
* @throws CreateException
* @ejb.create-method
*/
public void ejbCreate() throws CreateException {
// TODO Auto-generated method stub
}
/**
* Business method
* @ejb.interface-method view-type = "remote"
*/
public byte[] getBytesArray(int bytes) {
System.out.println("Generating and sending an array of
"+bytes+" bytes");
byte[] array = new byte[bytes];
209
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
for(int i=0;i<bytes;i++){
array[i]= 'a';
}
return array;
}
/**
* Business method
* @ejb.interface-method view-type = "remote"
*/
public byte[] getAndSetBytesArray(byte[] array) {
System.out.println("Receiving and sending an array of
"+array.length+" bytes");
return array;
}
/**
* Business method
* @ejb.interface-method view-type = "remote"
*/
public boolean setBytesArray(byte[] array) {
System.out.println("Receiving an array of "+array.length+"
bytes");
return true;
}
9.1.2.1.2. Ficheros de configuración
ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar >
<description><![CDATA[No Description.]]></description>
<display-name>Generated by XDoclet</display-name>
<enterprise-beans>
<!-- Session Beans -->
<session >
<description><![CDATA[BytesArray]]></description>
<display-name>BytesArray</display-name>
<ejb-name>BytesArray</ejb-name>
<home>es.viguera.ejb.interfaces.BytesArrayHome</home>
<remote>es.viguera.ejb.interfaces.BytesArray</remote>
<serviceendpoint>es.viguera.ejb.interfaces.BytesArrayWS</service-endpoint>
<ejb-class>es.viguera.ejb.business.BytesArrayBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
210
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
jboss.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN"
"http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
<jboss>
<enterprise-beans>
<session>
<ejb-name>BytesArray</ejb-name>
<jndi-name>ejb/BytesArray</jndi-name>
</session>
</enterprise-beans>
</jboss>
jaxrpc-mapping.xml
<?xml version='1.0' encoding='UTF-8'?><java-wsdl-mapping version='1.1'
xmlns='http://java.sun.com/xml/ns/j2ee'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd'>
<package-mapping>
<package-type>es.viguera.ejb.interfaces</package-type>
<namespaceURI>http://es.viguera.ejb.interfaces.types</namespaceURI>
</package-mapping>
<service-interface-mapping>
<service-interface>es.viguera.ejb.interfaces.BytesArrayWS</serviceinterface>
<wsdl-service-name
xmlns:serviceNS='http://es.viguera.ejb.interfaces'>serviceNS:BytesArra
yWS</wsdl-service-name>
<port-mapping>
<port-name>BytesArrayWSPort</port-name>
<java-port-name>BytesArrayWSPort</java-port-name>
</port-mapping>
</service-interface-mapping>
<service-endpoint-interface-mapping>
<service-endpointinterface>es.viguera.ejb.interfaces.BytesArrayWS</service-endpointinterface>
<wsdl-port-type
xmlns:portTypeNS='http://es.viguera.ejb.interfaces'>portTypeNS:BytesAr
rayWS</wsdl-port-type>
<wsdl-binding
xmlns:bindingNS='http://es.viguera.ejb.interfaces'>bindingNS:BytesArra
yWSBinding</wsdl-binding>
<service-endpoint-method-mapping>
<java-method-name>getBytesArray</java-method-name>
<wsdl-operation>getBytesArray</wsdl-operation>
<method-param-parts-mapping>
<param-position>0</param-position>
<param-type>int</param-type>
<wsdl-message-mapping>
<wsdl-message
xmlns:wsdlMsgNS='http://es.viguera.ejb.interfaces'>wsdlMsgNS:BytesArra
yWS_getBytesArray</wsdl-message>
<wsdl-message-part-name>int_1</wsdl-message-part-name>
<parameter-mode>IN</parameter-mode>
</wsdl-message-mapping>
211
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
</method-param-parts-mapping>
<wsdl-return-value-mapping>
<method-return-value>byte[]</method-return-value>
<wsdl-message
xmlns:wsdlMsgNS='http://es.viguera.ejb.interfaces'>wsdlMsgNS:BytesArra
yWS_getBytesArrayResponse</wsdl-message>
<wsdl-message-part-name>result</wsdl-message-part-name>
</wsdl-return-value-mapping>
</service-endpoint-method-mapping>
<service-endpoint-method-mapping>
<java-method-name>getAndSetBytesArray</java-method-name>
<wsdl-operation>getAndSetBytesArray</wsdl-operation>
<method-param-parts-mapping>
<param-position>0</param-position>
<param-type>byte[]</param-type>
<wsdl-message-mapping>
<wsdl-message
xmlns:wsdlMsgNS='http://es.viguera.ejb.interfaces'>wsdlMsgNS:BytesArra
yWS_getAndSetBytesArray</wsdl-message>
<wsdl-message-part-name>arrayOfbyte_1</wsdl-message-part-name>
<parameter-mode>IN</parameter-mode>
</wsdl-message-mapping>
</method-param-parts-mapping>
<wsdl-return-value-mapping>
<method-return-value>byte[]</method-return-value>
<wsdl-message
xmlns:wsdlMsgNS='http://es.viguera.ejb.interfaces'>wsdlMsgNS:BytesArra
yWS_getAndSetBytesArrayResponse</wsdl-message>
<wsdl-message-part-name>result</wsdl-message-part-name>
</wsdl-return-value-mapping>
</service-endpoint-method-mapping>
<service-endpoint-method-mapping>
<java-method-name>setBytesArray</java-method-name>
<wsdl-operation>setBytesArray</wsdl-operation>
<method-param-parts-mapping>
<param-position>0</param-position>
<param-type>byte[]</param-type>
<wsdl-message-mapping>
<wsdl-message
xmlns:wsdlMsgNS='http://es.viguera.ejb.interfaces'>wsdlMsgNS:BytesArra
yWS_setBytesArray</wsdl-message>
<wsdl-message-part-name>arrayOfbyte_1</wsdl-message-part-name>
<parameter-mode>IN</parameter-mode>
</wsdl-message-mapping>
</method-param-parts-mapping>
<wsdl-return-value-mapping>
<method-return-value>boolean</method-return-value>
<wsdl-message
xmlns:wsdlMsgNS='http://es.viguera.ejb.interfaces'>wsdlMsgNS:BytesArra
yWS_setBytesArrayResponse</wsdl-message>
<wsdl-message-part-name>result</wsdl-message-part-name>
</wsdl-return-value-mapping>
</service-endpoint-method-mapping>
</service-endpoint-interface-mapping>
</java-wsdl-mapping>
webservices.xml
212
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
<webservices version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee'
xmlns:impl='http://es.viguera.ejb.interfaces'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee
http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd'>
<webservice-description>
<webservice-description-name>BytesArrayWS</webservice-descriptionname>
<wsdl-file>META-INF/wsdl/BytesArrayWS.wsdl</wsdl-file>
<jaxrpc-mapping-file>META-INF/jaxrpc-mapping.xml</jaxrpc-mappingfile>
<port-component>
<port-component-name>BytesArrayWSPort</port-component-name>
<wsdl-port>impl:BytesArrayWSPort</wsdl-port>
<service-endpointinterface>es.viguera.ejb.interfaces.BytesArrayWS</service-endpointinterface>
<service-impl-bean>
<ejb-link>BytesArray</ejb-link>
</service-impl-bean>
</port-component>
</webservice-description>
</webservices>
BytesArrayWS.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<definitions name='BytesArrayWS'
targetNamespace='http://es.viguera.ejb.interfaces'
xmlns='http://schemas.xmlsoap.org/wsdl/'
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:tns='http://es.viguera.ejb.interfaces'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<types/>
<message name='BytesArrayWS_getAndSetBytesArray'>
<part name='arrayOfbyte_1' type='xsd:base64Binary'/>
</message>
<message name='BytesArrayWS_getAndSetBytesArrayResponse'>
<part name='result' type='xsd:base64Binary'/>
</message>
<message name='BytesArrayWS_getBytesArray'>
<part name='int_1' type='xsd:int'/>
</message>
<message name='BytesArrayWS_getBytesArrayResponse'>
<part name='result' type='xsd:base64Binary'/>
</message>
<message name='BytesArrayWS_setBytesArray'>
<part name='arrayOfbyte_1' type='xsd:base64Binary'/>
</message>
<message name='BytesArrayWS_setBytesArrayResponse'>
<part name='result' type='xsd:boolean'/>
</message>
<portType name='BytesArrayWS'>
<operation name='getAndSetBytesArray'
parameterOrder='arrayOfbyte_1'>
<input message='tns:BytesArrayWS_getAndSetBytesArray'/>
<output message='tns:BytesArrayWS_getAndSetBytesArrayResponse'/>
</operation>
<operation name='getBytesArray' parameterOrder='int_1'>
<input message='tns:BytesArrayWS_getBytesArray'/>
213
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
<output message='tns:BytesArrayWS_getBytesArrayResponse'/>
</operation>
<operation name='setBytesArray' parameterOrder='arrayOfbyte_1'>
<input message='tns:BytesArrayWS_setBytesArray'/>
<output message='tns:BytesArrayWS_setBytesArrayResponse'/>
</operation>
</portType>
<binding name='BytesArrayWSBinding' type='tns:BytesArrayWS'>
<soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getAndSetBytesArray'>
<soap:operation soapAction=''/>
<input>
<soap:body namespace='http://es.viguera.ejb.interfaces'
use='literal'/>
</input>
<output>
<soap:body namespace='http://es.viguera.ejb.interfaces'
use='literal'/>
</output>
</operation>
<operation name='getBytesArray'>
<soap:operation soapAction=''/>
<input>
<soap:body namespace='http://es.viguera.ejb.interfaces'
use='literal'/>
</input>
<output>
<soap:body namespace='http://es.viguera.ejb.interfaces'
use='literal'/>
</output>
</operation>
<operation name='setBytesArray'>
<soap:operation soapAction=''/>
<input>
<soap:body namespace='http://es.viguera.ejb.interfaces'
use='literal'/>
</input>
<output>
<soap:body namespace='http://es.viguera.ejb.interfaces'
use='literal'/>
</output>
</operation>
</binding>
<service name='BytesArrayWS'>
<port binding='tns:BytesArrayWSBinding' name='BytesArrayWSPort'>
<soap:address location='REPLACE_WITH_ACTUAL_URL'/>
</port>
</service>
</definitions>
9.1.2.2. Parte cliente
9.1.2.2.1. Clases
Clase ChangeServerForm.cs
using System;
using System.Collections.Generic;
214
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
using
using
using
using
using
using
Javier Viguera Muñoz
System.ComponentModel;
System.Data;
System.Drawing;
System.Text;
System.Windows.Forms;
log4net;
namespace es.viguera.client.ihm
{
public partial class ChangeServerForm : Form
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().D
eclaringType);
private string server = null;
public string Server
{
get { return server; }
set { server = value; }
}
public ChangeServerForm()
{
InitializeComponent();
comboBox1.Items.AddRange(XMLParser.getInstance().loadServers().ToArray
());
}
public ChangeServerForm(string server):this()
{
comboBox1.Text = server;
}
private void button1_Click(object sender, EventArgs e)
{
server = this.comboBox1.Text;
DialogResult = DialogResult.OK;
this.Dispose();
this.Close();
}
public void closeAndDispose()
{
}
}
}
Clase ChangeServerForm.Designer.cs
namespace es.viguera.client.ihm
{
partial class ChangeServerForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
215
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should
be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources =
new
System.ComponentModel.ComponentResourceManager(typeof(ChangeServerForm
));
this.label3 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(184, 13);
this.label3.TabIndex = 20;
this.label3.Text = "Nombre de máquina o IP del servidor:";
//
// button1
//
this.button1.Anchor =
System.Windows.Forms.AnchorStyles.Bottom;
this.button1.Location = new System.Drawing.Point(96, 82);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 22;
this.button1.Text = "Aceptar";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Anchor =
System.Windows.Forms.AnchorStyles.Bottom;
216
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.button2.DialogResult =
System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(186, 83);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 23;
this.button2.Text = "Cancelar";
this.button2.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.comboBox1);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Location = new System.Drawing.Point(11, 9);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(334, 62);
this.groupBox1.TabIndex = 24;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Servidor";
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(210,
22);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(118, 21);
this.comboBox1.TabIndex = 21;
this.comboBox1.Text = "localhost";
//
// ChangeServerForm
//
this.AcceptButton = this.button1;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.button2;
this.ClientSize = new System.Drawing.Size(357, 116);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Icon =
((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ChangeServerForm";
this.StartPosition =
System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Nombre del servidor";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private
private
private
private
private
System.Windows.Forms.Label label3;
System.Windows.Forms.ComboBox comboBox1;
System.Windows.Forms.Button button1;
System.Windows.Forms.Button button2;
System.Windows.Forms.GroupBox groupBox1;
217
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
}
Clase ConfigurationForm.cs
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Text;
System.Windows.Forms;
log4net;
namespace es.viguera.client.ihm
{
public partial class ConfigurationForm : Form
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().D
eclaringType);
//Máximo número de pruebas
private string max_num_pruebas;
//Mínimo número de pruebas
private string min_num_pruebas;
//Tamaño máximo del dato
private string max_tam_dato;
//Tamaño mínimo del dato
private string min_tam_dato;
//Paso de la barra de tamaño
private string trackbar_step;
//Puerto para Iiop
private string iiop_port;
//Puerto para WS
private string ws_port;
public ConfigurationForm()
{
InitializeComponent();
getInitConf();
}
private void getInitConf()
{
maxTamDato.Text =
XMLParser.getInstance().Max_tam_dato.ToString();
minTamDato.Text =
XMLParser.getInstance().Min_tam_dato.ToString();
maxNumPruebas.Text =
XMLParser.getInstance().Max_num_pruebas.ToString();
minNumPruebas.Text =
XMLParser.getInstance().Min_num_pruebas.ToString();
trackBarStep.Text =
XMLParser.getInstance().Trackbar_step.ToString();
iiopPort.Text =
XMLParser.getInstance().Iiop_port.ToString();
wsPort.Text = XMLParser.getInstance().Ws_port.ToString();
218
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
max_tam_dato =
XMLParser.getInstance().Max_tam_dato.ToString();
min_tam_dato =
XMLParser.getInstance().Min_tam_dato.ToString();
max_num_pruebas =
XMLParser.getInstance().Max_num_pruebas.ToString();
min_num_pruebas =
XMLParser.getInstance().Min_num_pruebas.ToString();
trackbar_step =
XMLParser.getInstance().Trackbar_step.ToString();
iiop_port = XMLParser.getInstance().Iiop_port.ToString();
ws_port = XMLParser.getInstance().Ws_port.ToString();
}
private void setInitConf()
{
try
{
XMLParser.getInstance().Max_tam_dato =
int.Parse(maxTamDato.Text);
XMLParser.getInstance().Min_tam_dato =
int.Parse(minTamDato.Text);
XMLParser.getInstance().Max_num_pruebas =
int.Parse(maxNumPruebas.Text);
XMLParser.getInstance().Min_num_pruebas =
int.Parse(minNumPruebas.Text);
XMLParser.getInstance().Trackbar_step =
int.Parse(trackBarStep.Text);
XMLParser.getInstance().Iiop_port =
int.Parse(iiopPort.Text);
XMLParser.getInstance().Ws_port =
int.Parse(wsPort.Text);
XMLParser.getInstance().writeInXMLFile();
//Método para escribir en el fichero
}
catch (Exception e)
{
log.Error(e.Message);
}
}
private void trackBarStep_Validating(object sender,
CancelEventArgs e)
{
validateIntTextBox((TextBox)sender);
}
private void minNumPruebas_Validating(object sender,
CancelEventArgs e)
{
validateIntTextBox((TextBox)sender);
}
private void maxNumPruebas_Validating(object sender,
CancelEventArgs e)
{
validateIntTextBox((TextBox)sender);
}
219
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
private void minTamDato_Validating(object sender,
CancelEventArgs e)
{
validateIntTextBox((TextBox)sender);
}
private void maxTamDato_Validating(object sender,
CancelEventArgs e)
{
validateIntTextBox((TextBox)sender);
}
private bool validateIntTextBox(TextBox textBox)
{
try
{
int.Parse(textBox.Text);
return true;
}
catch (FormatException ex)
{
MessageBox.Show("El formato no es válido: " +
ex.Message);
textBox.Focus();
return false;
}
catch (OverflowException ex)
{
MessageBox.Show("El número es demasiado grande: " +
ex.Message);
textBox.Focus();
return false;
}
}
private void button1_Click(object sender, EventArgs e)
{
bool hasChanged = checkChanges();
if (hasChanged)
{
setInitConf();
}
this.Dispose();
this.Close();
}
private bool checkChanges()
{
bool hasChanged = false;
if (!max_tam_dato.Equals(maxTamDato.Text) && !hasChanged)
{
hasChanged = true;
return hasChanged;
}
if (!min_tam_dato.Equals(minTamDato.Text) && !hasChanged)
{
hasChanged = true;
return hasChanged;
}
if (!max_num_pruebas.Equals(maxNumPruebas.Text) &&
!hasChanged)
{
220
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
hasChanged = true;
return hasChanged;
}
if (!min_num_pruebas.Equals(minNumPruebas.Text) &&
!hasChanged)
{
hasChanged = true;
return hasChanged;
}
if (!trackbar_step.Equals(trackBarStep.Text) &&
!hasChanged)
{
hasChanged = true;
return hasChanged;
}
if (!iiop_port.Equals(iiopPort.Text) && !hasChanged)
{
hasChanged = true;
return hasChanged;
}
if (!ws_port.Equals(wsPort.Text) && !hasChanged)
{
hasChanged = true;
return hasChanged;
}
return hasChanged;
}
}
}
Clase ConfigurationForm.Designer.cs
namespace es.viguera.client.ihm
{
partial class ConfigurationForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should
be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
221
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources =
new
System.ComponentModel.ComponentResourceManager(typeof(ConfigurationFor
m));
this.bytesLbIIOP = new System.Windows.Forms.Label();
this.maxTamDato = new System.Windows.Forms.TextBox();
this.tamDatoLbIIOP = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.minTamDato = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.trackBarStep = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.maxNumPruebas = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.minNumPruebas = new System.Windows.Forms.TextBox();
this.wsPort = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.iiopPort = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// bytesLbIIOP
//
this.bytesLbIIOP.AutoSize = true;
this.bytesLbIIOP.Location = new System.Drawing.Point(274,
16);
this.bytesLbIIOP.Name = "bytesLbIIOP";
this.bytesLbIIOP.Size = new System.Drawing.Size(33, 13);
this.bytesLbIIOP.TabIndex = 16;
this.bytesLbIIOP.Text = "Bytes";
//
// maxTamDato
//
this.maxTamDato.Location = new System.Drawing.Point(200,
13);
this.maxTamDato.Name = "maxTamDato";
this.maxTamDato.Size = new System.Drawing.Size(64, 20);
this.maxTamDato.TabIndex = 15;
this.maxTamDato.Text = "2048";
this.maxTamDato.Validating += new
System.ComponentModel.CancelEventHandler(this.maxTamDato_Validating);
//
// tamDatoLbIIOP
//
this.tamDatoLbIIOP.AutoSize = true;
this.tamDatoLbIIOP.Location = new System.Drawing.Point(6,
16);
this.tamDatoLbIIOP.Name = "tamDatoLbIIOP";
this.tamDatoLbIIOP.Size = new System.Drawing.Size(128,
13);
this.tamDatoLbIIOP.TabIndex = 14;
this.tamDatoLbIIOP.Text = "Tamaño máximo del dato:";
//
222
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(274, 48);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(33, 13);
this.label1.TabIndex = 19;
this.label1.Text = "Bytes";
//
// minTamDato
//
this.minTamDato.Location = new System.Drawing.Point(200,
45);
this.minTamDato.Name = "minTamDato";
this.minTamDato.Size = new System.Drawing.Size(64, 20);
this.minTamDato.TabIndex = 18;
this.minTamDato.Text = "500";
this.minTamDato.Validating += new
System.ComponentModel.CancelEventHandler(this.minTamDato_Validating);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 48);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(127, 13);
this.label2.TabIndex = 17;
this.label2.Text = "Tamaño mínimo del dato:";
//
// button1
//
this.button1.Anchor =
System.Windows.Forms.AnchorStyles.Bottom;
this.button1.Location = new System.Drawing.Point(84, 255);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 22;
this.button1.Text = "Aceptar";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Anchor =
System.Windows.Forms.AnchorStyles.Bottom;
this.button2.DialogResult =
System.Windows.Forms.DialogResult.Cancel;
this.button2.Location = new System.Drawing.Point(174,
256);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 23;
this.button2.Text = "Cancelar";
this.button2.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.wsPort);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label7);
223
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.groupBox1.Controls.Add(this.iiopPort);
this.groupBox1.Controls.Add(this.trackBarStep);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.maxNumPruebas);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.minNumPruebas);
this.groupBox1.Controls.Add(this.tamDatoLbIIOP);
this.groupBox1.Controls.Add(this.maxTamDato);
this.groupBox1.Controls.Add(this.bytesLbIIOP);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.minTamDato);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(11, 9);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(312, 234);
this.groupBox1.TabIndex = 24;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Puerto para WS:";
//
// trackBarStep
//
this.trackBarStep.Location = new System.Drawing.Point(200,
142);
this.trackBarStep.Name = "trackBarStep";
this.trackBarStep.Size = new System.Drawing.Size(64, 20);
this.trackBarStep.TabIndex = 28;
this.trackBarStep.Text = "8";
this.trackBarStep.Validating += new
System.ComponentModel.CancelEventHandler(this.trackBarStep_Validating)
;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 144);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(141, 13);
this.label5.TabIndex = 27;
this.label5.Text = "Incremento de las trackbars:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 81);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(140, 13);
this.label4.TabIndex = 22;
this.label4.Text = "Máximo número de pruebas:";
//
// maxNumPruebas
//
this.maxNumPruebas.Location = new
System.Drawing.Point(200, 78);
this.maxNumPruebas.Name = "maxNumPruebas";
this.maxNumPruebas.Size = new System.Drawing.Size(64, 20);
this.maxNumPruebas.TabIndex = 23;
this.maxNumPruebas.Text = "100";
this.maxNumPruebas.Validating += new
System.ComponentModel.CancelEventHandler(this.maxNumPruebas_Validating
);
224
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(6, 113);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(139, 13);
this.label6.TabIndex = 25;
this.label6.Text = "Mínimo número de pruebas:";
//
// minNumPruebas
//
this.minNumPruebas.Location = new
System.Drawing.Point(200, 110);
this.minNumPruebas.Name = "minNumPruebas";
this.minNumPruebas.Size = new System.Drawing.Size(64, 20);
this.minNumPruebas.TabIndex = 26;
this.minNumPruebas.Text = "1";
this.minNumPruebas.Validating += new
System.ComponentModel.CancelEventHandler(this.minNumPruebas_Validating
);
//
// wsPort
//
this.wsPort.Location = new System.Drawing.Point(201, 201);
this.wsPort.Name = "wsPort";
this.wsPort.Size = new System.Drawing.Size(64, 20);
this.wsPort.TabIndex = 32;
this.wsPort.Text = "8080";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(7, 203);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(86, 13);
this.label3.TabIndex = 31;
this.label3.Text = "Puerto para WS:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(7, 172);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(89, 13);
this.label7.TabIndex = 29;
this.label7.Text = "Puerto para IIOP:";
//
// iiopPort
//
this.iiopPort.Location = new System.Drawing.Point(201,
169);
this.iiopPort.Name = "iiopPort";
this.iiopPort.Size = new System.Drawing.Size(64, 20);
this.iiopPort.TabIndex = 30;
this.iiopPort.Text = "3528";
//
// ConfigurationForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
225
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(333, 289);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Icon =
((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ConfigurationForm";
this.StartPosition =
System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Configuration";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
System.Windows.Forms.Label bytesLbIIOP;
System.Windows.Forms.TextBox maxTamDato;
System.Windows.Forms.Label tamDatoLbIIOP;
System.Windows.Forms.Label label1;
System.Windows.Forms.TextBox minTamDato;
System.Windows.Forms.Label label2;
System.Windows.Forms.Button button1;
System.Windows.Forms.Button button2;
System.Windows.Forms.GroupBox groupBox1;
System.Windows.Forms.Label label4;
System.Windows.Forms.TextBox maxNumPruebas;
System.Windows.Forms.Label label6;
System.Windows.Forms.TextBox minNumPruebas;
System.Windows.Forms.TextBox trackBarStep;
System.Windows.Forms.Label label5;
System.Windows.Forms.TextBox wsPort;
System.Windows.Forms.Label label3;
System.Windows.Forms.Label label7;
System.Windows.Forms.TextBox iiopPort;
}
}
Clase MainForm.cs
using
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.ComponentModel;
System.Data;
System.Drawing;
System.Text;
System.Windows.Forms;
System.Collections;
log4net;
System.Threading;
namespace es.viguera.client.ihm
{
public partial class MainForm : Form
{
226
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().D
eclaringType);
//Máximo número de pruebas
private int MAX_NUMERO_PRUEBAS = 1000;
//Mínimo número de pruebas
private int MIN_NUMERO_PRUEBAS = 1;
//Tamaño máximo del dato
private int MAX_TAM_DATO = 12048;
//Tamaño mínimo del dato
private int MIN_TAM_DATO = 1;
//Paso de la barra de tamaño
private int TRACK_BAR_STEP = 8;
//Servidor al que conectarse
private string server = "localhost";
private IIOP iiop = null;
private WebServices ws = null;
#region ATRIBUTOS PARA IIOP
private int numPruebasIIOP;
private int tamDatoIIOP;
private float resultadoIIOP;
private int iiopMode;
private int iiop_port;
public int NumPruebasIIOP
{
get { return numPruebasIIOP; }
set
{
try
{
numPruebasIIOP = value;
this.progressBarIIOP.Maximum = value;
this.progressBarIIOP.Step =
progressBarIIOP.Maximum / value;
}
catch (Exception e)
{
log.Error(e.Message);
MessageBox.Show("El número de pruebas IIOP no
pruebas no puede ser 0");
}
}
}
public int TamDatoIIOP
{
get { return tamDatoIIOP; }
set { tamDatoIIOP = value; }
}
public float ResultadoIIOP
{
get { return resultadoIIOP; }
set { resultadoIIOP = value; }
}
public int IiopMode
{
get { return iiopMode; }
set { iiopMode = value; }
}
227
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
#endregion
#region ATRIBUTO PARA WS
private
private
private
private
private
int numPruebasWS;
int tamDatoWS;
float resultadoWS;
int wsMode;
int ws_port;
public int NumPruebasWS
{
get { return numPruebasWS; }
set
{
try
{
numPruebasWS = value;
this.progressBarWS.Maximum = value;
this.progressBarWS.Step = progressBarWS.Maximum /
value;
}
catch (Exception e)
{
log.Error(e.Message);
MessageBox.Show("El número de pruebas WS no
pruebas no puede ser 0");
}
}
}
public int TamDatoWS
{
get { return tamDatoWS; }
set { tamDatoWS = value; }
}
public float ResultadoWS
{
get { return resultadoWS; }
set { resultadoWS = value; }
}
public int WsMode
{
get { return wsMode; }
set { wsMode = value; }
}
#endregion
#region ATRIBUTO PARA LAS PRUEBAS CONJUNTAS
private int tamMaximBoth;
private int tamMinimBoth;
private int stepValueBoth;
private int numPruebasBoth;
private int bothMode;
public int TamMaximBoth
{
get { return tamMaximBoth; }
set { tamMaximBoth = value; }
}
228
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
public int TamMinimBoth
{
get { return tamMinimBoth; }
set { tamMinimBoth = value; }
}
public int StepValueBoth
{
get { return stepValueBoth; }
set { stepValueBoth = value; }
}
public int NumPruebasBoth
{
get { return numPruebasBoth; }
set { numPruebasBoth = value; }
}
public int BothMode
{
get { return bothMode; }
set { bothMode = value; }
}
#endregion
#region ATRIBUTOS AUXILIARES
private string numPruebasAux;
private string tamDataAux;
private string stepAux;
#endregion
public MainForm()
{
ChangeServerForm changeServer = new ChangeServerForm();
DialogResult result = changeServer.ShowDialog();
if (result == DialogResult.OK)
{
InitializeComponent();
setToolTips();
loadInitConfig();
server = changeServer.Server;
initVars();
registerToEvents();
}
else
{
Application.Exit();
}
}
private void registerToEvents()
{
XMLParser.getInstance().OnConfigurationChanged += new
XMLParser.OnConfigurationChangedEvent(configurationchanged);
}
private void setToolTips()
{
ToolTip tooltip = new ToolTip();
tooltip.SetToolTip(groupBoxIIOP, "Parámetros de
configuración para pruebas IIOP");
tooltip.SetToolTip(groupBoxWS, "Parámetros de
configuración para pruebas WS");
229
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
tooltip.SetToolTip(groupBox1, "Parámetros de configuración
para pruebas comparativas de IIOP y WS");
tooltip.SetToolTip(tamDatoLbIIOP, "Tamaño del dato que se
enviará y/o recibirá");
tooltip.SetToolTip(tamDatoLbWS, "Tamaño del dato que se
enviará y/o recibirá");
tooltip.SetToolTip(tamMaxBothlb, "Tamaño máximo del dato
que se enviará y/o recibirá");
tooltip.SetToolTip(tamMinBothLb, "Tamaño mínimo del dato
que se enviará y/o recibirá");
tooltip.SetToolTip(stepBothLb, "Incremento de tamaño del
dato que se enviará y/o recibirá");
tooltip.SetToolTip(numPruebasLbWS, "Número de pruebas que
se realizarán");
tooltip.SetToolTip(numPruebasLbIIOP, "Número de pruebas
que se realizarán");
tooltip.SetToolTip(resultadoLbIIOP, "Tiempo medio empleado
en las pruebas");
tooltip.SetToolTip(resultadoLbWS, "Tiempo medio empleado
en las pruebas");
tooltip.SetToolTip(radioButtonDownloadIIOP, "Se recibirán
datos del servidor");
tooltip.SetToolTip(radioButtonDownloadWS, "Se recibirán
datos del servidor");
tooltip.SetToolTip(radioButtonDownloadBoth, "Se recibirán
datos del servidor");
tooltip.SetToolTip(radioButtonUploadIIOP, "Se enviarán
datos al servidor");
tooltip.SetToolTip(radioButtonUploadWS, "Se enviarán datos
al servidor");
tooltip.SetToolTip(radioButtonUploadBoth, "Se enviarán
datos al servidor");
tooltip.SetToolTip(buttonComenzarIIOP, "Comenzarán las
pruebas de rendimiento");
tooltip.SetToolTip(buttonComenzarWS, "Comenzarán las
pruebas de rendimiento");
tooltip.SetToolTip(buttonComenzarBoth, "Comenzarán las
pruebas de rendimiento");
tooltip.SetToolTip(wsCheckBox, "Pruebas comparativas
mediante Web Services");
tooltip.SetToolTip(iiopCheckBox, "Pruebas comparativas
mediante IIOP");
}
private void loadInitConfig()
{
MAX_TAM_DATO = XMLParser.getInstance().Max_tam_dato;
MIN_TAM_DATO = XMLParser.getInstance().Min_tam_dato;
MAX_NUMERO_PRUEBAS =
XMLParser.getInstance().Max_num_pruebas;
MIN_NUMERO_PRUEBAS =
XMLParser.getInstance().Min_num_pruebas;
TRACK_BAR_STEP = XMLParser.getInstance().Trackbar_step;
//server = XMLParser.getInstance().Server;
if (iiop_port != XMLParser.getInstance().Iiop_port)
{
if (iiop != null)
230
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
{
iiop.reset();
iiop.Port =
XMLParser.getInstance().Iiop_port.ToString();
}
}
if (ws_port != XMLParser.getInstance().Ws_port)
{
if (ws != null)
{
ws.reset();
ws.Port =
XMLParser.getInstance().Ws_port.ToString();
}
}
iiop_port = XMLParser.getInstance().Iiop_port;
ws_port = XMLParser.getInstance().Ws_port;
trackBarIIOP.SmallChange = TRACK_BAR_STEP;
trackBarIIOP.Maximum = MAX_TAM_DATO;
trackBarIIOP.Minimum = MIN_TAM_DATO;
trackBarWS.SmallChange = TRACK_BAR_STEP;
trackBarWS.Maximum = MAX_TAM_DATO;
trackBarWS.Minimum = MIN_TAM_DATO;
trackBarTamMaxBoth.SmallChange = TRACK_BAR_STEP;
trackBarTamMaxBoth.Maximum = MAX_TAM_DATO;
trackBarTamMaxBoth.Minimum = MIN_TAM_DATO;
trackBarTamMinBoth.SmallChange = TRACK_BAR_STEP;
trackBarTamMinBoth.Maximum = MAX_TAM_DATO;
trackBarTamMinBoth.Minimum = MIN_TAM_DATO;
}
private void initVars()
{
//IIOP
NumPruebasIIOP = MIN_NUMERO_PRUEBAS;
TamDatoIIOP = MIN_TAM_DATO;
this.tamDatoTbIIOP.Text = MIN_TAM_DATO.ToString();
this.numPruebasTbIIOP.Text =
MIN_NUMERO_PRUEBAS.ToString();
// trackBarIIOP
this.trackBarIIOP.Maximum = MAX_TAM_DATO;
this.trackBarIIOP.Minimum = MIN_TAM_DATO;
this.trackBarIIOP.SmallChange = TRACK_BAR_STEP;
this.trackBarIIOP.Value = MIN_TAM_DATO;
//progressBarIIOP
this.progressBarIIOP.Style = ProgressBarStyle.Continuous;
this.progressBarIIOP.Maximum = NumPruebasIIOP;
this.progressBarIIOP.Step = progressBarIIOP.Maximum /
NumPruebasIIOP;
//WS
NumPruebasWS = MIN_NUMERO_PRUEBAS;
TamDatoWS = MIN_TAM_DATO;
this.tamDatoTbWS.Text = MIN_TAM_DATO.ToString();
this.numPruebasTbWS.Text = MIN_NUMERO_PRUEBAS.ToString();
//trackBarWS
this.trackBarWS.Maximum = MAX_TAM_DATO;
this.trackBarWS.Minimum = MIN_TAM_DATO;
this.trackBarWS.SmallChange = TRACK_BAR_STEP;
this.trackBarWS.Value = MIN_TAM_DATO;
//progressBarWS
this.progressBarWS.Style = ProgressBarStyle.Continuous;
231
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.progressBarWS.Maximum = NumPruebasWS;
this.progressBarWS.Step = progressBarWS.Maximum /
NumPruebasWS;
//BOTH
TamMinimBoth = MIN_TAM_DATO;
TamMaximBoth = MAX_TAM_DATO;
StepValueBoth = TRACK_BAR_STEP;
NumPruebasBoth = (TamMaximBoth - TamMinimBoth) /
StepValueBoth;
this.tamMaxBoth.Text = MAX_TAM_DATO.ToString();
this.tamMinBoth.Text = MIN_TAM_DATO.ToString();
this.stepBoth.Text = TRACK_BAR_STEP.ToString();
//trackBarTamMaxBoth
this.trackBarTamMaxBoth.Maximum = MAX_TAM_DATO;
this.trackBarTamMaxBoth.Minimum = MIN_TAM_DATO;
this.trackBarTamMaxBoth.SmallChange = TRACK_BAR_STEP;
this.trackBarTamMaxBoth.Value = MAX_TAM_DATO;
//trackBarTamMinBoth
this.trackBarTamMinBoth.Maximum = MAX_TAM_DATO;
this.trackBarTamMinBoth.Minimum = MIN_TAM_DATO;
this.trackBarTamMinBoth.SmallChange = TRACK_BAR_STEP;
this.trackBarTamMinBoth.Value = MIN_TAM_DATO;
//progressBarBoth
this.progressBarBoth.Style = ProgressBarStyle.Continuous;
this.progressBarBoth.Maximum = NumPruebasBoth;
this.progressBarBoth.Step = progressBarBoth.Maximum /
NumPruebasBoth;
}
public static void Main(string[] args)
{
Application.EnableVisualStyles();
MainForm main = new MainForm();
log4net.Config.XmlConfigurator.Configure();
Application.Run(main);
}
private void label3_Click(object sender, EventArgs e)
{
}
private void trackBar1_Scroll(object sender, EventArgs e)
{
// Display the trackbar value in the text box.
tamDatoTbIIOP.Text = "" + trackBarIIOP.Value;
TamDatoIIOP = trackBarIIOP.Value;
}
private void tamDatoTbIIOP_TextChanged(object sender,
EventArgs e)
{
try
{
if (tamDatoTbIIOP.Text.Equals(""))
{
tamDatoTbIIOP.Text = MIN_TAM_DATO.ToString();
}
int value = int.Parse(tamDatoTbIIOP.Text);
232
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
trackBarIIOP.Value = value;
}
catch (FormatException ex)
{
MessageBox.Show("El formato no es correcto:
"+ex.Message);
}
catch (OverflowException ex)
{
MessageBox.Show("Valor fuera de rango: " +
ex.Message);
}
catch (ArgumentOutOfRangeException ex)
{
MessageBox.Show("Valor fuera de rango: " +
ex.Message);
}
}
private void webServicesToolStripMenuItem_Click(object sender,
EventArgs e)
{
}
private void numPruebasTbWS_TextChanged(object sender,
EventArgs e)
{
try
{
int numPruebas = int.Parse(numPruebasTbWS.Text);
NumPruebasWS = numPruebas;
}
catch (FormatException ex)
{
MessageBox.Show("El formato para el número de pruebas
no es válido: " + ex.Message);
numPruebasTbWS.Text = MIN_NUMERO_PRUEBAS.ToString();
}
catch (OverflowException ex)
{
MessageBox.Show("El número de pruebas es demasiado
grande: " + ex.Message);
numPruebasTbWS.Text = MIN_NUMERO_PRUEBAS.ToString();
}
}
private void trackBarWS_Scroll(object sender, EventArgs e)
{
// Display the trackbar value in the text box.
tamDatoTbWS.Text = "" + trackBarWS.Value;
TamDatoWS = trackBarWS.Value;
}
private void button1_Click(object sender, EventArgs e)
{
try
{
writeLog("Batería de pruebas IIOP. Número de pruebas:"
+ numPruebasTbIIOP.Text + ". Tamaño del dato:" + tamDatoTbIIOP.Text);
Cursor.Current = Cursors.WaitCursor;
233
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.progressBarIIOP.Value =
this.progressBarIIOP.Minimum;
//WSLine.Clear();
IIOPLine.Clear();
IIOPLine.Add(0, 0);
iiop = IIOP.getInstance(server);
iiop.TestExecuted += new
IIOP.TestExecutedEventHandler(onIiopTestExecuted);
iiop.NumPruebas = int.Parse(numPruebasTbIIOP.Text);
iiop.TamDato = int.Parse(tamDatoTbIIOP.Text);
tChart1.Axes.Bottom.SetMinMax(0, iiop.NumPruebas);
tChart1.Axes.Bottom.Title.Text = "Número de prueba";
string result = iiop.execute(iiopMode);
resultadoTbIIOP.Text = result;
writeLog("Protocolo:IIOP, Media de todas las
pruebas:"+result);
iiop.TestExecuted -= new
IIOP.TestExecutedEventHandler(onIiopTestExecuted);
Cursor.Current = Cursors.Default;
}
catch (Exception ex)
{
writeLog(ex.Message);
}
}
private void button2_Click(object sender, EventArgs e)
{
try
{
writeLog("Batería de pruebas WS. Número de pruebas:" +
numPruebasTbWS.Text + ". Tamaño del dato:" + tamDatoTbWS.Text);
Cursor.Current = Cursors.WaitCursor;
this.progressBarWS.Value = this.progressBarWS.Minimum;
WSLine.Clear();
//IIOPLine.Clear();
WSLine.Add(0, 0);
ws = WebServices.getInstance(server);
ws.TestExecuted += new
WebServices.TestExecutedEventHandler(onWSTestExecuted);
ws.NumPruebas = int.Parse(numPruebasTbWS.Text);
ws.TamDato = int.Parse(tamDatoTbWS.Text);
tChart1.Axes.Bottom.SetMinMax(0, ws.NumPruebas);
tChart1.Axes.Bottom.Title.Text = "Número de prueba";
string result = ws.execute(wsMode);
resultadoTbWS.Text = result;
writeLog("Protocolo:WS, Media de todas las pruebas:" +
result);
ws.TestExecuted -= new
WebServices.TestExecutedEventHandler(onWSTestExecuted);
Cursor.Current = Cursors.Default;
}
catch (Exception ex)
{
writeLog(ex.Message);
}
}
234
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
private void button3_Click(object sender, EventArgs e)
{
writeLog("Batería de pruebas con tamaño variable. Tamaño
inicial del dato:" + TamMinimBoth + ". Tamaño final del dato:" +
TamMaximBoth);
Cursor.Current = Cursors.WaitCursor;
this.progressBarBoth.Value = this.progressBarBoth.Minimum;
if ((TamMaximBoth - TamMinimBoth) % StepValueBoth > 0)
{
NumPruebasBoth = (TamMaximBoth - TamMinimBoth) /
StepValueBoth + 1;
}
else
{
NumPruebasBoth = ((TamMaximBoth - TamMinimBoth) /
StepValueBoth);
}
this.progressBarBoth.Maximum = NumPruebasBoth*2;
WSLine.Clear();
IIOPLine.Clear();
WSLine.Add(0, 0);
IIOPLine.Add(0, 0);
if (iiopCheckBox.Checked)
{
iiop = IIOP.getInstance(server);
iiop.NumPruebas = 1;
}
if (wsCheckBox.Checked)
{
ws = WebServices.getInstance(server);
ws.NumPruebas = 1;
}
tChart1.Axes.Bottom.SetMinMax(TamMinimBoth-1,
TamMaximBoth+1);
tChart1.Axes.Bottom.Title.Text = "Tamaño del dato";
int count = TamMinimBoth;
int i = 0;
try
{
while (count < TamMaximBoth)
{
if (iiopCheckBox.Checked)
{
iiop.TamDato = count;
string iiopResult = iiop.execute(bothMode);
onIiopTestExecuted(count, count,
double.Parse(iiopResult));
}
progressBarBoth.Value++;
if (wsCheckBox.Checked)
{
ws.TamDato = count;
string wsResult = ws.execute(bothMode);
onWSTestExecuted(count, count,
double.Parse(wsResult));
}
progressBarBoth.Value++;
count += StepValueBoth;
235
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
i++;
}
}
catch (Exception ex)
{
writeLog(ex.Message);
}
Cursor.Current = Cursors.Default;
}
private void onIiopTestExecuted(int i,int tamDato, double
time)
{
if (IIOPLine != null)
{
IIOPLine.Add(i, time);
}
tChart1.AutoRepaint = true;
tChart1.Refresh();
progressBarIIOP.PerformStep();
writeLog("Protocolo:IIOP, Tamaño del dato:"+tamDato+",
Tiempo:"+time);
}
private void onWSTestExecuted(int i, int tamDato, double time)
{
if (WSLine != null)
{
WSLine.Add(i, time);
}
tChart1.AutoRepaint = true;
tChart1.Refresh();
progressBarWS.PerformStep();
writeLog("Protocolo:WS, Tamaño del dato:"+tamDato+",
Tiempo:"+time);
}
private void numPruebasTbIIOP_Enter(object sender, EventArgs
e)
{
numPruebasAux = ((TextBoxBase)sender).Text;
}
private void numPruebasTbIIOP_Leave(object sender, EventArgs
e)
{
try
{
int numPruebas = int.Parse(numPruebasTbIIOP.Text);
if (numPruebas < MIN_NUMERO_PRUEBAS || numPruebas >
MAX_NUMERO_PRUEBAS)
{
MessageBox.Show("El número de pruebas está por
encima o por debajo de los límites");
numPruebasTbIIOP.Text = numPruebasAux;
}
else
{
NumPruebasIIOP = numPruebas;
}
236
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
catch (FormatException ex)
{
MessageBox.Show("El formato para el número de pruebas
no es válido: " + ex.Message);
numPruebasTbIIOP.Text = numPruebasAux;
}
catch (OverflowException ex)
{
MessageBox.Show("El número de pruebas es demasiado
grande: " + ex.Message);
numPruebasTbIIOP.Text = numPruebasAux;
}
}
private void tamDatoTbWS_Enter(object sender, EventArgs e)
{
tamDataAux = ((TextBoxBase)sender).Text;
}
private void tamDatoTbWS_Leave(object sender, EventArgs e)
{
try
{
int tamdato = int.Parse(tamDatoTbWS.Text);
if (tamdato < MIN_TAM_DATO || tamdato > MAX_TAM_DATO)
{
MessageBox.Show("El número de pruebas está por
encima o por debajo de los límites");
tamDatoTbWS.Text = tamDataAux;
}
else
{
TamDatoWS = tamdato;
trackBarWS.Value = tamdato;
}
}
catch (FormatException ex)
{
MessageBox.Show("El formato para el tamaño del dato no
es válido: " + ex.Message);
tamDatoTbWS.Text = tamDataAux;
}
catch (OverflowException ex)
{
MessageBox.Show("El tamaño del dato es demasiado
grande: " + ex.Message);
tamDatoTbWS.Text = tamDataAux;
}
}
private void tamDatoTbIIOP_Enter(object sender, EventArgs e)
{
tamDataAux = ((TextBoxBase)sender).Text;
}
private void tamDatoTbIIOP_Leave(object sender, EventArgs e)
{
237
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
try
{
int tamdato = int.Parse(tamDatoTbIIOP.Text);
if (tamdato < MIN_TAM_DATO || tamdato > MAX_TAM_DATO)
{
MessageBox.Show("El tamaño del dato está por
encima o por debajo de los límites");
tamDatoTbIIOP.Text = tamDataAux;
}
else
{
TamDatoIIOP = tamdato;
trackBarIIOP.Value = tamdato;
}
}
catch (FormatException ex)
{
MessageBox.Show("El formato para el tamaño del dato no
es válido: " + ex.Message);
tamDatoTbIIOP.Text = tamDataAux;
}
catch (OverflowException ex)
{
MessageBox.Show("El tamaño del dato es demasiado
grande: " + ex.Message);
tamDatoTbIIOP.Text = tamDataAux;
}
}
private void numPruebasTbWS_Enter(object sender, EventArgs e)
{
numPruebasAux = ((TextBoxBase)sender).Text;
}
private void numPruebasTbWS_Leave(object sender, EventArgs e)
{
try
{
int numPruebas = int.Parse(numPruebasTbWS.Text);
if (numPruebas < MIN_NUMERO_PRUEBAS || numPruebas >
MAX_NUMERO_PRUEBAS)
{
MessageBox.Show("El número de pruebas está por
encima o por debajo de los límites");
numPruebasTbWS.Text = numPruebasAux;
}
else
{
NumPruebasWS = numPruebas;
}
}
catch (FormatException ex)
{
MessageBox.Show("El formato para el número de pruebas
no es válido: " + ex.Message);
numPruebasTbWS.Text = numPruebasAux;
}
238
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
catch (OverflowException ex)
{
MessageBox.Show("El número de pruebas es demasiado
grande: " + ex.Message);
numPruebasTbWS.Text = numPruebasAux;
}
}
private void tamMaxBoth_Enter(object sender, EventArgs e)
{
tamDataAux = ((TextBoxBase)sender).Text;
}
private void tamMaxBoth_Leave(object sender, EventArgs e)
{
try
{
int tamdato = int.Parse(((TextBoxBase)sender).Text);
if (tamdato < MIN_TAM_DATO || tamdato > MAX_TAM_DATO)
{
MessageBox.Show("El tamaño del dato está por
encima o por debajo de los límites");
((TextBoxBase)sender).Text = tamDataAux;
}
else
{
TamMaximBoth = tamdato;
trackBarTamMaxBoth.Value = tamdato;
}
}
catch (FormatException ex)
{
MessageBox.Show("El formato para el tamaño del dato no
es válido: " + ex.Message);
((TextBoxBase)sender).Text = tamDataAux;
}
catch (OverflowException ex)
{
MessageBox.Show("El tamaño del dato es demasiado
grande: " + ex.Message);
((TextBoxBase)sender).Text = tamDataAux;
}
}
private void tamMinBoth_Enter(object sender, EventArgs e)
{
tamDataAux = ((TextBoxBase)sender).Text;
}
private void tamMinBoth_Leave(object sender, EventArgs e)
{
try
{
int tamdato = int.Parse(((TextBoxBase)sender).Text);
if (tamdato < MIN_TAM_DATO || tamdato > MAX_TAM_DATO)
{
MessageBox.Show("El tamaño del dato está por
encima o por debajo de los límites");
((TextBoxBase)sender).Text = tamDataAux;
239
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
else
{
TamMinimBoth = tamdato;
trackBarTamMinBoth.Value = tamdato;
}
}
catch (FormatException ex)
{
MessageBox.Show("El formato para el tamaño del dato no
es válido: " + ex.Message);
((TextBoxBase)sender).Text = tamDataAux;
}
catch (OverflowException ex)
{
MessageBox.Show("El tamaño del dato es demasiado
grande: " + ex.Message);
((TextBoxBase)sender).Text = tamDataAux;
}
}
private void stepBoth_Enter(object sender, EventArgs e)
{
stepAux = ((TextBoxBase)sender).Text;
}
private void stepBoth_Leave(object sender, EventArgs e)
{
try
{
int step = int.Parse(((TextBoxBase)sender).Text);
if (step < 0 || step > TamMaximBoth)
{
MessageBox.Show("El tamaño del dato está por
encima de los límites");
((TextBoxBase)sender).Text = stepAux;
}
else
{
StepValueBoth = step;
}
}
catch (FormatException ex)
{
MessageBox.Show("El formato para el tamaño del dato no
es válido: " + ex.Message);
((TextBoxBase)sender).Text = stepAux;
}
catch (OverflowException ex)
{
MessageBox.Show("El tamaño del dato es demasiado
grande: " + ex.Message);
((TextBoxBase)sender).Text = stepAux;
}
}
private void trackBarTamMaxBoth_Scroll(object sender,
EventArgs e)
{
240
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
tamMaxBoth.Text = "" + trackBarTamMaxBoth.Value;
TamMaximBoth = trackBarTamMaxBoth.Value;
}
private void trackBarTamMinBoth_Scroll(object sender,
EventArgs e)
{
tamMinBoth.Text = "" + trackBarTamMinBoth.Value;
TamMinimBoth = trackBarTamMinBoth.Value;
}
private bool checkConsistency()
{
checkIIOPConsistency();
checkWSConsistency();
checkBothConsistency();
return true;
}
private bool checkBothConsistency()
{
if (TamMaximBoth > MAX_TAM_DATO)
{
TamMaximBoth = MAX_TAM_DATO;
this.trackBarTamMaxBoth.Value = MAX_TAM_DATO;
this.tamMaxBoth.Text = MAX_TAM_DATO.ToString();
}
if (TamMaximBoth < MIN_TAM_DATO)
{
TamMaximBoth = MIN_TAM_DATO;
this.trackBarTamMaxBoth.Value = MIN_TAM_DATO;
this.tamMaxBoth.Text = MIN_TAM_DATO.ToString();
}
if (TamMinimBoth > MAX_TAM_DATO)
{
TamMinimBoth = MAX_TAM_DATO;
this.trackBarTamMinBoth.Value = MAX_TAM_DATO;
this.tamMinBoth.Text = MAX_TAM_DATO.ToString();
}
if (TamMinimBoth < MIN_TAM_DATO)
{
TamMinimBoth = MIN_TAM_DATO;
this.trackBarTamMinBoth.Value = MIN_TAM_DATO;
this.tamMinBoth.Text = MIN_TAM_DATO.ToString();
}
if (StepValueBoth > MAX_TAM_DATO)
{
StepValueBoth = MAX_TAM_DATO;
NumPruebasBoth = (TamMaximBoth - TamMinimBoth) /
StepValueBoth;
}
return true;
}
private bool checkWSConsistency()
{
if (TamDatoWS > MAX_TAM_DATO)
{
TamDatoWS = MAX_TAM_DATO;
this.trackBarWS.Value = MAX_TAM_DATO;
this.tamDatoTbWS.Text = MAX_TAM_DATO.ToString();
241
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
if (TamDatoWS < MIN_TAM_DATO)
{
TamDatoWS = MIN_TAM_DATO;
this.trackBarWS.Value = MIN_TAM_DATO;
this.tamDatoTbWS.Text = MIN_TAM_DATO.ToString();
}
if (NumPruebasWS > MAX_NUMERO_PRUEBAS)
{
NumPruebasWS = MAX_NUMERO_PRUEBAS;
this.numPruebasTbWS.Text =
MAX_NUMERO_PRUEBAS.ToString();
}
if (NumPruebasWS < MIN_NUMERO_PRUEBAS)
{
NumPruebasWS = MIN_NUMERO_PRUEBAS;
this.numPruebasTbWS.Text =
MIN_NUMERO_PRUEBAS.ToString();
}
return true;
}
private bool checkIIOPConsistency()
{
if (TamDatoIIOP > MAX_TAM_DATO)
{
TamDatoIIOP = MAX_TAM_DATO;
this.trackBarIIOP.Value = MAX_TAM_DATO;
this.tamDatoTbIIOP.Text = MAX_TAM_DATO.ToString();
}
if (TamDatoIIOP < MIN_TAM_DATO)
{
TamDatoIIOP = MIN_TAM_DATO;
this.trackBarIIOP.Value = MIN_TAM_DATO;
this.tamDatoTbIIOP.Text = MIN_TAM_DATO.ToString();
}
if (NumPruebasIIOP > MAX_NUMERO_PRUEBAS)
{
NumPruebasIIOP = MAX_NUMERO_PRUEBAS;
this.numPruebasTbIIOP.Text =
MAX_NUMERO_PRUEBAS.ToString();
}
if (NumPruebasIIOP < MIN_NUMERO_PRUEBAS)
{
NumPruebasIIOP = MIN_NUMERO_PRUEBAS;
this.numPruebasTbIIOP.Text =
MIN_NUMERO_PRUEBAS.ToString();
}
return true;
}
private void configuraciónToolStripMenuItem_Click(object
sender, EventArgs e)
{
ConfigurationForm configuration = new ConfigurationForm();
DialogResult result = configuration.ShowDialog();
}
private void configurationchanged()
{
loadInitConfig();
checkNewConfiguration();
242
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
private void checkNewConfiguration()
{
checkIIOPConsistency();
checkWSConsistency();
checkBothConsistency();
}
private void cambiarServidorToolStripMenuItem_Click(object
sender, EventArgs e)
{
ChangeServerForm changeServer = new
ChangeServerForm(server);
DialogResult result = changeServer.ShowDialog();
if (result == DialogResult.OK)
{
if (!server.Equals(changeServer.Server))
{
server = changeServer.Server;
if (ws != null)
{
ws.reset();
ws.Server = server;
}
if (iiop != null)
{
iiop.reset();
iiop.Server = server;
}
}
}
}
public void writeLog(string log)
{
if (this.logsTB != null)
{
this.logsTB.AppendText(log + "\r\n");
}
}
private void
radionButtonUploadDownloadIIOP_CheckedChanged(object sender, EventArgs
e)
{
RadioButton radio = (RadioButton)sender;
if (radio.Checked)
{
iiopMode = IProxy.UPLOAD_DOWNLOAD;
}
}
private void radioButtonUploadIIOP_CheckedChanged(object
sender, EventArgs e)
{
RadioButton radio = (RadioButton)sender;
if (radio.Checked)
{
243
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
iiopMode = IProxy.UPLOAD;
}
}
private void radioButtonDownloadIIOP_CheckedChanged(object
sender, EventArgs e)
{
RadioButton radio = (RadioButton)sender;
if (radio.Checked)
{
iiopMode = IProxy.DOWNLOAD;
}
}
private void radioButtonDownloadWS_CheckedChanged(object
sender, EventArgs e)
{
RadioButton radio = (RadioButton)sender;
if (radio.Checked)
{
wsMode = IProxy.DOWNLOAD;
}
}
private void radioButtonUploadWS_CheckedChanged(object sender,
EventArgs e)
{
RadioButton radio = (RadioButton)sender;
if (radio.Checked)
{
wsMode = IProxy.UPLOAD;
}
}
private void radioButton1_CheckedChanged(object sender,
EventArgs e)
{
RadioButton radio = (RadioButton)sender;
if (radio.Checked)
{
wsMode = IProxy.UPLOAD_DOWNLOAD;
}
}
private void radioButtonDownloadBoth_CheckedChanged(object
sender, EventArgs e)
{
RadioButton radio = (RadioButton)sender;
if (radio.Checked)
{
bothMode = IProxy.DOWNLOAD;
}
}
private void radioButtonUploadBoth_CheckedChanged(object
sender, EventArgs e)
{
RadioButton radio = (RadioButton)sender;
if (radio.Checked)
{
bothMode = IProxy.UPLOAD;
244
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
}
private void radioButton2_CheckedChanged(object sender,
EventArgs e)
{
RadioButton radio = (RadioButton)sender;
if (radio.Checked)
{
bothMode = IProxy.UPLOAD_DOWNLOAD;
}
}
private void bandwidthDelimiterToolStripMenuItem_Click(object
sender, EventArgs e)
{
System.Diagnostics.Process.Start("C:\\Archivos de
programa\\Bandwidth Controller\\Bandwidth Controller.exe");
}
private void button2_Click_1(object sender, EventArgs e)
{
if (tChart1!=null && IIOPLine != null)
{
IIOPLine.Clear();
}
}
private void button1_Click_1(object sender, EventArgs e)
{
if (tChart1 != null && WSLine != null)
{
WSLine.Clear();
}
}
}
}
Clase MainForm.Designer.cs
namespace es.viguera.client.ihm
{
partial class MainForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should
be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
245
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources =
new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.configuraciónToolStripMenuItem1 = new
System.Windows.Forms.ToolStripMenuItem();
this.configuraciónDeParámetrosToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.cambiarServidorToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.herramientasToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.bandwidthDelimiterToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.ayudaToolStripMenuItem = new
System.Windows.Forms.ToolStripMenuItem();
this.sobreEntornoDePruebasDeRendimientoToolStripMenuItem =
new System.Windows.Forms.ToolStripMenuItem();
this.progressBarIIOP = new
System.Windows.Forms.ProgressBar();
this.buttonComenzarIIOP = new
System.Windows.Forms.Button();
this.tChart1 = new Steema.TeeChart.TChart();
this.IIOPLine = new Steema.TeeChart.Styles.Line();
this.WSLine = new Steema.TeeChart.Styles.Line();
this.logsTB = new System.Windows.Forms.TextBox();
this.groupBoxIIOP = new System.Windows.Forms.GroupBox();
this.radionButtonUploadDownloadIIOP = new
System.Windows.Forms.RadioButton();
this.radioButtonUploadIIOP = new
System.Windows.Forms.RadioButton();
this.segXpruebaLbIIOP = new System.Windows.Forms.Label();
this.radioButtonDownloadIIOP = new
System.Windows.Forms.RadioButton();
this.resultadoTbIIOP = new System.Windows.Forms.TextBox();
this.resultadoLbIIOP = new System.Windows.Forms.Label();
this.progresoLbIIOP = new System.Windows.Forms.Label();
this.numPruebasTbIIOP = new
System.Windows.Forms.TextBox();
this.numPruebasLbIIOP = new System.Windows.Forms.Label();
this.bytesLbIIOP = new System.Windows.Forms.Label();
this.tamDatoTbIIOP = new System.Windows.Forms.TextBox();
this.tamDatoLbIIOP = new System.Windows.Forms.Label();
this.trackBarIIOP = new System.Windows.Forms.TrackBar();
this.groupBoxWS = new System.Windows.Forms.GroupBox();
this.radioButton1 = new
System.Windows.Forms.RadioButton();
this.buttonComenzarWS = new System.Windows.Forms.Button();
this.radioButtonUploadWS = new
System.Windows.Forms.RadioButton();
246
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.radioButtonDownloadWS = new
System.Windows.Forms.RadioButton();
this.segXpruebaLbWS = new System.Windows.Forms.Label();
this.resultadoTbWS = new System.Windows.Forms.TextBox();
this.resultadoLbWS = new System.Windows.Forms.Label();
this.progresoLbWS = new System.Windows.Forms.Label();
this.numPruebasTbWS = new System.Windows.Forms.TextBox();
this.numPruebasLbWS = new System.Windows.Forms.Label();
this.progressBarWS = new
System.Windows.Forms.ProgressBar();
this.bytesLbWS = new System.Windows.Forms.Label();
this.tamDatoTbWS = new System.Windows.Forms.TextBox();
this.tamDatoLbWS = new System.Windows.Forms.Label();
this.trackBarWS = new System.Windows.Forms.TrackBar();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton2 = new
System.Windows.Forms.RadioButton();
this.radioButtonUploadBoth = new
System.Windows.Forms.RadioButton();
this.radioButtonDownloadBoth = new
System.Windows.Forms.RadioButton();
this.iiopCheckBox = new System.Windows.Forms.CheckBox();
this.trackBarTamMinBoth = new
System.Windows.Forms.TrackBar();
this.wsCheckBox = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.buttonComenzarBoth = new
System.Windows.Forms.Button();
this.tamMaxBothlb = new System.Windows.Forms.Label();
this.stepBoth = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.trackBarTamMaxBoth = new
System.Windows.Forms.TrackBar();
this.progressBarBoth = new
System.Windows.Forms.ProgressBar();
this.tamMaxBoth = new System.Windows.Forms.TextBox();
this.tamMinBothLb = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.stepBothLb = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.tamMinBoth = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
this.groupBoxIIOP.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarIIOP)).BeginI
nit();
this.groupBoxWS.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarWS)).BeginIni
t();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarTamMinBoth)).
BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBarTamMaxBoth)).
BeginInit();
this.SuspendLayout();
//
247
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
// menuStrip1
//
this.menuStrip1.Items.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.configuraciónToolStripMenuItem1,
this.herramientasToolStripMenuItem,
this.ayudaToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1100, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
// configuraciónToolStripMenuItem1
//
this.configuraciónToolStripMenuItem1.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.configuraciónDeParámetrosToolStripMenuItem,
this.cambiarServidorToolStripMenuItem});
this.configuraciónToolStripMenuItem1.Name =
"configuraciónToolStripMenuItem1";
this.configuraciónToolStripMenuItem1.Size = new
System.Drawing.Size(85, 20);
this.configuraciónToolStripMenuItem1.Text =
"&Configuración";
//
// configuraciónDeParámetrosToolStripMenuItem
//
this.configuraciónDeParámetrosToolStripMenuItem.Name =
"configuraciónDeParámetrosToolStripMenuItem";
this.configuraciónDeParámetrosToolStripMenuItem.Size = new
System.Drawing.Size(236, 22);
this.configuraciónDeParámetrosToolStripMenuItem.Text =
"Configuración de parámetros...";
this.configuraciónDeParámetrosToolStripMenuItem.Click +=
new System.EventHandler(this.configuraciónToolStripMenuItem_Click);
//
// cambiarServidorToolStripMenuItem
//
this.cambiarServidorToolStripMenuItem.Name =
"cambiarServidorToolStripMenuItem";
this.cambiarServidorToolStripMenuItem.Size = new
System.Drawing.Size(236, 22);
this.cambiarServidorToolStripMenuItem.Text = "Cambiar
servidor...";
this.cambiarServidorToolStripMenuItem.Click += new
System.EventHandler(this.cambiarServidorToolStripMenuItem_Click);
//
// herramientasToolStripMenuItem
//
this.herramientasToolStripMenuItem.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.bandwidthDelimiterToolStripMenuItem});
this.herramientasToolStripMenuItem.Name =
"herramientasToolStripMenuItem";
this.herramientasToolStripMenuItem.Size = new
System.Drawing.Size(83, 20);
this.herramientasToolStripMenuItem.Text = "&Herramientas";
//
248
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
// bandwidthDelimiterToolStripMenuItem
//
this.bandwidthDelimiterToolStripMenuItem.Name =
"bandwidthDelimiterToolStripMenuItem";
this.bandwidthDelimiterToolStripMenuItem.Size = new
System.Drawing.Size(223, 22);
this.bandwidthDelimiterToolStripMenuItem.Text = "Limitador
de ancho de banda";
this.bandwidthDelimiterToolStripMenuItem.Click += new
System.EventHandler(this.bandwidthDelimiterToolStripMenuItem_Click);
//
// ayudaToolStripMenuItem
//
this.ayudaToolStripMenuItem.DropDownItems.AddRange(new
System.Windows.Forms.ToolStripItem[] {
this.sobreEntornoDePruebasDeRendimientoToolStripMenuItem});
this.ayudaToolStripMenuItem.Name =
"ayudaToolStripMenuItem";
this.ayudaToolStripMenuItem.Size = new
System.Drawing.Size(50, 20);
this.ayudaToolStripMenuItem.Text = "Ay&uda";
//
// sobreEntornoDePruebasDeRendimientoToolStripMenuItem
//
this.sobreEntornoDePruebasDeRendimientoToolStripMenuItem.Name =
"sobreEntornoDePruebasDeRendimientoToolStripMenuItem";
this.sobreEntornoDePruebasDeRendimientoToolStripMenuItem.Size = new
System.Drawing.Size(320, 22);
this.sobreEntornoDePruebasDeRendimientoToolStripMenuItem.Text =
"Acerca de Entorno de Pruebas de Rendimiento...";
//
// progressBarIIOP
//
this.progressBarIIOP.Location = new
System.Drawing.Point(117, 147);
this.progressBarIIOP.Name = "progressBarIIOP";
this.progressBarIIOP.Size = new System.Drawing.Size(197,
17);
this.progressBarIIOP.Step = 1;
this.progressBarIIOP.TabIndex = 1;
//
// buttonComenzarIIOP
//
this.buttonComenzarIIOP.Location = new
System.Drawing.Point(138, 172);
this.buttonComenzarIIOP.Name = "buttonComenzarIIOP";
this.buttonComenzarIIOP.Size = new System.Drawing.Size(75,
23);
this.buttonComenzarIIOP.TabIndex = 3;
this.buttonComenzarIIOP.Text = "Comenzar";
this.buttonComenzarIIOP.UseVisualStyleBackColor = true;
this.buttonComenzarIIOP.Click += new
System.EventHandler(this.button1_Click);
//
// tChart1
//
249
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.tChart1.Anchor =
((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyl
es.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
//
//
//
this.tChart1.Aspect.ElevationFloat = 345;
this.tChart1.Aspect.RotationFloat = 345;
//
//
//
//
//
//
this.tChart1.Axes.Bottom.Automatic = true;
//
//
//
this.tChart1.Axes.Bottom.Grid.Style =
System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Bottom.Grid.ZPosition = 0;
//
//
//
//
//
//
//
//
//
this.tChart1.Axes.Bottom.Labels.Font.Shadow.Visible =
false;
this.tChart1.Axes.Bottom.Labels.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.Axes.Bottom.Labels.Shadow.Visible = false;
//
//
//
this.tChart1.Axes.Bottom.Title.Caption = "Tamaño del
dato";
//
//
//
//
//
//
this.tChart1.Axes.Bottom.Title.Font.Shadow.Visible =
false;
this.tChart1.Axes.Bottom.Title.Font.Unit =
System.Drawing.GraphicsUnit.World;
this.tChart1.Axes.Bottom.Title.Lines = new string[] {
"Tamaño del dato"};
//
//
//
this.tChart1.Axes.Bottom.Title.Shadow.Visible = false;
//
250
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
//
this.tChart1.Axes.Depth.Automatic = true;
//
//
//
this.tChart1.Axes.Depth.Grid.Style =
System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Depth.Grid.ZPosition = 0;
//
//
//
//
//
//
//
//
//
this.tChart1.Axes.Depth.Labels.Font.Shadow.Visible =
false;
this.tChart1.Axes.Depth.Labels.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.Axes.Depth.Labels.Shadow.Visible = false;
//
//
//
//
//
//
//
//
//
this.tChart1.Axes.Depth.Title.Font.Shadow.Visible = false;
this.tChart1.Axes.Depth.Title.Font.Unit =
System.Drawing.GraphicsUnit.World;
this.tChart1.Axes.Depth.Title.Lines = new string[] {
""};
//
//
//
this.tChart1.Axes.Depth.Title.Shadow.Visible = false;
//
//
//
this.tChart1.Axes.DepthTop.Automatic = true;
//
//
//
this.tChart1.Axes.DepthTop.Grid.Style =
System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.DepthTop.Grid.ZPosition = 0;
//
//
//
//
//
//
//
251
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
//
this.tChart1.Axes.DepthTop.Labels.Font.Shadow.Visible =
false;
this.tChart1.Axes.DepthTop.Labels.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.Axes.DepthTop.Labels.Shadow.Visible = false;
//
//
//
//
//
//
//
//
//
this.tChart1.Axes.DepthTop.Title.Font.Shadow.Visible =
false;
this.tChart1.Axes.DepthTop.Title.Font.Unit =
System.Drawing.GraphicsUnit.World;
this.tChart1.Axes.DepthTop.Title.Lines = new string[] {
""};
//
//
//
this.tChart1.Axes.DepthTop.Title.Shadow.Visible = false;
//
//
//
this.tChart1.Axes.Left.Automatic = true;
//
//
//
this.tChart1.Axes.Left.Grid.Style =
System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Left.Grid.ZPosition = 0;
//
//
//
//
//
//
//
//
//
this.tChart1.Axes.Left.Labels.Font.Shadow.Visible = false;
this.tChart1.Axes.Left.Labels.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.Axes.Left.Labels.Shadow.Visible = false;
//
//
//
this.tChart1.Axes.Left.Title.Caption = "Tiempo";
//
//
252
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
//
//
//
this.tChart1.Axes.Left.Title.Font.Shadow.Visible = false;
this.tChart1.Axes.Left.Title.Font.Unit =
System.Drawing.GraphicsUnit.World;
this.tChart1.Axes.Left.Title.Lines = new string[] {
"Tiempo"};
//
//
//
this.tChart1.Axes.Left.Title.Shadow.Visible = false;
//
//
//
this.tChart1.Axes.Right.Automatic = true;
//
//
//
this.tChart1.Axes.Right.Grid.Style =
System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Right.Grid.ZPosition = 0;
//
//
//
//
//
//
//
//
//
this.tChart1.Axes.Right.Labels.Font.Shadow.Visible =
false;
this.tChart1.Axes.Right.Labels.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.Axes.Right.Labels.Shadow.Visible = false;
//
//
//
//
//
//
//
//
//
this.tChart1.Axes.Right.Title.Font.Shadow.Visible = false;
this.tChart1.Axes.Right.Title.Font.Unit =
System.Drawing.GraphicsUnit.World;
this.tChart1.Axes.Right.Title.Lines = new string[] {
""};
//
//
//
this.tChart1.Axes.Right.Title.Shadow.Visible = false;
this.tChart1.Axes.Right.Visible = false;
//
//
253
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
this.tChart1.Axes.Top.Automatic = true;
//
//
//
this.tChart1.Axes.Top.Grid.Style =
System.Drawing.Drawing2D.DashStyle.Dash;
this.tChart1.Axes.Top.Grid.ZPosition = 0;
//
//
//
//
//
//
//
//
//
this.tChart1.Axes.Top.Labels.Font.Shadow.Visible = false;
this.tChart1.Axes.Top.Labels.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.Axes.Top.Labels.Shadow.Visible = false;
//
//
//
//
//
//
//
//
//
this.tChart1.Axes.Top.Title.Font.Shadow.Visible = false;
this.tChart1.Axes.Top.Title.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.Axes.Top.Title.Shadow.Visible = false;
this.tChart1.Axes.Top.Visible = false;
//
//
//
//
//
//
//
//
//
this.tChart1.Footer.Font.Shadow.Visible = false;
this.tChart1.Footer.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.Footer.Shadow.Visible = false;
//
//
//
//
254
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
//
//
//
//
this.tChart1.Header.Font.Shadow.Visible = false;
this.tChart1.Header.Font.Unit =
System.Drawing.GraphicsUnit.World;
this.tChart1.Header.Lines = new string[] {
"TeeChart"};
//
//
//
this.tChart1.Header.Shadow.Visible = false;
//
//
//
//
//
//
//
//
//
this.tChart1.Legend.Font.Shadow.Visible = false;
this.tChart1.Legend.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
//
//
//
this.tChart1.Legend.Title.Font.Bold = true;
//
//
//
this.tChart1.Legend.Title.Font.Shadow.Visible = false;
this.tChart1.Legend.Title.Font.Unit =
System.Drawing.GraphicsUnit.World;
this.tChart1.Legend.Title.Lines = new string[] {
""};
//
//
//
this.tChart1.Legend.Title.Pen.Visible = false;
//
//
//
this.tChart1.Legend.Title.Shadow.Visible = false;
this.tChart1.Location = new System.Drawing.Point(12, 240);
this.tChart1.Name = "tChart1";
//
//
//
//
//
//
this.tChart1.Panel.Shadow.Visible = false;
this.tChart1.Series.Add(this.IIOPLine);
this.tChart1.Series.Add(this.WSLine);
this.tChart1.Size = new System.Drawing.Size(532, 251);
255
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
//
//
//
//
//
//
//
//
this.tChart1.SubFooter.Font.Shadow.Visible = false;
this.tChart1.SubFooter.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.SubFooter.Shadow.Visible = false;
//
//
//
//
//
//
//
//
//
this.tChart1.SubHeader.Font.Shadow.Visible = false;
this.tChart1.SubHeader.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
this.tChart1.SubHeader.Shadow.Visible = false;
this.tChart1.TabIndex = 4;
//
//
//
//
//
//
this.tChart1.Walls.Back.AutoHide = false;
//
//
//
this.tChart1.Walls.Back.Shadow.Visible = false;
//
//
//
this.tChart1.Walls.Bottom.AutoHide = false;
//
//
//
this.tChart1.Walls.Bottom.Shadow.Visible = false;
//
//
//
this.tChart1.Walls.Left.AutoHide = false;
//
//
//
this.tChart1.Walls.Left.Shadow.Visible = false;
//
256
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
//
this.tChart1.Walls.Right.AutoHide = false;
//
//
//
this.tChart1.Walls.Right.Shadow.Visible = false;
//
// IIOPLine
//
//
//
//
this.IIOPLine.Brush.Color = System.Drawing.Color.Red;
//
//
//
this.IIOPLine.LinePen.Color =
System.Drawing.Color.FromArgb(((int)(((byte)(153)))),
((int)(((byte)(0)))), ((int)(((byte)(0)))));
//
//
//
//
//
//
this.IIOPLine.Marks.Callout.ArrowHead =
Steema.TeeChart.Styles.ArrowHeadStyles.None;
this.IIOPLine.Marks.Callout.ArrowHeadSize = 8;
//
//
//
this.IIOPLine.Marks.Callout.Brush.Color =
System.Drawing.Color.Black;
this.IIOPLine.Marks.Callout.Distance = 0;
this.IIOPLine.Marks.Callout.Draw3D = false;
this.IIOPLine.Marks.Callout.Length = 10;
this.IIOPLine.Marks.Callout.Style =
Steema.TeeChart.Styles.PointerStyles.Rectangle;
//
//
//
//
//
//
this.IIOPLine.Marks.Font.Shadow.Visible = false;
this.IIOPLine.Marks.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
//
//
//
this.IIOPLine.Pointer.Brush.Color =
System.Drawing.Color.Red;
this.IIOPLine.Pointer.Style =
Steema.TeeChart.Styles.PointerStyles.Rectangle;
this.IIOPLine.Title = "IIOP";
//
//
257
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
this.IIOPLine.XValues.DataMember = "X";
this.IIOPLine.XValues.Order =
Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
//
//
this.IIOPLine.YValues.DataMember = "Y";
//
// WSLine
//
//
//
//
this.WSLine.Brush.Color = System.Drawing.Color.Green;
//
//
//
this.WSLine.LinePen.Color =
System.Drawing.Color.FromArgb(((int)(((byte)(0)))),
((int)(((byte)(77)))), ((int)(((byte)(0)))));
//
//
//
//
//
//
this.WSLine.Marks.Callout.ArrowHead =
Steema.TeeChart.Styles.ArrowHeadStyles.None;
this.WSLine.Marks.Callout.ArrowHeadSize = 8;
//
//
//
this.WSLine.Marks.Callout.Brush.Color =
System.Drawing.Color.Black;
this.WSLine.Marks.Callout.Distance = 0;
this.WSLine.Marks.Callout.Draw3D = false;
this.WSLine.Marks.Callout.Length = 10;
this.WSLine.Marks.Callout.Style =
Steema.TeeChart.Styles.PointerStyles.Rectangle;
//
//
//
//
//
//
this.WSLine.Marks.Font.Shadow.Visible = false;
this.WSLine.Marks.Font.Unit =
System.Drawing.GraphicsUnit.World;
//
//
//
//
//
//
this.WSLine.Pointer.Brush.Color =
System.Drawing.Color.Green;
this.WSLine.Pointer.Style =
Steema.TeeChart.Styles.PointerStyles.Rectangle;
this.WSLine.Title = "WS";
//
258
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
//
this.WSLine.XValues.DataMember = "X";
this.WSLine.XValues.Order =
Steema.TeeChart.Styles.ValueListOrder.Ascending;
//
//
//
this.WSLine.YValues.DataMember = "Y";
//
// logsTB
//
this.logsTB.Anchor =
((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyl
es.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.logsTB.Location = new System.Drawing.Point(558, 240);
this.logsTB.Multiline = true;
this.logsTB.Name = "logsTB";
this.logsTB.ScrollBars =
System.Windows.Forms.ScrollBars.Both;
this.logsTB.Size = new System.Drawing.Size(532, 251);
this.logsTB.TabIndex = 5;
//
// groupBoxIIOP
//
this.groupBoxIIOP.Controls.Add(this.radionButtonUploadDownloadIIOP);
this.groupBoxIIOP.Controls.Add(this.radioButtonUploadIIOP);
this.groupBoxIIOP.Controls.Add(this.segXpruebaLbIIOP);
this.groupBoxIIOP.Controls.Add(this.radioButtonDownloadIIOP);
this.groupBoxIIOP.Controls.Add(this.buttonComenzarIIOP);
this.groupBoxIIOP.Controls.Add(this.resultadoTbIIOP);
this.groupBoxIIOP.Controls.Add(this.resultadoLbIIOP);
this.groupBoxIIOP.Controls.Add(this.progresoLbIIOP);
this.groupBoxIIOP.Controls.Add(this.numPruebasTbIIOP);
this.groupBoxIIOP.Controls.Add(this.numPruebasLbIIOP);
this.groupBoxIIOP.Controls.Add(this.progressBarIIOP);
this.groupBoxIIOP.Controls.Add(this.bytesLbIIOP);
this.groupBoxIIOP.Controls.Add(this.tamDatoTbIIOP);
this.groupBoxIIOP.Controls.Add(this.tamDatoLbIIOP);
this.groupBoxIIOP.Controls.Add(this.trackBarIIOP);
this.groupBoxIIOP.Location = new System.Drawing.Point(12,
33);
this.groupBoxIIOP.Name = "groupBoxIIOP";
this.groupBoxIIOP.Size = new System.Drawing.Size(350,
201);
this.groupBoxIIOP.TabIndex = 3;
this.groupBoxIIOP.TabStop = false;
this.groupBoxIIOP.Text = "IIOP";
//
// radionButtonUploadDownloadIIOP
//
this.radionButtonUploadDownloadIIOP.Location = new
System.Drawing.Point(247, 95);
this.radionButtonUploadDownloadIIOP.Name =
"radionButtonUploadDownloadIIOP";
this.radionButtonUploadDownloadIIOP.Size = new
System.Drawing.Size(100, 20);
259
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.radionButtonUploadDownloadIIOP.TabIndex = 29;
this.radionButtonUploadDownloadIIOP.Tag =
"UPLOAD_DOWNLOAD";
this.radionButtonUploadDownloadIIOP.Text =
"Bajada/Subida";
this.radionButtonUploadDownloadIIOP.UseVisualStyleBackColor = true;
this.radionButtonUploadDownloadIIOP.CheckedChanged += new
System.EventHandler(this.radionButtonUploadDownloadIIOP_CheckedChanged
);
//
// radioButtonUploadIIOP
//
this.radioButtonUploadIIOP.Location = new
System.Drawing.Point(135, 95);
this.radioButtonUploadIIOP.Name = "radioButtonUploadIIOP";
this.radioButtonUploadIIOP.Size = new
System.Drawing.Size(60, 20);
this.radioButtonUploadIIOP.TabIndex = 28;
this.radioButtonUploadIIOP.Tag = "UPLOAD";
this.radioButtonUploadIIOP.Text = "Subida";
this.radioButtonUploadIIOP.UseVisualStyleBackColor = true;
this.radioButtonUploadIIOP.CheckedChanged += new
System.EventHandler(this.radioButtonUploadIIOP_CheckedChanged);
//
// segXpruebaLbIIOP
//
this.segXpruebaLbIIOP.AutoSize = true;
this.segXpruebaLbIIOP.Location = new
System.Drawing.Point(189, 69);
this.segXpruebaLbIIOP.Name = "segXpruebaLbIIOP";
this.segXpruebaLbIIOP.Size = new System.Drawing.Size(70,
13);
this.segXpruebaLbIIOP.TabIndex = 19;
this.segXpruebaLbIIOP.Text = "mseg/prueba";
//
// radioButtonDownloadIIOP
//
this.radioButtonDownloadIIOP.Checked = true;
this.radioButtonDownloadIIOP.Location = new
System.Drawing.Point(9, 95);
this.radioButtonDownloadIIOP.Name =
"radioButtonDownloadIIOP";
this.radioButtonDownloadIIOP.Size = new
System.Drawing.Size(74, 20);
this.radioButtonDownloadIIOP.TabIndex = 27;
this.radioButtonDownloadIIOP.TabStop = true;
this.radioButtonDownloadIIOP.Tag = "DOWNLOAD";
this.radioButtonDownloadIIOP.Text = "Bajada";
this.radioButtonDownloadIIOP.UseVisualStyleBackColor =
true;
this.radioButtonDownloadIIOP.CheckedChanged += new
System.EventHandler(this.radioButtonDownloadIIOP_CheckedChanged);
//
// resultadoTbIIOP
//
this.resultadoTbIIOP.Location = new
System.Drawing.Point(117, 69);
this.resultadoTbIIOP.Name = "resultadoTbIIOP";
this.resultadoTbIIOP.ReadOnly = true;
260
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.resultadoTbIIOP.Size = new System.Drawing.Size(64,
20);
this.resultadoTbIIOP.TabIndex = 18;
//
// resultadoLbIIOP
//
this.resultadoLbIIOP.AutoSize = true;
this.resultadoLbIIOP.Location = new
System.Drawing.Point(6, 69);
this.resultadoLbIIOP.Name = "resultadoLbIIOP";
this.resultadoLbIIOP.Size = new System.Drawing.Size(58,
13);
this.resultadoLbIIOP.TabIndex = 17;
this.resultadoLbIIOP.Text = "Resultado:";
//
// progresoLbIIOP
//
this.progresoLbIIOP.AutoSize = true;
this.progresoLbIIOP.Location = new System.Drawing.Point(6,
147);
this.progresoLbIIOP.Name = "progresoLbIIOP";
this.progresoLbIIOP.Size = new System.Drawing.Size(52,
13);
this.progresoLbIIOP.TabIndex = 16;
this.progresoLbIIOP.Text = "Progreso:";
//
// numPruebasTbIIOP
//
this.numPruebasTbIIOP.Location = new
System.Drawing.Point(117, 43);
this.numPruebasTbIIOP.Name = "numPruebasTbIIOP";
this.numPruebasTbIIOP.Size = new System.Drawing.Size(64,
20);
this.numPruebasTbIIOP.TabIndex = 2;
this.numPruebasTbIIOP.Text = "1";
this.numPruebasTbIIOP.Enter += new
System.EventHandler(this.numPruebasTbIIOP_Enter);
this.numPruebasTbIIOP.Leave += new
System.EventHandler(this.numPruebasTbIIOP_Leave);
//
// numPruebasLbIIOP
//
this.numPruebasLbIIOP.AutoSize = true;
this.numPruebasLbIIOP.Location = new
System.Drawing.Point(6, 43);
this.numPruebasLbIIOP.Name = "numPruebasLbIIOP";
this.numPruebasLbIIOP.Size = new System.Drawing.Size(103,
13);
this.numPruebasLbIIOP.TabIndex = 14;
this.numPruebasLbIIOP.Text = "Número de pruebas:";
//
// bytesLbIIOP
//
this.bytesLbIIOP.AutoSize = true;
this.bytesLbIIOP.Location = new System.Drawing.Point(189,
17);
this.bytesLbIIOP.Name = "bytesLbIIOP";
this.bytesLbIIOP.Size = new System.Drawing.Size(33, 13);
this.bytesLbIIOP.TabIndex = 13;
this.bytesLbIIOP.Text = "Bytes";
//
261
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
// tamDatoTbIIOP
//
this.tamDatoTbIIOP.Location = new
System.Drawing.Point(116, 17);
this.tamDatoTbIIOP.Name = "tamDatoTbIIOP";
this.tamDatoTbIIOP.Size = new System.Drawing.Size(64, 20);
this.tamDatoTbIIOP.TabIndex = 0;
this.tamDatoTbIIOP.Text = "1";
this.tamDatoTbIIOP.Enter += new
System.EventHandler(this.tamDatoTbIIOP_Enter);
this.tamDatoTbIIOP.Leave += new
System.EventHandler(this.tamDatoTbIIOP_Leave);
//
// tamDatoLbIIOP
//
this.tamDatoLbIIOP.AutoSize = true;
this.tamDatoLbIIOP.Location = new System.Drawing.Point(6,
17);
this.tamDatoLbIIOP.Name = "tamDatoLbIIOP";
this.tamDatoLbIIOP.Size = new System.Drawing.Size(90, 13);
this.tamDatoLbIIOP.TabIndex = 9;
this.tamDatoLbIIOP.Text = "Tamaño del dato:";
//
// trackBarIIOP
//
this.trackBarIIOP.AutoSize = false;
this.trackBarIIOP.Location = new System.Drawing.Point(231,
17);
this.trackBarIIOP.Maximum = 2048;
this.trackBarIIOP.Minimum = 1;
this.trackBarIIOP.Name = "trackBarIIOP";
this.trackBarIIOP.Size = new System.Drawing.Size(104, 20);
this.trackBarIIOP.SmallChange = 8;
this.trackBarIIOP.TabIndex = 1;
this.trackBarIIOP.TickFrequency = 8;
this.trackBarIIOP.Value = 1;
this.trackBarIIOP.Scroll += new
System.EventHandler(this.trackBar1_Scroll);
//
// groupBoxWS
//
this.groupBoxWS.Anchor =
System.Windows.Forms.AnchorStyles.Top;
this.groupBoxWS.Controls.Add(this.radioButton1);
this.groupBoxWS.Controls.Add(this.buttonComenzarWS);
this.groupBoxWS.Controls.Add(this.radioButtonUploadWS);
this.groupBoxWS.Controls.Add(this.radioButtonDownloadWS);
this.groupBoxWS.Controls.Add(this.segXpruebaLbWS);
this.groupBoxWS.Controls.Add(this.resultadoTbWS);
this.groupBoxWS.Controls.Add(this.resultadoLbWS);
this.groupBoxWS.Controls.Add(this.progresoLbWS);
this.groupBoxWS.Controls.Add(this.numPruebasTbWS);
this.groupBoxWS.Controls.Add(this.numPruebasLbWS);
this.groupBoxWS.Controls.Add(this.progressBarWS);
this.groupBoxWS.Controls.Add(this.bytesLbWS);
this.groupBoxWS.Controls.Add(this.tamDatoTbWS);
this.groupBoxWS.Controls.Add(this.tamDatoLbWS);
this.groupBoxWS.Controls.Add(this.trackBarWS);
this.groupBoxWS.Location = new System.Drawing.Point(376,
33);
this.groupBoxWS.Name = "groupBoxWS";
262
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.groupBoxWS.Size = new System.Drawing.Size(350, 201);
this.groupBoxWS.TabIndex = 20;
this.groupBoxWS.TabStop = false;
this.groupBoxWS.Text = "Web Services";
//
// radioButton1
//
this.radioButton1.Location = new System.Drawing.Point(247,
95);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(100, 20);
this.radioButton1.TabIndex = 32;
this.radioButton1.Tag = "UPLOAD_DOWNLOAD";
this.radioButton1.Text = "Bajada/Subida";
this.radioButton1.UseVisualStyleBackColor = true;
this.radioButton1.CheckedChanged += new
System.EventHandler(this.radioButton1_CheckedChanged);
//
// buttonComenzarWS
//
this.buttonComenzarWS.Location = new
System.Drawing.Point(138, 172);
this.buttonComenzarWS.Name = "buttonComenzarWS";
this.buttonComenzarWS.Size = new System.Drawing.Size(75,
23);
this.buttonComenzarWS.TabIndex = 20;
this.buttonComenzarWS.Text = "Comenzar";
this.buttonComenzarWS.UseVisualStyleBackColor = true;
this.buttonComenzarWS.Click += new
System.EventHandler(this.button2_Click);
//
// radioButtonUploadWS
//
this.radioButtonUploadWS.Location = new
System.Drawing.Point(135, 95);
this.radioButtonUploadWS.Name = "radioButtonUploadWS";
this.radioButtonUploadWS.Size = new
System.Drawing.Size(60, 20);
this.radioButtonUploadWS.TabIndex = 31;
this.radioButtonUploadWS.Tag = "UPLOAD";
this.radioButtonUploadWS.Text = "Subida";
this.radioButtonUploadWS.UseVisualStyleBackColor = true;
this.radioButtonUploadWS.CheckedChanged += new
System.EventHandler(this.radioButtonUploadWS_CheckedChanged);
//
// radioButtonDownloadWS
//
this.radioButtonDownloadWS.Checked = true;
this.radioButtonDownloadWS.Location = new
System.Drawing.Point(9, 95);
this.radioButtonDownloadWS.Name = "radioButtonDownloadWS";
this.radioButtonDownloadWS.Size = new
System.Drawing.Size(74, 20);
this.radioButtonDownloadWS.TabIndex = 30;
this.radioButtonDownloadWS.TabStop = true;
this.radioButtonDownloadWS.Tag = "DOWNLOAD";
this.radioButtonDownloadWS.Text = "Bajada";
this.radioButtonDownloadWS.UseVisualStyleBackColor = true;
this.radioButtonDownloadWS.CheckedChanged += new
System.EventHandler(this.radioButtonDownloadWS_CheckedChanged);
//
263
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
// segXpruebaLbWS
//
this.segXpruebaLbWS.AutoSize = true;
this.segXpruebaLbWS.Location = new
System.Drawing.Point(189, 69);
this.segXpruebaLbWS.Name = "segXpruebaLbWS";
this.segXpruebaLbWS.Size = new System.Drawing.Size(70,
13);
this.segXpruebaLbWS.TabIndex = 19;
this.segXpruebaLbWS.Text = "mseg/prueba";
//
// resultadoTbWS
//
this.resultadoTbWS.Location = new
System.Drawing.Point(117, 69);
this.resultadoTbWS.Name = "resultadoTbWS";
this.resultadoTbWS.ReadOnly = true;
this.resultadoTbWS.Size = new System.Drawing.Size(64, 20);
this.resultadoTbWS.TabIndex = 18;
//
// resultadoLbWS
//
this.resultadoLbWS.AutoSize = true;
this.resultadoLbWS.Location = new System.Drawing.Point(6,
69);
this.resultadoLbWS.Name = "resultadoLbWS";
this.resultadoLbWS.Size = new System.Drawing.Size(58, 13);
this.resultadoLbWS.TabIndex = 17;
this.resultadoLbWS.Text = "Resultado:";
//
// progresoLbWS
//
this.progresoLbWS.AutoSize = true;
this.progresoLbWS.Location = new System.Drawing.Point(6,
147);
this.progresoLbWS.Name = "progresoLbWS";
this.progresoLbWS.Size = new System.Drawing.Size(52, 13);
this.progresoLbWS.TabIndex = 16;
this.progresoLbWS.Text = "Progreso:";
//
// numPruebasTbWS
//
this.numPruebasTbWS.Location = new
System.Drawing.Point(117, 43);
this.numPruebasTbWS.Name = "numPruebasTbWS";
this.numPruebasTbWS.Size = new System.Drawing.Size(64,
20);
this.numPruebasTbWS.TabIndex = 15;
this.numPruebasTbWS.Text = "1";
this.numPruebasTbWS.Enter += new
System.EventHandler(this.numPruebasTbWS_Enter);
this.numPruebasTbWS.Leave += new
System.EventHandler(this.numPruebasTbWS_Leave);
//
// numPruebasLbWS
//
this.numPruebasLbWS.AutoSize = true;
this.numPruebasLbWS.Location = new System.Drawing.Point(6,
43);
this.numPruebasLbWS.Name = "numPruebasLbWS";
264
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.numPruebasLbWS.Size = new System.Drawing.Size(103,
13);
this.numPruebasLbWS.TabIndex = 14;
this.numPruebasLbWS.Text = "Número de pruebas:";
//
// progressBarWS
//
this.progressBarWS.Location = new
System.Drawing.Point(117, 147);
this.progressBarWS.Name = "progressBarWS";
this.progressBarWS.Size = new System.Drawing.Size(197,
17);
this.progressBarWS.TabIndex = 1;
//
// bytesLbWS
//
this.bytesLbWS.AutoSize = true;
this.bytesLbWS.Location = new System.Drawing.Point(189,
17);
this.bytesLbWS.Name = "bytesLbWS";
this.bytesLbWS.Size = new System.Drawing.Size(33, 13);
this.bytesLbWS.TabIndex = 13;
this.bytesLbWS.Text = "Bytes";
//
// tamDatoTbWS
//
this.tamDatoTbWS.Location = new System.Drawing.Point(116,
17);
this.tamDatoTbWS.Name = "tamDatoTbWS";
this.tamDatoTbWS.Size = new System.Drawing.Size(64, 20);
this.tamDatoTbWS.TabIndex = 10;
this.tamDatoTbWS.Text = "1";
this.tamDatoTbWS.Enter += new
System.EventHandler(this.tamDatoTbWS_Enter);
this.tamDatoTbWS.Leave += new
System.EventHandler(this.tamDatoTbWS_Leave);
//
// tamDatoLbWS
//
this.tamDatoLbWS.AutoSize = true;
this.tamDatoLbWS.Location = new System.Drawing.Point(6,
17);
this.tamDatoLbWS.Name = "tamDatoLbWS";
this.tamDatoLbWS.Size = new System.Drawing.Size(90, 13);
this.tamDatoLbWS.TabIndex = 9;
this.tamDatoLbWS.Text = "Tamaño del dato:";
//
// trackBarWS
//
this.trackBarWS.AutoSize = false;
this.trackBarWS.Location = new System.Drawing.Point(231,
17);
this.trackBarWS.Maximum = 2048;
this.trackBarWS.Minimum = 1;
this.trackBarWS.Name = "trackBarWS";
this.trackBarWS.Size = new System.Drawing.Size(104, 20);
this.trackBarWS.SmallChange = 8;
this.trackBarWS.TabIndex = 8;
this.trackBarWS.TickFrequency = 8;
this.trackBarWS.Value = 1;
265
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.trackBarWS.Scroll += new
System.EventHandler(this.trackBarWS_Scroll);
//
// groupBox1
//
this.groupBox1.Anchor =
((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyle
s.Top | System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.radioButton2);
this.groupBox1.Controls.Add(this.radioButtonUploadBoth);
this.groupBox1.Controls.Add(this.radioButtonDownloadBoth);
this.groupBox1.Controls.Add(this.iiopCheckBox);
this.groupBox1.Controls.Add(this.trackBarTamMinBoth);
this.groupBox1.Controls.Add(this.wsCheckBox);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.buttonComenzarBoth);
this.groupBox1.Controls.Add(this.tamMaxBothlb);
this.groupBox1.Controls.Add(this.stepBoth);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.trackBarTamMaxBoth);
this.groupBox1.Controls.Add(this.progressBarBoth);
this.groupBox1.Controls.Add(this.tamMaxBoth);
this.groupBox1.Controls.Add(this.tamMinBothLb);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.stepBothLb);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.tamMinBoth);
this.groupBox1.Location = new System.Drawing.Point(740,
33);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(350, 201);
this.groupBox1.TabIndex = 21;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Pruebas comparativas";
//
// radioButton2
//
this.radioButton2.Location = new System.Drawing.Point(247,
95);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(100, 20);
this.radioButton2.TabIndex = 32;
this.radioButton2.Tag = "UPLOAD_DOWNLOAD";
this.radioButton2.Text = "Bajada/Subida";
this.radioButton2.UseVisualStyleBackColor = true;
this.radioButton2.CheckedChanged += new
System.EventHandler(this.radioButton2_CheckedChanged);
//
// radioButtonUploadBoth
//
this.radioButtonUploadBoth.Location = new
System.Drawing.Point(135, 95);
this.radioButtonUploadBoth.Name = "radioButtonUploadBoth";
this.radioButtonUploadBoth.Size = new
System.Drawing.Size(60, 20);
this.radioButtonUploadBoth.TabIndex = 31;
this.radioButtonUploadBoth.Tag = "UPLOAD";
this.radioButtonUploadBoth.Text = "Subida";
this.radioButtonUploadBoth.UseVisualStyleBackColor = true;
this.radioButtonUploadBoth.CheckedChanged += new
System.EventHandler(this.radioButtonUploadBoth_CheckedChanged);
266
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
// radioButtonDownloadBoth
//
this.radioButtonDownloadBoth.Checked = true;
this.radioButtonDownloadBoth.Location = new
System.Drawing.Point(9, 95);
this.radioButtonDownloadBoth.Name =
"radioButtonDownloadBoth";
this.radioButtonDownloadBoth.Size = new
System.Drawing.Size(74, 20);
this.radioButtonDownloadBoth.TabIndex = 30;
this.radioButtonDownloadBoth.TabStop = true;
this.radioButtonDownloadBoth.Tag = "DOWNLOAD";
this.radioButtonDownloadBoth.Text = "Bajada";
this.radioButtonDownloadBoth.UseVisualStyleBackColor =
true;
this.radioButtonDownloadBoth.CheckedChanged += new
System.EventHandler(this.radioButtonDownloadBoth_CheckedChanged);
//
// iiopCheckBox
//
this.iiopCheckBox.Checked = true;
this.iiopCheckBox.CheckState =
System.Windows.Forms.CheckState.Checked;
this.iiopCheckBox.Location = new System.Drawing.Point(160,
121);
this.iiopCheckBox.Name = "iiopCheckBox";
this.iiopCheckBox.Size = new System.Drawing.Size(47, 20);
this.iiopCheckBox.TabIndex = 1;
this.iiopCheckBox.Text = "IIOP";
this.iiopCheckBox.UseVisualStyleBackColor = true;
//
// trackBarTamMinBoth
//
this.trackBarTamMinBoth.AutoSize = false;
this.trackBarTamMinBoth.Location = new
System.Drawing.Point(245, 43);
this.trackBarTamMinBoth.Maximum = 2048;
this.trackBarTamMinBoth.Minimum = 1;
this.trackBarTamMinBoth.Name = "trackBarTamMinBoth";
this.trackBarTamMinBoth.Size = new
System.Drawing.Size(104, 20);
this.trackBarTamMinBoth.SmallChange = 8;
this.trackBarTamMinBoth.TabIndex = 21;
this.trackBarTamMinBoth.TickFrequency = 8;
this.trackBarTamMinBoth.Value = 1;
this.trackBarTamMinBoth.Scroll += new
System.EventHandler(this.trackBarTamMinBoth_Scroll);
//
// wsCheckBox
//
this.wsCheckBox.Checked = true;
this.wsCheckBox.CheckState =
System.Windows.Forms.CheckState.Checked;
this.wsCheckBox.Location = new System.Drawing.Point(9,
121);
this.wsCheckBox.Name = "wsCheckBox";
this.wsCheckBox.Size = new System.Drawing.Size(93, 20);
this.wsCheckBox.TabIndex = 0;
this.wsCheckBox.Text = "Web Services";
this.wsCheckBox.UseVisualStyleBackColor = true;
267
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(210, 69);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(33, 13);
this.label1.TabIndex = 26;
this.label1.Text = "Bytes";
//
// buttonComenzarBoth
//
this.buttonComenzarBoth.Location = new
System.Drawing.Point(138, 172);
this.buttonComenzarBoth.Name = "buttonComenzarBoth";
this.buttonComenzarBoth.Size = new System.Drawing.Size(75,
23);
this.buttonComenzarBoth.TabIndex = 20;
this.buttonComenzarBoth.Text = "Comenzar";
this.buttonComenzarBoth.UseVisualStyleBackColor = true;
this.buttonComenzarBoth.Click += new
System.EventHandler(this.button3_Click);
//
// tamMaxBothlb
//
this.tamMaxBothlb.AutoSize = true;
this.tamMaxBothlb.Location = new System.Drawing.Point(6,
17);
this.tamMaxBothlb.Name = "tamMaxBothlb";
this.tamMaxBothlb.Size = new System.Drawing.Size(128, 13);
this.tamMaxBothlb.TabIndex = 9;
this.tamMaxBothlb.Text = "Tamaño máximo del dato:";
//
// stepBoth
//
this.stepBoth.Location = new System.Drawing.Point(144,
69);
this.stepBoth.Name = "stepBoth";
this.stepBoth.Size = new System.Drawing.Size(64, 20);
this.stepBoth.TabIndex = 25;
this.stepBoth.Text = "1";
this.stepBoth.Enter += new
System.EventHandler(this.stepBoth_Enter);
this.stepBoth.Leave += new
System.EventHandler(this.stepBoth_Leave);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 147);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(52, 13);
this.label3.TabIndex = 16;
this.label3.Text = "Progreso:";
//
// trackBarTamMaxBoth
//
this.trackBarTamMaxBoth.AutoSize = false;
this.trackBarTamMaxBoth.Location = new
System.Drawing.Point(244, 17);
this.trackBarTamMaxBoth.Maximum = 2048;
268
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.trackBarTamMaxBoth.Minimum = 1;
this.trackBarTamMaxBoth.Name = "trackBarTamMaxBoth";
this.trackBarTamMaxBoth.Size = new
System.Drawing.Size(104, 20);
this.trackBarTamMaxBoth.SmallChange = 8;
this.trackBarTamMaxBoth.TabIndex = 8;
this.trackBarTamMaxBoth.TickFrequency = 8;
this.trackBarTamMaxBoth.Value = 1;
this.trackBarTamMaxBoth.Scroll += new
System.EventHandler(this.trackBarTamMaxBoth_Scroll);
//
// progressBarBoth
//
this.progressBarBoth.Location = new
System.Drawing.Point(121, 147);
this.progressBarBoth.Name = "progressBarBoth";
this.progressBarBoth.Size = new System.Drawing.Size(197,
17);
this.progressBarBoth.TabIndex = 1;
//
// tamMaxBoth
//
this.tamMaxBoth.Location = new System.Drawing.Point(144,
17);
this.tamMaxBoth.Name = "tamMaxBoth";
this.tamMaxBoth.Size = new System.Drawing.Size(64, 20);
this.tamMaxBoth.TabIndex = 10;
this.tamMaxBoth.Text = "1";
this.tamMaxBoth.Enter += new
System.EventHandler(this.tamMaxBoth_Enter);
this.tamMaxBoth.Leave += new
System.EventHandler(this.tamMaxBoth_Leave);
//
// tamMinBothLb
//
this.tamMinBothLb.AutoSize = true;
this.tamMinBothLb.Location = new System.Drawing.Point(6,
43);
this.tamMinBothLb.Name = "tamMinBothLb";
this.tamMinBothLb.Size = new System.Drawing.Size(127, 13);
this.tamMinBothLb.TabIndex = 22;
this.tamMinBothLb.Text = "Tamaño mínimo del dato:";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(210, 43);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(33, 13);
this.label7.TabIndex = 24;
this.label7.Text = "Bytes";
//
// stepBothLb
//
this.stepBothLb.AutoSize = true;
this.stepBothLb.Location = new System.Drawing.Point(6,
69);
this.stepBothLb.Name = "stepBothLb";
this.stepBothLb.Size = new System.Drawing.Size(118, 13);
this.stepBothLb.TabIndex = 17;
this.stepBothLb.Text = "Incremento del tamaño:";
269
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(210, 17);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(33, 13);
this.label5.TabIndex = 13;
this.label5.Text = "Bytes";
//
// tamMinBoth
//
this.tamMinBoth.Location = new System.Drawing.Point(144,
43);
this.tamMinBoth.Name = "tamMinBoth";
this.tamMinBoth.Size = new System.Drawing.Size(64, 20);
this.tamMinBoth.TabIndex = 23;
this.tamMinBoth.Text = "1";
this.tamMinBoth.Enter += new
System.EventHandler(this.tamMinBoth_Enter);
this.tamMinBoth.Leave += new
System.EventHandler(this.tamMinBoth_Leave);
//
// button1
//
this.button1.Anchor =
((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyle
s.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button1.Font = new System.Drawing.Font("Microsoft
Sans Serif", 6.25F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button1.Location = new System.Drawing.Point(479,
457);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(55, 23);
this.button1.TabIndex = 22;
this.button1.Text = "Clear WS";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new
System.EventHandler(this.button1_Click_1);
//
// button2
//
this.button2.Anchor =
((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyle
s.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.button2.Font = new System.Drawing.Font("Microsoft
Sans Serif", 6.25F, System.Drawing.FontStyle.Regular,
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button2.Location = new System.Drawing.Point(479,
428);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(55, 23);
this.button2.TabIndex = 23;
this.button2.Text = "Clear Iiop";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new
System.EventHandler(this.button2_Click_1);
//
// MainForm
//
270
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
this.AutoScaleDimensions = new System.Drawing.SizeF(6F,
13F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Font;
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(1100, 546);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.groupBoxWS);
this.Controls.Add(this.groupBoxIIOP);
this.Controls.Add(this.logsTB);
this.Controls.Add(this.tChart1);
this.Controls.Add(this.menuStrip1);
this.Icon =
((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.menuStrip1;
this.Name = "MainForm";
this.Text = "Entorno de Pruebas de Rendimiento";
this.WindowState =
System.Windows.Forms.FormWindowState.Maximized;
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.groupBoxIIOP.ResumeLayout(false);
this.groupBoxIIOP.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarIIOP)).EndIni
t();
this.groupBoxWS.ResumeLayout(false);
this.groupBoxWS.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarWS)).EndInit(
);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBarTamMinBoth)).
EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBarTamMaxBoth)).
EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem
herramientasToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
ayudaToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
sobreEntornoDePruebasDeRendimientoToolStripMenuItem;
private System.Windows.Forms.ProgressBar progressBarIIOP;
private System.Windows.Forms.Button buttonComenzarIIOP;
private Steema.TeeChart.TChart tChart1;
private Steema.TeeChart.Styles.Line IIOPLine;
private Steema.TeeChart.Styles.Line WSLine;
private System.Windows.Forms.TextBox logsTB;
271
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
private System.Windows.Forms.GroupBox groupBoxIIOP;
private System.Windows.Forms.Label progresoLbIIOP;
private System.Windows.Forms.TextBox numPruebasTbIIOP;
private System.Windows.Forms.Label numPruebasLbIIOP;
private System.Windows.Forms.TextBox resultadoTbIIOP;
private System.Windows.Forms.Label resultadoLbIIOP;
private System.Windows.Forms.Label segXpruebaLbIIOP;
private System.Windows.Forms.GroupBox groupBoxWS;
private System.Windows.Forms.Label segXpruebaLbWS;
private System.Windows.Forms.TextBox resultadoTbWS;
private System.Windows.Forms.Label resultadoLbWS;
private System.Windows.Forms.Label progresoLbWS;
private System.Windows.Forms.TextBox numPruebasTbWS;
private System.Windows.Forms.Label numPruebasLbWS;
private System.Windows.Forms.ProgressBar progressBarWS;
private System.Windows.Forms.Label bytesLbWS;
private System.Windows.Forms.TextBox tamDatoTbWS;
private System.Windows.Forms.Label tamDatoLbWS;
private System.Windows.Forms.TrackBar trackBarWS;
private System.Windows.Forms.Button buttonComenzarWS;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button buttonComenzarBoth;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ProgressBar progressBarBoth;
private System.Windows.Forms.CheckBox wsCheckBox;
private System.Windows.Forms.CheckBox iiopCheckBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label tamMaxBothlb;
private System.Windows.Forms.TextBox stepBoth;
private System.Windows.Forms.TextBox tamMaxBoth;
private System.Windows.Forms.Label tamMinBothLb;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label stepBothLb;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox tamMinBoth;
private System.Windows.Forms.RadioButton
radioButtonUploadIIOP;
private System.Windows.Forms.RadioButton
radioButtonDownloadIIOP;
private System.Windows.Forms.Label bytesLbIIOP;
private System.Windows.Forms.TextBox tamDatoTbIIOP;
private System.Windows.Forms.Label tamDatoLbIIOP;
private System.Windows.Forms.TrackBar trackBarIIOP;
private System.Windows.Forms.RadioButton
radioButtonUploadBoth;
private System.Windows.Forms.RadioButton
radioButtonDownloadBoth;
private System.Windows.Forms.TrackBar trackBarTamMinBoth;
private System.Windows.Forms.TrackBar trackBarTamMaxBoth;
private System.Windows.Forms.RadioButton radioButtonUploadWS;
private System.Windows.Forms.RadioButton
radioButtonDownloadWS;
private System.Windows.Forms.ToolStripMenuItem
bandwidthDelimiterToolStripMenuItem;
private System.Windows.Forms.RadioButton
radionButtonUploadDownloadIIOP;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.ToolStripMenuItem
configuraciónToolStripMenuItem1;
272
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
private System.Windows.Forms.ToolStripMenuItem
configuraciónDeParámetrosToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem
cambiarServidorToolStripMenuItem;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
}
}
Clase CExceptionHandler.cs
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.Text;
System.Windows.Forms;
System.Reflection;
log4net;
log4net.Config;
es.viguera.client.ihm;
namespace es.viguera.client
{
public class CExceptionHandler
{
public const int OTHER = 0;
public const int OBJECT_NOT_EXIST = 1;
public const int COMM_FAILURE = 2;
public const int NAMING_CONTEXT_PACKAGE_NOT_FOUND = 3;
public const int NULL_REFERENCE_EXCEPTION = 4;
public const int WEB_EXCEPTION = 5;
//LOG4NET Crea la variable log pawra esta clase
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().D
eclaringType);
private static CExceptionHandler instance = new
CExceptionHandler();
private const string getInstanceName = "getInstance";
private const string resetName = "reset";
private CExceptionHandler()
{
}
public static CExceptionHandler getInstance()
{
if (instance == null)
{
instance = new CExceptionHandler();
}
return instance;
}
public int handException(Exception ex,IProxy prot,string
message)
{
try
{
switch (ex.GetType().FullName)
273
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
{
case "omg.org.CORBA.OBJECT_NOT_EXIST":
//log.Error("La referencia del servicio no
está actualizada. Se procederá a su actualización. Error en el
método:" + message);
prot.reset();
return OBJECT_NOT_EXIST;
break;
case
"omg.org.CosNaming.NamingContext_package.NotFound":
//log.Error("No se ha podido encontrar el
servicio. " + message);
MessageBox.Show("Error de
comunicación","Error");
return NAMING_CONTEXT_PACKAGE_NOT_FOUND;
break;
case "System.NullReferenceException":
log.Error("La referencia del servicio es null.
Se procederá a su actualización. Error en el método:" + message);
prot.reset();
//getInstance.Invoke(null, null);
return NULL_REFERENCE_EXCEPTION;
break;
case "omg.org.CORBA.COMM_FAILURE":
log.Error("Se ha producido un error en la
comunicación. " + message);
MessageBox.Show("Error de
comunicación","Error");
return COMM_FAILURE;
break;
case "System.Net.WebException":
log.Error("Se ha producido un error en la
comunicación. " + message);
MessageBox.Show("Error de
comunicación","Error");
return COMM_FAILURE;
break;
default:
log.Error("Se ha producido un error en la
llamada al servicio. " + message);
MessageBox.Show("Error de
comunicación","Error");
return OTHER;
break;
}
}
catch (Exception e)
{
log.Error("No ha ido bien la gestión de las
excepciones");
return -1;
}
}
public int handException(Exception ex, string message)
{
try
{
switch (ex.GetType().FullName)
{
274
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
case "omg.org.CORBA.OBJECT_NOT_EXIST":
log.Error("La referencia del servicio no está
actualizada. Se procederá a su actualización. "+message);
return OBJECT_NOT_EXIST;
break;
case "omg.org.CORBA.COMM_FAILURE":
log.Error("Se ha producido un error en la
comunicación. " + message);
MessageBox.Show("Error de
comunicación","Error");
return COMM_FAILURE;
break;
case
"omg.org.CosNaming.NamingContext_package.NotFound":
log.Error("No se ha podido encontrar el
servicio. " + message);
MessageBox.Show("Error de
comunicación","Error");
return NAMING_CONTEXT_PACKAGE_NOT_FOUND;
break;
case "System.NullReferenceException":
log.Error("La referencia del servicio es null.
Se procederá a su actualización. Error en el método:" + message);
MessageBox.Show("Error de
comunicación","Error");
return NULL_REFERENCE_EXCEPTION;
break;
default:
log.Error("Se ha producido un error en la
llamada al servicio. " + message);
MessageBox.Show("Error de
comunicación","Error");
return OTHER;
break;
}
}
catch (Exception e)
{
log.Error("No ha ido bien la gestión de las
excepciones");
return -1;
}
}
public int handException(Exception ex)
{
return handException(ex,"");
}
}
}
Clase CFwComm.cs
using
using
using
using
using
System;
System.Runtime.Remoting;
System.Runtime.Remoting.Channels;
System.Windows.Forms;
System.IO;
275
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
using
using
using
using
using
using
using
using
using
Javier Viguera Muñoz
System.Collections;
Ch.Elca.Iiop;
Ch.Elca.Iiop.Services;
Ch.Elca.Iiop.Security.Ssl;
omg.org.CORBA;
omg.org.CosNaming;
Ch.Elca.Iiop.Idl;
IIOPLibrary;
System.Reflection;
using log4net;
namespace es.viguera.client
{
public class CFwComm
{
#region Properties
//LOG4NET Crea la variable log para esta clase
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().D
eclaringType);
private static CFwComm fwComm = null;
private NamingContext namingContext = null;
#endregion
#region Constructor and Methods
private CFwComm()
{ }
public static CFwComm getInstance()
{
if (fwComm == null)
{
fwComm = new CFwComm();
}
return fwComm;
}
public NamingContext NamingContext
{
get { return namingContext; }
set { namingContext = value; }
}
#endregion
#region Implements IFWCOMM
public void initComm()
{
log.Info("Inicio de initComm");
string serverName = "192.168.1.2";
log.Info("SERVER_NAME = " + serverName);
if (namingContext == null)
{
276
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
namingContext =
IIOPManagement.configuraIIOP(serverName);
try
{
CustomMapperRegistry reg =
CustomMapperRegistry.GetSingleton();
reg.AddMappingsFromFile(new
FileInfo("customMappingJavaToCls.xml"));
}
catch (Exception e)
{
log.Fatal("custom mapper not loadable: " +
e.Message);
throw e;
}
}
}
public void endComm()
{
//Poner los interfaces de los servicios a null
namingContext = null;
//Desregistrar el canal
IIOPManagement.unRegisterChannel();
}
public object lookupService(string serviceName, string
assemblyName)
{
NameComponent[] name = null;
try
{
// load the assemly
Assembly assembly =
Assembly.LoadFrom(Application.StartupPath + "\\" + assemblyName);
String[] names = serviceName.Split(new char[] { '.'
});
name = new NameComponent[names.Length];
for (int i = 0; i < names.Length; i++)
{
name[i] = new NameComponent(names[i], "");
}
String iName = names[names.Length - 1];
foreach (Type type in assembly.GetTypes())
{
if (type.IsInterface == true)
{
if (type.FullName.EndsWith("." + iName +
"Home"))
{
MarshalByRefObject ob =
namingContext.resolve(name);
Object o = type.InvokeMember("create",
BindingFlags.Default | BindingFlags.InvokeMethod,
null, ob,
null);
return o;
}
}
}
return null;
277
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
catch (Exception e)
{
CExceptionHandler.getInstance().handException(e,
"lookupService");
endComm();
initComm();
throw e;
}
return null;
}
#endregion
}
}
Clase IIOP.cs
using
using
using
using
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.Text;
IIOPLibrary;
Ch.Elca.Iiop;
Ch.Elca.Iiop.Services;
omg.org.CosNaming;
es.viguera.ejb.interfaces;
es.indra.myc.smcoa.FWCOMM;
log4net;
System.Diagnostics;
System.Threading;
namespace es.viguera.client
{
class IIOP:IProxy
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().D
eclaringType);
private static IIOP instance = null;
public override event TestExecutedEventHandler TestExecuted;
private static string server = null;
public string Server
{
get { return server; }
set { server = value; }
}
private static string port = "3528";
public string Port
{
get { return port; }
set { port = value; }
}
private BytesArray iiopService = null;
private IIOP(string _server)
{
server = _server;
initializeCommunication(server);
278
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
public static IIOP getInstance()
{
if (instance == null)
{
instance = new IIOP(server);
}
return instance;
}
public static IIOP getInstance(string _server)
{
server = _server;
return getInstance();
}
public override string execute(int mode)
{
double totalTime=0;
Start = DateTime.Now;
try
{
if (iiopService != null)
{
for (int i = 0; i < NumPruebas; i++)
{
//DateTime init = null;
TimeSpan span;
Stopwatch stopwatch;
switch (mode)
{
case DOWNLOAD:
//init = DateTime.Now;
stopwatch = Stopwatch.StartNew();
iiopService.getBytesArray(TamDato);
//span = DateTime.Now - init;
span = stopwatch.Elapsed;
break;
case UPLOAD:
//init = DateTime.Now;
stopwatch = Stopwatch.StartNew();
iiopService.setBytesArray(new
byte[TamDato]);
//span = DateTime.Now - init;
span = stopwatch.Elapsed;
break;
case UPLOAD_DOWNLOAD:
//init = DateTime.Now;
stopwatch = Stopwatch.StartNew();
iiopService.getAndSetBytesArray(new
byte[TamDato]);
//span = DateTime.Now - init;
span = stopwatch.Elapsed;
break;
default:
span = new TimeSpan();
break;
}
double time = span.TotalMilliseconds;
totalTime += time;
log.Error("Prueba"+i+":"+time);
279
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
if (TestExecuted != null)
{
TestExecuted(i, TamDato, time);
}
Thread.Sleep(300);
}
}
else
{
throw new Exception();
}
}
catch (Exception e)
{
CExceptionHandler.getInstance().handException(e);
reset();
log.Error("Error en la llamada al servicio IIOP:" +
e.Message);
throw new Exception("Error de comunicación IIOP con el
servidor");
}
End = DateTime.Now;
Average = End - Start;
//double av = (Average.TotalMilliseconds / NumPruebas);
double av = (totalTime / NumPruebas);
log.Error("Promedio:"+av);
return av.ToString();
}
protected override bool initializeCommunication(string host)
{
NamingContext namingContext =
IIOPManagement.configuraIIOP(host,port);
lookupIIOPService(namingContext);
return true;
}
private void lookupIIOPService(NamingContext namingContext)
{
try
{
NameComponent[] name = new NameComponent[] { new
NameComponent("ejb", ""),
new
NameComponent("BytesArray", "") };
BytesArrayHome ejemplo2 =
(BytesArrayHome)namingContext.resolve(name);
iiopService = ejemplo2.create();
}
catch (Exception e)
{
log.Error("Errores de comunicación:" + e.Message);
}
}
public override void reset()
{
instance = null;
IIOPManagement.unRegisterChannel();
280
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
}
}
Clase IProxy.cs
using System;
using System.Collections.Generic;
using System.Text;
namespace es.viguera.client
{
public abstract class IProxy
{
public const int DOWNLOAD = 0;
public const int UPLOAD = 1;
public const int UPLOAD_DOWNLOAD = 2;
private int numPruebas;
private int tamDato;
private DateTime start;
private DateTime end;
private TimeSpan average;
public delegate void TestExecutedEventHandler(int i,int
tamDato, double time);
public abstract event TestExecutedEventHandler TestExecuted;
#region
public int NumPruebas
{
get { return numPruebas; }
set { numPruebas = value; }
}
public int TamDato
{
get { return tamDato; }
set { tamDato = value; }
}
public DateTime Start
{
get { return start;}
set { start = value; }
}
public DateTime End
{
get { return end; }
set { end = value; }
}
public TimeSpan Average
{
get { return average; }
set { average = value; }
}
#endregion
protected IProxy()
{
}
281
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
public abstract string execute(int mode);
protected abstract bool initializeCommunication(string host);
public abstract void reset();
}
}
Clase LogWriter.cs
using
using
using
using
System;
System.Collections.Generic;
System.Text;
log4net;
namespace es.viguera.client
{
class LogWriter
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().D
eclaringType);
public static LogWriter instance = new LogWriter();
public LogWriter()
{
}
public static LogWriter getInstance()
{
if (instance == null)
{
instance = new LogWriter();
}
return instance;
}
public void writeLog(string log)
{
}
}
}
Clase WebServices.cs
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.Text;
es.indra.myc.smcoa.FWCOMM;
log4net;
System.Diagnostics;
System.Threading;
namespace es.viguera.client
{
class WebServices:IProxy
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().D
eclaringType);
282
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
private const string prefix = "http://";
private const string sufix = "/EJBBytesArray/BytesArray";
//private const string port = "8080";
private static WebServices instance = null;
//public delegate void TestExecutedEventHandler(int i,int
tamDato, double time);
public override event TestExecutedEventHandler TestExecuted;
//private ClienteEJBEjemplo.localhostBytesArrayWS.BytesArrayWS
ejemploWS = null;
private BytesArrayWS webService = null;
private static string server = "localhost";
public string Server
{
get { return server; }
set { server = value; }
}
private static string port = "8080";
public string Port
{
get { return port; }
set { port = value; }
}
private WebServices(string _server)
{
server = _server;
initializeCommunication(server);
}
public static WebServices getInstance(string _server)
{
server = _server;
return getInstance();
}
public static WebServices getInstance()
{
if (instance == null)
{
instance = new WebServices(server);
}
return instance;
}
public override string execute(int mode)
{
double totalTime = 0;
Start = DateTime.Now;
try
{
if (webService != null)
{
for (int i = 0; i < NumPruebas; i++)
{
//DateTime init = null;
TimeSpan span;
Stopwatch stopwatch;
switch (mode)
{
case DOWNLOAD:
//init = DateTime.Now;
stopwatch = Stopwatch.StartNew();
webService.getBytesArray(TamDato);
283
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
//span = DateTime.Now - init;
span = stopwatch.Elapsed;
break;
case UPLOAD:
stopwatch = Stopwatch.StartNew();
//init = DateTime.Now;
webService.setBytesArray(new
byte[TamDato]);
//span = DateTime.Now - init;
span = stopwatch.Elapsed;
break;
case UPLOAD_DOWNLOAD:
//init = DateTime.Now;
stopwatch = Stopwatch.StartNew();
webService.getAndSetBytesArray(new
byte[TamDato]);
//span = DateTime.Now - init;
span = stopwatch.Elapsed;
break;
default:
span = new TimeSpan();
break;
}
double time = span.TotalMilliseconds;
totalTime += time;
log.Error("Prueba" + i + ":" + time);
if (TestExecuted != null)
{
TestExecuted(i, TamDato, time);
}
Thread.Sleep(300);
}
}
else
{
throw new Exception();
}
}
catch (Exception e)
{
CExceptionHandler.getInstance().handException(e);
reset();
log.Error("Error en la llamada al servicio WS:" +
e.Message);
throw new Exception("Error de comunicación WS con el
servidor");
}
End = DateTime.Now;
Average = End - Start;
double av = (totalTime / NumPruebas);
log.Error("Promedio:"+av);
return av.ToString();
}
protected override bool initializeCommunication(string host)
{
webService = new BytesArrayWS();
webService.Url = prefix + server + ":" + port + sufix;
return true;
284
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
}
public override void reset()
{
instance = null;
}
}
}
Clase XMLParser.cs
using
using
using
using
using
using
using
using
System;
System.Collections.Generic;
System.Text;
System.Collections;
System.Xml;
System.IO;
System.Windows.Forms;
log4net;
namespace es.viguera.client
{
class XMLParser
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().D
eclaringType);
public delegate void OnConfigurationChangedEvent();
public event OnConfigurationChangedEvent
OnConfigurationChanged = null;
private const string initConfigFile =
".\\config\\InitConf.xml";
//Máximo número de pruebas
private int max_num_pruebas;
//Mínimo número de pruebas
private int min_num_pruebas;
//Tamaño máximo del dato
private int max_tam_dato;
//Tamaño mínimo del dato
private int min_tam_dato;
//Paso de la barra de tamaño
private int trackbar_step;
//Puerto usado en IIOP
private int iiop_port;
//Puerto usado en WS
private int ws_port;
public int Max_num_pruebas
{
get { return max_num_pruebas; }
set { max_num_pruebas = value; }
}
public int Min_num_pruebas
{
get { return min_num_pruebas; }
set { min_num_pruebas = value; }
}
public int Max_tam_dato
{
285
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
get { return max_tam_dato; }
set { max_tam_dato = value; }
}
public int Min_tam_dato
{
get { return min_tam_dato; }
set { min_tam_dato = value; }
}
public int Trackbar_step
{
get { return trackbar_step; }
set { trackbar_step = value; }
}
public int Iiop_port
{
get { return iiop_port; }
set { iiop_port = value; }
}
public int Ws_port
{
get { return ws_port; }
set { ws_port = value; }
}
private static XMLParser instance = new XMLParser();
private XMLParser()
{
parseInitConf();
}
public static XMLParser getInstance()
{
if (instance == null)
{
instance = new XMLParser();
}
return instance;
}
public void parseInitConf()
{
const string INIT_CONF = "init_conf";
const string MAX_TAM_DATO = "max_tam_dato";
const string MIN_TAM_DATO = "min_tam_dato";
const string MAX_NUM_PRUEBAS = "max_num_pruebas";
const string MIN_NUM_PRUEBAS = "min_num_pruebas";
const string TRACKBAR_STEP = "trackbar_step";
const string IIOP_PORT = "iiop_port";
const string WS_PORT = "ws_port";
try
{
XmlTextReader reader = new
XmlTextReader(initConfigFile);
if (reader != null)
{
string aux;
while (reader.Read())
{
switch (reader.Name)
{
case MAX_TAM_DATO:
286
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
aux = reader.ReadString();
max_tam_dato = int.Parse(aux);
break;
case MIN_TAM_DATO:
aux = reader.ReadString();
min_tam_dato = int.Parse(aux);
break;
case MAX_NUM_PRUEBAS:
aux = reader.ReadString();
max_num_pruebas = int.Parse(aux);
break;
case MIN_NUM_PRUEBAS:
aux = reader.ReadString();
min_num_pruebas = int.Parse(aux);
break;
case TRACKBAR_STEP:
aux = reader.ReadString();
trackbar_step = int.Parse(aux);
break;
case IIOP_PORT:
aux = reader.ReadString();
iiop_port = int.Parse(aux);
break;
case WS_PORT:
aux = reader.ReadString();
ws_port = int.Parse(aux);
break;
case INIT_CONF:
/*if (reader.NodeType ==
XmlNodeType.EndElement)
{
table.Add(SERVER, server);
table.Add(MAX_TAM_DATO,
max_tam_dato);
table.Add(MIN_TAM_DATO,
min_tam_dato);
table.Add(MAX_NUM_PRUEBAS,
max_num_pruebas);
table.Add(MIN_NUM_PRUEBAS,
min_num_pruebas);
table.Add(TRACKBAR_STEP,
trackbar_step);
}*/
break;
}
}
}
}
catch (Exception e)
{
log.Error(e.Message);
MessageBox.Show("Error al leer la configuración
inicial");
}
}
public List<string> loadServers()
{
const string serversFile = ".\\config\\servers.xml";
const string SERVERS = "servers";
const string SERVER = "server";
287
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
Javier Viguera Muñoz
List<string> list = new List<string>();
try
{
XmlTextReader reader = new XmlTextReader(serversFile);
if (reader != null)
{
string aux;
while (reader.Read())
{
switch (reader.Name)
{
case SERVER:
list.Add(reader.ReadString());
break;
}
}
}
}
catch (Exception e)
{
log.Error(e.Message);
MessageBox.Show("Error al leer la lista de
servidores");
}
return list;
}
internal void writeInXMLFile()
{
if (OnConfigurationChanged != null)
{
OnConfigurationChanged();
}
}
}
}
9.1.2.2.2. Ficheros de configuración
InitConf.xml
<init_conf>
<!-- Tamano maximo del dato que se envia o se recibe -->
<max_tam_dato>100000</max_tam_dato>
<!-- Tamano minimo del dato que se envia o se recibe -->
<min_tam_dato>0</min_tam_dato>
<!-- Maximo numero de pruebas que se podran establecer -->
<max_num_pruebas>150</max_num_pruebas>
<!-- Minimo numero de pruebas que se podran establecer -->
<min_num_pruebas>1</min_num_pruebas>
<!-- Incremento de las trackbar cuando se pulsa con los cursores-->
<trackbar_step>10</trackbar_step>
<!-- Puerto por el que van los EJBs 3528-->
<iiop_port>3528</iiop_port>
<!-- Puerto por el que van los WS 8080-->
<ws_port>8080</ws_port>
288
Interoperatividad .Net-J2EE mediante WS e IIOP.
Entorno de pruebas de rendimiento
</init_conf>
servers.xml
<servers>
<server>localhost</server>
<server>jviguera</server>
</servers>
289
Javier Viguera Muñoz
Descargar