Browse code

BM-14204 Fix: remove net.bluemind.hornetq.client.tests

kladier authored on 08/02/2019 09:14:47
Showing 9 changed files
1 1
deleted file mode 100644
... ...
@@ -1,7 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<classpath>
3
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
4
-	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
-	<classpathentry kind="src" path="src/"/>
6
-	<classpathentry kind="output" path="target/classes"/>
7
-</classpath>
8 0
deleted file mode 100644
... ...
@@ -1,30 +0,0 @@
1
-<?xml version="1.0"?>
2
-<projectDescription>
3
-	<name>net.bluemind.hornetq.client.tests</name>
4
-	<comment/>
5
-	<projects>
6
-	</projects>
7
-	<buildSpec>
8
-		<buildCommand>
9
-			<name>org.eclipse.jdt.core.javabuilder</name>
10
-			<arguments>
11
-			</arguments>
12
-		</buildCommand>
13
-		<buildCommand>
14
-			<name>org.eclipse.pde.ManifestBuilder</name>
15
-			<arguments>
16
-			</arguments>
17
-		</buildCommand>
18
-		<buildCommand>
19
-			<name>org.eclipse.pde.SchemaBuilder</name>
20
-			<arguments>
21
-			</arguments>
22
-		</buildCommand>
23
-		
24
-	</buildSpec>
25
-	<natures>
26
-		
27
-		<nature>org.eclipse.pde.PluginNature</nature>
28
-		<nature>org.eclipse.jdt.core.javanature</nature>
29
-	</natures>
30
-</projectDescription>
31 0
deleted file mode 100644
... ...
@@ -1,12 +0,0 @@
1
-Manifest-Version: 1.0
2
-Bundle-ManifestVersion: 2
3
-Bundle-Name: net.bluemind.hornetq.client.tests
4
-Bundle-SymbolicName: net.bluemind.hornetq.client.tests
5
-Bundle-Version: 4.1.0.qualifier
6
-Bundle-Vendor: www.blue-mind.net
7
-Fragment-Host: net.bluemind.hornetq.client
8
-Require-Bundle: org.eclipse.core.runtime,
9
- org.junit;bundle-version="3.8.2",
10
- io.netty;bundle-version="4.0.33"
11
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
12
-Bundle-ActivationPolicy: lazy
13 0
deleted file mode 100644
... ...
@@ -1,3 +0,0 @@
1
-source.. = src/
2
-bin.includes = META-INF/,\
3
-               .
4 0
deleted file mode 100644
... ...
@@ -1,17 +0,0 @@
1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4
-	<modelVersion>4.0.0</modelVersion>
5
-
6
-	<parent>
7
-		<groupId>net.bluemind</groupId>
8
-		<artifactId>plugins</artifactId>
9
-		<version>4.1.0-SNAPSHOT</version>
10
-	</parent>
11
-
12
-	<artifactId>net.bluemind.hornetq.client.tests</artifactId>
13
-
14
-	<packaging>eclipse-test-plugin</packaging>
15
-	
16
-
17
-</project>
18 0
\ No newline at end of file
19 1
deleted file mode 100644
... ...
@@ -1,52 +0,0 @@
1
-/* BEGIN LICENSE
2
- * Copyright © Blue Mind SAS, 2012-2016
3
- *
4
- * This file is part of BlueMind. BlueMind is a messaging and collaborative
5
- * solution.
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of either the GNU Affero General Public License as
9
- * published by the Free Software Foundation (version 3 of the License).
10
- *
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
- *
16
- * See LICENSE.txt
17
- * END LICENSE
18
- */
19
-package net.bluemind.hornetq.client.tests;
20
-
21
-import org.osgi.framework.BundleActivator;
22
-import org.osgi.framework.BundleContext;
23
-
24
-public class Activator implements BundleActivator {
25
-
26
-	private static BundleContext context;
27
-
28
-	static BundleContext getContext() {
29
-		return context;
30
-	}
31
-
32
-	/*
33
-	 * (non-Javadoc)
34
-	 * 
35
-	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.
36
-	 * BundleContext)
37
-	 */
38
-	public void start(BundleContext bundleContext) throws Exception {
39
-		Activator.context = bundleContext;
40
-	}
41
-
42
-	/*
43
-	 * (non-Javadoc)
44
-	 * 
45
-	 * @see
46
-	 * org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
47
-	 */
48
-	public void stop(BundleContext bundleContext) throws Exception {
49
-		Activator.context = null;
50
-	}
51
-
52
-}
53 0
deleted file mode 100644
... ...
@@ -1,76 +0,0 @@
1
-/* BEGIN LICENSE
2
-  * Copyright © Blue Mind SAS, 2012-2017
3
-  *
4
-  * This file is part of BlueMind. BlueMind is a messaging and collaborative
5
-  * solution.
6
-  *
7
-  * This program is free software; you can redistribute it and/or modify
8
-  * it under the terms of either the GNU Affero General Public License as
9
-  * published by the Free Software Foundation (version 3 of the License).
10
-  *
11
-  * This program is distributed in the hope that it will be useful,
12
-  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
-  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
-  *
15
-  * See LICENSE.txt
16
-  * END LICENSE
17
-  */
18
-package net.bluemind.hornetq.client.tests;
19
-
20
-import static org.junit.Assert.assertTrue;
21
-
22
-import java.util.concurrent.CompletableFuture;
23
-import java.util.concurrent.CountDownLatch;
24
-import java.util.concurrent.TimeUnit;
25
-import java.util.concurrent.atomic.AtomicBoolean;
26
-
27
-import org.junit.Test;
28
-import org.vertx.java.core.json.JsonObject;
29
-
30
-import net.bluemind.hornetq.client.Consumer;
31
-import net.bluemind.hornetq.client.MQ;
32
-import net.bluemind.hornetq.client.OOPMessage;
33
-import net.bluemind.hornetq.client.Producer;
34
-
35
-public class HZTests {
36
-
37
-	@Test
38
-	public void testFutureBehaviour() {
39
-		CompletableFuture<Void> future = new CompletableFuture<>();
40
-		AtomicBoolean f1Called = new AtomicBoolean(false);
41
-		AtomicBoolean f2Called = new AtomicBoolean(false);
42
-		future.thenAccept(v -> {
43
-			System.out.println("f1");
44
-			f1Called.set(true);
45
-		});
46
-		future.thenAccept(v -> {
47
-			System.out.println("f2");
48
-			f2Called.set(true);
49
-		});
50
-		future.complete(null);
51
-		assertTrue(f1Called.get());
52
-		assertTrue(f2Called.get());
53
-	}
54
-
55
-	@Test
56
-	public void testHZStart() throws InterruptedException {
57
-		CountDownLatch cdl = new CountDownLatch(1);
58
-		CountDownLatch msgLatch = new CountDownLatch(1);
59
-		MQ.init(() -> {
60
-			cdl.countDown();
61
-			Producer prod = MQ.registerProducer("ass.hole");
62
-			Consumer cons = MQ.registerConsumer("ass.hole", oop -> {
63
-				System.out.println("Received " + oop.toJson().encodePrettily());
64
-				msgLatch.countDown();
65
-			});
66
-			OOPMessage msg = new OOPMessage(new JsonObject().putString("payload", "dick"));
67
-			prod.send(msg);
68
-			cons.close();
69
-		});
70
-		boolean ok = cdl.await(30, TimeUnit.SECONDS);
71
-		assertTrue(ok);
72
-		ok = msgLatch.await(30, TimeUnit.SECONDS);
73
-		assertTrue(ok);
74
-	}
75
-
76
-}
77 0
deleted file mode 100644
... ...
@@ -1,65 +0,0 @@
1
-package net.bluemind.hornetq.client.tests;
2
-
3
-import java.util.Date;
4
-import java.util.concurrent.CountDownLatch;
5
-import java.util.concurrent.atomic.LongAdder;
6
-
7
-import junit.framework.TestCase;
8
-import net.bluemind.hornetq.client.MQ;
9
-import net.bluemind.hornetq.client.OOPMessage;
10
-import net.bluemind.hornetq.client.OutOfProcessMessageHandler;
11
-import net.bluemind.hornetq.client.Producer;
12
-import net.bluemind.hornetq.client.Topic;
13
-
14
-public class HprofOnMassNotifTest extends TestCase {
15
-
16
-	private static final int CNT = 100000;
17
-
18
-	public void testProduceMassImapNotifications() throws InterruptedException {
19
-		final CountDownLatch cd = new CountDownLatch(1);
20
-		LongAdder received = new LongAdder();
21
-		MQ.init(new MQ.IMQConnectHandler() {
22
-
23
-			@Override
24
-			public void connected() {
25
-				Producer producer = MQ.registerProducer(Topic.IMAP_NOTIFICATIONS);
26
-				MQ.registerConsumer(Topic.IMAP_NOTIFICATIONS, new OutOfProcessMessageHandler() {
27
-
28
-					@Override
29
-					public void handle(OOPMessage message) {
30
-						received.increment();
31
-					}
32
-				});
33
-				System.out.println("Producer: " + producer);
34
-				try {
35
-					int count = 0;
36
-					for (int i = 0; i < CNT; i++) {
37
-						OOPMessage m = MQ.newMessage();
38
-						m.putStringProperty("latd", "admin@willow.vmw");
39
-						m.putStringProperty("operation", "mail.added");
40
-						m.putStringProperty("arguments",
41
-								"Sent ($Forwarded \\Seen) \"01-Oct-2012 10:52:06 +0200\" {114971+}");
42
-						m.putStringProperty("response", "OK [APPENDUID 123 456] Completed.");
43
-						assertFalse("producer is closed", producer.isClosed());
44
-						producer.send(m);
45
-						int cur = count++;
46
-						if ((cur % 5000) == 0) {
47
-							System.out.println(new Date() + " - " + cur + " / " + CNT);
48
-						}
49
-					}
50
-				} catch (Throwable e) {
51
-					e.printStackTrace();
52
-					fail(e.getMessage());
53
-				}
54
-				cd.countDown();
55
-			}
56
-		});
57
-		cd.await();
58
-		int retry = 100;
59
-		while (received.intValue() < CNT && retry-- > 0) {
60
-			Thread.sleep(200);
61
-		}
62
-		assertEquals(CNT, received.intValue());
63
-	}
64
-
65
-}
66 0
deleted file mode 100644
... ...
@@ -1,92 +0,0 @@
1
-package net.bluemind.hornetq.client.tests;
2
-
3
-import java.util.concurrent.CountDownLatch;
4
-import java.util.concurrent.TimeUnit;
5
-import java.util.concurrent.atomic.AtomicInteger;
6
-
7
-import junit.framework.TestCase;
8
-import net.bluemind.hornetq.client.MQ;
9
-import net.bluemind.hornetq.client.OOPMessage;
10
-import net.bluemind.hornetq.client.OutOfProcessMessageHandler;
11
-import net.bluemind.hornetq.client.Producer;
12
-
13
-public class LockOnBrokenProducer extends TestCase {
14
-
15
-	private static final String TEST_TOPIC = "test_" + System.currentTimeMillis();
16
-
17
-	private class BrokenConsumer implements OutOfProcessMessageHandler {
18
-
19
-		public AtomicInteger received = new AtomicInteger();
20
-		public long maxDelayMs = 0;
21
-		public long maxDelaySeq = 0;
22
-		public CountDownLatch expected;
23
-
24
-		public BrokenConsumer(CountDownLatch expected) {
25
-			this.expected = expected;
26
-		}
27
-
28
-		@Override
29
-		public void handle(OOPMessage message) {
30
-			// int rec =
31
-			received.incrementAndGet();
32
-			// comment this line to make it a broken consumer again
33
-			long sent = message.getLongProperty("send");
34
-			long delay = System.currentTimeMillis() - sent;
35
-			if (delay > maxDelayMs) {
36
-				maxDelayMs = delay;
37
-				maxDelaySeq = message.getIntProperty("seq");
38
-			}
39
-			expected.countDown();
40
-			// System.out.println("At " + rec);
41
-		}
42
-
43
-	}
44
-
45
-	public void testSendWithOneBrokenConsumer() throws InterruptedException {
46
-		final CountDownLatch cd = new CountDownLatch(1);
47
-		MQ.init(new MQ.IMQConnectHandler() {
48
-
49
-			@Override
50
-			public void connected() {
51
-				MQ.registerProducer(TEST_TOPIC);
52
-				cd.countDown();
53
-			}
54
-		});
55
-		cd.await();
56
-
57
-		Producer producer = MQ.getProducer(TEST_TOPIC);
58
-		assertNotNull(producer);
59
-
60
-		int CNT = 5000000;
61
-		CountDownLatch received = new CountDownLatch(CNT);
62
-		final BrokenConsumer bc = new BrokenConsumer(received);
63
-		final CountDownLatch csCd = new CountDownLatch(1);
64
-		MQ.init(new MQ.IMQConnectHandler() {
65
-
66
-			@Override
67
-			public void connected() {
68
-				MQ.registerConsumer(TEST_TOPIC, bc);
69
-				csCd.countDown();
70
-			}
71
-		});
72
-		csCd.await();
73
-		System.out.println("Producer & Consumer both set.");
74
-
75
-		for (int i = 0; i < CNT; i++) {
76
-			if ((i % 250000) == 0) {
77
-				// leave MQ some time to breathe
78
-				Thread.sleep(1000);
79
-			}
80
-			OOPMessage cm = MQ.newMessage().putStringProperty("yeah", "yeah");
81
-			long time = System.currentTimeMillis();
82
-			cm.putLongProperty("send", time);
83
-			cm.putIntProperty("seq", (i + 1));
84
-			producer.send(cm);
85
-		}
86
-
87
-		System.out.println("Waiting some messages: " + received.getCount());
88
-		received.await(1, TimeUnit.MINUTES);
89
-		assertEquals(CNT, bc.received.get());
90
-		System.out.println("Maximum message for msg " + bc.maxDelaySeq + ". Delay was: " + bc.maxDelayMs + "ms.");
91
-	}
92
-}