# Class MongoSourceElement

java.lang.Object
org.apache.jmeter.testelement.AbstractTestElement
org.apache.jmeter.config.ConfigTestElement
org.apache.jmeter.protocol.mongodb.config.MongoSourceElement

All Implemented Interfaces:
  `Serializable, Cloneable, ConfigElement, Searchable, TestBean, TestElement, TestStateListener`

public class MongoSourceElement extends ConfigTestElement implements TestStateListener, TestBean

See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class ConfigTestElement

`PASSWORD, USERNAME`

### Fields inherited from interface TestElement

`COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS`

## Constructor Summary

Constructors
Constructor
Description
`MongoSourceElement()`

## Method Summary

Modifier and Type
Method
Description
`void`
`addConfigElement(ConfigElement configElement)`
Add a configuration element to this one.
`boolean`
`expectsModification()`
If your config element expects to be modified in the process of a test run, and you want those modifications to carry over from sample to sample (as in a cookie manager - you want to save all cookies that get set throughout the test), then return true for this method.
`boolean`
`getAutoConnectRetry()`
`String`
`getConnection()`
`int`
`getConnectionsPerHost()`
`int`
`getConnectTimeout()`
`boolean`
`getContinueOnInsertError()`
`boolean`
`getFsync()`
`long`
`getMaxAutoConnectRetryTime()`
`int`
`getMaxWaitTime()`
`static MongoDB`
`getMongoDB(String source)`
`boolean`
`getSafe()`
`boolean`
`getSocketKeepAlive()`
`int`
`getSocketTimeout()`
`String`
`getSource()`
`int`
`getThreadsAllowedToBlockForConnectionMultiplier()`
`String`
`getTitle()`
`boolean`
`getWaitForJournaling()`
`int`
`getWriteOperationNumberOfServers()`
`int`
`getWriteOperationTimeout()`
`void`
`setAutoConnectRetry(boolean autoConnectRetry)`
`void`
`setConnection(String connection)`
`void`
`setConnectionsPerHost(int connectionsPerHost)`
`void`
`setConnectTimeout(int connectTimeout)`
`void`
`setContinueOnInsertError(boolean continueOnInsertError)`
`void`
`setFsync(boolean fsync)`
`void`
`setMaxAutoConnectRetryTime(long maxAutoConnectRetryTime)`
`void`
`setMaxWaitTime(int maxWaitTime)`
`void`
`setSafe(boolean safe)`
`void`
`setSocketKeepAlive(boolean socketKeepAlive)`
`void`
`setSocketTimeout(int socketTimeout)`
`void`
`setSource(String source)`
`void`
`setThreadsAllowedToBlockForConnectionMultiplier(int threadsAllowedToBlockForConnectionMultiplier)`
`void`
`setWaitForJournaling(boolean waitForJournaling)`
`void`
`setWriteOperationNumberOfServers(int writeOperationNumberOfServers)`
`void`
`setWriteOperationTimeout(int writeOperationTimeout)`
`void`
`testEnded()`
Called once for all threads after the end of a test.
`void`
`testEnded(String s)`
Called once for all threads after the end of a test.
`void`
`testStarted()`
Called just before the start of the test from the main engine thread.
`void`
`testStarted(String s)`
Called just before the start of the test from the main engine thread.

### Methods inherited from class ConfigTestElement

`addTestElement`

### Methods inherited from class AbstractTestElement

`addPropertiesValues, addProperty, addProperty, canRemove, clear, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty`

### Methods inherited from class Object

`finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface ConfigElement

`clone`

## Constructor Details

### MongoSourceElement

public MongoSourceElement()

## Method Details

### getTitle

public String getTitle()

### getConnection

public String getConnection()

### setConnection

public void setConnection(String connection)

### getSource

public String getSource()

### setSource

public void setSource(String source)

### getMongoDB

public static MongoDB getMongoDB(String source)

### addConfigElement

public void addConfigElement(ConfigElement configElement)
Description copied from class: `ConfigTestElement`
Add a configuration element to this one. This allows config elements to combine and give a "layered" effect. For example, HTTPConfigElements have properties for domain, path, method, and parameters. If element A has everything filled in, but null for domain, and element B is added, which has only domain filled in, then after adding B to A, A will have the domain from B. If A already had a domain, then the correct behavior is for A to ignore the addition of element B.

Specified by:
  `addConfigElement` in interface `ConfigElement`
Overrides:
  `addConfigElement` in class `ConfigTestElement`
Parameters:
  `configElement` - the element to be added to this ConfigElement

### expectsModification

public boolean expectsModification()
Description copied from class: `ConfigTestElement`
If your config element expects to be modified in the process of a test run, and you want those modifications to carry over from sample to sample (as in a cookie manager - you want to save all cookies that get set throughout the test), then return true for this method. Your config element will not be cloned for each sample. If your config elements are more static in nature, return false. If in doubt, return false.

Specified by:
  `expectsModification` in interface `ConfigElement`
Overrides:
  `expectsModification` in class `ConfigTestElement`
Returns:
  true if the element expects to be modified over the course of a test run

### testStarted

public void testStarted()
Description copied from interface: `TestStateListener`

Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
  `testStarted` in interface `TestStateListener`
See Also:
  - `StandardJMeterEngine.run()`

### testStarted

public void testStarted(String s)
Description copied from interface: `TestStateListener`

Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
  `testStarted` in interface `TestStateListener`
Parameters:
  `s` - name of host
See Also:
  - `StandardJMeterEngine.run()`

### testEnded

public void testEnded()
Description copied from interface: `TestStateListener`

Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
  `testEnded` in interface `TestStateListener`
See Also:
  - `StandardJMeterEngine.stopTest()`

### testEnded

public void testEnded(String s)
Description copied from interface: `TestStateListener`

Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.

N.B. testStarted() and testEnded() are called from different threads.

Specified by:
  `testEnded` in interface `TestStateListener`
Parameters:
  `s` - name of host
See Also:
  - `StandardJMeterEngine.stopTest()`

### getAutoConnectRetry

public boolean getAutoConnectRetry()

Returns:
  the autoConnectRetry

### setAutoConnectRetry

public void setAutoConnectRetry(boolean autoConnectRetry)

Parameters:
  `autoConnectRetry` - the autoConnectRetry to set

### getConnectionsPerHost

public int getConnectionsPerHost()

Returns:
  the connectionsPerHost

### setConnectionsPerHost

public void setConnectionsPerHost(int connectionsPerHost)

Parameters:
  `connectionsPerHost` - the connectionsPerHost to set

### getConnectTimeout

public int getConnectTimeout()

Returns:
  the connectTimeout

### setConnectTimeout

public void setConnectTimeout(int connectTimeout)

Parameters:
  `connectTimeout` - the connectTimeout to set

### getMaxAutoConnectRetryTime

public long getMaxAutoConnectRetryTime()

Returns:
  the maxAutoConnectRetryTime

### setMaxAutoConnectRetryTime

public void setMaxAutoConnectRetryTime(long maxAutoConnectRetryTime)

Parameters:
  `maxAutoConnectRetryTime` - the maxAutoConnectRetryTime to set

### getMaxWaitTime

public int getMaxWaitTime()

Returns:
  the maxWaitTime

### setMaxWaitTime

public void setMaxWaitTime(int maxWaitTime)

Parameters:
  `maxWaitTime` - the maxWaitTime to set

### getSocketTimeout

public int getSocketTimeout()

Returns:
  the socketTimeout

### setSocketTimeout

public void setSocketTimeout(int socketTimeout)

Parameters:
  `socketTimeout` - the socketTimeout to set

### getSocketKeepAlive

public boolean getSocketKeepAlive()

Returns:
  the socketKeepAlive

### setSocketKeepAlive

public void setSocketKeepAlive(boolean socketKeepAlive)

Parameters:
  `socketKeepAlive` - the socketKeepAlive to set

### getThreadsAllowedToBlockForConnectionMultiplier

public int getThreadsAllowedToBlockForConnectionMultiplier()

Returns:
  the threadsAllowedToBlockForConnectionMultiplier

### setThreadsAllowedToBlockForConnectionMultiplier

public void setThreadsAllowedToBlockForConnectionMultiplier(int threadsAllowedToBlockForConnectionMultiplier)

Parameters:
  `threadsAllowedToBlockForConnectionMultiplier` - the threadsAllowedToBlockForConnectionMultiplier to set

### getFsync

public boolean getFsync()

Returns:
  the fsync

### setFsync

public void setFsync(boolean fsync)

Parameters:
  `fsync` - the fsync to set

### getSafe

public boolean getSafe()

Returns:
  the safe

### setSafe

public void setSafe(boolean safe)

Parameters:
  `safe` - the safe to set

### getWaitForJournaling

public boolean getWaitForJournaling()

Returns:
  the waitForJournaling

### setWaitForJournaling

public void setWaitForJournaling(boolean waitForJournaling)

Parameters:
  `waitForJournaling` - the waitForJournaling to set

### getWriteOperationNumberOfServers

public int getWriteOperationNumberOfServers()

Returns:
  the writeOperationNumberOfServers

### setWriteOperationNumberOfServers

public void setWriteOperationNumberOfServers(int writeOperationNumberOfServers)

Parameters:
  `writeOperationNumberOfServers` - the writeOperationNumberOfServers to set

### getWriteOperationTimeout

public int getWriteOperationTimeout()

Returns:
  the writeOperationTimeout

### setWriteOperationTimeout

public void setWriteOperationTimeout(int writeOperationTimeout)

Parameters:
  `writeOperationTimeout` - the writeOperationTimeout to set

### getContinueOnInsertError

public boolean getContinueOnInsertError()

Returns:
  the continueOnInsertError

### setContinueOnInsertError

public void setContinueOnInsertError(boolean continueOnInsertError)

Parameters:
  `continueOnInsertError` - the continueOnInsertError to set