use of org.eclipse.persistence.internal.sessions.factories.model.platform.CustomServerPlatformConfig in project eclipselink by eclipse-ee4j.
the class SessionsXMLSchemaWriteTest method verify.
@Override
protected void verify() {
if (m_session == null) {
throw new TestErrorException("The session on read back was null");
}
// Name
check("Name", m_session.getName(), "EmployeeSession");
// Profiler
check("Profiler", m_session.getProfiler(), "toplink");
// Primary project
if (m_session.getPrimaryProject() != null) {
check("ProjectClass", m_session.getPrimaryProject().getProjectString(), "org.eclipse.persistence.demos.employee.relational.EmployeeProject");
} else {
throw new TestErrorException("ProjectClass was null");
}
// Exception handler class
check("ExceptionHandlerClass", m_session.getExceptionHandlerClass(), "handlerClass");
// Custom server platform config
if (m_session.getServerPlatformConfig() != null) {
ServerPlatformConfig platformConfig = m_session.getServerPlatformConfig();
if (platformConfig instanceof CustomServerPlatformConfig) {
check("ExternalTransactionControllerClass", ((CustomServerPlatformConfig) platformConfig).getExternalTransactionControllerClass(), "externalTransactionController");
} else {
throw new TestErrorException("ServerPlatformConfig not correct type");
}
} else {
throw new TestErrorException("ServerPlatformConfig was null");
}
// Session customizer
check("SessionCustomizer", m_session.getSessionCustomizerClass(), "sessionCustomizer");
// Log config
if (m_session.getLogConfig() instanceof DefaultSessionLogConfig) {
DefaultSessionLogConfig logConfig = (DefaultSessionLogConfig) m_session.getLogConfig();
check("LogLevel", logConfig.getLogLevel(), "severe");
check("Filename", logConfig.getFilename(), "logfile");
} else {
throw new TestErrorException("LogConfig not correct type");
}
// Login
if (m_session.getLoginConfig() instanceof DatabaseLoginConfig) {
DatabaseLoginConfig loginConfig = (DatabaseLoginConfig) m_session.getLoginConfig();
checkBoolean("BatchWriting", loginConfig.getBatchWriting(), true);
checkBoolean("BindAllParameters", loginConfig.getBindAllParameters(), true);
checkBoolean("ByteArrayBinding", loginConfig.getByteArrayBinding(), false);
checkBoolean("CacheAllStatements", loginConfig.getCacheAllStatements(), false);
check("ConnectionURL", loginConfig.getConnectionURL(), "jdbc:oracle:thin:@otl-ora8infmx73:1521:toplinkj");
check("DriverClass", loginConfig.getDriverClass(), "oracle.jdbc.OracleDriver");
checkBoolean("ExternalConnectionPooling", loginConfig.getExternalConnectionPooling(), false);
checkBoolean("ExternalTransactionController", loginConfig.getExternalTransactionController(), false);
checkBoolean("ForceFieldNamesToUppercase", loginConfig.getForceFieldNamesToUppercase(), false);
checkBoolean("JdbcBatchWriting", loginConfig.getJdbcBatchWriting(), false);
check("MaxBatchWritingSize", loginConfig.getMaxBatchWritingSize(), 5);
checkBoolean("NativeSequencing", loginConfig.getNativeSequencing(), false);
checkBoolean("NativeSQL", loginConfig.getNativeSQL(), false);
checkBoolean("OptimizeDataConversion", loginConfig.getOptimizeDataConversion(), true);
check("Password", loginConfig.getPassword(), "password");
check("PlatformClass", loginConfig.getPlatformClass(), "platform");
check("SequenceCounterField", loginConfig.getSequenceCounterField(), "SEQ_COUNT");
check("SequenceNameField", loginConfig.getSequenceNameField(), "SEQ_NAME");
check("SequencePreallocationSize", loginConfig.getSequencePreallocationSize(), 99);
check("SequenceTable", loginConfig.getSequenceTable(), "\"SEQUENCE\"");
checkBoolean("StreamsForBinding", loginConfig.getStreamsForBinding(), false);
checkBoolean("StringBinding", loginConfig.getStringBinding(), false);
check("TableQualifier", loginConfig.getTableQualifier(), "table:");
checkBoolean("TrimStrings", loginConfig.getTrimStrings(), true);
check("Username", loginConfig.getUsername(), "tljtest1");
} else {
throw new TestErrorException("LogConfig not correct type");
}
// Remote command manager
RemoteCommandManagerConfig rcmConfig = m_session.getRemoteCommandManagerConfig();
if (rcmConfig == null) {
throw new TestErrorException("RemoteCommandManagerConfig was null");
} else {
// Channel
check("Channel", rcmConfig.getChannel(), "new_channel");
if (rcmConfig.getTransportManagerConfig() instanceof JMSTopicTransportManagerConfig) {
// Transport manager
JMSTopicTransportManagerConfig transportConfig = (JMSTopicTransportManagerConfig) rcmConfig.getTransportManagerConfig();
check("OnConnectionError", transportConfig.getOnConnectionError(), "KeepConnection");
check("TopicHostURL", transportConfig.getTopicHostURL(), "ormi://jms_topic_host");
check("TopicConnectionFactoryName", transportConfig.getTopicConnectionFactoryName(), "test-topic-connection-factory-name");
check("TopicName", transportConfig.getTopicName(), "test-topic-name");
// Naming
JNDINamingServiceConfig namingConfig = transportConfig.getJNDINamingServiceConfig();
if (namingConfig == null) {
throw new TestErrorException("JNDINamingServiceConfig was null");
} else {
check("Naming URL", namingConfig.getURL(), "new_jndi_url");
check("Naming Username", namingConfig.getUsername(), "guy");
check("Naming Password", namingConfig.getPassword(), "password");
check("InitialContextFactoryName", namingConfig.getInitialContextFactoryName(), "new_initial_context_factory_name");
// Properties
Vector propertyConfigs = namingConfig.getPropertyConfigs();
if (propertyConfigs == null) {
throw new TestErrorException("PropertyConfigs were null");
} else if (propertyConfigs.size() != 2) {
throw new TestErrorException("PropertyConfigs were not the correct size");
} else {
PropertyConfig one = (PropertyConfig) propertyConfigs.firstElement();
check("Property name", one.getName(), "name1");
check("Property value", one.getValue(), "value1");
PropertyConfig two = (PropertyConfig) propertyConfigs.lastElement();
check("Property name", two.getName(), "name2");
check("Property value", two.getValue(), "value2");
}
}
} else {
throw new TestErrorException("TransportManagerConfig not correct type");
}
}
}
use of org.eclipse.persistence.internal.sessions.factories.model.platform.CustomServerPlatformConfig in project eclipselink by eclipse-ee4j.
the class GlassfishPackager method buildSessionsXML.
@Override
public SessionConfigs buildSessionsXML(OutputStream dbwsSessionsStream, DBWSBuilder builder) {
SessionConfigs ts = super.buildSessionsXML(dbwsSessionsStream, builder);
String dataSource = builder.getDataSource();
if (dataSource != null) {
DatabaseSessionConfig tmpConfig = (DatabaseSessionConfig) ts.getSessionConfigs().firstElement();
ProjectConfig orProject = tmpConfig.getPrimaryProject();
LogConfig logConfig = tmpConfig.getLogConfig();
String sessionName = tmpConfig.getName();
DatabaseSessionConfig orSessionConfig = new ServerSessionConfig();
orSessionConfig.setPrimaryProject(orProject);
orSessionConfig.setName(sessionName);
orSessionConfig.setLogConfig(logConfig);
CustomServerPlatformConfig customServerPlatformConfig = new CustomServerPlatformConfig();
customServerPlatformConfig.setEnableJTA(true);
customServerPlatformConfig.setEnableRuntimeServices(true);
customServerPlatformConfig.setServerClassName("org.eclipse.persistence.platform.server.sunas.SunAS9ServerPlatform");
customServerPlatformConfig.setExternalTransactionControllerClass("org.eclipse.persistence.transaction.sunas.SunAS9TransactionController");
orSessionConfig.setServerPlatformConfig(customServerPlatformConfig);
DatabaseLoginConfig dlc = new DatabaseLoginConfig();
dlc.setPlatformClass(builder.getPlatformClassname());
dlc.setExternalConnectionPooling(true);
dlc.setExternalTransactionController(true);
dlc.setDatasource(dataSource);
dlc.setBindAllParameters(true);
dlc.setStreamsForBinding(true);
orSessionConfig.setLoginConfig(dlc);
ts.getSessionConfigs().set(0, orSessionConfig);
}
return ts;
}
use of org.eclipse.persistence.internal.sessions.factories.model.platform.CustomServerPlatformConfig in project eclipselink by eclipse-ee4j.
the class JBossPackager method buildSessionsXML.
@Override
public SessionConfigs buildSessionsXML(OutputStream dbwsSessionsStream, DBWSBuilder builder) {
SessionConfigs ts = super.buildSessionsXML(dbwsSessionsStream, builder);
String dataSource = builder.getDataSource();
if (dataSource != null) {
DatabaseSessionConfig tmpConfig = (DatabaseSessionConfig) ts.getSessionConfigs().firstElement();
ProjectConfig orProject = tmpConfig.getPrimaryProject();
LogConfig logConfig = tmpConfig.getLogConfig();
String sessionName = tmpConfig.getName();
DatabaseSessionConfig orSessionConfig = new ServerSessionConfig();
orSessionConfig.setPrimaryProject(orProject);
orSessionConfig.setName(sessionName);
orSessionConfig.setLogConfig(logConfig);
CustomServerPlatformConfig customServerPlatformConfig = new CustomServerPlatformConfig();
customServerPlatformConfig.setEnableJTA(true);
customServerPlatformConfig.setEnableRuntimeServices(true);
customServerPlatformConfig.setServerClassName("org.eclipse.persistence.platform.server.jboss.JBossPlatform");
customServerPlatformConfig.setExternalTransactionControllerClass("org.eclipse.persistence.transaction.jboss.JBossTransactionController");
orSessionConfig.setServerPlatformConfig(customServerPlatformConfig);
DatabaseLoginConfig dlc = new DatabaseLoginConfig();
dlc.setPlatformClass(builder.getPlatformClassname());
dlc.setExternalConnectionPooling(true);
dlc.setExternalTransactionController(true);
dlc.setDatasource(dataSource);
dlc.setLookupType(JNDIConnector.STRING_LOOKUP);
dlc.setBindAllParameters(true);
dlc.setStreamsForBinding(true);
orSessionConfig.setLoginConfig(dlc);
ts.getSessionConfigs().set(0, orSessionConfig);
}
return ts;
}
use of org.eclipse.persistence.internal.sessions.factories.model.platform.CustomServerPlatformConfig in project eclipselink by eclipse-ee4j.
the class WebSpherePackager method buildSessionsXML.
@Override
public SessionConfigs buildSessionsXML(OutputStream dbwsSessionsStream, DBWSBuilder builder) {
SessionConfigs ts = super.buildSessionsXML(dbwsSessionsStream, builder);
String dataSource = builder.getDataSource();
if (dataSource != null) {
DatabaseSessionConfig tmpConfig = (DatabaseSessionConfig) ts.getSessionConfigs().firstElement();
ProjectConfig orProject = tmpConfig.getPrimaryProject();
LogConfig logConfig = tmpConfig.getLogConfig();
String sessionName = tmpConfig.getName();
DatabaseSessionConfig orSessionConfig = new ServerSessionConfig();
orSessionConfig.setPrimaryProject(orProject);
orSessionConfig.setName(sessionName);
orSessionConfig.setLogConfig(logConfig);
CustomServerPlatformConfig customServerPlatformConfig = new CustomServerPlatformConfig();
customServerPlatformConfig.setEnableJTA(true);
customServerPlatformConfig.setEnableRuntimeServices(true);
customServerPlatformConfig.setServerClassName("org.eclipse.persistence.platform.server.was.WebSphere_7_Platform");
customServerPlatformConfig.setExternalTransactionControllerClass("org.eclipse.persistence.transaction.was.WebSphereTransactionController");
orSessionConfig.setServerPlatformConfig(customServerPlatformConfig);
DatabaseLoginConfig dlc = new DatabaseLoginConfig();
dlc.setPlatformClass(builder.getPlatformClassname());
dlc.setExternalConnectionPooling(true);
dlc.setExternalTransactionController(true);
dlc.setDatasource(dataSource);
dlc.setBindAllParameters(true);
dlc.setStreamsForBinding(true);
orSessionConfig.setLoginConfig(dlc);
ts.getSessionConfigs().set(0, orSessionConfig);
}
return ts;
}
use of org.eclipse.persistence.internal.sessions.factories.model.platform.CustomServerPlatformConfig in project eclipselink by eclipse-ee4j.
the class SessionsXMLSchemaWriteTest method setup.
@Override
protected void setup() throws Exception {
m_resource = new File("XMLSchemaWriteTest.xml");
SessionConfigs sessions = new SessionConfigs();
DatabaseSessionConfig dbSessionConfig = new DatabaseSessionConfig();
// Exception handler class
dbSessionConfig.setExceptionHandlerClass("handlerClass");
// CustomServerPlatformConfid & External transaction controller
CustomServerPlatformConfig platformConfig = new CustomServerPlatformConfig();
platformConfig.setExternalTransactionControllerClass("externalTransactionController");
dbSessionConfig.setServerPlatformConfig(platformConfig);
// Log config
DefaultSessionLogConfig logConfig = new DefaultSessionLogConfig();
logConfig.setLogLevel("severe");
logConfig.setFilename("logfile");
dbSessionConfig.setLogConfig(logConfig);
// Login
DatabaseLoginConfig loginConfig = new DatabaseLoginConfig();
loginConfig.setBatchWriting(true);
loginConfig.setBindAllParameters(true);
loginConfig.setByteArrayBinding(false);
loginConfig.setCacheAllStatements(false);
loginConfig.setConnectionURL("jdbc:oracle:thin:@otl-ora8infmx73:1521:toplinkj");
loginConfig.setDriverClass("oracle.jdbc.OracleDriver");
loginConfig.setExternalConnectionPooling(false);
loginConfig.setExternalTransactionController(false);
loginConfig.setForceFieldNamesToUppercase(false);
loginConfig.setJdbcBatchWriting(false);
loginConfig.setMaxBatchWritingSize(5);
loginConfig.setNativeSequencing(false);
loginConfig.setNativeSQL(false);
loginConfig.setOptimizeDataConversion(true);
loginConfig.setPassword("password");
loginConfig.setPlatformClass("platform");
loginConfig.setSequenceCounterField("SEQ_COUNT");
loginConfig.setSequenceNameField("SEQ_NAME");
loginConfig.setSequencePreallocationSize(99);
loginConfig.setSequenceTable("\"SEQUENCE\"");
loginConfig.setStreamsForBinding(false);
loginConfig.setStringBinding(false);
loginConfig.setTableQualifier("table:");
loginConfig.setTrimStrings(true);
loginConfig.setUsername("tljtest1");
dbSessionConfig.setLoginConfig(loginConfig);
// Name
dbSessionConfig.setName("EmployeeSession");
// Profiler
dbSessionConfig.setProfiler("toplink");
// Primary project
ProjectClassConfig projectConfig = new ProjectClassConfig();
projectConfig.setProjectString("org.eclipse.persistence.demos.employee.relational.EmployeeProject");
dbSessionConfig.setPrimaryProject(projectConfig);
// Remote command manager
RemoteCommandManagerConfig rcmConfig = new RemoteCommandManagerConfig();
rcmConfig.setChannel("new_channel");
// Transport Manager
JMSTopicTransportManagerConfig transportConfig = new JMSTopicTransportManagerConfig();
transportConfig.setOnConnectionError("KeepConnection");
transportConfig.setTopicHostURL("ormi://jms_topic_host");
transportConfig.setTopicConnectionFactoryName("test-topic-connection-factory-name");
transportConfig.setTopicName("test-topic-name");
// Naming
JNDINamingServiceConfig namingConfig = new JNDINamingServiceConfig();
namingConfig.setURL("new_jndi_url");
namingConfig.setUsername("guy");
namingConfig.setPassword("password");
namingConfig.setInitialContextFactoryName("new_initial_context_factory_name");
Vector props = new Vector();
PropertyConfig one = new PropertyConfig();
one.setName("name1");
one.setValue("value1");
props.add(one);
PropertyConfig two = new PropertyConfig();
two.setName("name2");
two.setValue("value2");
props.add(two);
namingConfig.setPropertyConfigs(props);
transportConfig.setJNDINamingServiceConfig(namingConfig);
rcmConfig.setTransportManagerConfig(transportConfig);
dbSessionConfig.setRemoteCommandManagerConfig(rcmConfig);
// Session customizer
dbSessionConfig.setSessionCustomizerClass("sessionCustomizer");
sessions.addSessionConfig(dbSessionConfig);
ServerSessionConfig serverSessionConfig = new ServerSessionConfig();
serverSessionConfig.setPoolsConfig(new PoolsConfig());
ReadConnectionPoolConfig readPool = new ReadConnectionPoolConfig();
readPool.setMaxConnections(2);
readPool.setMinConnections(2);
serverSessionConfig.getPoolsConfig().setReadConnectionPoolConfig(readPool);
WriteConnectionPoolConfig writePool = new WriteConnectionPoolConfig();
writePool.setMaxConnections(10);
writePool.setMinConnections(5);
serverSessionConfig.getPoolsConfig().setWriteConnectionPoolConfig(writePool);
WriteConnectionPoolConfig userPool = new WriteConnectionPoolConfig();
userPool.setMaxConnections(5);
userPool.setMinConnections(0);
serverSessionConfig.getPoolsConfig().addConnectionPoolConfig(userPool);
sessions.addSessionConfig(serverSessionConfig);
FileWriter writer = new FileWriter(m_resource);
XMLSessionConfigWriter.write(sessions, writer);
writer.close();
}
Aggregations