teiid SVN: r1508 - trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap.
by teiid-commits@lists.jboss.org
Author: jdoyle
Date: 2009-09-30 14:47:20 -0400 (Wed, 30 Sep 2009)
New Revision: 1508
Modified:
trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPRequest.java
Log:
TEIID-865
Getting SoapAction from model.
Modified: trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPRequest.java
===================================================================
--- trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPRequest.java 2009-09-30 18:33:01 UTC (rev 1507)
+++ trunk/connectors/connector-xml/src/main/java/com/metamatrix/connector/xml/soap/SOAPRequest.java 2009-09-30 18:47:20 UTC (rev 1508)
@@ -72,6 +72,14 @@
Source.class,
Service.Mode.PAYLOAD);
+ // I should be able to send no value here, but the dispatch throws an exception
+ // if soapAction == null. We allow the default "" to get sent in that case.
+ // In SOAP 1.1 we must send a SoapAction.
+ String soapAction = (String)exeInfo.getOtherProperties().get("SOAPAction");
+ if(null != soapAction) {
+ dispatch.getRequestContext().put(Dispatch.SOAPACTION_URI_PROPERTY, soapAction);
+ }
+
String requestDocument = xmlOutputter.outputString(doc);
attemptConditionalLog(requestDocument);
StringReader reader = new StringReader(requestDocument);
15 years, 2 months
teiid SVN: r1507 - in trunk: metadata/src/test/java/com/metamatrix/connector/metadata/index and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-09-30 14:33:01 -0400 (Wed, 30 Sep 2009)
New Revision: 1507
Modified:
trunk/engine/src/main/java/com/metamatrix/query/resolver/command/ExecResolver.java
trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/TestMetadataResultsPostProcessor.java
Log:
TEIID-750 cleaning up some of the visibility logic and adding a test case for resolving against only public models.
Modified: trunk/engine/src/main/java/com/metamatrix/query/resolver/command/ExecResolver.java
===================================================================
--- trunk/engine/src/main/java/com/metamatrix/query/resolver/command/ExecResolver.java 2009-09-30 18:18:30 UTC (rev 1506)
+++ trunk/engine/src/main/java/com/metamatrix/query/resolver/command/ExecResolver.java 2009-09-30 18:33:01 UTC (rev 1507)
@@ -59,7 +59,6 @@
import com.metamatrix.query.sql.symbol.ElementSymbol;
import com.metamatrix.query.sql.symbol.Expression;
import com.metamatrix.query.sql.symbol.GroupSymbol;
-import com.metamatrix.query.sql.visitor.CommandCollectorVisitor;
import com.metamatrix.query.sql.visitor.ValueIteratorProviderCollectorVisitor;
import com.metamatrix.query.util.ErrorMessageKeys;
Modified: trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/TestMetadataResultsPostProcessor.java
===================================================================
--- trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/TestMetadataResultsPostProcessor.java 2009-09-30 18:18:30 UTC (rev 1506)
+++ trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/TestMetadataResultsPostProcessor.java 2009-09-30 18:33:01 UTC (rev 1507)
@@ -25,6 +25,8 @@
import java.util.HashMap;
import java.util.Map;
+import junit.framework.TestCase;
+
import org.teiid.connector.metadata.MetadataLiteralCriteria;
import org.teiid.connector.metadata.MetadataResultsPostProcessor;
import org.teiid.connector.metadata.VdbMetadataContext;
@@ -32,8 +34,7 @@
import org.teiid.connector.metadata.runtime.ColumnRecordImpl;
import org.teiid.connector.metadata.runtime.ModelRecordImpl;
-import junit.framework.TestCase;
-
+import com.metamatrix.dqp.service.FakeVDBService;
import com.metamatrix.dqp.service.VDBService;
15 years, 2 months
teiid SVN: r1506 - in trunk: engine/src/test/java/com/metamatrix/dqp/service and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2009-09-30 14:18:30 -0400 (Wed, 30 Sep 2009)
New Revision: 1506
Removed:
trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/FakeVDBService.java
Modified:
trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/ModelVisibilityValidationVisitor.java
trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeVDBService.java
trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/TestMetadataConnectorMetadata.java
Log:
TEIID-750 cleaning up some of the visibility logic and adding a test case for resolving against only public models.
Modified: trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/ModelVisibilityValidationVisitor.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/ModelVisibilityValidationVisitor.java 2009-09-30 17:01:20 UTC (rev 1505)
+++ trunk/engine/src/main/java/org/teiid/dqp/internal/process/validator/ModelVisibilityValidationVisitor.java 2009-09-30 18:18:30 UTC (rev 1506)
@@ -34,7 +34,6 @@
import com.metamatrix.query.function.FunctionLibrary;
import com.metamatrix.query.metadata.TempMetadataID;
import com.metamatrix.query.resolver.util.ResolverUtil;
-import com.metamatrix.query.resolver.util.ResolverUtil.ResolvedLookup;
import com.metamatrix.query.sql.lang.Command;
import com.metamatrix.query.sql.lang.Delete;
import com.metamatrix.query.sql.lang.Insert;
Modified: trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeVDBService.java
===================================================================
--- trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeVDBService.java 2009-09-30 17:01:20 UTC (rev 1505)
+++ trunk/engine/src/test/java/com/metamatrix/dqp/service/FakeVDBService.java 2009-09-30 18:18:30 UTC (rev 1506)
@@ -24,8 +24,10 @@
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -37,52 +39,16 @@
import com.metamatrix.common.application.exception.ApplicationLifecycleException;
import com.metamatrix.common.vdb.api.ModelInfo;
import com.metamatrix.common.vdb.api.VDBArchive;
+import com.metamatrix.vdb.runtime.VDBKey;
/**
*/
public class FakeVDBService extends FakeAbstractService implements VDBService {
private Map vdbsMap = new HashMap(); // VdbInfo -> Map<Model name (upper), <ModelInfo>>
private Map bindingNames = new HashMap(); // binding UUID -> binding name
+ public Collection publicFiles = new HashSet();
+ private boolean defaultPrivate;
- private static class VdbInfo {
- private final String vdbName;
- private final String vdbVersion;
-
- private final String key;
-
- public VdbInfo(String name, String version) {
- this.vdbName = name;
- this.vdbVersion = version;
- this.key = name.toUpperCase() + ":" + version; //$NON-NLS-1$
- }
-
- public String getName() {
- return this.vdbName;
- }
-
- public String getVersion() {
- return this.vdbVersion;
- }
-
- public boolean equals(Object obj) {
- if(obj == null) {
- return false;
- } else if(obj == this) {
- return true;
- } else {
- return this.key.equals(((VdbInfo)obj).key);
- }
- }
-
- public int hashCode() {
- return this.key.hashCode();
- }
-
- public String toString() {
- return vdbName + ":" + vdbVersion; //$NON-NLS-1$
- }
- }
-
private static class FakeModel {
String modelName;
boolean multiSource = false;
@@ -91,6 +57,10 @@
List bindingUUIDs = new ArrayList(); // mapped to names
}
+ public void setDefaultPrivate(boolean defaultPrivate) {
+ this.defaultPrivate = defaultPrivate;
+ }
+
/**
* Method for testing - add a model with the specified properties. The vdb will be created
* automatically under the hood.
@@ -107,7 +77,7 @@
model.multiSource = multiSource;
model.modelName = modelName;
- VdbInfo vdb = new VdbInfo(vdbName, version);
+ VDBKey vdb = new VDBKey(vdbName, version);
Map vdbModels = (Map)this.vdbsMap.get(vdb);
if(vdbModels == null) {
vdbModels = new HashMap();
@@ -131,7 +101,7 @@
FakeModel model = null;
// Find existing model
- VdbInfo vdb = new VdbInfo(vdbName, version);
+ VDBKey vdb = new VDBKey(vdbName, version);
Map vdbModels = (Map)this.vdbsMap.get(vdb);
if(vdbModels != null) {
model = (FakeModel) vdbModels.get(modelName.toUpperCase());
@@ -158,14 +128,14 @@
* @see com.metamatrix.dqp.service.VDBService#isActiveVDB(java.lang.String, java.lang.String)
*/
public boolean isActiveVDB(String vdbName, String vdbVersion) {
- return vdbsMap.containsKey(new VdbInfo(vdbName, vdbVersion));
+ return vdbsMap.containsKey(new VDBKey(vdbName, vdbVersion));
}
/* (non-Javadoc)
* @see com.metamatrix.dqp.service.VDBService#getConnectorBinding(java.lang.String, java.lang.String, java.lang.String)
*/
public List getConnectorBindingNames(String vdbName, String vdbVersion, String modelName) {
- VdbInfo vdb = new VdbInfo(vdbName, vdbVersion);
+ VDBKey vdb = new VDBKey(vdbName, vdbVersion);
Map vdbModels = (Map)this.vdbsMap.get(vdb);
if(vdbModels != null) {
FakeModel model = (FakeModel) vdbModels.get(modelName.toUpperCase());
@@ -187,7 +157,7 @@
* @see com.metamatrix.dqp.service.VDBService#getModelVisibility(java.lang.String, java.lang.String, java.lang.String)
*/
public int getModelVisibility(String vdbName, String vdbVersion, String modelName) {
- VdbInfo vdb = new VdbInfo(vdbName, vdbVersion);
+ VDBKey vdb = new VDBKey(vdbName, vdbVersion);
Map vdbModels = (Map)this.vdbsMap.get(vdb);
if(vdbModels != null) {
FakeModel model = (FakeModel) vdbModels.get(modelName.toUpperCase());
@@ -195,7 +165,9 @@
return model.visibility;
}
}
-
+ if (defaultPrivate) {
+ return ModelInfo.PRIVATE;
+ }
return ModelInfo.PUBLIC;
}
@@ -204,7 +176,10 @@
* @since 4.2
*/
public int getFileVisibility(String vdbName, String vdbVersion, String pathInVDB) throws MetaMatrixComponentException {
- return ModelInfo.PUBLIC;
+ if(this.publicFiles.contains(pathInVDB)) {
+ return ModelInfo.PUBLIC;
+ }
+ return ModelInfo.PRIVATE;
}
/* (non-Javadoc)
@@ -240,7 +215,7 @@
public List getMultiSourceModels(String vdbName,
String vdbVersion) throws MetaMatrixComponentException {
- VdbInfo vdb = new VdbInfo(vdbName, vdbVersion);
+ VDBKey vdb = new VDBKey(vdbName, vdbVersion);
Map vdbModels = (Map)this.vdbsMap.get(vdb);
if(vdbModels != null) {
List multiModels = new ArrayList();
Modified: trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2009-09-30 17:01:20 UTC (rev 1505)
+++ trunk/engine/src/test/java/org/teiid/dqp/internal/process/TestDQPCore.java 2009-09-30 18:18:30 UTC (rev 1506)
@@ -80,8 +80,8 @@
env.bindService(DQPServiceNames.DATA_SERVICE, new AutoGenDataService());
env.bindService(DQPServiceNames.TRANSACTION_SERVICE, new FakeTransactionService());
FakeVDBService vdbService = new FakeVDBService();
+ vdbService.setDefaultPrivate(true);
vdbService.addBinding(vdbName, vdbVersion, "BQT1", "mmuuid:blah", "BQT"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- vdbService.addBinding(vdbName, vdbVersion, "BQT2", "mmuuid:blah", "BQT"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
vdbService.addBinding(vdbName, vdbVersion, "BQT3", "mmuuid:blah", "BQT"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
vdbService.addModel(vdbName, vdbVersion, "BQT3", ModelInfo.PRIVATE, false); //$NON-NLS-1$
env.bindService(DQPServiceNames.VDB_SERVICE, vdbService);
@@ -247,6 +247,10 @@
helpTestVisibilityFails(xquery);
}
+ @Test public void testResolvingVisibility() throws Exception {
+ String sql = "SELECT * FROM SmallA"; //$NON-NLS-1$
+ helpExecute(sql, "a"); //$NON-NLS-1$
+ }
///////////////////////////Helper method///////////////////////////////////
private ResultsMessage helpExecute(String sql, String userName) throws Exception {
Deleted: trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/FakeVDBService.java
===================================================================
--- trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/FakeVDBService.java 2009-09-30 17:01:20 UTC (rev 1505)
+++ trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/FakeVDBService.java 2009-09-30 18:18:30 UTC (rev 1506)
@@ -1,171 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.connector.metadata.index;
-
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-
-import com.metamatrix.api.exception.MetaMatrixComponentException;
-import com.metamatrix.common.application.ApplicationEnvironment;
-import com.metamatrix.common.application.exception.ApplicationInitializationException;
-import com.metamatrix.common.application.exception.ApplicationLifecycleException;
-import com.metamatrix.common.vdb.api.ModelInfo;
-import com.metamatrix.common.vdb.api.VDBArchive;
-import com.metamatrix.dqp.service.VDBService;
-
-
-/**
- * @since 4.3
- */
-public class FakeVDBService implements
- VDBService {
- public Collection publicModels = new HashSet();
-
- public Collection publicFiles = new HashSet();
-
- /**
- * @see com.metamatrix.dqp.service.VDBService#getConnectorBindingNames(java.lang.String, java.lang.String, java.lang.String)
- * @since 4.3
- */
- public List getConnectorBindingNames(String vdbName,
- String vdbVersion,
- String modelName) throws MetaMatrixComponentException {
- return null;
- }
-
- /**
- * @see com.metamatrix.dqp.service.VDBService#getModelVisibility(java.lang.String, java.lang.String, java.lang.String)
- * @since 4.3
- */
- public int getModelVisibility(String vdbName,
- String vdbVersion,
- String modelName) throws MetaMatrixComponentException {
- if(this.publicModels.contains(modelName)) {
- return ModelInfo.PUBLIC;
- }
- return ModelInfo.PRIVATE;
- }
-
- /**
- * @see com.metamatrix.dqp.service.VDBService#getFileVisibility(java.lang.String, java.lang.String, java.lang.String)
- * @since 4.3
- */
- public int getFileVisibility(String vdbName,
- String vdbVersion,
- String pathInVDB) throws MetaMatrixComponentException {
- if(this.publicFiles.contains(pathInVDB)) {
- return ModelInfo.PUBLIC;
- }
- return ModelInfo.PRIVATE;
- }
-
- /**
- * @see com.metamatrix.dqp.service.VDBService#getVDBResource(java.lang.String, java.lang.String)
- * @since 4.3
- */
- public InputStream getVDBResource(String vdbName,
- String vdbVersion) throws MetaMatrixComponentException {
- return null;
- }
-
- /**
- * @see com.metamatrix.dqp.service.VDBService#getMultiSourceModels(java.lang.String, java.lang.String)
- * @since 4.3
- */
- public List getMultiSourceModels(String vdbName,
- String vdbVersion) throws MetaMatrixComponentException {
- return null;
- }
-
-
- /**
- * @see com.metamatrix.dqp.service.VDBService#getAvailableVDBs()
- * @since 4.3
- */
- public List getAvailableVDBs() throws MetaMatrixComponentException {
- return null;
- }
-
- /**
- * @see com.metamatrix.dqp.service.VDBService#getVDBStatus(java.lang.String, java.lang.String)
- * @since 4.3
- */
- public int getVDBStatus(String vdbName,
- String vdbVersion) throws MetaMatrixComponentException {
- return 0;
- }
-
- /**
- * @see com.metamatrix.dqp.service.VDBService#changeVDBStatus(java.lang.String, java.lang.String, int)
- * @since 4.3
- */
- public void changeVDBStatus(String vdbName,
- String vdbVersion,
- int status) throws ApplicationLifecycleException,
- MetaMatrixComponentException {
- }
-
- /**
- * @see com.metamatrix.dqp.service.VDBService#getConnectorName(java.lang.String)
- * @since 4.3
- */
- public String getConnectorName(String connectorBindingID) {
- return null;
- }
-
- /**
- * @see com.metamatrix.common.application.ApplicationService#initialize(java.util.Properties)
- * @since 4.3
- */
- public void initialize(Properties props) throws ApplicationInitializationException {
- }
-
- /**
- * @see com.metamatrix.common.application.ApplicationService#start(com.metamatrix.common.application.ApplicationEnvironment)
- * @since 4.3
- */
- public void start(ApplicationEnvironment environment) throws ApplicationLifecycleException {
- }
-
- /**
- * @see com.metamatrix.common.application.ApplicationService#stop()
- * @since 4.3
- */
- public void stop() throws ApplicationLifecycleException {
- }
-
- @Override
- public String getActiveVDBVersion(String vdbName, String vdbVersion) {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public VDBArchive getVDB(String vdbName, String vdbVersion)
- throws MetaMatrixComponentException {
- throw new UnsupportedOperationException();
- }
-
-}
Modified: trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/TestMetadataConnectorMetadata.java
===================================================================
--- trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/TestMetadataConnectorMetadata.java 2009-09-30 17:01:20 UTC (rev 1505)
+++ trunk/metadata/src/test/java/com/metamatrix/connector/metadata/index/TestMetadataConnectorMetadata.java 2009-09-30 18:18:30 UTC (rev 1506)
@@ -28,6 +28,8 @@
import java.util.HashMap;
import java.util.Map;
+import junit.framework.TestCase;
+
import org.teiid.connector.metadata.FileRecordImpl;
import org.teiid.connector.metadata.MetadataConnectorMetadata;
import org.teiid.connector.metadata.MetadataLiteralCriteria;
@@ -39,10 +41,10 @@
import org.teiid.metadata.index.IndexConstants;
import org.teiid.metadata.index.IndexMetadataStore;
-import junit.framework.TestCase;
-
+import com.metamatrix.common.vdb.api.ModelInfo;
import com.metamatrix.common.vdb.api.VDBArchive;
import com.metamatrix.core.util.UnitTestUtil;
+import com.metamatrix.dqp.service.FakeVDBService;
import com.metamatrix.dqp.service.VDBService;
import com.metamatrix.metadata.runtime.api.MetadataSource;
@@ -78,13 +80,15 @@
return new MetadataConnectorMetadata(context, new CompositeMetadataStore(Arrays.asList(composite), source));
}
- public VDBService helpGetVdbService() {
- return new FakeVDBService();
+ public FakeVDBService helpGetVdbService() {
+ FakeVDBService vdbService = new FakeVDBService();
+ vdbService.setDefaultPrivate(true);
+ return vdbService;
}
public void testGetFileRecords() throws Exception {
String entityPath = "/parts/partsmd/PartsSupplier.xmi"; //$NON-NLS-1$
- FakeVDBService service = (FakeVDBService) helpGetVdbService();
+ FakeVDBService service = helpGetVdbService();
service.publicFiles.add(entityPath);
MetadataLiteralCriteria literalcriteria = new MetadataLiteralCriteria(FileRecordImpl.MetadataMethodNames.PATH_IN_VDB_FIELD, entityPath);
Map criteria = new HashMap();
@@ -97,8 +101,8 @@
public void testGetPublicModelRecords() throws Exception {
String modelName = "PartsSupplier"; //$NON-NLS-1$
- FakeVDBService service = (FakeVDBService) helpGetVdbService();
- service.publicModels.add(modelName);
+ FakeVDBService service = helpGetVdbService();
+ service.addModel(TEST_VDB_NAME, TEST_VDB_VERSION, modelName, ModelInfo.PUBLIC, false);
MetadataLiteralCriteria literalcriteria = new MetadataLiteralCriteria(AbstractMetadataRecord.MetadataFieldNames.FULL_NAME_FIELD, modelName);
Map criteria = new HashMap();
criteria.put(AbstractMetadataRecord.MetadataFieldNames.FULL_NAME_FIELD.toUpperCase(), literalcriteria);
@@ -112,7 +116,7 @@
public void testGetPrivateModelRecords() throws Exception {
String modelName = "PartsSupplier"; //$NON-NLS-1$
- FakeVDBService service = (FakeVDBService) helpGetVdbService();
+ FakeVDBService service = helpGetVdbService();
//service.publicModels.add(modelName);
MetadataLiteralCriteria literalcriteria = new MetadataLiteralCriteria(AbstractMetadataRecord.MetadataFieldNames.FULL_NAME_FIELD, modelName);
Map criteria = new HashMap();
@@ -126,7 +130,7 @@
}
public void testGetWrappedVdbRecords() throws Exception {
- FakeVDBService service = (FakeVDBService) helpGetVdbService();
+ FakeVDBService service = helpGetVdbService();
Map criteria = new HashMap();
MetadataConnectorMetadata metadata = helpGetMetadata(TEST_FILE_NAME, TEST_VDB_NAME, TEST_VDB_VERSION, service);
Collection records = metadata.getObjects(IndexConstants.INDEX_NAME.VDBS_INDEX, criteria);
@@ -138,8 +142,8 @@
public void testGetRecordsWithFalseCriteria() throws Exception {
String modelName = "PartsSupplier"; //$NON-NLS-1$
- FakeVDBService service = (FakeVDBService) helpGetVdbService();
- service.publicModels.add(modelName);
+ FakeVDBService service = helpGetVdbService();
+ service.addModel(TEST_VDB_NAME, TEST_VDB_VERSION, modelName, ModelInfo.PUBLIC, false);
MetadataLiteralCriteria literalcriteria = new MetadataLiteralCriteria(AbstractMetadataRecord.MetadataFieldNames.FULL_NAME_FIELD, modelName);
literalcriteria.setFieldFunction("UPPER"); //$NON-NLS-1$
Map criteria = new HashMap();
15 years, 2 months
teiid SVN: r1505 - in trunk/test-integration/db/src/main/resources/datasources: mysql and 4 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-30 13:01:20 -0400 (Wed, 30 Sep 2009)
New Revision: 1505
Modified:
trunk/test-integration/db/src/main/resources/datasources/derby/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties
Log:
Teiid 773 - changes to properties names for correct case sensitive
Modified: trunk/test-integration/db/src/main/resources/datasources/derby/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/derby/example_connection.properties 2009-09-30 16:47:23 UTC (rev 1504)
+++ trunk/test-integration/db/src/main/resources/datasources/derby/example_connection.properties 2009-09-30 17:01:20 UTC (rev 1505)
@@ -9,9 +9,9 @@
User=
Password=
-servername=localhost
-databasename=(databasename)
-portnumber=1527
+ServerName=localhost
+SatabaseNMame=(databasename)
+PortNumber=1527
ds-jndiname=localhost_1527
Immutable=true
Modified: trunk/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties 2009-09-30 16:47:23 UTC (rev 1504)
+++ trunk/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties 2009-09-30 17:01:20 UTC (rev 1505)
@@ -9,9 +9,9 @@
User=
Password=
-servername=(servername)
-databasename=(databasename)
-portnumber=3306
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=3306
ds-jndiname=mysql_3306
Immutable=true
Modified: trunk/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties 2009-09-30 16:47:23 UTC (rev 1504)
+++ trunk/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties 2009-09-30 17:01:20 UTC (rev 1505)
@@ -9,9 +9,9 @@
User=
Password=
-servername=(servername)
-databasename=(databasename)
-portnumber=1527
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=1527
ds-jndiname=(servername)_1527
Immutable=true
Modified: trunk/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties 2009-09-30 16:47:23 UTC (rev 1504)
+++ trunk/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties 2009-09-30 17:01:20 UTC (rev 1505)
@@ -9,9 +9,9 @@
User=
Password=
-servername=(servername)
-databasename=(databasename)
-portnumber=5432
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=5432
ds-jndiname=(servername)_5432
Immutable=true
Modified: trunk/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties 2009-09-30 16:47:23 UTC (rev 1504)
+++ trunk/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties 2009-09-30 17:01:20 UTC (rev 1505)
@@ -9,9 +9,9 @@
User=
Password=
-servername=(servername)
-databasename=(databasename)
-portnumber=1433
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=1433
ds-jndiname=microsoft_1433
Immutable=true
Modified: trunk/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties 2009-09-30 16:47:23 UTC (rev 1504)
+++ trunk/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties 2009-09-30 17:01:20 UTC (rev 1505)
@@ -9,9 +9,9 @@
User=
Password=
-servername=(servername)
-databasename=(databasename)
-portnumber=3306
+ServerName=(servername)
+DatabaseName=(databasename)
+PortNumber=3306
ds-jndiname=microsoft_3306
Immutable=true
15 years, 2 months
teiid SVN: r1504 - trunk/test-integration/db/src/test/java/org/teiid/test/testcases.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-30 12:47:23 -0400 (Wed, 30 Sep 2009)
New Revision: 1504
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
Log:
Teiid 773 - cleanup
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java 2009-09-30 16:34:39 UTC (rev 1503)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java 2009-09-30 16:47:23 UTC (rev 1504)
@@ -27,7 +27,7 @@
protected void setUp() throws Exception {
super.setUp();
- this.addProperty(ConfigPropertyNames.USE_DATASOURCES_PROP, "oracle,sqlserver");
+// this.addProperty(ConfigPropertyNames.USE_DATASOURCES_PROP, "oracle,sqlserver");
this.addProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
15 years, 2 months
teiid SVN: r1503 - trunk/test-integration/db/src/main/resources.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-30 12:34:39 -0400 (Wed, 30 Sep 2009)
New Revision: 1503
Modified:
trunk/test-integration/db/src/main/resources/default-config.properties
trunk/test-integration/db/src/main/resources/xa-config.properties
Log:
Teiid 773 - changed the following:
- the testcase will not use system property to pass in overrides/additions to the loaded config.properties file. Now will use an addProperty() method provided on the abstract testcase that will apply the properties per test.
- remove the datasource_mapping.xml. There is no need to distinquish between xa and nonxa connector types. The connector type will be specified in the connection.properties file.
- if using the -DuserDataSources property to control datasource, it will imply order based on whats specified. The config.properties file will now map the model to order (i.e., pm1:1), where this order determines which datasource it will correspond to based on the userDataSources property. This mapping is done so that the nightly testing process can control which datasources are being used and can ensure retestability.
Modified: trunk/test-integration/db/src/main/resources/default-config.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/default-config.properties 2009-09-30 16:25:50 UTC (rev 1502)
+++ trunk/test-integration/db/src/main/resources/default-config.properties 2009-09-30 16:34:39 UTC (rev 1503)
@@ -21,9 +21,9 @@
URL=jdbc:metamatrix:Transaction@target/classes/transactions/transaction.properties;user=admin;password=teiid
User=admin
Password=teiid
-databasename=Transaction
-servername=target/classes/transactions/transaction.properties
-portnumber=0
+DatabaseName=Transaction
+ServerName=target/classes/transactions/transaction.properties
+PortNumber=0
application-name=txn-test
# jboss
Modified: trunk/test-integration/db/src/main/resources/xa-config.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/xa-config.properties 2009-09-30 16:25:50 UTC (rev 1502)
+++ trunk/test-integration/db/src/main/resources/xa-config.properties 2009-09-30 16:34:39 UTC (rev 1503)
@@ -18,9 +18,9 @@
URL=jdbc:metamatrix:Transaction@target/classes/transactions/transaction.properties;user=admin;password=teiid
User=admin
Password=teiid
-databasename=Transaction
-servername=target/classes/transactions/transaction.properties
-portnumber=0
+DatabaseName=Transaction
+ServerName=target/classes/transactions/transaction.properties
+PortNumber=0
application-name=txn-test
# jboss
15 years, 2 months
teiid SVN: r1502 - trunk/test-integration/db/src/main/java/org/teiid/test/framework.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-30 12:25:50 -0400 (Wed, 30 Sep 2009)
New Revision: 1502
Removed:
trunk/test-integration/db/src/main/java/org/teiid/test/framework/DataSourceSetup.java
Log:
Teiid 773 - changed the following:
- the testcase will not use system property to pass in overrides/additions to the loaded config.properties file. Now will use an addProperty() method provided on the abstract testcase that will apply the properties per test.
- remove the datasource_mapping.xml. There is no need to distinquish between xa and nonxa connector types. The connector type will be specified in the connection.properties file.
- if using the -DuserDataSources property to control datasource, it will imply order based on whats specified. The config.properties file will now map the model to order (i.e., pm1:1), where this order determines which datasource it will correspond to based on the userDataSources property. This mapping is done so that the nightly testing process can control which datasources are being used and can ensure retestability.
Deleted: trunk/test-integration/db/src/main/java/org/teiid/test/framework/DataSourceSetup.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/framework/DataSourceSetup.java 2009-09-30 16:09:30 UTC (rev 1501)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/framework/DataSourceSetup.java 2009-09-30 16:25:50 UTC (rev 1502)
@@ -1,11 +0,0 @@
-package org.teiid.test.framework;
-
-public interface DataSourceSetup {
-
-
- void setup() throws Exception;
-
-
- int getDataSourceCnt();
-
-}
15 years, 2 months
teiid SVN: r1501 - in trunk/test-integration/db/src/main/resources: datasources and 6 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-30 12:09:30 -0400 (Wed, 30 Sep 2009)
New Revision: 1501
Removed:
trunk/test-integration/db/src/main/resources/datasources/datasource_mapping.xml
Modified:
trunk/test-integration/db/src/main/resources/datasources/derby/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties
trunk/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties
trunk/test-integration/db/src/main/resources/default-config.properties
trunk/test-integration/db/src/main/resources/xa-config.properties
Log:
Teiid 773 - changed the following:
- the testcase will not use system property to pass in overrides/additions to the loaded config.properties file. Now will use an addProperty() method provided on the abstract testcase that will apply the properties per test.
- remove the datasource_mapping.xml. There is no need to distinquish between xa and nonxa connector types. The connector type will be specified in the connection.properties file.
- if using the -DuserDataSources property to control datasource, it will imply order based on whats specified. The config.properties file will now map the model to order (i.e., pm1:1), where this order determines which datasource it will correspond to based on the userDataSources property. This mapping is done so that the nightly testing process can control which datasources are being used and can ensure retestability.
Deleted: trunk/test-integration/db/src/main/resources/datasources/datasource_mapping.xml
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/datasource_mapping.xml 2009-09-30 16:08:14 UTC (rev 1500)
+++ trunk/test-integration/db/src/main/resources/datasources/datasource_mapping.xml 2009-09-30 16:09:30 UTC (rev 1501)
@@ -1,86 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- ======================================================================
- Aug 26, 2009 9:05:03 AM
-
- description: This datasource configuration file is used to define the
- different datasources that "may be" used during test execution.
- I say may be used, because these are all the types that are supported
- by Teiid, but only if the defined "dir" exist under the "datasources"
- directory that contains a connection.properties file will it actually be used.
-
- The organization of the datasources splits them between groups XA and Non-XA
- related transactional types so that when a test is run the process will obtain
- a connection from a datasoure defined for that group.
-
- To use a datasource(s) in a test, map the model(s) to a datasource indicated here.
- The mapping is done in the configuration properties file (see default-config.properties).
-
- This configuration specifies the following information:
- - It indicates the location ("dir") to find the datasource connection
- information that is used to populate the connector bindings and create
- direct connections to the source.
-
- - It provides a mapping to the Connector Type that needs
- to be specified when deploying the ConnectorBinding and assigning it to
- the mapped model (see default.config.properties)
-
- NOTE: the name of datasource must be unique across all datasources in the file
-
- vanhalbert
- ====================================================================== -->
-
-<datasourceconfig>
- <datasourcetype name="nonxa">
- <datasource name="ds_mysql">
- <property name="dir">mysql</property>
- <property name="connectortype">MySQL JDBC Connector</property>
- </datasource>
- <datasource name="ds_oracle">
- <property name="dir">oracle</property>
- <property name="connectortype">Oracle Connector</property>
- </datasource>
- <datasource name="ds_sqlserver">
- <property name="dir">sqlserver</property>
- <property name="connectortype">SQL Server Connector</property>
- </datasource>
- <datasource name="ds_db2">
- <property name="dir">db2</property>
- <property name="connectortype">DB2 Connector</property>
- </datasource>
- <datasource name="ds_postgres">
- <property name="dir">postgres</property>
- <property name="connectortype">PostgreSQL JDBC Connector</property>
- </datasource>
-
- <datasource name="ds_derby">
- <property name="dir">derby</property>
- <property name="connectortype">Apache Derby Network Connector</property>
- </datasource>
-
- </datasourcetype>
-
- <datasourcetype name="xa">
- <datasource name="ds_mysql_xa">
- <property name="dir">mysql</property>
- <property name="connectortype">MySQL JDBC XA Connector</property>
- </datasource>
- <datasource name="ds_oracle_xa">
- <property name="dir">oracle</property>
- <property name="connectortype">Oracle XA Connector</property>
- </datasource>
- <datasource name="ds_sqlserve_xa">
- <property name="dir">sqlserver</property>
- <property name="connectortype">SQL Server XA Connector</property>
- </datasource>
- <datasource name="ds_db2_xa">
- <property name="dir">db2</property>
- <property name="connectortype">DB2 XA Connector</property>
- </datasource>
- <datasource name="ds_postgres_xa">
- <property name="dir">postgres</property>
- <property name="connectortype">PostgreSQL XA JDBC Connector</property>
- </datasource>
-
- </datasourcetype>
-
-</datasourceconfig>
\ No newline at end of file
Modified: trunk/test-integration/db/src/main/resources/datasources/derby/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/derby/example_connection.properties 2009-09-30 16:08:14 UTC (rev 1500)
+++ trunk/test-integration/db/src/main/resources/datasources/derby/example_connection.properties 2009-09-30 16:09:30 UTC (rev 1501)
@@ -1,4 +1,9 @@
+# db.type must match a ddl folder
db.type=derby
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=Apache Derby Network XA Connector
+
+
driver=org.apache.derby.jdbc.ClientDriver
URL=jdbc:derby://localhost:1527//(derbyinstallloc)
User=
Modified: trunk/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties 2009-09-30 16:08:14 UTC (rev 1500)
+++ trunk/test-integration/db/src/main/resources/datasources/mysql/example_connection.properties 2009-09-30 16:09:30 UTC (rev 1501)
@@ -1,5 +1,9 @@
-# db.type must match a ddl folder and it also represents the ANT sql datatype used during execution
+# db.type must match a ddl folder
db.type=mysql
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=MySQL JDBC XA Connector
+
+
driver=com.mysql.jdbc.Driver
URL=jdbc:mysql://(servername):3306/(databasename)
User=
Modified: trunk/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties 2009-09-30 16:08:14 UTC (rev 1500)
+++ trunk/test-integration/db/src/main/resources/datasources/oracle/example_connection.properties 2009-09-30 16:09:30 UTC (rev 1501)
@@ -1,5 +1,9 @@
# db.type must match a ddl folder
db.type=oracle
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=Oracle XA Connector
+
+
driver=oracle.jdbc.OracleDriver
URL=jdbc:oracle:thin:@(servername):1521:(sid)
User=
Modified: trunk/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties 2009-09-30 16:08:14 UTC (rev 1500)
+++ trunk/test-integration/db/src/main/resources/datasources/postgres/example_connection.properties 2009-09-30 16:09:30 UTC (rev 1501)
@@ -1,5 +1,9 @@
# db.type must match a ddl folder
db.type=postgres
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=PostgreSQL XA JDBC Connector
+
+
driver=org.postgresql.Driver
URL=jdbc:postgresql://(servername):5432/(databasename)
User=
Modified: trunk/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties 2009-09-30 16:08:14 UTC (rev 1500)
+++ trunk/test-integration/db/src/main/resources/datasources/sqlserver/example_connection.properties 2009-09-30 16:09:30 UTC (rev 1501)
@@ -1,5 +1,9 @@
# db.type must match a ddl folder
db.type=sqlserver
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectortype=SQL Server XA Connector
+
+
driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
URL=jdbc:sqlserver://(servername):1433;databaseName=(databasename)
User=
Modified: trunk/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties 2009-09-30 16:08:14 UTC (rev 1500)
+++ trunk/test-integration/db/src/main/resources/datasources/sybase/example_connection.properties 2009-09-30 16:09:30 UTC (rev 1501)
@@ -1,5 +1,9 @@
# db.type must match a ddl folder
db.type=sybase
+# db.connectortype must match a connector type defined in the configuration.xml
+db.connectorytype=
+
+
driver=com.mysql.jdbc.Driver
URL=jdbc:mysql://(servername):3306/(databasename)
User=
Modified: trunk/test-integration/db/src/main/resources/default-config.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/default-config.properties 2009-09-30 16:08:14 UTC (rev 1500)
+++ trunk/test-integration/db/src/main/resources/default-config.properties 2009-09-30 16:09:30 UTC (rev 1501)
@@ -4,7 +4,7 @@
# local, xa, jndi
-transaction-type=local
+#transaction-type=local
process-batch = 20
connector-batch = 20
@@ -34,20 +34,18 @@
mm.ds-jndiname=mmXA
usertxn-jndiname=java:comp/UserTransaction
-# === Mode-to-Datasource Mapping ======
-# <model>=<datasource type name>
-# This mapping will be used by the set of testcases that load this config file.
-# These mapping control what datasource is mapped to which model
+# These mappings control what datasource is mapped to which model when the -Dusedatasources=<comma seperated datasource names> option is used
+# or the system environment is set.
#
-# See the resources/datasources/datasource_mapping.xml for the available datasource type names
+# By providing the numerical order, it indicates which datasource to assign based on the order in the usedatasources property.
#
-# <datasource type name> can be the name of either a datasourcegroup or datasource
+# If -Dusedatasources is not set, then the datasource will be assigned in the order they are calling to obtain a datasource.
#
#
-pm1=nonxa
-pm2=nonxa
+pm1=1
+pm2=2
##########################################
Modified: trunk/test-integration/db/src/main/resources/xa-config.properties
===================================================================
--- trunk/test-integration/db/src/main/resources/xa-config.properties 2009-09-30 16:08:14 UTC (rev 1500)
+++ trunk/test-integration/db/src/main/resources/xa-config.properties 2009-09-30 16:09:30 UTC (rev 1501)
@@ -31,20 +31,17 @@
mm.ds-jndiname=mmXA
usertxn-jndiname=java:comp/UserTransaction
-# === Mode-to-Datasource Mapping ======
-# <model>=<datasource type name>
-
-# This mapping will be used by the set of testcases that load this config file.
-# These mapping control what datasource is mapped to which model
+# These mappings control what datasource is mapped to which model when the -Dusedatasources=<comma seperated datasource names> option is used
+# or the system environment is set.
#
-# See the resources/datasources/datasource_mapping.xml for the available datasource type names
+# By providing the numerical order, it indicates which datasource to assign based on the order in the usedatasources property.
#
-# <datasource type name> can be the name of either a datasourcegroup or datasource
+# If -Dusedatasources is not set, then the datasource will be assigned in the order they are calling to obtain a datasource.
#
#
-pm1=xa
-pm2=xa
+pm1=1
+pm2=2
##########################################
15 years, 2 months
teiid SVN: r1500 - in trunk/test-integration/db/src/test/java/org/teiid/test: framework/datasource and 1 other directories.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-30 12:08:14 -0400 (Wed, 30 Sep 2009)
New Revision: 1500
Added:
trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetup.java
Modified:
trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java
trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetupFactory.java
trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/SingleDataSourceSetup.java
trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/TwoDataSourceSetup.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java
Log:
Teiid 773 - changed the following:
- the testcase will not use system property to pass in overrides/additions to the loaded config.properties file. Now will use an addProperty() method provided on the abstract testcase that will apply the properties per test.
- remove the datasource_mapping.xml. There is no need to distinquish between xa and nonxa connector types. The connector type will be specified in the connection.properties file.
- if using the -DuserDataSources property to control datasource, it will imply order based on whats specified. The config.properties file will now map the model to order (i.e., pm1:1), where this order determines which datasource it will correspond to based on the userDataSources property. This mapping is done so that the nightly testing process can control which datasources are being used and can ensure retestability.
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java 2009-09-30 16:07:17 UTC (rev 1499)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/AbstractQueryTransactionTest.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -16,12 +16,13 @@
import javax.sql.XAConnection;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
import org.teiid.test.framework.connection.ConnectionStrategy;
import org.teiid.test.framework.connection.ConnectionUtil;
import org.teiid.test.framework.datasource.DataSource;
+import org.teiid.test.framework.datasource.DataSourceSetup;
import org.teiid.test.framework.datasource.DataSourceSetupFactory;
import org.teiid.test.framework.exception.QueryTestFailedException;
-import org.teiid.test.framework.exception.TransactionRuntimeException;
import com.metamatrix.jdbc.api.AbstractQueryTest;
@@ -40,7 +41,9 @@
protected Map<String, DataSource> datasources = null;
+ protected ConnectionStrategy connStrategy;
+
public AbstractQueryTransactionTest() {
super();
}
@@ -53,18 +56,16 @@
public String getTestName() {
return this.testname;
}
+
- /**
- * Called to set the datasources used during this test
- *
- * @since
- */
- public void setDataSources(Map<String, DataSource> datasources) {
- this.datasources = datasources;
+ @Override
+ public void setConnectionStrategy(ConnectionStrategy connStrategy) {
+ this.connStrategy = connStrategy;
+ this.datasources = this.connStrategy.getDataSources();
+
}
-
-
- public void setExecutionProperties(Properties props) {
+
+ public void setExecutionProperties(Properties props) {
assertNotNull(props);
this.executionProperties = props;
}
@@ -77,13 +78,13 @@
if (this.executionProperties != null) {
if (stmt instanceof com.metamatrix.jdbc.api.Statement) {
com.metamatrix.jdbc.api.Statement statement = (com.metamatrix.jdbc.api.Statement)stmt;
- String txnautowrap = this.executionProperties.getProperty(ConnectionStrategy.TXN_AUTO_WRAP);
+ String txnautowrap = this.executionProperties.getProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP);
if (txnautowrap != null) {
- statement.setExecutionProperty(ConnectionStrategy.TXN_AUTO_WRAP, txnautowrap);
+ statement.setExecutionProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP, txnautowrap);
}
- if (this.executionProperties.getProperty(ConnectionStrategy.FETCH_SIZE) != null) {
- statement.setExecutionProperty(ConnectionStrategy.FETCH_SIZE, this.executionProperties.getProperty(ConnectionStrategy.FETCH_SIZE));
+ if (this.executionProperties.getProperty(CONNECTION_STRATEGY_PROPS.FETCH_SIZE) != null) {
+ statement.setExecutionProperty(CONNECTION_STRATEGY_PROPS.FETCH_SIZE, this.executionProperties.getProperty(CONNECTION_STRATEGY_PROPS.FETCH_SIZE));
}
}
}
@@ -102,28 +103,26 @@
/**
* Override <code>setupDataSource</code> if there is different mechinism for
* setting up the datasources for the testcase
+ * @throws QueryTestFailedException
+ * @throws QueryTestFailedException
*
* @since
*/
@Override
- public void setupDataSources() {
- DataSourceSetup dss = null;
- try {
-
- dss = DataSourceSetupFactory.createDataSourceSetup(this.datasources);
- dss.setup();
- } catch(Exception e) {
- throw new TransactionRuntimeException(e.getMessage());
- }
+ public void setupDataSource() throws QueryTestFailedException {
+
+ DataSourceSetup dss = DataSourceSetupFactory.createDataSourceSetup(this.getNumberRequiredDataSources());
+ dss.setup(datasources, connStrategy);
+
}
public Connection getSource(String identifier) throws QueryTestFailedException {
- return ConnectionUtil.getConnection(identifier, this.datasources);
+ return ConnectionUtil.getConnection(identifier, this.datasources, this.connStrategy);
}
public XAConnection getXASource(String identifier) throws QueryTestFailedException {
- return ConnectionUtil.getXAConnection(identifier, this.datasources);
+ return ConnectionUtil.getXAConnection(identifier, this.datasources, this.connStrategy);
}
@@ -173,7 +172,7 @@
/**
- * At end of each test, perfrom any cleanup that your test requires.
+ * At end of each test, perfoom any cleanup that your test requires.
* Note: Do not cleanup any connections. That is performed by
* the {@link TransactionContainer#runTransaction(TransactionQueryTest)} at the end of the test.
*/
Copied: trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetup.java (from rev 1482, trunk/test-integration/db/src/main/java/org/teiid/test/framework/DataSourceSetup.java)
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetup.java (rev 0)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetup.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -0,0 +1,22 @@
+package org.teiid.test.framework.datasource;
+
+import java.util.Map;
+
+import org.teiid.test.framework.connection.ConnectionStrategy;
+import org.teiid.test.framework.datasource.DataSource;
+import org.teiid.test.framework.exception.QueryTestFailedException;
+
+/**
+ * The DataSourceSetup
+ * @author vanhalbert
+ *
+ */
+public interface DataSourceSetup {
+
+
+ void setup(Map<String, DataSource> datasources, ConnectionStrategy connStrategy) throws QueryTestFailedException;
+
+
+ int getDataSourceCnt();
+
+}
Property changes on: trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetup.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetupFactory.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetupFactory.java 2009-09-30 16:07:17 UTC (rev 1499)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/DataSourceSetupFactory.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -1,26 +1,23 @@
package org.teiid.test.framework.datasource;
-import java.util.Map;
+import org.teiid.test.framework.exception.TransactionRuntimeException;
-import org.teiid.test.framework.DataSourceSetup;
-import org.teiid.test.framework.exception.QueryTestFailedException;
-
public class DataSourceSetupFactory {
- public static DataSourceSetup createDataSourceSetup(Map<String, DataSource> datasources) throws QueryTestFailedException {
+ public static DataSourceSetup createDataSourceSetup(int numofsources) {
DataSourceSetup dss = null;
- switch (datasources.size()) {
+ switch (numofsources) {
case 1:
- dss = new SingleDataSourceSetup(datasources);
+ dss = new SingleDataSourceSetup();
break;
case 2:
- dss = new TwoDataSourceSetup(datasources);
+ dss = new TwoDataSourceSetup();
break;
default:
- throw new QueryTestFailedException("Number of datasources " + datasources.size() + " is not supported");
+ throw new TransactionRuntimeException("Number of datasources " + numofsources + " is not supported");
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/SingleDataSourceSetup.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/SingleDataSourceSetup.java 2009-09-30 16:07:17 UTC (rev 1499)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/SingleDataSourceSetup.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -6,9 +6,10 @@
import java.util.Map;
-import org.teiid.test.framework.DataSourceSetup;
import org.teiid.test.framework.QueryExecution;
+import org.teiid.test.framework.connection.ConnectionStrategy;
import org.teiid.test.framework.connection.ConnectionUtil;
+import org.teiid.test.framework.exception.QueryTestFailedException;
import com.metamatrix.jdbc.api.AbstractQueryTest;
@@ -18,16 +19,10 @@
* This performs the data setup for SingleSource test cases
*/
public class SingleDataSourceSetup implements DataSourceSetup {
-
- private Map ds=null;
-
- public SingleDataSourceSetup(Map datasources) {
- this.ds = datasources;
- }
-
+
@Override
- public void setup() throws Exception {
+ public void setup(Map<String, DataSource> datasources, ConnectionStrategy connStrategy) throws QueryTestFailedException {
// NOTE: dont close the connections here because in most cases they are reused
// to validate the results
// The connections will be closed at teardown
@@ -36,7 +31,7 @@
// Only one of the models are needed because pm1 and pm2 point to the same datasource
- AbstractQueryTest test1 = new QueryExecution(ConnectionUtil.getConnection("pm1", ds) ); //$NON-NLS-1$
+ AbstractQueryTest test1 = new QueryExecution(ConnectionUtil.getConnection("pm1", datasources, connStrategy) ); //$NON-NLS-1$
test1.execute("delete from g2"); //$NON-NLS-1$
test1.execute("delete from g1"); //$NON-NLS-1$
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/TwoDataSourceSetup.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/TwoDataSourceSetup.java 2009-09-30 16:07:17 UTC (rev 1499)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/framework/datasource/TwoDataSourceSetup.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -6,9 +6,10 @@
import java.util.Map;
-import org.teiid.test.framework.DataSourceSetup;
import org.teiid.test.framework.QueryExecution;
+import org.teiid.test.framework.connection.ConnectionStrategy;
import org.teiid.test.framework.connection.ConnectionUtil;
+import org.teiid.test.framework.exception.QueryTestFailedException;
import com.metamatrix.jdbc.api.AbstractQueryTest;
@@ -18,22 +19,18 @@
* This performs the data setup for SingleSource test cases
*/
public class TwoDataSourceSetup implements DataSourceSetup {
- private Map ds=null;
-
- public TwoDataSourceSetup(Map datasources) {
- this.ds = datasources;
- }
+
@Override
- public void setup() throws Exception {
+ public void setup(Map<String, DataSource> datasources, ConnectionStrategy connStrategy) throws QueryTestFailedException {
// NOTE: dont close the connections here because in most cases they are reused
// to validate the results
// The connections will be closed at teardown
System.out.println("Run TwoSource Setup...");
- AbstractQueryTest test1 = new QueryExecution(ConnectionUtil.getConnection("pm1", ds));//$NON-NLS-1$
+ AbstractQueryTest test1 = new QueryExecution(ConnectionUtil.getConnection("pm1", datasources, connStrategy));//$NON-NLS-1$
test1.execute("delete from g2"); //$NON-NLS-1$
test1.execute("delete from g1"); //$NON-NLS-1$
@@ -63,7 +60,7 @@
test1.assertRowCount(100);
- AbstractQueryTest test2 = new QueryExecution(ConnectionUtil.getConnection("pm2", ds));//$NON-NLS-1$
+ AbstractQueryTest test2 = new QueryExecution(ConnectionUtil.getConnection("pm2", datasources, connStrategy));//$NON-NLS-1$
test2.execute("delete from g2"); //$NON-NLS-1$
test2.execute("delete from g1"); //$NON-NLS-1$
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java 2009-09-30 16:07:17 UTC (rev 1499)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/BaseAbstractTransactionTestCase.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -8,34 +8,38 @@
import junit.framework.TestCase;
+import org.teiid.test.framework.ConfigPropertyLoader;
import org.teiid.test.framework.TransactionContainer;
-import org.teiid.test.framework.datasource.DataSourceMgr;
import org.teiid.test.framework.exception.QueryTestFailedException;
import org.teiid.test.framework.transaction.TransactionFactory;
public class BaseAbstractTransactionTestCase extends TestCase {
+ protected ConfigPropertyLoader config = null;
public BaseAbstractTransactionTestCase(String name) {
super(name);
}
- @Override
+
+
+ @Override
protected void setUp() throws Exception {
- DataSourceMgr.reset();
+ // TODO Auto-generated method stub
+ super.setUp();
+
+ config = ConfigPropertyLoader.createInstance();
+
}
+
+
+
+ protected void addProperty(String key, String value) {
+ config.setProperty(key, value);
+ }
protected TransactionContainer getTransactionContainter() throws QueryTestFailedException {
- return TransactionFactory.create();
- }
+ return TransactionFactory.create(config);
+ }
-
-// public Connection getSource(String identifier) throws QueryTestFailedException {
-// return ConnectionUtil.getSource(identifier);
-// }
-//
-// public XAConnection getXASource(String identifier) throws QueryTestFailedException {
-// return ConnectionUtil.getXASource(identifier);
-// }
-
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java 2009-09-30 16:07:17 UTC (rev 1499)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverFalseOffTest.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -5,7 +5,7 @@
package org.teiid.test.testcases;
import org.teiid.test.framework.ConfigPropertyNames;
-import org.teiid.test.framework.connection.ConnectionStrategy;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
/**
@@ -25,10 +25,14 @@
@Override
protected void setUp() throws Exception {
+ super.setUp();
+
+ this.addProperty(ConfigPropertyNames.USE_DATASOURCES_PROP, "oracle,sqlserver");
- System.setProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
- System.setProperty(ConnectionStrategy.AUTOCOMMIT, "false");
- System.setProperty(ConnectionStrategy.TXN_AUTO_WRAP, "off");
+ this.addProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
+
+ this.addProperty(CONNECTION_STRATEGY_PROPS.AUTOCOMMIT, "false");
+ this.addProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP, "off");
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java 2009-09-30 16:07:17 UTC (rev 1499)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/LocalTransactionDriverTrueOffTest.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -5,7 +5,7 @@
package org.teiid.test.testcases;
import org.teiid.test.framework.ConfigPropertyNames;
-import org.teiid.test.framework.connection.ConnectionStrategy;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
/**
@@ -25,11 +25,12 @@
@Override
protected void setUp() throws Exception {
+ super.setUp();
+
+ this.addProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
+ this.addProperty(CONNECTION_STRATEGY_PROPS.AUTOCOMMIT, "true");
+ this.addProperty(CONNECTION_STRATEGY_PROPS.TXN_AUTO_WRAP, "off");
- System.setProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DRIVER_CONNECTION);
- System.setProperty(ConnectionStrategy.AUTOCOMMIT, "true");
- System.setProperty(ConnectionStrategy.TXN_AUTO_WRAP, "off");
-
}
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java 2009-09-30 16:07:17 UTC (rev 1499)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/TwoSourceTransactionScenarios.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -296,7 +296,7 @@
* Batching = Full Processing, Single Connector Batch
* result = commit
*/
- public void testMultipleSourceMultipleCommands() throws Exception {
+ public void lookat_testMultipleSourceMultipleCommands() throws Exception {
AbstractQueryTransactionTest userTxn = new AbstractQueryTransactionTest("testMultipleSourceMultipleCommands") {
public void testCase() throws Exception {
execute("delete from pm1.g2 where e1 >= ?", new Object[] {new Integer(100)});
Modified: trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java
===================================================================
--- trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java 2009-09-30 16:07:17 UTC (rev 1499)
+++ trunk/test-integration/db/src/test/java/org/teiid/test/testcases/XATransactionDatasourceFalseOffTest.java 2009-09-30 16:08:14 UTC (rev 1500)
@@ -5,7 +5,7 @@
package org.teiid.test.testcases;
import org.teiid.test.framework.ConfigPropertyNames;
-import org.teiid.test.framework.connection.ConnectionStrategy;
+import org.teiid.test.framework.ConfigPropertyNames.CONNECTION_STRATEGY_PROPS;
/**
@@ -34,13 +34,13 @@
//XATransactions currently doesn't support using sqlserver
//{@see TEIID-559}
- System.setProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP, "sqlserver");
+ this.addProperty(ConfigPropertyNames.EXCLUDE_DATASBASE_TYPES_PROP, "sqlserver");
- System.setProperty(ConfigPropertyNames.CONFIG_FILE, "xa-config.properties");
+ this.addProperty(ConfigPropertyNames.CONFIG_FILE, "xa-config.properties");
- System.setProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DATASOURCE_CONNECTION);
- System.setProperty(ConnectionStrategy.AUTOCOMMIT, "false");
- // System.setProperty(ConnectionStrategy.TXN_AUTO_WRAP, "on");
+ this.addProperty(ConfigPropertyNames.CONNECTION_TYPE, ConfigPropertyNames.CONNECTION_TYPES.DATASOURCE_CONNECTION);
+ this.addProperty(CONNECTION_STRATEGY_PROPS.AUTOCOMMIT, "false");
+ // this.addProperty(ConnectionStrategy.TXN_AUTO_WRAP, "on");
}
15 years, 2 months
teiid SVN: r1499 - trunk/test-integration/db/src/main/java/org/teiid/test/util.
by teiid-commits@lists.jboss.org
Author: vhalbert(a)redhat.com
Date: 2009-09-30 12:07:17 -0400 (Wed, 30 Sep 2009)
New Revision: 1499
Modified:
trunk/test-integration/db/src/main/java/org/teiid/test/util/StringUtil.java
Log:
Teiid 773 - changed the following:
- the testcase will not use system property to pass in overrides/additions to the loaded config.properties file. Now will use an addProperty() method provided on the abstract testcase that will apply the properties per test.
- remove the datasource_mapping.xml. There is no need to distinquish between xa and nonxa connector types. The connector type will be specified in the connection.properties file.
- if using the -DuserDataSources property to control datasource, it will imply order based on whats specified. The config.properties file will now map the model to order (i.e., pm1:1), where this order determines which datasource it will correspond to based on the userDataSources property. This mapping is done so that the nightly testing process can control which datasources are being used and can ensure retestability.
Modified: trunk/test-integration/db/src/main/java/org/teiid/test/util/StringUtil.java
===================================================================
--- trunk/test-integration/db/src/main/java/org/teiid/test/util/StringUtil.java 2009-09-30 16:06:51 UTC (rev 1498)
+++ trunk/test-integration/db/src/main/java/org/teiid/test/util/StringUtil.java 2009-09-30 16:07:17 UTC (rev 1499)
@@ -12,95 +12,13 @@
package org.teiid.test.util;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-import java.util.regex.Pattern;
/**
* This is a common place to put String utility methods.
*/
public final class StringUtil {
-// public interface Constants {
-// char CARRIAGE_RETURN_CHAR = '\r';
-// char LINE_FEED_CHAR = '\n';
-// char NEW_LINE_CHAR = LINE_FEED_CHAR;
-// char SPACE_CHAR = ' ';
-// char DOT_CHAR = '.';
-// char TAB_CHAR = '\t';
-//
-// String CARRIAGE_RETURN = String.valueOf(CARRIAGE_RETURN_CHAR);
-// String EMPTY_STRING = ""; //$NON-NLS-1$
-// String DBL_SPACE = " "; //$NON-NLS-1$
-// String LINE_FEED = String.valueOf(LINE_FEED_CHAR);
-// String NEW_LINE = String.valueOf(NEW_LINE_CHAR);
-// String SPACE = String.valueOf(SPACE_CHAR);
-// String DOT = String.valueOf(DOT_CHAR);
-// String TAB = String.valueOf(TAB_CHAR);
-//
-// String[] EMPTY_STRING_ARRAY = new String[0];
-//
-// // all patterns below copied from Eclipse's PatternConstructor class.
-// final Pattern PATTERN_BACK_SLASH = Pattern.compile("\\\\"); //$NON-NLS-1$
-// final Pattern PATTERN_QUESTION = Pattern.compile("\\?"); //$NON-NLS-1$
-// final Pattern PATTERN_STAR = Pattern.compile("\\*"); //$NON-NLS-1$
-// }
-//
- /**
- * The String "'"
- */
-// public static final String SINGLE_QUOTE = "'"; //$NON-NLS-1$
-//
-// /**
-// * The name of the System property that specifies the string that should be used to separate
-// * lines. This property is a standard environment property that is usually set automatically.
-// */
-// public static final String LINE_SEPARATOR_PROPERTY_NAME = "line.separator"; //$NON-NLS-1$
-//
-// /**
-// * The String that should be used to separate lines; defaults to
-// * {@link #NEW_LINE}
-// */
-// public static final String LINE_SEPARATOR = System.getProperty(LINE_SEPARATOR_PROPERTY_NAME, Constants.NEW_LINE);
-//
-// public static final Comparator CASE_INSENSITIVE_ORDER = String.CASE_INSENSITIVE_ORDER;
-//
-// public static final Comparator CASE_SENSITIVE_ORDER = new Comparator() {
-// /**
-// * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
-// * @since 4.2
-// */
-// public int compare(Object o1, Object o2) {
-// if ( o1 == o2 ) {
-// return 0;
-// }
-// return ((String)o1).compareTo((String)o2);
-// }
-// };
-//
-// public static String getLineSeparator() {
-// return LINE_SEPARATOR;
-// }
- /**
- * Utility to return a string enclosed in ''.
- * Creation date: (12/2/99 12:05:10 PM)
- */
-// public static String enclosedInSingleQuotes(String aString) {
-// StringBuffer sb = new StringBuffer();
-// sb.append(SINGLE_QUOTE);
-// sb.append(aString);
-// sb.append(SINGLE_QUOTE);
-// return sb.toString();
-// }
public static String removeChars(final String value, final char[] chars) {
final StringBuffer result = new StringBuffer();
@@ -118,789 +36,5 @@
return result.toString();
}
- /**
- * Join string pieces and separate with a delimiter. Similar to the perl function of
- * the same name. If strings or delimiter are null, null is returned. Otherwise, at
- * least an empty string will be returned.
- * @see #split
- *
- * @param strings String pieces to join
- * @param delimiter Delimiter to put between string pieces
- * @return One merged string
- */
-// public static String join(List strings, String delimiter) {
-// if(strings == null || delimiter == null) {
-// return null;
-// }
-//
-// StringBuffer str = new StringBuffer();
-//
-// // This is the standard problem of not putting a delimiter after the last
-// // string piece but still handling the special cases. A typical way is to check every
-// // iteration if it is the last one and skip the delimiter - this is avoided by
-// // looping up to the last one, then appending just the last one.
-//
-// // First we loop through all but the last one (if there are at least 2) and
-// // put the piece and a delimiter after it. An iterator is used to walk the list.
-// int most = strings.size()-1;
-// if(strings.size() > 1) {
-// Iterator iter = strings.iterator();
-// for(int i=0; i<most; i++) {
-// str.append(iter.next());
-// str.append(delimiter);
-// }
-// }
-//
-// // If there is at least one element, put the last one on with no delimiter after.
-// if(strings.size() > 0) {
-// str.append(strings.get(most));
-// }
-//
-// return str.toString();
-// }
-//
-// /**
-// * Return a stringified version of the array.
-// * @param array the array
-// * @param delim the delimiter to use between array components
-// * @return the string form of the array
-// */
-// public static String toString( final Object[] array, final String delim ) {
-// if ( array == null ) {
-// return ""; //$NON-NLS-1$
-// }
-// if ( array.length == 0 ) {
-// return "[]"; //$NON-NLS-1$
-// }
-// final StringBuffer sb = new StringBuffer();
-// sb.append('[');
-// for (int i = 0; i < array.length; ++i) {
-// if ( i != 0 ) {
-// sb.append(delim);
-// }
-// sb.append(array[i]);
-// }
-// sb.append(']');
-// return sb.toString();
-// }
-//
-// /**
-// * Return a stringified version of the array, using a ',' as a delimiter
-// * @param array the array
-// * @return the string form of the array
-// * @see #toString(Object[], String)
-// */
-// public static String toString( final Object[] array ) {
-// return toString(array,","); //$NON-NLS-1$
-// }
-//
-// /**
-// * Split a string into pieces based on delimiters. Similar to the perl function of
-// * the same name. The delimiters are not included in the returned strings.
-// * @see #join
-// *
-// * @param str Full string
-// * @param splitter Characters to split on
-// * @return List of String pieces from full string
-// */
-// public static List split(String str, String splitter) {
-// StringTokenizer tokens = new StringTokenizer(str, splitter);
-// ArrayList l = new ArrayList(tokens.countTokens());
-// while(tokens.hasMoreTokens()) {
-// l.add(tokens.nextToken());
-// }
-// return l;
-// }
-//
-// /**
-// * Break a string into pieces based on matching the full delimiter string in the text.
-// * The delimiter is not included in the returned strings.
-// * @param target The text to break up.
-// * @param delimiter The sub-string which is used to break the target.
-// * @return List of String from the target.
-// */
-// public static List splitOnEntireString(String target, String delimiter) {
-// ArrayList result = new ArrayList();
-// if (delimiter.length() > 0) {
-// int index = 0;
-// int indexOfNextMatch = target.indexOf(delimiter);
-// while (indexOfNextMatch > -1) {
-// result.add(target.substring(index, indexOfNextMatch));
-// index = indexOfNextMatch + delimiter.length();
-// indexOfNextMatch = target.indexOf(delimiter, index);
-// }
-// if (index <= target.length()) {
-// result.add(target.substring(index));
-// }
-// } else {
-// result.add(target);
-// }
-// return result;
-// }
-//
-// /**
-// * Split a string into pieces based on delimiters preserving spaces in
-// * quoted substring as on element in the returned list. The delimiters are
-// * not included in the returned strings.
-// * @see #join
-// *
-// * @param str Full string
-// * @param splitter Characters to split on
-// * @return List of String pieces from full string
-// */
-// public static List splitPreservingQuotedSubstring(String str, String splitter) {
-// ArrayList l = new ArrayList();
-// StringTokenizer tokens = new StringTokenizer(str, splitter);
-// StringBuffer token = new StringBuffer();
-// while(tokens.hasMoreTokens()) {
-// token.setLength(0);
-// token.append(tokens.nextToken());
-// if ( token.charAt(0) == '"' ) {
-// token.deleteCharAt(0);
-// while ( tokens.hasMoreTokens() ) {
-// token.append(Constants.SPACE + tokens.nextToken());
-// if ( token.charAt(token.length() -1) == '"' ) {
-// token.deleteCharAt(token.length() - 1);
-// break;
-// }
-// }
-// }
-// l.add(token.toString().trim());
-// }
-// return l;
-// }
-//
-// /*
-// * Replace a single occurrence of the search string with the replace string
-// * in the source string. If any of the strings is null or the search string
-// * is zero length, the source string is returned.
-// * @param source the source string whose contents will be altered
-// * @param search the string to search for in source
-// * @param replace the string to substitute for search if present
-// * @return source string with the *first* occurrence of the search string
-// * replaced with the replace string
-// */
-// public static String replace(String source, String search, String replace) {
-// if (source != null && search != null && search.length() > 0 && replace != null) {
-// int start = source.indexOf(search);
-// if (start > -1) {
-// return new StringBuffer(source).replace(start, start + search.length(), replace).toString();
-// }
-// }
-// return source;
-// }
-//
-// /*
-// * Replace all occurrences of the search string with the replace string
-// * in the source string. If any of the strings is null or the search string
-// * is zero length, the source string is returned.
-// * @param source the source string whose contents will be altered
-// * @param search the string to search for in source
-// * @param replace the string to substitute for search if present
-// * @return source string with *all* occurrences of the search string
-// * replaced with the replace string
-// */
-// public static String replaceAll(String source, String search, String replace) {
-// if (source != null && search != null && search.length() > 0 && replace != null) {
-// int start = source.indexOf(search);
-// if (start > -1) {
-// StringBuffer newString = new StringBuffer(source);
-// replaceAll(newString, search, replace);
-// return newString.toString();
-// }
-// }
-// return source;
-// }
-//
-// public static void replaceAll(StringBuffer source, String search, String replace) {
-// if (source != null && search != null && search.length() > 0 && replace != null) {
-// int start = source.toString().indexOf(search);
-// while (start > -1) {
-// int end = start + search.length();
-// source.replace(start, end, replace);
-// start = source.toString().indexOf(search, start + replace.length());
-// }
-// }
-// }
-//
-// /**
-// * Simple static method to tuncate Strings to given length.
-// * @param in the string that may need tuncating.
-// * @param len the lenght that the string should be truncated to.
-// * @return a new String containing chars with length <= len or <code>null</code>
-// * if input String is <code>null</code>.
-// */
-// public static String truncString(String in, int len) {
-// String out = in;
-// if ( in != null && len > 0 && in.length() > len ) {
-// out = in.substring(0, len);
-// }
-// return out;
-// }
-//
-// /**
-// * Simple utility method to wrap a string by inserting line separators creating
-// * multiple lines each with length no greater than the user specified maximum.
-// * The method parses the given string into tokens using a space delimiter then
-// * reassembling the tokens into the resulting string while inserting separators
-// * when required. If the number of characters in a single token is greater
-// * than the specified maximum, the token will not be split but instead the
-// * maximum will be exceeded.
-// * @param str the string that may need tuncating.
-// * @param maxCharPerLine the max number of characters per line
-// * @return a new String containing line separators or the original string
-// * if its length was less than the maximum.
-// */
-// public static String wrap(String str, int maxCharPerLine) {
-// int strLength = str.length();
-// if (strLength > maxCharPerLine) {
-// StringBuffer sb = new StringBuffer(str.length()+(strLength/maxCharPerLine)+1);
-// strLength = 0;
-// List tokens = StringUtil.split(str,Constants.SPACE);
-// Iterator itr = tokens.iterator();
-// while (itr.hasNext()) {
-// String token = (String) itr.next();
-// if ( strLength+token.length() > maxCharPerLine ) {
-//// sb.append(getLineSeparator());
-// sb.append(Constants.NEW_LINE);
-// strLength = 0;
-// }
-// sb.append(token);
-// sb.append(Constants.SPACE);
-// strLength += token.length()+1;
-// }
-// return sb.toString();
-// }
-// return str;
-// }
-//
-// /**
-// * Return the tokens in a string in a list. This is particularly
-// * helpful if the tokens need to be processed in reverse order. In that case,
-// * a list iterator can be acquired from the list for reverse order traversal.
-// *
-// * @param str String to be tokenized
-// * @param delimiter Characters which are delimit tokens
-// * @return List of string tokens contained in the tokenized string
-// */
-// public static List getTokens(String str, String delimiter) {
-// ArrayList l = new ArrayList();
-// StringTokenizer tokens = new StringTokenizer(str, delimiter);
-// while(tokens.hasMoreTokens()) {
-// l.add(tokens.nextToken());
-// }
-// return l;
-// }
-//
-// /**
-// * Return the number of tokens in a string that are seperated by the delimiter.
-// *
-// * @param str String to be tokenized
-// * @param delimiter Characters which are delimit tokens
-// * @return Number of tokens seperated by the delimiter
-// */
-// public static int getTokenCount(String str, String delimiter) {
-// StringTokenizer tokens = new StringTokenizer(str, delimiter);
-// return tokens.countTokens();
-// }
-//
-// /**
-// * Return the number of occurrences of token string that occurs in input string.
-// * Note: token is case sensitive.
-// *
-// * @param input
-// * @param token
-// * @return int
-// */
-// public static int occurrences(String input, String token) {
-// int num = 0;
-// int index = input.indexOf(token);
-// while (index >= 0) {
-// num++;
-// index = input.indexOf(token, index+1);
-// }
-// return num;
-// }
-//
-// /**
-// * Return the last token in the string.
-// *
-// * @param str String to be tokenized
-// * @param delimiter Characters which are delimit tokens
-// * @return the last token contained in the tokenized string
-// */
-// public static String getLastToken(String str, String delimiter) {
-// if (str == null) {
-// return Constants.EMPTY_STRING;
-// }
-// int beginIndex = 0;
-// if (str.lastIndexOf(delimiter) > 0) {
-// beginIndex = str.lastIndexOf(delimiter)+1;
-// }
-// return str.substring(beginIndex,str.length());
-// }
-//
-//
-// /**
-// * Return the first token in the string.
-// *
-// * @param str String to be tokenized
-// * @param delimiter Characters which are delimit tokens
-// * @return the first token contained in the tokenized string
-// */
-// public static String getFirstToken(String str, String delimiter) {
-// if (str == null) {
-// return Constants.EMPTY_STRING;
-// }
-// int endIndex = str.indexOf(delimiter);
-// if (endIndex < 0) {
-// endIndex = str.length();
-// }
-// return str.substring(0,endIndex);
-// }
-//
-//
-// public static String computePluralForm(String str) {
-// return computePluralForm(str, Constants.EMPTY_STRING);
-// }
-//
-// public static String computePluralForm(String str, String defaultValue ) {
-// if ( str == null || str.length() == 0 ) {
-// return defaultValue;
-// }
-// String result = str;
-// if ( result.endsWith("es") ) { //$NON-NLS-1$
-// // do nothing
-// } else if ( result.endsWith("ss") || //$NON-NLS-1$
-// result.endsWith("x") || //$NON-NLS-1$
-// result.endsWith("ch") || //$NON-NLS-1$
-// result.endsWith("sh") ) { //$NON-NLS-1$
-// result = result + "es"; //$NON-NLS-1$
-// } else if ( result.endsWith("y") && ! ( //$NON-NLS-1$
-// result.endsWith("ay") || //$NON-NLS-1$
-// result.endsWith("ey") || //$NON-NLS-1$
-// result.endsWith("iy") || //$NON-NLS-1$
-// result.endsWith("oy") || //$NON-NLS-1$
-// result.endsWith("uy") || //$NON-NLS-1$
-// result.equalsIgnoreCase("any") ) ) { //$NON-NLS-1$
-// result = result.substring(0, result.length()-1) + "ies"; //$NON-NLS-1$
-// } else {
-// result += "s"; //$NON-NLS-1$
-// }
-// return result;
-// }
-//
-// public static String getStackTrace( final Throwable t ) {
-// final ByteArrayOutputStream bas = new ByteArrayOutputStream();
-// final PrintWriter pw = new PrintWriter(bas);
-// t.printStackTrace(pw);
-// pw.close();
-// return bas.toString();
-// }
-//
-// /**
-// * Returns whether the specified text represents a boolean value, i.e., whether it equals "true" or "false"
-// * (case-insensitive).
-// * @since 4.0
-// */
-// public static boolean isBoolean(final String text) {
-// return (Boolean.TRUE.toString().equalsIgnoreCase(text) || Boolean.FALSE.toString().equalsIgnoreCase(text));
-// }
-//
-// /**<p>
-// * Returns whether the specified text is either empty or null.
-// * </p>
-// * @param text The text to check; may be null;
-// * @return True if the specified text is either empty or null.
-// * @since 4.0
-// */
-// public static boolean isEmpty(final String text) {
-// return (text == null || text.length() == 0);
-// }
-//
-// /**
-// * Returns the index within this string of the first occurrence of the
-// * specified substring. The integer returned is the smallest value
-// * <i>k</i> such that:
-// * <blockquote><pre>
-// * this.startsWith(str, <i>k</i>)
-// * </pre></blockquote>
-// * is <code>true</code>.
-// *
-// * @param text any string.
-// * @param str any string.
-// * @return if the str argument occurs as a substring within text,
-// * then the index of the first character of the first
-// * such substring is returned; if it does not occur as a
-// * substring, <code>-1</code> is returned. If the text or
-// * str argument is null or empty then <code>-1</code> is returned.
-// */
-// public static int indexOfIgnoreCase(final String text, final String str) {
-// if (isEmpty(text)) {
-// return -1;
-// }
-// if (isEmpty(str)) {
-// return -1;
-// }
-// final String lowerText = text.toLowerCase();
-// final String lowerStr = str.toLowerCase();
-// return lowerText.indexOf(lowerStr);
-// }
-//
-// /**
-// * Tests if the string starts with the specified prefix.
-// *
-// * @param text the string to test.
-// * @param prefix the prefix.
-// * @return <code>true</code> if the character sequence represented by the
-// * argument is a prefix of the character sequence represented by
-// * this string; <code>false</code> otherwise.
-// * Note also that <code>true</code> will be returned if the
-// * prefix is an empty string or is equal to the text
-// * <code>String</code> object as determined by the
-// * {@link #equals(Object)} method. If the text or
-// * prefix argument is null <code>false</code> is returned.
-// * @since JDK1. 0
-// */
-// public static boolean startsWithIgnoreCase(final String text, final String prefix) {
-// if (isEmpty(text)) {
-// return false;
-// }
-// if (prefix == null) {
-// return false;
-// }
-// int textLength = text.length();
-// int prefixLength = prefix.length();
-// if (prefixLength == 0) {
-// return true;
-// }
-// if (prefixLength > textLength) {
-// return false;
-// }
-// char[] chArray = prefix.toCharArray();
-// for (int i = 0; i != chArray.length; ++i) {
-// char ch1 = chArray[i];
-// char ch2 = text.charAt(i);
-// if (ch1 == ch2 || Character.toLowerCase(ch1) == Character.toLowerCase(ch2)) {
-// // continue
-// } else {
-// return false;
-// }
-// }
-// return true;
-// }
-//
-// /**
-// * Tests if the string ends with the specified suffix.
-// *
-// * @param text the string to test.
-// * @param suffix the suffix.
-// * @return <code>true</code> if the character sequence represented by the
-// * argument is a suffix of the character sequence represented by
-// * this object; <code>false</code> otherwise. Note that the
-// * result will be <code>true</code> if the suffix is the
-// * empty string or is equal to this <code>String</code> object
-// * as determined by the {@link #equals(Object)} method. If the text or
-// * suffix argument is null <code>false</code> is returned.
-// */
-// public static boolean endsWithIgnoreCase(final String text, final String suffix) {
-// if (isEmpty(text)) {
-// return false;
-// }
-// if (suffix == null) {
-// return false;
-// }
-// int textLength = text.length();
-// int suffixLength = suffix.length();
-// if (suffixLength == 0) {
-// return true;
-// }
-// if (suffixLength > textLength) {
-// return false;
-// }
-// int offset = textLength - suffixLength;
-// char[] chArray = suffix.toCharArray();
-// for (int i = 0; i != chArray.length; ++i) {
-// char ch1 = chArray[i];
-// char ch2 = text.charAt(offset + i);
-// if (ch1 == ch2 || Character.toLowerCase(ch1) == Character.toLowerCase(ch2)) {
-// // continue
-// } else {
-// return false;
-// }
-// }
-// return true;
-// }
-//
-// /**
-// * Determine if the string passed in has all digits as its contents
-// * @param str
-// * @return true if digits; false otherwise
-// */
-// public static boolean isDigits(String str) {
-// for(int i=0; i<str.length(); i++) {
-// if(!StringUtil.isDigit(str.charAt(i))) {
-// return false;
-// }
-// }
-// return true;
-// }
-// //============================================================================================================================
-// // Constructors
-//
-// /**<p>
-// * Prevents instantiation.
-// * </p>
-// * @since 4.0
-// */
-// private StringUtil() {
-// }
-//
-// /*
-// * Converts user string to regular expres '*' and '?' to regEx variables.
-// * copied from eclipse's PatternConstructor
-// */
-// static String asRegEx(String pattern) {
-// // Replace \ with \\, * with .* and ? with .
-// // Quote remaining characters
-// String result1 = Constants.PATTERN_BACK_SLASH.matcher(pattern).replaceAll(
-// "\\\\E\\\\\\\\\\\\Q"); //$NON-NLS-1$
-// String result2 = Constants.PATTERN_STAR.matcher(result1).replaceAll(
-// "\\\\E.*\\\\Q"); //$NON-NLS-1$
-// String result3 = Constants.PATTERN_QUESTION.matcher(result2).replaceAll(
-// "\\\\E.\\\\Q"); //$NON-NLS-1$
-// return "\\Q" + result3 + "\\E"; //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// /**
-// * Creates a regular expression pattern from the pattern string (which is
-// * our old 'StringMatcher' format). Copied from Eclipse's PatternConstructor class.
-// *
-// * @param pattern
-// * The search pattern
-// * @param isCaseSensitive
-// * Set to <code>true</code> to create a case insensitve pattern
-// * @return The created pattern
-// */
-// public static Pattern createPattern(String pattern, boolean isCaseSensitive) {
-// if (isCaseSensitive)
-// return Pattern.compile(asRegEx(pattern));
-// return Pattern.compile(asRegEx(pattern), Pattern.CASE_INSENSITIVE
-// | Pattern.UNICODE_CASE);
-// }
-//
-// /**
-// * Removes extraneous whitespace from a string. By it's nature, it will be trimmed also.
-// * @param raw
-// * @return
-// * @since 5.0
-// */
-// public static String collapseWhitespace(String raw) {
-// StringBuffer rv = new StringBuffer(raw.length());
-//
-// StringTokenizer izer = new StringTokenizer(raw, " "); //$NON-NLS-1$
-// while (izer.hasMoreTokens()) {
-// String tok = izer.nextToken();
-// // Added one last check here so we don't append a "space" on the end of the string
-// rv.append(tok);
-// if( izer.hasMoreTokens() ) {
-// rv.append(' ');
-// }
-// } // endwhile
-//
-// return rv.toString();
-// }
-//
-// /**
-// * If input == null OR input.length() < desiredLength, pad to desiredLength with spaces.
-// * If input.length() > desiredLength, chop at desiredLength.
-// * @param input Input text
-// * @param desiredLength Desired length
-// * @return
-// * @since 5.0
-// */
-// public static String toFixedLength(String input, int desiredLength) {
-// if(input == null) {
-// input = ""; //$NON-NLS-1$
-// }
-//
-// if(input.length() == desiredLength) {
-// return input;
-// }
-//
-// if(input.length() < desiredLength) {
-// StringBuffer str = new StringBuffer(input);
-// int needSpaces = desiredLength - input.length();
-// for(int i=0; i<needSpaces; i++) {
-// str.append(' ');
-// }
-// return str.toString();
-// }
-//
-// // Else too long - chop
-// return input.substring(0, desiredLength);
-// }
-//
-//
-// public static boolean isLetter(char c) {
-// return isBasicLatinLetter(c) || Character.isLetter(c);
-// }
-// public static boolean isDigit(char c) {
-// return isBasicLatinDigit(c) || Character.isDigit(c);
-// }
-// public static boolean isLetterOrDigit(char c) {
-// return isBasicLatinLetter(c) || isBasicLatinDigit(c) || Character.isLetterOrDigit(c);
-// }
-//
-// public static String toUpperCase(String str) {
-// String newStr = convertBasicLatinToUpper(str);
-// if (newStr == null) {
-// return str.toUpperCase();
-// }
-// return newStr;
-// }
-//
-// public static String toLowerCase(String str) {
-// String newStr = convertBasicLatinToLower(str);
-// if (newStr == null) {
-// return str.toLowerCase();
-// }
-// return newStr;
-// }
-//
-// /**
-// * Create a valid filename from the given String.
-// *
-// * @param str The String to convert to a valid filename.
-// * @param defaultName The default name to use if only special characters exist.
-// * @return String A valid filename.
-// */
-// public static String createFileName(String str) {
-//
-// /** Replace some special chars */
-// str = str.replaceAll(" \\| ", "_"); //$NON-NLS-1$ //$NON-NLS-2$
-// str = str.replaceAll(">", "_"); //$NON-NLS-1$ //$NON-NLS-2$
-// str = str.replaceAll(": ", "_"); //$NON-NLS-1$ //$NON-NLS-2$
-// str = str.replaceAll(" ", "_"); //$NON-NLS-1$ //$NON-NLS-2$
-// str = str.replaceAll("\\?", "_"); //$NON-NLS-1$ //$NON-NLS-2$
-// str = str.replaceAll("/", "_"); //$NON-NLS-1$ //$NON-NLS-2$
-//
-// /** If filename only contains of special chars */
-// if (str.matches("[_]+")) //$NON-NLS-1$
-// str = "file"; //$NON-NLS-1$
-//
-// return str;
-// }
-//
-//
-// /**
-// * Make the first letter uppercase
-// * @param str
-// * @return The string with the first letter being changed to uppercase
-// * @since 5.5
-// */
-// public static String firstLetterUppercase(String str) {
-// if(str == null || str.length() == 0) {
-// return null;
-// }
-// if(str.length() == 1) {
-// return str.toUpperCase();
-// }
-// return str.substring(0, 1).toUpperCase() + str.substring(1);
-// }
-//
-// private static String convertBasicLatinToUpper(String str) {
-// char[] chars = str.toCharArray();
-// for (int i = 0; i < chars.length; i++) {
-// if (isBasicLatinLowerCase(chars[i])) {
-// chars[i] = (char)('A' + (chars[i] - 'a'));
-// } else if (!isBasicLatinChar(chars[i])) {
-// return null;
-// }
-// }
-// return new String(chars);
-// }
-//
-// private static String convertBasicLatinToLower(String str) {
-// char[] chars = str.toCharArray();
-// for (int i = 0; i < chars.length; i++) {
-// if (isBasicLatinUpperCase(chars[i])) {
-// chars[i] = (char)('a' + (chars[i] - 'A'));
-// } else if (!isBasicLatinChar(chars[i])) {
-// return null;
-// }
-// }
-// return new String(chars);
-// }
-//
-// private static boolean isBasicLatinUpperCase(char c) {
-// return c >= 'A' && c <= 'Z';
-// }
-// private static boolean isBasicLatinLowerCase(char c) {
-// return c >= 'a' && c <= 'z';
-// }
-// private static boolean isBasicLatinLetter(char c) {
-// return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
-// }
-// private static boolean isBasicLatinDigit(char c) {
-// return c >= '0' && c <= '9';
-// }
-// private static boolean isBasicLatinChar(char c) {
-// return c <= '\u007F';
-// }
-//
-// /**
-// * Convert the given value to specified type.
-// * @param value
-// * @param type
-// * @return
-// */
-// @SuppressWarnings("unchecked")
-// public static <T> T valueOf(String value, Class type){
-//
-// if(type == String.class) {
-// return (T) value;
-// }
-// else if(type == Boolean.class || type == Boolean.TYPE) {
-// return (T) Boolean.valueOf(value);
-// }
-// else if (type == Integer.class || type == Integer.TYPE) {
-// return (T) Integer.decode(value);
-// }
-// else if (type == Float.class || type == Float.TYPE) {
-// return (T) Float.valueOf(value);
-// }
-// else if (type == Double.class || type == Double.TYPE) {
-// return (T) Double.valueOf(value);
-// }
-// else if (type == Long.class || type == Long.TYPE) {
-// return (T) Long.decode(value);
-// }
-// else if (type == Short.class || type == Short.TYPE) {
-// return (T) Short.decode(value);
-// }
-// else if (type.isAssignableFrom(List.class)) {
-// return (T)new ArrayList<String>(Arrays.asList(value.split(","))); //$NON-NLS-1$
-// }
-// else if (type == Void.class) {
-// return null;
-// }
-// else if (type.isEnum()) {
-// return (T)Enum.valueOf(type, value);
-// }
-//
-// else if (type.isAssignableFrom(Map.class)) {
-// List<String> l = Arrays.asList(value.split(",")); //$NON-NLS-1$
-// Map m = new HashMap<String, String>();
-// for(String key: l) {
-// int index = key.indexOf('=');
-// if (index != -1) {
-// m.put(key.substring(0, index), key.substring(index+1));
-// }
-// }
-// return (T)m;
-// }
-//
-// throw new IllegalArgumentException("Conversion from String to "+ type.getName() + " is not supported"); //$NON-NLS-1$ //$NON-NLS-2$
-// }
+
}
15 years, 2 months