1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
#import <objc/Ice.h>
#import <objc/Glacier2.h>
#import <objc/IceStorm.h>
#import <objc/IceGrid.h>
#import <TestCommon.h>
#import <ServicesTest.h>
#import <Foundation/Foundation.h>
@interface ClockI : TestServicesClock<TestServicesClock>
-(id) init;
-(void)tick:(NSString*)time current:(ICECurrent*)current;
@end
@implementation ClockI
-(id) init
{
self = [super init];
return self;
}
-(void)tick:(NSString*)time current:(ICECurrent*)__unused current
{
NSLog(@"%@", time);
}
@end
void
servicesAllTests(id<ICECommunicator> communicator)
{
{
tprintf("testing Glacier2 stub... ");
@try
{
id<GLACIER2RouterPrx> router = [GLACIER2RouterPrx checkedCast:[communicator getDefaultRouter]];
[router createSession:@"" password:@""];
}
@catch(ICEException* ex)
{
test(NO);
}
tprintf("ok\n");
}
{
tprintf("testing IceStorm stub... ");
ICESTORMTopicManagerPrx* manager =
[ICESTORMTopicManagerPrx uncheckedCast:[communicator stringToProxy:@"test:default -p 12010"]];
ICESTORMQoS* qos = nil;
ICESTORMTopicPrx* topic = nil;
NSString* topicName = @"time";
id<ICEObjectAdapter> adapter = [communicator createObjectAdapterWithEndpoints:@"subscriber" endpoints:@"tcp"];
ICEObjectPrx* subscriber = [adapter addWithUUID:[ClockI clock]];
[adapter activate];
@try
{
topic = [manager retrieve:topicName];
[topic subscribeAndGetPublisher:qos subscriber:subscriber];
}
@catch(ICESTORMNoSuchTopic*)
{
test(NO);
}
@catch(ICESTORMAlreadySubscribed*)
{
test(NO);
}
@catch(ICELocalException*)
{
}
tprintf("ok\n");
}
{
tprintf("testing IceGrid stub... ");
ICEObjectPrx* base = [communicator stringToProxy:@"test:default -p 12010"];
ICEGRIDRegistryPrx* registry = [ICEGRIDRegistryPrx uncheckedCast:base];
ICEGRIDAdminSessionPrx* session;
@try
{
session = [registry createAdminSession:@"username" password:@"password"];
test(NO);
[session getAdmin];
}
@catch(ICEGRIDPermissionDeniedException*)
{
test(NO);
}
@catch(ICELocalException*)
{
}
tprintf("ok\n");
}
}
|