initialize

This commit is contained in:
Pruefer
2025-06-06 09:15:13 +02:00
commit fa7c2730f1
5817 changed files with 1339670 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory/>
<includes>
<include>*dependencies*.jar</include>
</includes>
<excludes>
<exclude>*.zip</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>

View File

@@ -0,0 +1,14 @@
package com.itac.mes.yamaha;
public interface IMesServicesChannel extends IMesServices {
public boolean isShutdown();
public void startup();
public void shutdown();
public String getChannelName();
public void setChannelName(String channelName);
}

View File

@@ -0,0 +1,534 @@
/*
* Copyright (c) 2010 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.yamaha;
import static com.itac.mes.yamaha.ResponseDetail.OK;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Date;
import javax.jws.WebService;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.namespace.QName;
import com.itac.mes.datainterface.data.IMesServicesLog;
import com.itac.mes.datainterface.socket.BaseIhapHandler;
import com.itac.mes.yamaha.data.CheckContainerRequest;
import com.itac.mes.yamaha.data.CheckContainerResponse;
import com.itac.mes.yamaha.data.CreateContainerRequest;
import com.itac.mes.yamaha.data.CreateContainerResponse;
import com.itac.mes.yamaha.data.ErrorDetail;
import com.itac.mes.yamaha.data.InterlockingRequest;
import com.itac.mes.yamaha.data.InterlockingResponse;
import com.itac.mes.yamaha.data.ItemProducedRequest;
import com.itac.mes.yamaha.data.MachineMessageRequest;
import com.itac.mes.yamaha.data.MachineStatusRequest;
import com.itac.mes.yamaha.data.MaterialConsumedRequest;
import com.itac.mes.yamaha.data.MesConfigurationResponse;
import com.itac.mes.yamaha.data.MesRequest;
import com.itac.mes.yamaha.data.MesResponse;
import com.itac.mes.yamaha.data.MesStartRequest;
import com.itac.mes.yamaha.data.PlacementRecipeCheckRequest;
import com.itac.mes.yamaha.data.PlacementRecipeCheckResponse;
import com.itac.mes.yamaha.sockets.IhapHandler;
/**
* @author frankp created 2011
*/
@WebService(endpointInterface = "com.itac.mes.yamaha.IMesServices")
public class MesServices implements IMesServices, IMesServicesLog {
private static String LOG_PREFIX = "iTAC.MES.Suite SMT-Plugin > ";
private static final int MIN_REQUEST_ID = 0;
private static final int MAX_REQUEST_ID = 1000000;
private static final int MIN_PORT = 1023;
private static final int MAX_PORT = 49150;
private boolean isConfigured;
private boolean isActive;
private boolean isConnected;
private String sHost;
private int iPort;
private int requestId;
private boolean logDetails = false; // default keine details loggen
private PropertyChangeListener interfaceConnectionListener;
private IMesServices interfaceConnection;
private Marshaller marshaller;
public MesServices() {
isConfigured = false;
isConnected = false;
requestId = 0;
}
/**
* Vorbedingungen sind dass der Request gesetzt ist, sowie die Konfiguration und die aktivierung des Plugin
*
* @param mesResponse
* @param mesRequest
* @throws YamahaException
*/
private void checkPreconditions(MesResponse mesResponse, MesRequest mesRequest) throws YamahaException {
if (mesRequest == null) {
throw new YamahaException(ResponseDetail.REQUEST_IS_NULL);
}
if (mesRequest.getRequestId() <= 0) {
mesRequest.setRequestId(getRequestId());
}
if (mesRequest.getEventDate() == null) {
mesRequest.setEventDate(new Date());
}
// Request ausgeben
logRequest(mesRequest);
// requestId aus Request in den Response uebernehmen
mesResponse.setRequestId(mesRequest.getRequestId());
// Konfigurationsprobleme checken
if (!isConfigured) {
throw new YamahaException(ResponseDetail.PLUGIN_NOT_CONFIGURED);
}
if (!isActive) {
throw new YamahaException(ResponseDetail.PLUGIN_NOT_ACTIVE);
}
if (!isConnected) {
throw new YamahaException(ResponseDetail.PLUGIN_NOT_CONNECTED);
}
setResponseValues(mesResponse, OK);
}
/**
* finalizing means closing communication channel and loggin response Object
*
* @param connection
* the used connection
* @param responseObject
* the responseObject
*/
private void finalizeRequest(IMesServicesChannel connection, MesResponse responseObject) {
if (connection != null) {
connection.shutdown();
}
logResponse(responseObject);
}
/**
* gets a new communication cahnnel with specified name
*
* @param channelName
* the name for the channel
* @param connectionListener
* @return
* @throws IOException
*/
protected IMesServicesChannel getConnection(String channelName, PropertyChangeListener connectionListener) throws IOException {
IMesServicesChannel serviceChannel = IhapHandler.connect(sHost, iPort, channelName, connectionListener,
getClass().getClassLoader(), this);
// Kanal Ueberwachung starten
serviceChannel.startup();
isConnected = true;
return serviceChannel;
}
// convenient method
private ErrorDetail getErrorDetail(String detail, int code) {
ErrorDetail errorDetail = new ErrorDetail();
errorDetail.setCode(code);
errorDetail.setDetail(detail);
return errorDetail;
}
// creates an almost unique id
private int getRequestId() {
requestId += 1;
if (requestId >= MAX_REQUEST_ID) {
requestId = MIN_REQUEST_ID;
}
return requestId;
}
private void handleThrowable(MesResponse response, Throwable throwable) {
response.setTotalResult(IMesServices.MES_RESULT_NOT_OK);
if (throwable instanceof YamahaException) {
setResponseValues(response, ((YamahaException) throwable).getResponseDetail());
} else if (throwable instanceof IOException) {
response.getErrorDetails().add(getErrorDetail(throwable.getMessage(), ResponseDetail.COMMUNICATION_FAILURE.getCode()));
} else {
response.getErrorDetails().add(getErrorDetail(throwable.getMessage(), ResponseDetail.PROCESSED_WITH_EXCEPTION.getCode()));
throwable.printStackTrace();
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private void logResponse(MesResponse mesResponse) {
if (mesResponse == null) {
System.out.println(LOG_PREFIX + "finish empty request");
return;
}
System.out.println(LOG_PREFIX + "finish request " + mesResponse.getRequestId() + " with code " + mesResponse.getTotalResult());
if (logDetails) {
try {
System.out.print(LOG_PREFIX);
JAXBElement<?> jexbelement = new JAXBElement(new QName(mesResponse.getClass().getSimpleName()), mesResponse.getClass(),
mesResponse);
marshaller.marshal(jexbelement, System.out);
} catch (Throwable e) {
System.out.print("-> Error logging mesResponse details");
} finally {
System.out.println();
}
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private void logRequest(MesRequest mesRequest) {
System.out
.print(LOG_PREFIX + "start request " + mesRequest.getRequestId() + " (" + mesRequest.getClass().getSimpleName() + ")");
if (logDetails) {
try {
JAXBElement<?> jexbelement = new JAXBElement(new QName(mesRequest.getClass().getSimpleName()), mesRequest.getClass(),
mesRequest);
marshaller.marshal(jexbelement, System.out);
} catch (Throwable e) {
System.out.print("-> Error logging mesRequest details");
}
}
System.out.println();
}
private void setResponseValues(MesResponse response, ResponseDetail responseDetail) {
if (responseDetail == ResponseDetail.OK) {
response.setTotalResult(IMesServices.MES_RESULT_OK);
return;
}
response.setTotalResult(IMesServices.MES_RESULT_NOT_OK);
response.getErrorDetails().add(getErrorDetail(responseDetail.getText(), responseDetail.getCode()));
}
@Override
public CreateContainerResponse mesCreateContainer(CreateContainerRequest createContainerRequest) {
CreateContainerResponse responseObject = new CreateContainerResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, createContainerRequest);
connection = getConnection("createContainer", null);
responseObject = connection.mesCreateContainer(createContainerRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public CheckContainerResponse mesCheckContainer(CheckContainerRequest checkContainerRequest) {
CheckContainerResponse responseObject = new CheckContainerResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, checkContainerRequest);
connection = getConnection("createContainer", null);
responseObject = connection.mesCheckContainer(checkContainerRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public PlacementRecipeCheckResponse mesCheckPlacementRecipe(PlacementRecipeCheckRequest placementRecipeCheckRequest) {
PlacementRecipeCheckResponse responseObject = new PlacementRecipeCheckResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, placementRecipeCheckRequest);
connection = getConnection("checkPlacementRecipe", null);
responseObject = connection.mesCheckPlacementRecipe(placementRecipeCheckRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public InterlockingResponse mesInterlocking(InterlockingRequest interlockingRequest) {
InterlockingResponse responseObject = new InterlockingResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, interlockingRequest);
connection = getConnection("interlocking", null);
responseObject = connection.mesInterlocking(interlockingRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public MesResponse mesItemProduced(ItemProducedRequest itemProducedRequest) {
MesResponse responseObject = new MesResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, itemProducedRequest);
connection = getConnection("itemProduced", null);
responseObject = connection.mesItemProduced(itemProducedRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public MesResponse mesMachineState(MachineStatusRequest machineStatus) {
MesResponse responseObject = new MesResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, machineStatus);
connection = getConnection("machineStatus", null);
responseObject = connection.mesMachineState(machineStatus);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public MesResponse mesMachineMessage(MachineMessageRequest machineMessage) {
MesResponse responseObject = new MesResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, machineMessage);
connection = getConnection("machineMessage", null);
responseObject = connection.mesMachineMessage(machineMessage);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public MesResponse mesMaterialConsumed(MaterialConsumedRequest materialConsumedRequest) {
MesResponse responseObject = new MesResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, materialConsumedRequest);
connection = getConnection("materialConsumed", null);
responseObject = connection.mesMaterialConsumed(materialConsumedRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public MesConfigurationResponse mesGetConfiguration(MesRequest mesRequest) {
MesConfigurationResponse responseObject = new MesConfigurationResponse();
IMesServicesChannel connection = null;
try {
checkPreconditions(responseObject, mesRequest);
connection = getConnection("getConfiguration", null);
responseObject = connection.mesGetConfiguration(mesRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
finalizeRequest(connection, responseObject);
}
return responseObject;
}
@Override
public MesResponse mesStart(MesRequest mesRequest) {
MesStartRequest mesStart = new MesStartRequest();
mesStart.setRequestId(mesRequest.getRequestId());
mesStart.setEventDate(mesRequest.getEventDate());
return mesStart(mesStart);
}
@Override
public MesResponse mesStart(MesStartRequest mesRequest) {
MesResponse responseObject = new MesResponse();
try {
try {
checkPreconditions(responseObject, mesRequest);
} catch (YamahaException ye) {
}
// zuerst die properties pruefen und Werte uebernehmen
if (System.getProperties().containsKey(MES_LOG_PREFIX)) {
LOG_PREFIX = System.getProperty(MES_LOG_PREFIX);
}
if (System.getProperties().containsKey(MES_LOG_DETAILS)) {
String sLogDetails = System.getProperty(MES_LOG_DETAILS);
logDetails = sLogDetails.equalsIgnoreCase(Boolean.TRUE.toString()) || sLogDetails.equals("1");
}
if (logDetails && marshaller == null) {
// alle Klassen aus diesem Package...
Class<?>[] classes = new Class[] { CreateContainerRequest.class, CreateContainerResponse.class, CheckContainerRequest.class,
CheckContainerResponse.class, InterlockingRequest.class, InterlockingResponse.class, ItemProducedRequest.class,
MachineMessageRequest.class, MachineStatusRequest.class, MaterialConsumedRequest.class, MesConfigurationResponse.class,
MesRequest.class, MesResponse.class, PlacementRecipeCheckRequest.class, PlacementRecipeCheckResponse.class };
JAXBContext jc;
try {
jc = JAXBContext.newInstance(classes);
marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
} catch (JAXBException e) {
System.err.println(LOG_PREFIX + "no jaxb context or marshaller created");
responseObject.getErrorDetails().add(getErrorDetail("no jaxb context or marshaller created", -1));
}
} else {
// wenn das detailled loggin ausgeschlaten wurde auch den marshaller killen; bei erneutem mesStart call wird ein
// neuer marshaller erzeugt
marshaller = null;
}
// ab jetzt fachlich checken
if (mesRequest == null) {
throw new YamahaException(ResponseDetail.REQUEST_IS_NULL);
}
logRequest(mesRequest);
if (isActive) {
setResponseValues(responseObject, ResponseDetail.OK);
return responseObject;
}
if (!isConfigured) {
boolean ok = true;
try {
sHost = System.getProperty(MesServices.MES_HOST).toString();
} catch (Exception exception) {
String err = MessageFormat.format("{0}setting value for property {1} failed", LOG_PREFIX, MES_HOST);
System.err.println(err);
responseObject.getErrorDetails().add(getErrorDetail(err, -1));
ok = false;
}
try {
String sPort = System.getProperty(MesServices.MES_PORT).toString();
iPort = Integer.parseInt(sPort);
if ((iPort < MIN_PORT) || (iPort > MAX_PORT)) {
String err = MessageFormat.format("{0}setting value for property {1} failed, value {2} is out of range {3}..{4}",
LOG_PREFIX, MES_PORT, sPort, MIN_PORT, MAX_PORT);
System.err.println(err);
responseObject.getErrorDetails().add(getErrorDetail(err, -1));
ok = false;
}
} catch (Exception exception) {
String err = MessageFormat.format("{0}setting value for property {1} failed:{2}", LOG_PREFIX, MES_PORT,
exception.getClass().getSimpleName());
System.err.println(err);
responseObject.getErrorDetails().add(getErrorDetail(err, -1));
ok = false;
}
if (!ok) {
throw new YamahaException(ResponseDetail.WRONG_COMMUNICATION_PROPERTIES);
}
isConfigured = true;
}
if (!isActive) {
interfaceConnectionListener = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
BaseIhapHandler ihapHandler = (BaseIhapHandler) evt.getSource();
System.out.println(LOG_PREFIX + ihapHandler.getChannelName() + " was closed by iTAC.MES.Suite DataInterface");
}
};
try {
if (interfaceConnection != null) {
if (((IMesServicesChannel) interfaceConnection).isShutdown()) {
interfaceConnection = null;
isConnected = false;
}
}
interfaceConnection = getConnection("interfaceConnection", interfaceConnectionListener);
long start = System.nanoTime();
responseObject = interfaceConnection.mesStart(mesRequest);
long finished = System.nanoTime();
System.out.println(LOG_PREFIX + "roundtrip = " + ((finished - start) / 1000L) + " microseconds");
isActive = true;
} catch (IOException e) {
throw new YamahaException(ResponseDetail.COMMUNICATION_FAILURE);
}
}
} catch (YamahaException cse) {
handleThrowable(responseObject, cse);
} finally {
logResponse(responseObject);
}
return responseObject;
}
@Override
public MesResponse mesGetStatus(MesRequest mesRequest) {
MesResponse responseObject = new MesResponse();
try {
checkPreconditions(responseObject, mesRequest);
responseObject = interfaceConnection.mesGetStatus(mesRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
logResponse(responseObject);
}
return responseObject;
}
@Override
public MesResponse mesStop(MesRequest mesRequest) {
MesResponse responseObject = new MesResponse();
try {
checkPreconditions(responseObject, mesRequest);
responseObject = interfaceConnection.mesStop(mesRequest);
} catch (Throwable throwable) {
handleThrowable(responseObject, throwable);
} finally {
logResponse(responseObject);
}
isActive = false;
isConfigured = false;
isConnected = false;
if (interfaceConnection != null) {
((IMesServicesChannel) interfaceConnection).shutdown();
}
return responseObject;
}
public void out(String text) {
System.out.println(LOG_PREFIX + "[MesServices][" + Thread.currentThread().getName() + "] " + text);
}
public void err(String text) {
System.err.println(LOG_PREFIX + "[MesServices][" + Thread.currentThread().getName() + "] " + text);
}
}

View File

@@ -0,0 +1,47 @@
package com.itac.mes.yamaha;
public enum ResponseDetail {
// WARNINGS, HINTS: positive values
//
OK("", 0),
// Plugin-ERRORS: negative values
REQUEST_IS_NULL("request is null", -10001), //
/** any call to MES before mesConfigure was called properly */
PLUGIN_NOT_CONFIGURED("plugin not configured", -10002), //
PLUGIN_NOT_ACTIVE("plugin not active", -10003), //
PLUGIN_NOT_CONNECTED("plugin not connected " + ResponseDetail.MES_DATA_INTERFACE, -10004), //
COMMUNICATION_FAILURE("communication failure", -10005), //
WRONG_COMMUNICATION_PROPERTIES("communication properties wrong", -10006), //
PLUGIN_VERSION_MISMATCH("plugin version mismatch", -10007), //
// Errors from Data Interface negative values
MES_NOT_CONNECTED(ResponseDetail.MES_DATA_INTERFACE + "is not connected", -20000), //
MES_NOT_CONFIGURED_PROPERLY(ResponseDetail.MES_DATA_INTERFACE + "is not properly configured", -20001), //
MES_NOT_INITIALIZED(ResponseDetail.MES_DATA_INTERFACE + "is not initialized", -20002), //
PARSED_WITH_EXCEPTION(ResponseDetail.MES_DATA_INTERFACE + "caught an exception on parsing request", -20003), //
PROCESSED_WITH_EXCEPTION(ResponseDetail.MES_DATA_INTERFACE + "caught an exception on processing request", -20004), //
SERIALNUMBER_NOT_ALLOWED(ResponseDetail.MES_DATA_INTERFACE + "Serialnumber not allowed", -20005), //
PARSE_PROBLEM(ResponseDetail.MES_DATA_INTERFACE + "has a problem parsing the request", -20006), //
NOT_SENT(ResponseDetail.MES_DATA_INTERFACE + "did not sent data", -20007), //
MES_SERVICE_NOT_REACHABLE("iTAC.MES.Suite service is not reachable", -20008), //
;
private static final String MES_DATA_INTERFACE = "iTAC.MES.Suite DataInterface ";
private int code;
private String text;
private ResponseDetail(String text, int code) {
this.text = text;
this.code = code;
}
public int getCode() {
return code;
}
public String getText() {
return text;
}
}

View File

@@ -0,0 +1,19 @@
package com.itac.mes.yamaha;
public class YamahaException extends Exception {
/**
*
*/
private static final long serialVersionUID = -9180600020616111590L;
private ResponseDetail responseDetail;
public YamahaException(ResponseDetail responseDetail) {
this.responseDetail = responseDetail;
}
public ResponseDetail getResponseDetail() {
return responseDetail;
}
}

View File

@@ -0,0 +1,59 @@
/*
* Copyright (c) 2008 iTAC Software AG, Germany. All Rights Reserved.
*
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
* without the written permission of iTAC Software AG.
*/
package com.itac.mes.yamaha.sockets;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.lang.reflect.Proxy;
import com.itac.mes.datainterface.data.IMesServicesLog;
import com.itac.mes.datainterface.socket.BaseIhapHandler;
import com.itac.mes.yamaha.IMesServicesChannel;
/**
* This handler delegates IMesService calls to a socket server for Yamaha Interface
*
* @author frankp
*
*/
public class IhapHandler extends BaseIhapHandler {
/**
* This handler is responsible for calling all IMesServices functions at a socket server for this type.<br>
*
* @param host
* the host where the server listens
* @param port
* the port the server listens
* @param channelName
* the name of the channel. As every channel has a unique name it is possible to debug server/client side
* @param connectionStateCloseListener
* detect wether a
* @param classLoader
* a classloader to override default class loader
* @param log
* the mesLog. if null prints direct to System.out/System.err
* @return the reference to a base Handler
* @throws IOException
* thrown if no connection was established (server not available)
*/
public static IMesServicesChannel connect(String host, int port, String channelName,
PropertyChangeListener connectionStateCloseListener, ClassLoader classLoader, IMesServicesLog log) throws IOException {
// create a default connection, not bound to any type
BaseIhapHandler handler = createHandler(host, port, channelName, connectionStateCloseListener, classLoader, log);
// create a proxy for a specific type (Interface)
IMesServicesChannel mesServiceChannel = (IMesServicesChannel) Proxy.newProxyInstance(IMesServicesChannel.class.getClassLoader(),
new Class[] { IMesServicesChannel.class }, handler);
// set the channel name and transport it top server
mesServiceChannel.setChannelName(channelName);
return mesServiceChannel;
}
}

Binary file not shown.

View File

@@ -0,0 +1,661 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xs:schema id="message" targetNamespace="yamaha.mes.itac.com" xmlns="com.yamaha.mes" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:Q1="yamaha.mes.itac.com" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
jxb:version="1.0">
<xs:annotation>
<xs:appinfo>
<jxb:globalBindings>
<jxb:javaType name="java.util.Date" xmlType="xs:dateTime" parseMethod="com.itac.mes.yamaha.DateAdapter.parseDate"
printMethod="com.itac.mes.yamaha.DateAdapter.printDate" />
</jxb:globalBindings>
</xs:appinfo>
</xs:annotation>
<xs:complexType name="Machine">
<xs:annotation>
<xs:documentation>Complete information for a machine. Used in iTAC.MES.Suite to find a corresponding stationNumber.</xs:documentation>
</xs:annotation>
<xs:attribute name="lineName" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The line name this machine belongs to</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="machineName" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The machine name as used in yamaha.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="stageName" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The name (or number) of a stage. May remain empty if stage is not available.</xs:documentation>
</xs:annotation></xs:attribute>
</xs:complexType>
<xs:complexType name="CreateContainerRequest">
<xs:annotation>
<xs:documentation>
Requesting information about a container from MES
or
advicing MES to create a material(container) in MES
which is known
by yamaha.
</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="container" type="Q1:Container" minOccurs="1" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>list of containers
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="operation" use="required">
<xs:annotation>
<xs:documentation>0: request material from MES
1: create Material in MES
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:annotation>
<xs:documentation>0: request material from MES
1: create Material
in MES
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:int">
<xs:enumeration value="0"></xs:enumeration>
<xs:enumeration value="1"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="CheckContainerRequest">
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="container" type="Q1:Container" minOccurs="1" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="operation" use="required">
<xs:annotation>
<xs:documentation>
0: set up material (container) 1: tear down
a
material (container) 2: marry a feeder
with a material
3: divorce
a material from a
feeder
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:enumeration value="0"></xs:enumeration>
<xs:enumeration value="1"></xs:enumeration>
<xs:enumeration value="2"></xs:enumeration>
<xs:enumeration value="3"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="ItemProducedRequest">
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="panelInfo" type="Q1:PanelInfo" minOccurs="0" maxOccurs="unbounded"></xs:element>
<xs:element name="machinePlacements" type="Q1:MachinePlacement" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="serialNumber" type="xs:string"></xs:attribute>
<xs:attribute name="placementRecipeName" type="xs:string"></xs:attribute>
<xs:attribute name="orderId" type="xs:string"></xs:attribute>
<xs:attribute name="state" type="xs:string"></xs:attribute>
<xs:attribute name="startProduction" type="xs:dateTime"></xs:attribute>
<xs:attribute name="endProduction" type="xs:dateTime"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="CheckContainerResponse">
<xs:complexContent>
<xs:extension base="Q1:MesResponse">
<xs:sequence>
<xs:element name="container" type="Q1:Container" minOccurs="1" maxOccurs="unbounded">
</xs:element>
</xs:sequence>
<xs:attribute name="operation" use="required">
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:enumeration value="0"></xs:enumeration>
<xs:enumeration value="1"></xs:enumeration>
<xs:enumeration value="2"></xs:enumeration>
<xs:enumeration value="3"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="MesResponse">
<xs:annotation>
<xs:documentation>
Every request is answered by a response, at least containing a totalresult for complete Operation and the
request id from its corresponding request.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="errorDetails" type="Q1:ErrorDetail" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="requestId" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>
An value identifying the call. Every response has the same requestId as it's corresponding request.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="totalResult" use="required">
<xs:annotation>
<xs:documentation>0 = OK 1 = NOT_OK</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:annotation>
<xs:documentation>0 = OK 1 = NOT_OK</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:int">
<xs:enumeration value="0"></xs:enumeration>
<xs:enumeration value="1"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="MesRequest">
<xs:annotation>
<xs:documentation>Every request from yamaha to MES extends this message.</xs:documentation>
</xs:annotation>
<xs:attribute name="requestId" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>This is the request Id, to be found on both sides
and both on request and response. This information
could help on
error analysis.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="eventDate" type="xs:dateTime" use="required">
<xs:annotation>
<xs:documentation>The date and time a request is created.</xs:documentation>
</xs:annotation></xs:attribute>
</xs:complexType>
<xs:complexType name="InterlockingRequest">
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="machine" type="Q1:Machine" minOccurs="1" maxOccurs="1" nillable="false">
<xs:annotation>
<xs:documentation>The machine (or first machine of a line) where
the barcode likes to enter.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="serialNumber" type="xs:string" minOccurs="1" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="placementRecipeName" type="xs:string"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="InterlockingResponse">
<xs:annotation>
<xs:documentation>
There are several resons why a
barcode(serialnumber) may not enter a
machine or line. 1) internal
processing error. 2)
serialnumber is unknown 3) serialnumber is not
valid at this station 4)
serialnumber is not processed
at previous
workstep
5) serialnumber is not good
</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="Q1:MesResponse">
<xs:sequence>
<xs:element name="serialNumber" type="Q1:PanelInfo" minOccurs="1" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
even if only one serialnumber was requested we
may return a list of
serialnumbers for a board (one
for each
panel)
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="placementRecipeName" type="xs:string"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="PlacementRecipeCheckRequest">
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="machine" type="Q1:Machine" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>expected: first producing machine in line
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="placementList" type="Q1:Placement" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="placementRecipeName" type="xs:string"></xs:attribute>
<xs:attribute name="setupName" type="xs:string"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="PlacementRecipeCheckResponse">
<xs:complexContent>
<xs:extension base="Q1:MesResponse">
<xs:sequence>
<xs:element name="result" type="Q1:Placement" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
only erroneous values are returned (wrong
component, wrong
designator, missing placements)
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="placementRecipeName" type="xs:string"></xs:attribute>
<xs:attribute name="setupName" type="xs:string"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="CreateContainerResponse">
<xs:annotation>
<xs:documentation>
returns 0 if the container was created by mes or if
the
container already exists in MES, otherwise 1.
error may
contain a
more detailled information.
</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="Q1:MesResponse">
<xs:sequence>
<xs:element name="container" type="Q1:Container" minOccurs="0" maxOccurs="unbounded"></xs:element>
</xs:sequence>
<xs:attribute name="operation" use="required">
<xs:annotation>
<xs:documentation>
0: request material from MES 1: create
Material
in MES
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:int">
<xs:enumeration value="0"></xs:enumeration>
<xs:enumeration value="1"></xs:enumeration>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="HandlerPlacement">
<xs:annotation>
<xs:documentation>A single placement from a container.</xs:documentation>
</xs:annotation>
<xs:attribute name="designator" type="xs:string">
<xs:annotation>
<xs:documentation>The designator for a placement. Required information. e.g. R1 or C12.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="panelNumber" type="xs:string">
<xs:annotation>
<xs:documentation>The panel where a placement was performed. Required information, value is the panel number (counting from 1 up) or use -1 </xs:documentation>
</xs:annotation></xs:attribute>
</xs:complexType>
<xs:complexType name="MachineMessageRequest">
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="machine" type="Q1:Machine" minOccurs="1" maxOccurs="1"></xs:element>
</xs:sequence>
<xs:attribute name="messageText" type="xs:string" use="required"></xs:attribute>
<xs:attribute name="messageStart" type="xs:dateTime" use="required"></xs:attribute>
<xs:attribute name="messageStop" type="xs:dateTime" use="required">
<xs:annotation>
<xs:documentation>The stop date for this message. If this date is
before or equal to messageStart a default message
time is used
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="messageDetail" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The message code for the machine message.
If this
code is not used in iTAC this event is ignored.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="MachineStatusRequest">
<xs:annotation>
<xs:documentation>Used whenever a machine changes its state.</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="machine" type="Q1:Machine" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>The machine descriptor.</xs:documentation>
</xs:annotation></xs:element>
</xs:sequence>
<xs:attribute name="status" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The new status for the machine. This status is valid from the (inherited field) eventDate.</xs:documentation>
</xs:annotation></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="MachinePlacement">
<xs:annotation>
<xs:documentation>A machine placement contains the complete inventory for one machine, as well as all handlers with its information.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element name="handlerInfo" type="Q1:HandlerInfo" minOccurs="1" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>All handlers informations.</xs:documentation>
</xs:annotation></xs:element>
<xs:element name="machine" type="Q1:Machine" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>The machine identifier for this machines placements.</xs:documentation>
</xs:annotation></xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PanelInfo">
<xs:annotation>
<xs:documentation>optional</xs:documentation>
</xs:annotation>
<xs:attribute name="panelName" type="xs:string"></xs:attribute>
<xs:attribute name="serialNumber" type="xs:string">
<xs:annotation>
<xs:documentation>
optional, only if the machine scans every single
panel
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="panelNumber" type="xs:string"></xs:attribute>
<xs:attribute name="status" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>0 = good
1 = rework
2 = scrap (badmark)
3 = unknown
totalresult is 0(OK) if all single serialnumbers for
this board are
good or
scrap or unknown, but not all scrap
totalresult is
1(NOT_OK)if at least one single serialnumbers
for this board is
rework
yamaha should only evaluate the totalresult and may be
displaying the
error
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="HandlerInfo">
<xs:annotation>
<xs:documentation>A material handler (feeder or tray server) with information about positions for handlers, used container an placements from each container.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:annotation>
<xs:documentation>Information about placements and used container for a placement.</xs:documentation>
</xs:annotation>
<xs:element name="placement" type="Q1:HandlerPlacement" minOccurs="1" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>List of placements for this material Handler.</xs:documentation>
</xs:annotation></xs:element>
<xs:element name="container" type="Q1:Container" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation>The container for this material handler. iTAC allows one container to be setup on more than one materialHandler</xs:documentation>
</xs:annotation></xs:element>
</xs:sequence>
<xs:attribute name="table" type="xs:string">
<xs:annotation>
<xs:documentation>A table number or id where a feeder is placed.
Required for feeders.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="handlerId" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The serialnumber of a handler (feeder or tray server). Optional information.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="track" type="xs:string">
<xs:annotation>
<xs:documentation>A track within a table where a feeder is placed. Used for generating a position in iTAC.MES.Suite. Required information for feeders.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="division" type="xs:string">
<xs:annotation>
<xs:documentation>A sub-division if one feeder has more than one reel on it. Use value 1 if not appplicable.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="tower" type="xs:string">
<xs:annotation>
<xs:documentation>The position of the tower. Used for tray server only. Value ignored for feeders.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="level" type="xs:string">
<xs:annotation>
<xs:documentation>The used level for a tower. Used for tray server only. Value ignored for feeders.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="verifiedDate" type="xs:dateTime">
<xs:annotation>
<xs:documentation>Date and time a container was verified. Optional information.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="pickAttempts" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>The number of picks for material for a single board. It is the sum of placed and wasted components.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="placed" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>The number of placed components for a single board. Required information.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="handlerType" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>Used to identify the handler type. Could be a text like Feeder or Stick or Tray, or any other text. Optional information</xs:documentation>
</xs:annotation></xs:attribute>
</xs:complexType>
<xs:complexType name="Container">
<xs:annotation>
<xs:documentation>One Container containing complete container information. Some information is optional.</xs:documentation>
</xs:annotation>
<xs:attribute name="containerId" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The unique Id of a container (e.g. a reel or stick or tray). This information is always required.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="componentId" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The component Id (in iTAC: partNumber) for this container. Minimum required information for creating containers in iTAC.MES.Suite.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="initialQuantity" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>Initial quantity as declared by the supplier. Minimum required information for creating containers in iTAC.MES.Suite.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="actualQuantity" type="xs:int" use="required">
<xs:annotation>
<xs:documentation>In a request this field must contain the actual quantity for a container. Its response message could contain a differing value; in this case yamaha should process
the changed value and adjust its quantity for this container.
When a material should be created in MES and the actualQuantity differs from initialQuantity the actual quantity is adjusted in MES.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="supplierNumber" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Optional supplier number if a material should be
created
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="supplierName" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Optional supplier name if a material should be
created
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lot" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
The lot a reel belongs to. This information is
optional, also known as a batch number
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="dateCode" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
A reels datecode as provided by a supplier.
optional
information.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="expirationDate" type="xs:dateTime">
<xs:annotation>
<xs:documentation>The date when a container expires because of MSL. Use December 31 3000 if this container does never expires. Used for request and response.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="state" type="xs:string">
<xs:annotation>
<xs:documentation>A container state as used in iTAC.MES.Suite. Only used in response messages; Its content in requests will be ignored.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="incomingRefNumber" type="xs:string">
<xs:annotation>
<xs:documentation>An incoming reference number for a container. Optional information.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="classification" type="xs:string">
<xs:annotation>
<xs:documentation>For LEDs a lightning class, optional information.</xs:documentation>
</xs:annotation></xs:attribute>
<xs:attribute name="errorText" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>Detailled result for a single Container Request
(information about resolving or creating container).
Only used in a response message. Leave it null or better set it empty.</xs:documentation>
</xs:annotation></xs:attribute>
</xs:complexType>
<xs:complexType name="MaterialConsumedRequest">
<xs:complexContent>
<xs:extension base="Q1:MesRequest">
<xs:sequence>
<xs:element name="machine" type="Q1:Machine" minOccurs="0" maxOccurs="1"></xs:element>
</xs:sequence>
<xs:attribute name="reelId" type="xs:string"></xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="MesConfigurationResponse">
<xs:complexContent>
<xs:extension base="Q1:MesResponse">
<xs:attribute name="isLineBased" type="xs:boolean" use="required">
<xs:annotation>
<xs:documentation>
true: return consolidated trace information
for
all machines of one line; false: return
one trace
information per
machine in a line;
if a machine is in "passthrough-mode add
info
about last producing machine for this
line.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="Placement">
<xs:attribute name="panelName" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Never empty, if unknown use 1</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="componentId" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>the component name for this placement (not the
reelId)</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="designator" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>The reference designator for this placement, e.g.
R12, IC1</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="resultString" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>Only used as a return value.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="ErrorDetail">
<xs:attribute name="detail" type="xs:string"></xs:attribute>
<xs:attribute name="code" type="xs:int" use="required"></xs:attribute>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,64 @@
package com.itac.mes.yamaha;
import static org.junit.Assert.assertEquals;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.spy;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.util.Date;
import org.junit.Test;
import org.mockito.Matchers;
import com.itac.mes.yamaha.data.MesConfigurationResponse;
import com.itac.mes.yamaha.data.MesRequest;
public class MesServicesTest {
@Test
public void test() throws IOException {
MesServices out = new MesServices();
MesServices spyServices = spy(out);
doReturn(null).when(spyServices).getConnection(anyString(), Matchers.any(PropertyChangeListener.class));
MesConfigurationResponse k = spyServices.mesGetConfiguration(null);
assertEquals(1, k.getTotalResult());
MesRequest mesRequest = new MesRequest();
k = spyServices.mesGetConfiguration(mesRequest);
assertEquals(1, k.getTotalResult());
mesRequest.setRequestId(100);
k = spyServices.mesGetConfiguration(mesRequest);
assertEquals(1, k.getTotalResult());
mesRequest.setEventDate(new Date());
k = spyServices.mesGetConfiguration(mesRequest);
assertEquals(1, k.getTotalResult());
// System.setProperty(IMesServices.MES_HOST, "localhost");
// System.setProperty(IMesServices.MES_PORT, "32000");
//
// MesResponse response = spyServices.mesStart(mesRequest);
// assertEquals(1, response.getTotalResult());
//
// System.setProperty(IMesServices.MES_LOG_DETAILS, "true"); // or "false"
// System.setProperty(IMesServices.MES_LOG_PREFIX, "iTAC.MES.Suite Yamaha Plugin: ");
//
// response = spyServices.mesStart(mesRequest);
// assertEquals(1, response.getTotalResult());
//
// IMesServices intfConnMock = mock(IMesServices.class);
// MesResponse mesStartResponse = new MesResponse();
// mesStartResponse.setRequestId(102);
// mesStartResponse.setTotalResult(0);
// when(intfConnMock.mesStart(any(MesRequest.class))).thenReturn(mesStartResponse );
// doReturn(intfConnMock ).when(spyServices).getConnection(anyString(), Matchers.any(PropertyChangeListener.class));
// response = spyServices.mesStart(mesRequest);
// assertEquals(1, response.getTotalResult());
}
}