KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > jmeter > ejb > jndi > control > JndiTestSample


1 // $Header: /home/cvs/jakarta-jmeter/src/protocol/jndi/control/JndiTestSample.java,v 1.3 2004/02/13 02:40:55 sebb Exp $
2
/*
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17 */

18
19 package org.apache.jmeter.ejb.jndi.control;
20
21 import java.io.Serializable JavaDoc;
22 import java.util.Collection JavaDoc;
23 import java.util.HashSet JavaDoc;
24 import java.util.LinkedList JavaDoc;
25 import java.util.Set JavaDoc;
26
27 import org.apache.jmeter.control.AbstractGenerativeController;
28 import org.apache.jmeter.ejb.jndi.config.JndiConfig;
29 import org.apache.jmeter.ejb.jndi.config.LookupConfig;
30 import org.apache.jmeter.ejb.jndi.config.MethodConfig;
31 import org.apache.jmeter.ejb.jndi.control.gui.JndiTestSampleGui;
32 import org.apache.jmeter.ejb.jndi.sampler.JNDISampler;
33 import org.apache.jmeter.samplers.Entry;
34 import org.apache.jmeter.util.JMeterUtils;
35 import org.apache.log4j.Category;
36 /**
37  * Controls how the sampling is done
38  *
39  * @author Khor Soon Hin
40  * Created 20 Dec 2001
41  * @version $Revision: 1.3 $ Last Updated: $Date: 2004/02/13 02:40:55 $
42  */

43 public class JndiTestSample extends AbstractGenerativeController
44     implements Serializable JavaDoc
45 {
46   private static Category catClass = Category.getInstance(
47     JndiTestSample.class.getName());
48
49   protected JndiConfig defaultJndiConfig;
50
51   protected static Set JavaDoc addableList;
52
53   public JndiTestSample()
54   {
55     defaultJndiConfig = new JndiConfig();
56   }
57
58   public JndiConfig getDefaultJndiConfig()
59   {
60     return defaultJndiConfig;
61   }
62
63   public void setDefaultJndiConfig(JndiConfig config)
64   {
65     defaultJndiConfig = config;
66   }
67
68   public void uncompile()
69   {
70     super.uncompile();
71   }
72
73   public String JavaDoc getClassLabel()
74   {
75     return JMeterUtils.getResString("jndi_testing_title");
76   }
77
78   public Class JavaDoc getGuiClass()
79   {
80     return org.apache.jmeter.ejb.jndi.control.gui.JndiTestSampleGui.class;
81   }
82
83   public Class JavaDoc getTagHandlerClass()
84   {
85     return org.apache.jmeter.ejb.jndi.save.JndiTestSampleHandler.class;
86   }
87
88   /**
89    * Returns a <code>Collaction</code> containing a list of all
90    * elements which can be added to this element
91    *
92    * @return a collection of elements
93    */

94   public Collection JavaDoc getAddList()
95   {
96     if(addableList == null)
97     {
98       addableList = new HashSet JavaDoc();
99       addableList.add(new LookupConfig().getClassLabel());
100       addableList.add(new MethodConfig().getClassLabel());
101     }
102     return addableList;
103   }
104
105   public Object JavaDoc clone()
106   {
107     catClass.info("Start : clone1");
108     JndiTestSample control = new JndiTestSample();
109     control.setDefaultJndiConfig(defaultJndiConfig);
110     this.standardCloneProc(control);
111     catClass.info("End : clone1");
112     return control;
113   }
114
115   protected Entry createEntry()
116   {
117     catClass.info("Start : createEntry1");
118     Entry entry = new Entry();
119     entry.setSamplerClass(JNDISampler.class);
120     entry.addConfigElement(defaultJndiConfig);
121     catClass.info("End : createEntry1");
122     return entry;
123   }
124 }
125
Popular Tags