View Javadoc
1   // Copyright (c) Microsoft Corporation. All rights reserved.
2   // Licensed under the MIT License.
3   
4   package com.microsoft.azure.eventhubs.sendrecv;
5   
6   import com.microsoft.azure.eventhubs.ConnectionStringBuilder;
7   import com.microsoft.azure.eventhubs.EventHubException;
8   import com.microsoft.azure.eventhubs.TransportType;
9   import com.microsoft.azure.eventhubs.lib.SasTokenTestBase;
10  import com.microsoft.azure.eventhubs.lib.TestContext;
11  import org.junit.After;
12  import org.junit.AfterClass;
13  import org.junit.Assert;
14  import org.junit.BeforeClass;
15  import org.junit.Test;
16  
17  import java.util.concurrent.ExecutionException;
18  import java.util.concurrent.TimeoutException;
19  
20  public class WebSocketsSendTest extends SasTokenTestBase {
21  
22      private static SendTest sendTest;
23  
24      @BeforeClass
25      public static void initialize() throws Exception {
26  
27          Assert.assertTrue(TestContext.getConnectionString().getSharedAccessSignature() != null
28                  && TestContext.getConnectionString().getSasKey() == null
29                  && TestContext.getConnectionString().getSasKeyName() == null);
30  
31          sendTest = new SendTest();
32  
33          ConnectionStringBuilder connectionString = TestContext.getConnectionString();
34          connectionString.setTransportType(TransportType.AMQP_WEB_SOCKETS);
35          SendTest.initializeEventHub(connectionString);
36      }
37  
38      @AfterClass
39      public static void cleanupClient() throws EventHubException {
40  
41          SendTest.cleanupClient();
42      }
43  
44      @Test
45      public void sendBatchRetainsOrderWithinBatch() throws EventHubException, InterruptedException, ExecutionException, TimeoutException {
46  
47          sendTest.sendBatchRetainsOrderWithinBatch();
48      }
49  
50      @Test
51      public void sendResultsInSysPropertiesWithPartitionKey() throws EventHubException, InterruptedException, ExecutionException, TimeoutException {
52  
53          sendTest.sendResultsInSysPropertiesWithPartitionKey();
54      }
55  
56      @After
57      public void cleanup() throws EventHubException {
58  
59          sendTest.cleanup();
60      }
61  }