/*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.agila.util;
import org.apache.agila.util.JDBCUtil;
import org.apache.agila.util.XMLUtil;
import org.apache.agila.engine.Instance;
import org.apache.agila.engine.InstanceID;
import org.apache.agila.engine.Token;
import org.apache.agila.engine.TokenID;
import org.apache.agila.impl.TokenImpl;
import org.apache.agila.impl.dao.AgilaDAO;
import org.apache.agila.impl.dao.DAOTestCaseSupport;
import org.apache.agila.model.BusinessProcess;
import org.apache.agila.model.BusinessProcessID;
import org.apache.agila.model.NodeID;
import org.apache.agila.services.InstanceServiceInfo;
import org.apache.agila.services.task.Task;
import org.apache.agila.services.task.TaskID;
import org.apache.agila.services.task.TaskImpl;
import org.apache.agila.services.user.UserID;
import org.apache.agila.services.user.UserInfo;
import junit.framework.TestCase;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class JDBCTestCase extends DAOTestCaseSupport {
public void testGetInstance() {
JDBCUtil jdbcUtil = JDBCUtil.getInstance();
assertNotNull( jdbcUtil );
}
public void testGenerateKey() {
JDBCUtil jdbcUtil = JDBCUtil.getInstance();
int nextKey = 0;
int previousKey = jdbcUtil.generateKey();
for( int i = 0; i < 10; i++ ) {
nextKey = jdbcUtil.generateKey();
assertTrue( (previousKey + 1) == nextKey );
previousKey = nextKey;
}
}
public void setUp() throws Exception {
dao = JDBCUtil.getInstance();
}
}