KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > impl > jdbcjobstore > StdJDBCDelegateTest


1 /*
2  * Copyright 2004-2006 OpenSymphony
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5  * use this file except in compliance with the License. You may obtain a copy
6  * of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13  * License for the specific language governing permissions and limitations
14  * under the License.
15  */

16 package org.quartz.impl.jdbcjobstore;
17
18 import java.io.IOException JavaDoc;
19 import java.io.NotSerializableException JavaDoc;
20
21 import org.apache.commons.logging.LogFactory;
22 import org.quartz.JobDataMap;
23
24 import junit.framework.TestCase;
25
26 public class StdJDBCDelegateTest extends TestCase {
27
28     public void testSerializeJobData() throws IOException JavaDoc {
29         StdJDBCDelegate delegate = new StdJDBCDelegate(LogFactory.getLog(getClass()), "QRTZ_", "INSTANCE");
30         
31         JobDataMap jdm = new JobDataMap();
32         delegate.serializeJobData(jdm).close();
33
34         jdm.clear();
35         jdm.put("key", "value");
36         jdm.put("key2", null);
37         delegate.serializeJobData(jdm).close();
38
39         jdm.clear();
40         jdm.put("key1", "value");
41         jdm.put("key2", null);
42         jdm.put("key3", new Object JavaDoc());
43         try {
44             delegate.serializeJobData(jdm);
45             fail();
46         } catch (NotSerializableException JavaDoc e) {
47             assertTrue(e.getMessage().indexOf("key3") >= 0);
48         }
49     }
50 }
51
Popular Tags