Skip to content

Commit

Permalink
Merge branch 'master' of github.com:undera/jmeter-plugins
Browse files Browse the repository at this point in the history
Conflicts:
	site/dat/wiki/Changelog.wiki
  • Loading branch information
undera committed Jun 30, 2015
2 parents 1600767 + a06ae85 commit 514d26b
Show file tree
Hide file tree
Showing 47 changed files with 1,066 additions and 1,236 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: java
jdk:
- openjdk6
- openjdk7
- oraclejdk8
install: "mvn clean --batch-mode"
#before_script:
# - "export DISPLAY=:99.0"
Expand Down
26 changes: 18 additions & 8 deletions common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins</artifactId>
<version>1.2.2</version>
<version>1.3.0</version>
</parent>
<artifactId>jmeter-plugins-common</artifactId>
<packaging>jar</packaging>
Expand All @@ -25,14 +25,14 @@
<connection>https://github.com/undera/jmeter-plugins.git</connection>
<developerConnection>[email protected]:undera/jmeter-plugins.git</developerConnection>
</scm>
<distributionManagement>
<distributionManagement>
<snapshotRepository>
<id>sonatype-snapshot</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

Expand All @@ -55,6 +55,16 @@
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>${jmeter.version}</version>
<exclusions>
<exclusion>
<groupId>excalibur-fortress</groupId>
<artifactId>excalibur-fortress-container-api</artifactId>
</exclusion>
<exclusion>
<groupId>excalibur-fortress</groupId>
<artifactId>excalibur-fortress-meta</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
Expand Down Expand Up @@ -109,7 +119,7 @@
<directory>src</directory>
</testResource>
</testResources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand All @@ -130,7 +140,7 @@
<version>2.2.1</version>
<executions>
<execution>
<phase>install</phase>
<phase>install</phase>
<goals>
<goal>jar</goal>
</goals>
Expand Down Expand Up @@ -158,14 +168,14 @@
<version>2.7</version>
<executions>
<execution>
<phase>deploy</phase>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down
40 changes: 40 additions & 0 deletions common/src/kg/apc/io/DatagramChannelWithTimeouts.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

import java.io.IOException;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketAddress;
import java.net.SocketOption;
import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;
import java.nio.channels.MembershipKey;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.Set;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

Expand All @@ -33,6 +38,31 @@ public static DatagramChannel open() throws IOException {
return new DatagramChannelWithTimeouts();
}

@Override
public DatagramChannel bind(SocketAddress socketAddress) throws IOException {
return channel.bind(socketAddress);
}

@Override
public SocketAddress getLocalAddress() throws IOException {
return channel.getLocalAddress();
}

@Override
public <T> DatagramChannel setOption(SocketOption<T> socketOption, T t) throws IOException {
return channel.setOption(socketOption, t);
}

@Override
public <T> T getOption(SocketOption<T> socketOption) throws IOException {
return channel.getOption(socketOption);
}

@Override
public Set<SocketOption<?>> supportedOptions() {
return channel.supportedOptions();
}

public int read(ByteBuffer dst) throws IOException {
int bytesRead = 0;
while (selector.select(readTimeout) > 0) {
Expand Down Expand Up @@ -122,4 +152,14 @@ public DatagramChannel connect(SocketAddress remote) throws IOException {
public SocketAddress getRemoteAddress() throws IOException {
return null;
}

@Override
public MembershipKey join(InetAddress inetAddress, NetworkInterface networkInterface) throws IOException {
return channel.join(inetAddress, networkInterface);
}

@Override
public MembershipKey join(InetAddress inetAddress, NetworkInterface networkInterface, InetAddress inetAddress1) throws IOException {
return channel.join(inetAddress, networkInterface, inetAddress1);
}
}
40 changes: 38 additions & 2 deletions common/src/kg/apc/io/SocketChannelWithTimeouts.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.net.SocketOption;
import java.net.SocketTimeoutException;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;

import java.util.Set;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

Expand Down Expand Up @@ -45,13 +46,48 @@ public static SocketChannel open() throws IOException {
return new SocketChannelWithTimeouts();
}

@Override
public SocketChannel bind(SocketAddress socketAddress) throws IOException {
return socketChannel.bind(socketAddress);
}

@Override
public SocketAddress getLocalAddress() throws IOException {
return socketChannel.getLocalAddress();
}

@Override
public <T> SocketChannel setOption(SocketOption<T> socketOption, T t) throws IOException {
return socketChannel.setOption(socketOption, t);
}

@Override
public <T> T getOption(SocketOption<T> socketOption) throws IOException {
return socketChannel.getOption(socketOption);
}

@Override
public Set<SocketOption<?>> supportedOptions() {
return socketChannel.supportedOptions();
}

@Override
public SocketChannel shutdownInput() throws IOException {
return socketChannel.shutdownInput();
}

@Override
public SocketChannel shutdownOutput() throws IOException {
return socketChannel.shutdownOutput();
}

@Override
public boolean connect(SocketAddress remote) throws IOException {

long start = System.currentTimeMillis();
//log.debug("trying to connect");
socketChannel.connect(remote);
while (selector.select(connectTimeout) > 0) {
if (selector.select(connectTimeout) > 0) {
selector.selectedKeys().remove(channelKey);
//log.debug("selected connect");
//log.debug("Spent " + (System.currentTimeMillis() - start));
Expand Down
49 changes: 47 additions & 2 deletions common/test/kg/apc/emulators/DatagramChannelEmul.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

import java.io.IOException;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketAddress;
import java.net.SocketException;
import java.net.SocketOption;
import java.nio.ByteBuffer;
import java.nio.channels.DatagramChannel;
import java.nio.channels.MembershipKey;
import java.util.Set;
import java.util.logging.Level;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
Expand All @@ -30,6 +35,31 @@ public static DatagramChannel open() throws IOException {
return new DatagramChannelEmul();
}

@Override
public DatagramChannel bind(SocketAddress socketAddress) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public SocketAddress getLocalAddress() throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public <T> DatagramChannel setOption(SocketOption<T> socketOption, T t) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public <T> T getOption(SocketOption<T> socketOption) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Set<SocketOption<?>> supportedOptions() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public DatagramSocket socket() {
return socket;
Expand All @@ -46,7 +76,7 @@ public int read(ByteBuffer dst) throws IOException {
log.debug("No more data to read");
return -1;
}
int cnt = dst.capacity()<bytesToRead.capacity()?dst.capacity():bytesToRead.capacity();
int cnt = dst.capacity() < bytesToRead.capacity() ? dst.capacity() : bytesToRead.capacity();
ByteBuffer chunk = bytesToRead.duplicate();
if (cnt < chunk.capacity()) {
log.debug("Setting limit to " + cnt);
Expand Down Expand Up @@ -86,7 +116,7 @@ protected void implCloseSelectableChannel() throws IOException {

@Override
protected void implConfigureBlocking(boolean block) throws IOException {
log.debug("Configure blocking: "+block);
log.debug("Configure blocking: " + block);
}

/**
Expand Down Expand Up @@ -121,6 +151,11 @@ public DatagramChannel disconnect() throws IOException {
return this;
}

@Override
public SocketAddress getRemoteAddress() throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public SocketAddress receive(ByteBuffer dst) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
Expand All @@ -130,4 +165,14 @@ public SocketAddress receive(ByteBuffer dst) throws IOException {
public int send(ByteBuffer src, SocketAddress target) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public MembershipKey join(InetAddress inetAddress, NetworkInterface networkInterface) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public MembershipKey join(InetAddress inetAddress, NetworkInterface networkInterface, InetAddress inetAddress1) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}
}
3 changes: 2 additions & 1 deletion common/test/kg/apc/emulators/FileLockEmul.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package kg.apc.emulators;

import java.io.IOException;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
Expand All @@ -14,7 +15,7 @@ class FileLockEmul extends FileLock {
private static final Logger log = LoggingManager.getLoggerForClass();

public FileLockEmul() {
super(null, 0, 0, false);
super((FileChannel) null, 0, 0, false);
}

@Override
Expand Down
28 changes: 28 additions & 0 deletions common/test/kg/apc/emulators/ServerSocketChannelEmul.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,43 @@

import java.io.IOException;
import java.net.ServerSocket;
import java.net.SocketAddress;
import java.net.SocketOption;
import java.nio.channels.ServerSocketChannel;
import java.nio.channels.SocketChannel;
import java.util.Set;

class ServerSocketChannelEmul extends ServerSocketChannel {

public ServerSocketChannelEmul() {
super(null);
}

@Override
public ServerSocketChannel bind(SocketAddress socketAddress, int i) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public SocketAddress getLocalAddress() throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public <T> ServerSocketChannel setOption(SocketOption<T> socketOption, T t) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public <T> T getOption(SocketOption<T> socketOption) throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public Set<SocketOption<?>> supportedOptions() {
throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public ServerSocket socket() {
throw new UnsupportedOperationException("Not supported yet.");
Expand Down
Loading

0 comments on commit 514d26b

Please sign in to comment.