Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sboikov committed Jan 23, 2015
1 parent ff7771e commit b24441a
Show file tree
Hide file tree
Showing 18 changed files with 329 additions and 43 deletions.
Expand Up @@ -39,28 +39,28 @@ public static TestSuite suite() {
suite.addTest(new TestSuite(GridRouterFactorySelfTest.class)); suite.addTest(new TestSuite(GridRouterFactorySelfTest.class));


// Parser standalone test. // Parser standalone test.
suite.addTest(new TestSuite(GridTcpRestParserSelfTest.class)); suite.addTest(new TestSuite(TcpRestParserSelfTest.class));


// Test memcache protocol with custom test client. // Test memcache protocol with custom test client.
suite.addTest(new TestSuite(GridRestMemcacheProtocolSelfTest.class)); suite.addTest(new TestSuite(RestMemcacheProtocolSelfTest.class));


// Test custom binary protocol with test client. // Test custom binary protocol with test client.
suite.addTest(new TestSuite(GridRestBinaryProtocolSelfTest.class)); suite.addTest(new TestSuite(RestBinaryProtocolSelfTest.class));


// Test jetty rest processor // Test jetty rest processor
suite.addTest(new TestSuite(GridJettyRestProcessorSignedSelfTest.class)); suite.addTest(new TestSuite(JettyRestProcessorSignedSelfTest.class));
suite.addTest(new TestSuite(GridJettyRestProcessorUnsignedSelfTest.class)); suite.addTest(new TestSuite(JettyRestProcessorUnsignedSelfTest.class));


// Test TCP rest processor with original memcache client. // Test TCP rest processor with original memcache client.
suite.addTest(new TestSuite(GridClientMemcachedProtocolSelfTest.class)); suite.addTest(new TestSuite(ClientMemcachedProtocolSelfTest.class));


suite.addTest(new TestSuite(GridRestProcessorStartSelfTest.class)); suite.addTest(new TestSuite(RestProcessorStartSelfTest.class));


// Test cache flag conversion. // Test cache flag conversion.
suite.addTest(new TestSuite(GridClientCacheFlagsCodecTest.class)); suite.addTest(new TestSuite(GridClientCacheFlagsCodecTest.class));


// Test multi-start. // Test multi-start.
suite.addTest(new TestSuite(GridRestProcessorMultiStartSelfTest.class)); suite.addTest(new TestSuite(RestProcessorMultiStartSelfTest.class));


// Test clients. // Test clients.
suite.addTest(new TestSuite(GridClientDataImplSelfTest.class)); suite.addTest(new TestSuite(GridClientDataImplSelfTest.class));
Expand Down Expand Up @@ -89,7 +89,7 @@ public static TestSuite suite() {
suite.addTest(new TestSuite(GridClientReconnectionSelfTest.class)); suite.addTest(new TestSuite(GridClientReconnectionSelfTest.class));


// Rest task command handler test. // Rest task command handler test.
suite.addTest(new TestSuite(GridTaskCommandHandlerSelfTest.class)); suite.addTest(new TestSuite(TaskCommandHandlerSelfTest.class));


// Default cache only test. // Default cache only test.
suite.addTest(new TestSuite(GridClientDefaultCacheSelfTest.class)); suite.addTest(new TestSuite(GridClientDefaultCacheSelfTest.class));
Expand Down
Expand Up @@ -27,7 +27,7 @@
/** /**
* Abstract class for REST protocols tests. * Abstract class for REST protocols tests.
*/ */
abstract class GridAbstractRestProcessorSelfTest extends GridCommonAbstractTest { abstract class AbstractRestProcessorSelfTest extends GridCommonAbstractTest {
/** IP finder. */ /** IP finder. */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);


Expand Down
Expand Up @@ -32,7 +32,7 @@
/** /**
* Tests for TCP binary protocol. * Tests for TCP binary protocol.
*/ */
public class GridClientMemcachedProtocolSelfTest extends GridAbstractRestProcessorSelfTest { public class ClientMemcachedProtocolSelfTest extends AbstractRestProcessorSelfTest {
/** Grid count. */ /** Grid count. */
private static final int GRID_CNT = 1; private static final int GRID_CNT = 1;


Expand Down
Expand Up @@ -30,7 +30,7 @@
* Tests for Jetty REST protocol. * Tests for Jetty REST protocol.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
abstract class GridJettyRestProcessorAbstractSelfTest extends GridAbstractRestProcessorSelfTest { abstract class JettyRestProcessorAbstractSelfTest extends AbstractRestProcessorSelfTest {
/** Grid count. */ /** Grid count. */
private static final int GRID_CNT = 3; private static final int GRID_CNT = 3;


Expand Down
Expand Up @@ -27,7 +27,7 @@
/** /**
* *
*/ */
public class GridJettyRestProcessorSignedSelfTest extends GridJettyRestProcessorAbstractSelfTest { public class JettyRestProcessorSignedSelfTest extends JettyRestProcessorAbstractSelfTest {
/** */ /** */
protected static final String REST_SECRET_KEY = "secret-key"; protected static final String REST_SECRET_KEY = "secret-key";


Expand Down
Expand Up @@ -20,7 +20,7 @@
/** /**
* *
*/ */
public class GridJettyRestProcessorUnsignedSelfTest extends GridJettyRestProcessorAbstractSelfTest { public class JettyRestProcessorUnsignedSelfTest extends JettyRestProcessorAbstractSelfTest {
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected int restPort() { @Override protected int restPort() {
return 8091; return 8091;
Expand Down
Expand Up @@ -26,7 +26,7 @@


/** /**
*/ */
public class GridMemcacheRestProcessorTest extends GridCommonAbstractTest { public class MemcacheRestProcessorTest extends GridCommonAbstractTest {
/** Client. */ /** Client. */
private MemcachedClientIF client; private MemcachedClientIF client;


Expand Down
Expand Up @@ -44,7 +44,7 @@
* TCP protocol test. * TCP protocol test.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class GridRestBinaryProtocolSelfTest extends GridCommonAbstractTest { public class RestBinaryProtocolSelfTest extends GridCommonAbstractTest {
/** */ /** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);


Expand All @@ -58,7 +58,7 @@ public class GridRestBinaryProtocolSelfTest extends GridCommonAbstractTest {
private static final int PORT = 11212; private static final int PORT = 11212;


/** */ /** */
private GridTestBinaryClient client; private TestBinaryClient client;


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception { @Override protected void beforeTestsStarted() throws Exception {
Expand Down Expand Up @@ -127,8 +127,8 @@ private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws
* @return Client. * @return Client.
* @throws IgniteCheckedException In case of error. * @throws IgniteCheckedException In case of error.
*/ */
private GridTestBinaryClient client() throws IgniteCheckedException { private TestBinaryClient client() throws IgniteCheckedException {
return new GridTestBinaryClient(HOST, PORT); return new TestBinaryClient(HOST, PORT);
} }


/** /**
Expand Down
Expand Up @@ -36,7 +36,7 @@
* TCP protocol test. * TCP protocol test.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class GridRestMemcacheProtocolSelfTest extends GridCommonAbstractTest { public class RestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
/** */ /** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);


Expand All @@ -50,7 +50,7 @@ public class GridRestMemcacheProtocolSelfTest extends GridCommonAbstractTest {
private static final int PORT = 11212; private static final int PORT = 11212;


/** */ /** */
private GridTestMemcacheClient client; private TestMemcacheClient client;


/** {@inheritDoc} */ /** {@inheritDoc} */
@Override protected void beforeTestsStarted() throws Exception { @Override protected void beforeTestsStarted() throws Exception {
Expand Down Expand Up @@ -119,8 +119,8 @@ private CacheConfiguration cacheConfiguration(@Nullable String cacheName) throws
* @return Client. * @return Client.
* @throws IgniteCheckedException In case of error. * @throws IgniteCheckedException In case of error.
*/ */
private GridTestMemcacheClient client() throws IgniteCheckedException { private TestMemcacheClient client() throws IgniteCheckedException {
return new GridTestMemcacheClient(HOST, PORT); return new TestMemcacheClient(HOST, PORT);
} }


/** /**
Expand Down
Expand Up @@ -23,7 +23,7 @@
/** /**
* Rest processor test. * Rest processor test.
*/ */
public class GridRestProcessorMultiStartSelfTest extends GridCommonAbstractTest { public class RestProcessorMultiStartSelfTest extends GridCommonAbstractTest {
/** */ /** */
private static final int GRID_CNT = 3; private static final int GRID_CNT = 3;


Expand Down
Expand Up @@ -34,7 +34,7 @@
/** /**
* *
*/ */
public class GridRestProcessorStartSelfTest extends GridCommonAbstractTest { public class RestProcessorStartSelfTest extends GridCommonAbstractTest {
/** */ /** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);


Expand Down
Expand Up @@ -48,12 +48,12 @@
* <li>http://localhost:8080/gridgain?cmd=res&id=XXXX</li> * <li>http://localhost:8080/gridgain?cmd=res&id=XXXX</li>
* </ul> * </ul>
*/ */
public class GridRestProcessorTest extends GridCommonAbstractTest { public class RestProcessorTest extends GridCommonAbstractTest {
/** Counter */ /** Counter */
private static int cntr; private static int cntr;


/** */ /** */
public GridRestProcessorTest() { public RestProcessorTest() {
super(/*start grid*/false); super(/*start grid*/false);
} }


Expand Down
Expand Up @@ -43,7 +43,7 @@
/** /**
* Test for {@code GridTaskCommandHandler} * Test for {@code GridTaskCommandHandler}
*/ */
public class GridTaskCommandHandlerSelfTest extends GridCommonAbstractTest { public class TaskCommandHandlerSelfTest extends GridCommonAbstractTest {
/** */ /** */
private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true); private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);


Expand Down
Expand Up @@ -39,7 +39,7 @@
/** /**
* Test client. * Test client.
*/ */
final class GridTestBinaryClient { final class TestBinaryClient {
/** Logger. */ /** Logger. */
private final IgniteLogger log = new IgniteJavaLogger(); private final IgniteLogger log = new IgniteJavaLogger();


Expand Down Expand Up @@ -74,7 +74,7 @@ final class GridTestBinaryClient {
* @param port Port number. * @param port Port number.
* @throws IgniteCheckedException In case of error. * @throws IgniteCheckedException In case of error.
*/ */
GridTestBinaryClient(String host, int port) throws IgniteCheckedException { TestBinaryClient(String host, int port) throws IgniteCheckedException {
assert host != null; assert host != null;
assert port > 0; assert port > 0;


Expand Down
Expand Up @@ -33,7 +33,7 @@
/** /**
* Test client. * Test client.
*/ */
final class GridTestMemcacheClient { final class TestMemcacheClient {
/** Header length. */ /** Header length. */
private static final short HDR_LEN = 24; private static final short HDR_LEN = 24;


Expand Down Expand Up @@ -93,7 +93,7 @@ final class GridTestMemcacheClient {
* @param port Port number. * @param port Port number.
* @throws IgniteCheckedException In case of error. * @throws IgniteCheckedException In case of error.
*/ */
GridTestMemcacheClient(String host, int port) throws IgniteCheckedException { TestMemcacheClient(String host, int port) throws IgniteCheckedException {
assert host != null; assert host != null;
assert port > 0; assert port > 0;


Expand Down
Expand Up @@ -26,7 +26,7 @@
/** /**
* Mock nio session with disabled functionality for testing parser. * Mock nio session with disabled functionality for testing parser.
*/ */
public class GridMockNioSession extends GridMetadataAwareAdapter implements GridNioSession { public class MockNioSession extends GridMetadataAwareAdapter implements GridNioSession {
/** Local address */ /** Local address */
private InetSocketAddress locAddr = new InetSocketAddress(0); private InetSocketAddress locAddr = new InetSocketAddress(0);


Expand All @@ -36,7 +36,7 @@ public class GridMockNioSession extends GridMetadataAwareAdapter implements Grid
/** /**
* Creates empty mock session. * Creates empty mock session.
*/ */
public GridMockNioSession() { public MockNioSession() {
// No-op. // No-op.
} }


Expand All @@ -46,7 +46,7 @@ public GridMockNioSession() {
* @param locAddr Local address. * @param locAddr Local address.
* @param rmtAddr Remote address. * @param rmtAddr Remote address.
*/ */
public GridMockNioSession(InetSocketAddress locAddr, InetSocketAddress rmtAddr) { public MockNioSession(InetSocketAddress locAddr, InetSocketAddress rmtAddr) {
this(); this();


this.locAddr = locAddr; this.locAddr = locAddr;
Expand Down
Expand Up @@ -40,7 +40,7 @@
* This class tests that parser confirms memcache extended specification. * This class tests that parser confirms memcache extended specification.
*/ */
@SuppressWarnings("TypeMayBeWeakened") @SuppressWarnings("TypeMayBeWeakened")
public class GridTcpRestParserSelfTest extends GridCommonAbstractTest { public class TcpRestParserSelfTest extends GridCommonAbstractTest {
/** Marshaller. */ /** Marshaller. */
private GridClientMarshaller marshaller = new GridClientOptimizedMarshaller(); private GridClientMarshaller marshaller = new GridClientOptimizedMarshaller();


Expand All @@ -54,7 +54,7 @@ public class GridTcpRestParserSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed. * @throws Exception If failed.
*/ */
public void testSimplePacketParsing() throws Exception { public void testSimplePacketParsing() throws Exception {
GridNioSession ses = new GridMockNioSession(); GridNioSession ses = new MockNioSession();


GridTcpRestParser parser = new GridTcpRestParser(); GridTcpRestParser parser = new GridTcpRestParser();


Expand Down Expand Up @@ -89,7 +89,7 @@ public void testSimplePacketParsing() throws Exception {
* @throws Exception If failed. * @throws Exception If failed.
*/ */
public void testIncorrectPackets() throws Exception { public void testIncorrectPackets() throws Exception {
final GridNioSession ses = new GridMockNioSession(); final GridNioSession ses = new MockNioSession();


final GridTcpRestParser parser = new GridTcpRestParser(); final GridTcpRestParser parser = new GridTcpRestParser();


Expand Down Expand Up @@ -147,7 +147,7 @@ public void testCustomMessages() throws Exception {


ByteBuffer raw = clientRequestPacket(req); ByteBuffer raw = clientRequestPacket(req);


GridNioSession ses = new GridMockNioSession(); GridNioSession ses = new MockNioSession();


ses.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); ses.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller());


Expand All @@ -174,8 +174,8 @@ public void testCustomMessages() throws Exception {
* @throws Exception If failed. * @throws Exception If failed.
*/ */
public void testMixedParsing() throws Exception { public void testMixedParsing() throws Exception {
GridNioSession ses1 = new GridMockNioSession(); GridNioSession ses1 = new MockNioSession();
GridNioSession ses2 = new GridMockNioSession(); GridNioSession ses2 = new MockNioSession();


ses1.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); ses1.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller());
ses2.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); ses2.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller());
Expand Down Expand Up @@ -262,7 +262,7 @@ public void testParseContinuousSplit() throws Exception {


tmp.flip(); tmp.flip();


GridNioSession ses = new GridMockNioSession(); GridNioSession ses = new MockNioSession();


ses.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); ses.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller());


Expand Down Expand Up @@ -304,7 +304,7 @@ public void testParseClientHandshake() throws Exception {


ByteBuffer[] split = split(tmp, splitPos); ByteBuffer[] split = split(tmp, splitPos);


GridNioSession ses = new GridMockNioSession(); GridNioSession ses = new MockNioSession();


ses.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller()); ses.addMeta(MARSHALLER.ordinal(), new GridClientOptimizedMarshaller());


Expand Down

0 comments on commit b24441a

Please sign in to comment.