1 18 19 package org.apache.jmeter.samplers; 20 21 import java.util.HashMap ; 22 import java.util.LinkedList ; 24 import java.util.List ; 25 import java.util.Map ; 26 28 import org.apache.jmeter.assertions.Assertion; 29 import org.apache.jmeter.config.ConfigElement; 30 import org.apache.jorphan.logging.LoggingManager; 31 import org.apache.log.Logger; 32 33 37 public class Entry 38 { 39 transient private static Logger log = LoggingManager.getLoggerForClass(); 40 Map configSet; 41 Class sampler; 43 List assertions; 44 45 public Entry() 46 { 47 configSet = new HashMap (); 48 assertions = new LinkedList (); 50 } 51 52 public void addAssertion(Assertion assertion) 53 { 54 assertions.add(assertion); 55 } 56 57 public List getAssertions() 58 { 59 return assertions; 60 } 61 62 public void setSamplerClass(Class samplerClass) 63 { 64 this.sampler = samplerClass; 65 } 66 67 public Class getSamplerClass() 68 { 69 return this.sampler; 70 } 71 72 public ConfigElement getConfigElement(Class configClass) 73 { 74 return (ConfigElement) configSet.get(configClass); 75 } 76 77 public void addConfigElement(ConfigElement config) 78 { 79 addConfigElement(config, config.getClass()); 80 } 81 82 86 public void addConfigElement(ConfigElement config, Class asClass) 87 { 88 if (config != null) 89 { 90 ConfigElement current = (ConfigElement) configSet.get(asClass); 91 if (current == null) 92 { 93 configSet.put(asClass, cloneIfNecessary(config)); 94 } 95 else 96 { 97 current.addConfigElement(config); 98 } 99 } 100 } 101 102 private ConfigElement cloneIfNecessary(ConfigElement config) 103 { 104 if (config.expectsModification()) 105 { 106 return config; 107 } 108 else 109 { 110 return (ConfigElement) config.clone(); 111 } 112 } 113 114 public Object clone() 115 { 116 try 117 { 118 return super.clone(); 119 } 120 catch (Exception ex) 121 { 122 log.error("", ex); 123 } 124 return null; 125 } 126 } 127 | Popular Tags |