use of org.eclipse.persistence.tools.dbws.JSR109WebServicePackager in project eclipselink by eclipse-ee4j.
the class SOAP12TestSuite method setUp.
@BeforeClass
public static void setUp() throws WSDLException {
try {
conn = buildConnection();
} catch (Exception e) {
e.printStackTrace();
}
String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
if ("true".equalsIgnoreCase(ddlCreateProp)) {
ddlCreate = true;
}
String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
if ("true".equalsIgnoreCase(ddlDropProp)) {
ddlDrop = true;
}
String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
if ("true".equalsIgnoreCase(ddlDebugProp)) {
ddlDebug = true;
}
if (ddlCreate) {
runDdl(conn, CREATE_SOAP12_TABLE, ddlDebug);
}
builder.setProjectName(SOAP12_TEST);
builder.setTargetNamespace(SOAP12_NAMESPACE);
TableOperationModel mtomOp = new TableOperationModel();
mtomOp.additionalOperations = new ArrayList<OperationModel>();
mtomOp.setName(SOAP12_TEST);
mtomOp.setTablePattern(SOAP12);
mtomOp.setBinaryAttachment(true);
mtomOp.setAttachmentType("MTOM");
builder.getOperations().add(mtomOp);
builder.quiet = true;
// builder.setLogLevel(SessionLog.FINE_LABEL);
builder.setLogLevel(SessionLog.OFF_LABEL);
builder.setDriver(DATABASE_DRIVER);
builder.setPlatformClassname(DATABASE_PLATFORM);
builder.getProperties().put(SESSIONS_FILENAME_KEY, NO_SESSIONS_FILENAME);
builder.setUsername(username);
builder.setPassword(password);
builder.setUrl(url);
builder.setPackager(new JSR109WebServicePackager(null, "WebServiceTestPackager", noArchive) {
@Override
public void start() {
}
});
builder.build(DBWS_SCHEMA_STREAM, __nullStream, DBWS_SERVICE_STREAM, DBWS_OR_STREAM, DBWS_OX_STREAM, __nullStream, __nullStream, DBWS_WSDL_STREAM, __nullStream, __nullStream, __nullStream, __nullStream, null);
SOAP12TestSuite soap12TestSuite = new SOAP12TestSuite();
soap12TestSuite.mtomEnabled = true;
endpoint = Endpoint.create(soap12TestSuite);
endpoint.publish(ENDPOINT_ADDRESS);
QName serviceQName = new QName(SOAP12_SERVICE_NAMESPACE, SOAP12_SERVICE);
portQName = new QName(SOAP12_SERVICE_NAMESPACE, SOAP12_PORT);
testService = Service.create(serviceQName);
testService.addPort(portQName, SOAP12HTTP_BINDING, ENDPOINT_ADDRESS);
dispatch = testService.createDispatch(portQName, SOAPMessage.class, MESSAGE, new MTOMFeature(100));
}
use of org.eclipse.persistence.tools.dbws.JSR109WebServicePackager in project eclipselink by eclipse-ee4j.
the class UpdateFaultTestSuite method setUp.
@BeforeClass
public static void setUp() throws WSDLException {
try {
conn = buildConnection();
} catch (Exception e) {
e.printStackTrace();
}
String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
if ("true".equalsIgnoreCase(ddlCreateProp)) {
ddlCreate = true;
}
String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
if ("true".equalsIgnoreCase(ddlDropProp)) {
ddlDrop = true;
}
String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
if ("true".equalsIgnoreCase(ddlDebugProp)) {
ddlDebug = true;
}
if (ddlCreate) {
runDdl(conn, CREATE_SFAULT_TABLE, ddlDebug);
try {
Statement stmt = conn.createStatement();
for (int i = 0; i < POPULATE_SFAULT_TABLE.length; i++) {
stmt.addBatch(POPULATE_SFAULT_TABLE[i]);
}
stmt.executeBatch();
} catch (SQLException e) {
if (ddlDebug) {
e.printStackTrace();
}
}
}
builder.setProjectName(SFAULT_TEST);
builder.setTargetNamespace(SFAULT_NAMESPACE);
TableOperationModel sFaultOp = new TableOperationModel();
sFaultOp.additionalOperations = new ArrayList<OperationModel>();
sFaultOp.setName(SFAULT_TEST);
sFaultOp.setTablePattern(SFAULT);
builder.getOperations().add(sFaultOp);
builder.quiet = true;
// builder.setLogLevel(SessionLog.FINE_LABEL);
builder.setLogLevel(SessionLog.OFF_LABEL);
builder.setDriver(DATABASE_DRIVER);
builder.setPlatformClassname(DATABASE_PLATFORM);
builder.getProperties().put(SESSIONS_FILENAME_KEY, NO_SESSIONS_FILENAME);
builder.setUsername(username);
builder.setPassword(password);
builder.setUrl(url);
builder.setPackager(new JSR109WebServicePackager(null, "WebServiceTestPackager", noArchive) {
@Override
public void start() {
}
});
builder.build(DBWS_SCHEMA_STREAM, __nullStream, DBWS_SERVICE_STREAM, DBWS_OR_STREAM, DBWS_OX_STREAM, __nullStream, __nullStream, DBWS_WSDL_STREAM, __nullStream, __nullStream, __nullStream, __nullStream, null);
endpoint = Endpoint.create(new UpdateFaultTestSuite());
endpoint.publish(ENDPOINT_ADDRESS);
QName serviceQName = new QName(SFAULT_SERVICE_NAMESPACE, SFAULT_SERVICE);
portQName = new QName(SFAULT_SERVICE_NAMESPACE, SFAULT_PORT);
testService = Service.create(serviceQName);
testService.addPort(portQName, SOAP11HTTP_BINDING, ENDPOINT_ADDRESS);
}
use of org.eclipse.persistence.tools.dbws.JSR109WebServicePackager in project eclipselink by eclipse-ee4j.
the class MTOMTestSuite method setUp.
@BeforeClass
public static void setUp() throws WSDLException {
try {
conn = buildConnection();
} catch (Exception e) {
e.printStackTrace();
}
String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
if ("true".equalsIgnoreCase(ddlCreateProp)) {
ddlCreate = true;
}
String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
if ("true".equalsIgnoreCase(ddlDropProp)) {
ddlDrop = true;
}
String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
if ("true".equalsIgnoreCase(ddlDebugProp)) {
ddlDebug = true;
}
if (ddlCreate) {
runDdl(conn, CREATE_MTOM_TABLE, ddlDebug);
}
builder.setProjectName(MTOM_TEST);
builder.setTargetNamespace(MTOM_NAMESPACE);
TableOperationModel mtomOp = new TableOperationModel();
mtomOp.additionalOperations = new ArrayList<OperationModel>();
mtomOp.setName(MTOM_TEST);
mtomOp.setTablePattern(MTOM);
mtomOp.setBinaryAttachment(true);
mtomOp.setAttachmentType("MTOM");
builder.getOperations().add(mtomOp);
builder.quiet = true;
// builder.setLogLevel(SessionLog.FINE_LABEL);
builder.setLogLevel(SessionLog.OFF_LABEL);
builder.setDriver(DATABASE_DRIVER);
builder.setPlatformClassname(DATABASE_PLATFORM);
builder.getProperties().put(SESSIONS_FILENAME_KEY, NO_SESSIONS_FILENAME);
builder.setUsername(username);
builder.setPassword(password);
builder.setUrl(url);
builder.setPackager(new JSR109WebServicePackager(null, "WebServiceTestPackager", noArchive) {
@Override
public void start() {
}
});
builder.build(DBWS_SCHEMA_STREAM, __nullStream, DBWS_SERVICE_STREAM, DBWS_OR_STREAM, DBWS_OX_STREAM, __nullStream, __nullStream, DBWS_WSDL_STREAM, __nullStream, __nullStream, __nullStream, __nullStream, null);
MTOMTestSuite mtomTestSuite = new MTOMTestSuite();
mtomTestSuite.mtomEnabled = true;
endpoint = Endpoint.create(mtomTestSuite);
endpoint.publish(ENDPOINT_ADDRESS);
QName serviceQName = new QName(MTOM_SERVICE_NAMESPACE, MTOM_SERVICE);
portQName = new QName(MTOM_SERVICE_NAMESPACE, MTOM_PORT);
testService = Service.create(serviceQName);
testService.addPort(portQName, SOAP11HTTP_BINDING, ENDPOINT_ADDRESS);
dispatch = testService.createDispatch(portQName, SOAPMessage.class, MESSAGE, new MTOMFeature(100));
}
use of org.eclipse.persistence.tools.dbws.JSR109WebServicePackager in project eclipselink by eclipse-ee4j.
the class OptLockTestSuite method setUp.
@BeforeClass
public static void setUp() throws WSDLException {
try {
conn = buildConnection();
} catch (Exception e) {
e.printStackTrace();
}
String ddlCreateProp = System.getProperty(DATABASE_DDL_CREATE_KEY, DEFAULT_DATABASE_DDL_CREATE);
if ("true".equalsIgnoreCase(ddlCreateProp)) {
ddlCreate = true;
}
String ddlDropProp = System.getProperty(DATABASE_DDL_DROP_KEY, DEFAULT_DATABASE_DDL_DROP);
if ("true".equalsIgnoreCase(ddlDropProp)) {
ddlDrop = true;
}
String ddlDebugProp = System.getProperty(DATABASE_DDL_DEBUG_KEY, DEFAULT_DATABASE_DDL_DEBUG);
if ("true".equalsIgnoreCase(ddlDebugProp)) {
ddlDebug = true;
}
if (ddlCreate) {
runDdl(conn, CREATE_OPTLOCK_TABLE, ddlDebug);
try {
Statement stmt = conn.createStatement();
for (int i = 0; i < POPULATE_OPTLOCK_TABLE.length; i++) {
stmt.addBatch(POPULATE_OPTLOCK_TABLE[i]);
}
stmt.executeBatch();
} catch (SQLException e) {
if (ddlDebug) {
e.printStackTrace();
}
}
}
builder.setProjectName(OPTLOCK_TEST);
builder.setTargetNamespace(OPTLOCK_NAMESPACE);
TableOperationModel tModel = new TableOperationModel();
tModel.setName(OPTLOCK);
tModel.setTablePattern(OPTLOCK);
builder.getOperations().add(tModel);
builder.quiet = true;
// builder.setLogLevel(SessionLog.FINE_LABEL);
builder.setLogLevel(SessionLog.OFF_LABEL);
builder.setDriver(DATABASE_DRIVER);
builder.setPlatformClassname(DATABASE_PLATFORM);
builder.getProperties().put(SESSIONS_FILENAME_KEY, NO_SESSIONS_FILENAME);
builder.setUsername(username);
builder.setPassword(password);
builder.setUrl(url);
builder.setPackager(new JSR109WebServicePackager(null, "WebServiceTestPackager", noArchive) {
@Override
public void start() {
}
});
builder.build(DBWS_SCHEMA_STREAM, __nullStream, DBWS_SERVICE_STREAM, DBWS_OR_STREAM, DBWS_OX_STREAM, __nullStream, __nullStream, DBWS_WSDL_STREAM, __nullStream, __nullStream, __nullStream, __nullStream, null);
endpoint = Endpoint.create(new OptLockTestSuite());
endpoint.publish(ENDPOINT_ADDRESS);
QName serviceQName = new QName(OPTLOCK_SERVICE_NAMESPACE, OPTLOCK_SERVICE);
portQName = new QName(OPTLOCK_SERVICE_NAMESPACE, OPTLOCK_PORT);
testService = Service.create(serviceQName);
testService.addPort(portQName, SOAP11HTTP_BINDING, ENDPOINT_ADDRESS);
}
use of org.eclipse.persistence.tools.dbws.JSR109WebServicePackager in project eclipselink by eclipse-ee4j.
the class SimpleTableWithNestedSQLTestSuite method checkWSDL.
@Test
public void checkWSDL() throws WSDLException {
DBWS_BUILDER_XML_USERNAME = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<dbws-builder xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" + "<properties>" + "<property name=\"projectName\">simpletable2</property>" + "<property name=\"logLevel\">off</property>" + "<property name=\"username\">";
DBWS_BUILDER_XML_PASSWORD = "</property><property name=\"password\">";
DBWS_BUILDER_XML_URL = "</property><property name=\"url\">";
DBWS_BUILDER_XML_DRIVER = "</property><property name=\"driver\">";
DBWS_BUILDER_XML_PLATFORM = "</property><property name=\"platformClassname\">";
DBWS_BUILDER_XML_MAIN = "</property>" + "</properties>" + "<table " + "schemaPattern=\"%\" " + "tableNamePattern=\"simpletable2\" " + ">" + "<sql " + "name=\"findByName\" " + "isCollection=\"true\" " + "returnType=\"simpletable2Type\" " + ">" + "<text><![CDATA[select * from SIMPLETABLE2 where NAME like ?]]></text>" + "<binding name=\"NAME\" type=\"xsd:string\"/>" + "</sql>" + "</table>" + "</dbws-builder>";
String username = System.getProperty(DATABASE_USERNAME_KEY, DEFAULT_DATABASE_USERNAME);
String password = System.getProperty(DATABASE_PASSWORD_KEY, DEFAULT_DATABASE_PASSWORD);
String url = System.getProperty(DATABASE_URL_KEY, DEFAULT_DATABASE_URL);
String builderString = DBWS_BUILDER_XML_USERNAME + username + DBWS_BUILDER_XML_PASSWORD + password + DBWS_BUILDER_XML_URL + url + DBWS_BUILDER_XML_DRIVER + DATABASE_DRIVER + DBWS_BUILDER_XML_PLATFORM + DATABASE_PLATFORM + DBWS_BUILDER_XML_MAIN;
XMLContext context = new XMLContext(new DBWSBuilderModelProject());
XMLUnmarshaller unmarshaller = context.createUnmarshaller();
DBWSBuilderModel builderModel = (DBWSBuilderModel) unmarshaller.unmarshal(new StringReader(builderString));
DBWSBuilder builder = new DBWSBuilder();
builder.quiet = true;
// builder.setLogLevel(SessionLog.FINE_LABEL);
builder.setLogLevel(SessionLog.OFF_LABEL);
builder.setPlatformClassname(DATABASE_PLATFORM);
builder.properties = builderModel.properties;
builder.getProperties().put(SESSIONS_FILENAME_KEY, NO_SESSIONS_FILENAME);
builder.operations = builderModel.operations;
builder.setPackager(new JSR109WebServicePackager(null, "WebServiceTestPackager", noArchive) {
@Override
public void start() {
// do nothing - don't have to verify existence of 'stageDir' when
// all the streams are in-memory
}
});
ByteArrayOutputStream dbwsServiceStream = new ByteArrayOutputStream();
ByteArrayOutputStream wsdlStream = new ByteArrayOutputStream();
builder.build(__nullStream, __nullStream, dbwsServiceStream, __nullStream, __nullStream, __nullStream, __nullStream, wsdlStream, __nullStream, __nullStream, __nullStream, __nullStream, null);
// for the nested sql operation 'findByName'
try {
StringWriter sw = new StringWriter();
StreamSource wsdlStreamSource = new StreamSource(new StringReader(wsdlStream.toString()));
Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(MATCH_SCHEMA)));
StreamResult streamResult = new StreamResult(sw);
t.transform(wsdlStreamSource, streamResult);
sw.toString();
SchemaModelProject schemaProject = new SchemaModelProject();
XMLContext xmlContext2 = new XMLContext(schemaProject);
unmarshaller = xmlContext2.createUnmarshaller();
Schema schema = (Schema) unmarshaller.unmarshal(new StringReader(sw.toString()));
ComplexType findByNameResponseType = schema.getTopLevelComplexTypes().get(FINDBYNAME_RESPONSETYPE);
Element result = findByNameResponseType.getSequence().getElements().get(0);
Element unnamed = result.getComplexType().getSequence().getElements().get(0);
assertTrue("wrong refType for " + FINDBYNAME_RESPONSETYPE, TABLE_ALIAS.equals(unnamed.getRef()));
} catch (Exception e) {
fail(e.getMessage());
}
}
Aggregations