Mintea de metal

Tags

,

Mintea de metal

Această minte de metal,
dezvoltată de lumea actuală,
este noua deghizare morală,
a demonicului mental.

Este ceva cu care noi, creştinii,
ne-am mai confruntat până acum,
şi fiecare generaţie oricum,
sa confruntat la vremea ei cu opinii.

Dar am aflat modele potrivite,
de contracarare a acţiunii demonice,
care se impune cu forţe diabolice,
asupra minţii omeneşti ademenite.

versificarea Dan Bârsan

Inspirat după articolul lui Paul Cocei: http://www.crestinortodox.ro/editoriale/mintea-metal-142213.html

Advertisement

Running SoapUI Standard version with DataSource and DataLoop groovy

Tags

, ,

soapUI_groovy
Running SoapUI Standard version with DataSource and DataLoop groovy

This is what goes into the DataSource groovy file.


/*
@Author : Dan Birsan
@Description : Data Source to read .csv file and pass the value to corresponding property.
@GroovyTestStepName : "DataSource"
*/

import com.eviware.soapui.support.XmlHolder
def myTestCase = context.testCase
def counter,next,previous,size
File tickerEnumFile = new File("T:\\Dan\\FTC HL7 - UC8 Test Data 2014-05-21 Random_2.csv")
//make sure input.txt file already exists and contains different set of values sepearted by new line (CR).
List lines = tickerEnumFile.readLines()
size = lines.size.toInteger()
propTestStep = myTestCase.getTestStepByName("Properties") // get the Property TestStep
propTestStep.setPropertyValue("Total", size.toString())
counter = propTestStep.getPropertyValue("Count").toString()
counter= counter.toInteger()
next = (counter > size-2? 0: counter+1)
tempValue = lines[counter]

//Split the first line into a string array and assign the array elements to various test case properties
String[] propData = tempValue.split(",")

propTestStep.setPropertyValue("HL7EventType", propData[0])
propTestStep.setPropertyValue("SendingFacility", propData[2])
propTestStep.setPropertyValue("memIDNum", propData[4])
propTestStep.setPropertyValue("PatientIDAssigningAuthority1", propData[5])
propTestStep.setPropertyValue("PatientIDAssigningAuthority2", propData[8])
propTestStep.setPropertyValue("PatientIDAssigningAuthority3", propData[12])
propTestStep.setPropertyValue("PID", propData[7])
propTestStep.setPropertyValue("PIDType", propData[11])
propTestStep.setPropertyValue("Surname", propData[13])
propTestStep.setPropertyValue("Givename", propData[14])
propTestStep.setPropertyValue("DOB", propData[15])
propTestStep.setPropertyValue("Gender", propData[16])
propTestStep.setPropertyValue("StreetAddress", propData[17])
propTestStep.setPropertyValue("City", propData[18])
propTestStep.setPropertyValue("State", propData[19])
propTestStep.setPropertyValue("PostalCode", propData[20])
propTestStep.setPropertyValue("Telephone", propData[21])
propTestStep.setPropertyValue("AreaCode", propData[22])
propTestStep.setPropertyValue("PID_OID", propData[23])

propTestStep.setPropertyValue("Count", next.toString())
next++
// log.info "Reading line : ${(counter+1)} / $lines.size"
propTestStep.setPropertyValue("Next", next.toString())
// log.info "Value '$tempValue' -- updated in $propTestStep.name"
if (counter == size-1)
{
propTestStep.setPropertyValue("StopLoop", "T")
// log.info "Setting the stoploop property now..."
}
else if (counter==0)
{
def runner = new com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner(testRunner.testCase, null)
propTestStep.setPropertyValue("StopLoop", "F")
}
else
{
propTestStep.setPropertyValue("StopLoop", "F")
}

And this is what goes into the DataLoop groovy file.


/*
@Author : Dan Birsan
@Description : Data Source Looper responsible for looping a specific teststep.
@GroovyTestStepName : "DataLoop"
*/

def myTestCase = context.testCase
def runner
propTestStep = myTestCase.getTestStepByName("Properties") // get the Property TestStep
endLoop = propTestStep.getPropertyValue("StopLoop").toString()

if (endLoop.toString() == "T" || endLoop.toString()=="True" || endLoop.toString()=="true")
{
 log.info ("Exit Groovy Data Source Looper")
 assert true
}
else
{
 testRunner.gotoStepByName("DataSource") //setStartStep
}

Sample Jmeter – HAPI integration

Tags

,

hapi Jemeter

hapi Jemeter


package org.apache.jmeter.protocol.java.test;

import java.io.IOException;
import java.io.Serializable;
import java.io.StringReader;
import java.util.Iterator;

import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

import ca.uhn.hl7v2.DefaultHapiContext;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.HapiContext;
import ca.uhn.hl7v2.app.Connection;
import ca.uhn.hl7v2.hoh.sockets.CustomCertificateTlsSocketFactory;
import ca.uhn.hl7v2.hoh.util.HapiSocketTlsFactoryWrapper;
import ca.uhn.hl7v2.llp.LLPException;
import ca.uhn.hl7v2.llp.MinLowerLayerProtocol;
import ca.uhn.hl7v2.model.Message;
import ca.uhn.hl7v2.util.Hl7InputStreamMessageIterator;

public class SendMLLPTest extends AbstractJavaSamplerClient implements Serializable {

	private static final Logger LOG = LoggingManager.getLoggerForClass();

	private static final long serialVersionUID = 1L;

    /** The label to store in the sample result. */
    private String label;

    /** The default value of the Label parameter. */
    private static final String LABEL_DEFAULT = "SendMLLPTest";

    /** The name used to store the Label parameter. */
    private static final String LABEL_NAME = "Label";

    /** The response message to store in the sample result. */
    private String responseMessage;
    /**
     * The default value of the ip parameter.
     */
    public static final String DEFAULT_MLLP_IP_ADDRESS = "10.69.5.164";

    /**
     * The default value of the port parameter.
     */
    public static final long DEFAULT_MLLP_PORT_NUMBER = 7878;

    /**
     * The default value of the timeout parameter in milliseconds.
     */
    public static final int DEFAULT_TIMEOUT = 10000;

    /**
     * The default value of the certificate parameter.
     */
    public static final String DEFAULT_CERTIFICATE = "C:\\keystores\\client_DIT.jks";

    /**
     * The default value of the certificate password parameter.
     */
    public static final String DEFAULT_PASSWORD = "Keys04QA";

    private static String eol = System.getProperty("line.separator");

    /**
     * The default value of the request parameter that is parameterized for using with JMeter.
     */
    public static final String DEFAULT_REQUEST = "MSH|^~\\&|SendingApplication|SendingFacility|ReceivingApplication|RceivingFacility|20101004143744||QBP^Q22^QBP_Q21|NIST-101004143744188|T|2.5" + eol +
"QPD|IHE PDQ Query|${tcn}_${tcName}|@PID.3.1^${Extension}~@PID.3.4.2^${OID}~@PID.3.4.3^ISO~@PID.5.1^${lName}~@PID.5.2^${fName}~@PID.5.3^${mName}~@PID.5.4^${Sufname}~@PID.5.5^${Prefname}~@PID.5.6^${Degree}~@PID.5.7^${NameType}~@PID.7.1^${BirthTime}~@PID.8.1^${Sex}~@PID.11.1^${StrLAddr}~@PID.11.2^${StrLine2}~@PID.11.3^${City}~@PID.11.4^${Province}~@PID.11.5^${Zip}~@PID.11.6^${Country}~@PID.11.7^${AddrType}~@PID.13.2^${TelUseCode}~@PID.13.4^${Email}~@PID.13.5^${CntrCode}~@PID.13.6^${Area}~@PID.13.7^${LocalNum}~@PID.13.8^${Extens}|" + eol +
"RCP|I";

    private int timeout;
    private String ip;
    private long port;
    private String certificate;
    private String password;
    private String request;

    // The name of the sampler
    private String name;

    /** The response message to store in the sample result. */
    private String response;

    /** The default value of the ResponseMessage parameter. */
    private static final String DEFAULT_RESPONSE_MESSAGE = "";

    /** The default value of the ResponseMessage parameter. */
    private static final String RESPONSE_MESSAGE_DEFAULT = "";

    /** The name used to store the ResponseMessage parameter. */
    private static final String RESPONSE_MESSAGE_NAME = "ResponseMessage";

    /** The response code to be stored in the sample result. */
    private String responseCode;

    /** The default value of the ResponseCode parameter. */
    private static final String RESPONSE_CODE_DEFAULT = "AA";

    /** The name used to store the ResponseCode parameter. */
    private static final String RESPONSE_CODE_NAME = "ResponseCode";

    /** The sampler data (shown as Request Data in the Tree display). */
    private String samplerData;

    /** The default value of the SamplerData parameter. */
    private static final String SAMPLER_DATA_DEFAULT = "";

    /** The name used to store the SamplerData parameter. */
    private static final String SAMPLER_DATA_NAME = "SamplerData";

    /** Holds the result data (shown as Response Data in the Tree display). */
    private String resultData;

    /** The default value of the ResultData parameter. */
    private static final String RESULT_DATA_DEFAULT = "";

    /** The name used to store the ResultData parameter. */
    private static final String RESULT_DATA_NAME = "ResultData";

    /** The success status to be stored in the sample result. */
    private boolean success;

    /** The default value of the Success Status parameter. */
    private static final String SUCCESS_DEFAULT = "OK";

    /** The name used to store the Success Status parameter. */
    private static final String SUCCESS_NAME = "Status";

    /**
     * Default constructor for <code>SleepTest</code>.
     *
     * The Java Sampler uses the default constructor to instantiate an instance
     * of the client class.
     */
    public SendMLLPTest() {
        LOG.debug(whoAmI() + "\tConstruct");
    }

    /**
     * Do any initialization required by this client. In this case,
     * initialization consists of getting the values of the IP and
     * Port parameters plus other. It is generally recommended to do any
     * initialization such as getting parameter values in the setupTest method
     * rather than the runTest method in order to add as little overhead as
     * possible to the test.
     *
     * @param context
     *            the context to run with. This provides access to
     *            initialization parameters.
     */
    @Override
    public void setupTest(JavaSamplerContext context) {
        if (LOG.isDebugEnabled()) {
            LOG.debug(whoAmI() + "\tsetupTest()");
            listParameters(context);
        }
        timeout = context.getIntParameter("TIMEOUT", DEFAULT_TIMEOUT);
        ip = context.getParameter("IP", DEFAULT_MLLP_IP_ADDRESS);
        port = context.getLongParameter("PORT", DEFAULT_MLLP_PORT_NUMBER);
        certificate = context.getParameter("CERTIFICATE", DEFAULT_CERTIFICATE);
        password = context.getParameter("PASSWORD", DEFAULT_PASSWORD);
        request = context.getParameter("REQUEST", DEFAULT_REQUEST);
        response = context.getParameter("RESPONSE", DEFAULT_RESPONSE_MESSAGE);

        name = context.getParameter(TestElement.NAME);
    }

	public static String sendMLLPTest(int timeoutArg, String ipArg, long portNoArg, String certArg, String pwdArg, String reqArg) throws HL7Exception, LLPException, InterruptedException, IOException {

		int timeout = timeoutArg;
		String ip = ipArg;
		long portNo = portNoArg;
		String certif = certArg;
		String parola = pwdArg;
		String request = reqArg;
		String resp = null;

		System.setProperty("ca.uhn.hl7v2.app.initiator.timeout", Integer.toString(timeout));

		StringReader reader = new StringReader(request);
		// Create an iterator to iterate over all the messages
		Hl7InputStreamMessageIterator iter = new Hl7InputStreamMessageIterator(
				reader);

		// Create a HapiContext
		HapiContext context = new DefaultHapiContext();
		MinLowerLayerProtocol mllp = new MinLowerLayerProtocol();
		mllp.setCharset("UTF-8");
		context.setLowerLayerProtocol(mllp);

		Connection conn = null;
		 while (iter.hasNext()) {

			if (conn == null) {
				boolean useTls = true;
				long port = portNo;

				CustomCertificateTlsSocketFactory sfac = new CustomCertificateTlsSocketFactory();
				// using jks certificates
				sfac.setKeystoreFilename(certif);
				// default pwd is "Keys04QA"
				sfac.setKeystorePassphrase(parola);
				// Use the following adapter to pass the socket factory to the context
				context.setSocketFactory(new HapiSocketTlsFactoryWrapper(sfac));
				conn = context.newClient(ip, (int) port, useTls);
			}

			try {

				//see if timeout has been set
				String time_out = System.getProperty("ca.uhn.hl7v2.app.initiator.timeout");
				if (time_out != null) {
				    try {
				        Integer timeoutMillis = Integer.parseInt(time_out);
				        System.out.println("Setting Initiator timeout to " + timeoutMillis + " ms");
				    }
				    catch (NumberFormatException e) {
				    	System.out.println(time_out + " is not a valid integer - Initiator is using default timeout");
				    }
				}

				Message next = iter.next();
		        System.out.println("Request:" + eol + next.toString());
				Message response = conn.getInitiator().sendAndReceive(next);
				System.out.println("Response encoded message is:" + eol + response.toString());

		        conn.close();
		        conn = null;

		        context.close();
				resp = response.toString();

			} catch (HL7Exception e) {
				System.out.println("Didn't send out this message or didn't properly handled the HL7 message!");
				e.printStackTrace();

				// Since we failed, close the connection
				conn.close();
				conn = null;
			}
		}
			return resp;
	}

    /*
     * Utility method to set up all the values
     */
    private void setupValues(JavaSamplerContext context) {

        response = context.getParameter(RESPONSE_MESSAGE_NAME, DEFAULT_RESPONSE_MESSAGE);
        responseCode = context.getParameter(RESPONSE_CODE_NAME, RESPONSE_CODE_DEFAULT);
        responseMessage = context.getParameter(RESPONSE_MESSAGE_NAME, RESPONSE_MESSAGE_DEFAULT);

        success = context.getParameter(SUCCESS_NAME, SUCCESS_DEFAULT).equalsIgnoreCase("OK");

        label = context.getParameter(LABEL_NAME, LABEL_DEFAULT);
        if (label.length() == 0) {
            label = context.getParameter(TestElement.NAME); // default to name of element
        }

        samplerData = context.getParameter(SAMPLER_DATA_NAME, SAMPLER_DATA_DEFAULT);
        resultData = context.getParameter(RESULT_DATA_NAME, RESULT_DATA_DEFAULT);
    }

	@Override
	public SampleResult runTest(JavaSamplerContext context) {
		setupValues(context);

		request = context.getParameter("REQUEST", DEFAULT_REQUEST);

		SampleResult results = new SampleResult();

		results.setSampleLabel(name);
		results.setSuccessful(success);
        results.setResponseMessage(responseMessage);
        results.setSampleLabel(label);

        samplerData = request;

        if (samplerData != null &amp;&amp; samplerData.length() &gt; 0) {
            results.setSamplerData(samplerData);
        }

        // Record sample start time.
        results.sampleStart();

		try {
			response = sendMLLPTest(timeout,ip,port,certificate,password,request);
			resultData = response;
	        if (resultData != null &amp;&amp; resultData.length() &gt; 0) {
	            results.setResponseData(resultData, null);
	            results.setDataType(SampleResult.TEXT);
	        }
			results.setSuccessful(success);

		} catch (HL7Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (LLPException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (InterruptedException e) {
            LOG.warn("JavaTest: interrupted.");
            results.setSuccessful(true);
			e.printStackTrace();
		} catch (IOException e) {
            LOG.error("JavaTest: error during sample", e);
            results.setSuccessful(false);
			e.printStackTrace();
        } finally {
            // Record end time and populate the results.
            results.sampleEnd();
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug(whoAmI() + "\trunTest()" + "\tTime:\t" + results.getTime());
            listParameters(context);
        }

		return results;
	}

    /**
     * Provide a list of parameters which this test supports. Any parameter
     * names and associated values returned by this method will appear in the
     * GUI by default so the user doesn't have to remember the exact names. The
     * user can add other parameters which are not listed here. If this method
     * returns null then no parameters will be listed. If the value for some
     * parameter is null then that parameter will be listed in the GUI with an
     * empty value.
     *
     * @return a specification of the parameters used by this test which should
     *         be listed in the GUI, or null if no parameters should be listed.
     */
    @Override
    public Arguments getDefaultParameters() {
        Arguments params = new Arguments();
        params.addArgument(LABEL_NAME, LABEL_DEFAULT);
        params.addArgument("IP", String.valueOf(DEFAULT_MLLP_IP_ADDRESS));
        params.addArgument("PORT", String.valueOf(DEFAULT_MLLP_PORT_NUMBER));
        params.addArgument("TIMEOUT", String.valueOf(DEFAULT_TIMEOUT));
        params.addArgument("CERTIFICATE", String.valueOf(DEFAULT_CERTIFICATE));
        params.addArgument("PASSWORD", String.valueOf(DEFAULT_PASSWORD));
        params.addArgument("REQUEST", String.valueOf(DEFAULT_REQUEST));
        params.addArgument(SUCCESS_NAME, SUCCESS_DEFAULT);
        params.addArgument(RESPONSE_CODE_NAME, RESPONSE_CODE_DEFAULT);

        return params;
    }

    /**
     * Dump a list of the parameters in this context to the debug log.
     * Should only be called if debug is enabled.
     *
     * @param context
     *            the context which contains the initialization parameters.
     */
    private void listParameters(JavaSamplerContext context) {
        Iterator argsIt = context.getParameterNamesIterator();
        while (argsIt.hasNext()) {
            String name = argsIt.next();
            LOG.debug(name + "=" + context.getParameter(name));
        }
    }

    /**
     * Generate a String identifier of this test for debugging purposes.
     * @return a String identifier for this test instance
     */
    private String whoAmI() {
        StringBuilder sb = new StringBuilder();
        sb.append(Thread.currentThread().toString());
        sb.append("@");
        sb.append(Integer.toHexString(hashCode()));
        return sb.toString();
    }
}

Mandatory Elements Required to Create a TCO Assessment

Tags

,

Total Cost of Ownership

Total Cost of Ownership

Regardless of the objective of the analysis, several mandatory elements must be included for the analysis to qualify as a Gartner TCO:
• Identify the domain or activity for which an annual TCO is required (for example, distributed computing, telecommunications or data center), or to make a specific decision, such as, “Will server consolidation really save us money?”
• Develop a chart of accounts, which is a list of cost elements that refers to TCO as
defined above. For IT costs, this must include or evaluate the following:
• Direct cost elements relating to assets or activities that are relevant to the analysis;
for example:
• Client, server, storage and all peripheral hardware costs
• Software and related support costs
• Maintenance and development costs
• Networking and communications costs
• IT operations and support costs
• Associated indirect cost elements — for example, labor costs associated with the end user’s use of an asset or activity, and any subsequent downtime involved.
• Ensure that the chart of accounts contains cost elements that satisfy the TCO definition’s criteria for “holistic view” and “enterprise boundaries” — that is, taking a wider view of costs than normally occurs. Rather than simply being concerned about identifying and listing the costs within a specific function or department, the chart of accounts must also contain cost elements or cost categories that could be affected by activities or changes in the domain. For example, the chart of accounts for a help desk TCO may include cost elements outside of IT operations or IT support. Limiting the chart of accounts to cost elements only contained within IT operations is misleading, because help desk users incur a cost in the form of time spent and, thus, opportunity lost. Indirect costs may be associated with other departmental budgets, but they are still part of a properly constructed TCO. It’s easy to turn a blind eye to such costs — for example, assuming that they’re too small to be relevant, while ignoring the multiplication factor caused by the many individuals who are involved.
• Review the chart of accounts to ensure that all of its elements represent an annualized view of the TCO in question. The chart of accounts should contain details on critical affecting factors (such as depreciation periods) because these will significantly affect any annualized view.
• Review all chart-of-accounts elements to ensure that critical cost elements have been included and don’t overlap, thus avoiding double counting.
• Collect and validate information regarding the costs and other data required to populate the chart of accounts. Use the enterprise’s financial management system, asset management system and HR records to detail unit costs, and use survey questionnaires to establish people’s use of time.
• Amortize all cost elements in the chart of accounts during a specified time period (such as annual, quarterly and so on). For example, a server with a three-year depreciation period would be included in the chart of accounts as one-third of the total server cost.

pdf-icon

Service Level Agreement – a HIAL implementation proposal for eHealth Ontario

Featured

Tags

, , , ,

eHealth Ontario

eHealth Ontario

The SLA is a formal document outlining a service commitment provided by an IT service provider to one or more customers. The Service Level Management mission statement is to “plan, coordinate, negotiate, report and manage the quality of IT services at acceptable cost”.

The scope of the SLA project is to implement an enterprise framework that adapts to changing business priorities and service levels, define clear goals to shape the service offered by the provider, and avoid the back and forth associated with service level disagreements.

SLA benefits include open communication and the ability to manage the customers’ expectations. IT organizations also benefit from a clearer picture of what the users need, the ability to balance and adjust their resources to meet those expectations, as well as explicitly detail the costs associated with any given level of service.

For more details check the following attached PDF document:

pdf-icon

SOA problems

Tags

enterprise system spaghettiThe common and most important problem of enterprise IT architecture is to integrate siloed applications, inflexible data structures and technology-specific platforms. SOA is technology independent. Thus there are several possibilities to implement a service that can be accessed by a service consumer via the service bus.

The structure of the legacy systems may also be a problem as they are often siloed applications and separated from other applications.

Unpredictable twists and turns in an ongoing project to suppliers, customers or the environment are not an exception but the norm. These risks are well-known, because they frequently occur in many ongoing projects, as well as in the execution phase. Nevertheless, they often do not get a close attention. Problems are then blandished as challenges, but they are occurred risks. Only if those risks are known, we can handle them.

Even though the principle of the separation of concerns is important for creating reusable software and realizing an SOA, it is often violated for many reasons. There are internal and external reasons. An internal reason is the amount of work. It takes time to create software that meets the requirement of separation. Some try to avoid the additional effort and sloppy solutions win over sustainable solutions. The disadvantages of this behavior will appear in the future and many people repress them in the present. An external factor is the behavior of IT vendors that want to lock the business logic of their customers to their proprietary technology. The separation of concerns may reduce their profit, so an organization should not blindly trust on their vendors’ technological recommendations. Their greed will prevail over technical advisable solutions. Companies should use open standards to remain independent.

Big IT projects usually fail because too many participants operate over a long period of time on a project and everyone works on his hidden agenda. Starke and Tilkov, SOA experts, suggest determining a strategic direction and a fast implementation of smaller projects. Feedback loops of the projects’ experience lead to an adjustment of the strategic direction. They emphasize particularly a solid governance.

Many SOA projects were not as successful as the SOA infrastructure vendors promised. The technical requirements are not the problem. These are solved perfectly. The main problem is a missing methodical approach to identify the business services that exist in a company.

The service oriented approach is not a pure IT issue. It means that the business processes need to be designed service-oriented. That is the main problem of many SOA efforts. The entire company has to get involved in this new way of thinking and abandon established habits. It is clear that this is not a piece of cake. When an SOA project fails, it is most probably not in the technology but in the communication and the lack of willingness to compromise. [1851-FOM_ILD_Arbeitspapier_Bd27_Online_12_12_18-01_01.pdf]

Some enterprise architecture resources

Tags

Some enterprise architecture resources :

Enterprise Architecture at Work

Enterprise Architect User Guide

Doing Enterprise Architecture – Enabling the agile institution

Service Oriented Architecture for Dummies

Overview of Enterprise Data Architetcure

National Association of State Chief Information Officers – Enterprise Architecture

MIT Enterprise Architecture Guide

Everyday enterprise architecture-Sensemaking, strategy, structures and solutions

Enterprise Architecture Whitepaper-1-23-03

Enterprise Architecture Tool Selection Guide v6.3

Enterprise architecture modelling-the issue of integration