Search in sources :

Example 26 with ApnsService

use of com.notnoop.apns.ApnsService in project java-apns by notnoop.

the class QueuedApnsServiceTest method pushEventually.

@Test
public void pushEventually() {
    ConnectionStub connection = spy(new ConnectionStub(0, 1));
    ApnsService service = newService(connection, null);
    service.push(notification);
    connection.semaphore.acquireUninterruptibly();
    verify(connection, times(1)).sendMessage(notification);
}
Also used : ApnsService(com.notnoop.apns.ApnsService) Test(org.junit.Test)

Example 27 with ApnsService

use of com.notnoop.apns.ApnsService in project java-apns by notnoop.

the class ApnsServiceImplTest method pushEventually.

@Test
public void pushEventually() {
    ApnsConnection connection = mock(ApnsConnection.class);
    ApnsService service = newService(connection, null);
    service.push(notification);
    verify(connection, times(1)).sendMessage(notification);
}
Also used : ApnsService(com.notnoop.apns.ApnsService) Test(org.junit.Test)

Example 28 with ApnsService

use of com.notnoop.apns.ApnsService in project camel by apache.

the class ApnsServiceFactory method getApnsService.

public ApnsService getApnsService() {
    ApnsServiceBuilder builder = APNS.newService();
    builder = configureServiceBuilder(builder);
    configureConnectionStrategy(builder);
    configureReconnectionPolicy(builder);
    configureApnsDelegate(builder);
    configureApnsDestinations(builder);
    try {
        configureApnsCertificate(builder);
    } catch (IOException e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    } catch (GeneralSecurityException e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
    ApnsService apnsService = builder.build();
    return apnsService;
}
Also used : GeneralSecurityException(java.security.GeneralSecurityException) ApnsServiceBuilder(com.notnoop.apns.ApnsServiceBuilder) IOException(java.io.IOException) ApnsService(com.notnoop.apns.ApnsService)

Example 29 with ApnsService

use of com.notnoop.apns.ApnsService in project camel by apache.

the class ApnsProducerTest method createCamelContext.

protected CamelContext createCamelContext() throws Exception {
    CamelContext camelContext = super.createCamelContext();
    ApnsServiceFactory apnsServiceFactory = ApnsUtils.createDefaultTestConfiguration(camelContext);
    ApnsService apnsService = apnsServiceFactory.getApnsService();
    ApnsComponent apnsComponent = new ApnsComponent(apnsService);
    camelContext.addComponent("apns", apnsComponent);
    return camelContext;
}
Also used : CamelContext(org.apache.camel.CamelContext) ApnsServiceFactory(org.apache.camel.component.apns.factory.ApnsServiceFactory) ApnsService(com.notnoop.apns.ApnsService)

Example 30 with ApnsService

use of com.notnoop.apns.ApnsService in project camel by apache.

the class ApnsServiceFactoryTest method testApnsServiceFactoryWithFixedCertificates.

@Test
public void testApnsServiceFactoryWithFixedCertificates() throws Exception {
    ApnsServiceFactory apnsServiceFactory = createApnsServiceFactoryWithFixedCertificates();
    ApnsService apnsService = apnsServiceFactory.getApnsService();
    doBasicAsserts(apnsService);
}
Also used : ApnsService(com.notnoop.apns.ApnsService) Test(org.junit.Test)

Aggregations

ApnsService (com.notnoop.apns.ApnsService)32 Test (org.junit.Test)20 ApnsNotification (com.notnoop.apns.ApnsNotification)5 DeliveryError (com.notnoop.apns.DeliveryError)5 EnhancedApnsNotification (com.notnoop.apns.EnhancedApnsNotification)5 SimpleApnsNotification (com.notnoop.apns.SimpleApnsNotification)5 StartSendingApnsDelegate (com.notnoop.apns.StartSendingApnsDelegate)5 ApnsServerStub (com.notnoop.apns.utils.ApnsServerStub)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)5 CountDownLatch (java.util.concurrent.CountDownLatch)4 CamelContext (org.apache.camel.CamelContext)4 ApnsServiceFactory (org.apache.camel.component.apns.factory.ApnsServiceFactory)4 ApnsDelegate (com.notnoop.apns.ApnsDelegate)2 Repeat (com.notnoop.apns.utils.junit.Repeat)2 ApnsServiceBuilder (com.notnoop.apns.ApnsServiceBuilder)1 ConnectionStub (com.notnoop.apns.internal.QueuedApnsServiceTest.ConnectionStub)1 NetworkIOException (com.notnoop.exceptions.NetworkIOException)1 IOException (java.io.IOException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 GeneralSecurityException (java.security.GeneralSecurityException)1