public void TestRemoteInvocationOnCache() { Console.WriteLine(Directory.GetCurrentDirectory()); IInvocationService service = (IInvocationService)CacheFactory.GetService("RemoteInvocationServiceSSL"); Assert.IsNotNull(service); IDictionary result = service.Query(new EmptyInvocable(), null); Assert.IsNotNull(result); }
public static void AccessInvocationService() { Console.WriteLine("------InvocationService access control example " + "begins------"); Console.WriteLine(); // Someone with writer role can run invocables IPrincipal principal = SecurityExampleHelper.Login("JohnWhorfin"); try { Thread.CurrentPrincipal = principal; IInvocationService service = (IInvocationService) CacheFactory.GetService(SecurityExampleHelper.INVOCATION_SERVICE_NAME); service.Query(new ExampleInvocable(), null); Console.WriteLine(); Console.WriteLine(" Success: Correctly allowed to " + "use the invocation service"); Console.WriteLine(); } catch (Exception e) { // get exception if not allowed to perform the operation Console.WriteLine(e.StackTrace); } // Someone with reader role cannot cannot run invocables principal = SecurityExampleHelper.Login("JohnBigboote"); try { Thread.CurrentPrincipal = principal; IInvocationService service = (IInvocationService) CacheFactory.GetService(SecurityExampleHelper.INVOCATION_SERVICE_NAME); service.Query(new ExampleInvocable(), null); } catch (Exception e) { // get exception if not allowed to perform the operation Console.WriteLine(); Console.WriteLine(" Success: Correctly unable to " + "use the invocation service"); Console.WriteLine(); } Console.WriteLine(); Console.WriteLine("------InvocationService access control example " + "completed------"); }
public void TestJmxConnectionInformation() { IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory; IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config.xml"); ccf.Config = config; IInvocationService service = (IInvocationService)CacheFactory.GetService("RemoteInvocationService"); IMember member = ((DefaultConfigurableCacheFactory)ccf).OperationalContext.LocalMember; MBeanInvocable invocable = new MBeanInvocable(); IDictionary result = service.Query(invocable, null); Assert.IsNotNull(result); Assert.AreEqual(result.Count, 1); Assert.IsNotNull(result[member]); service.Shutdown(); }
/** * utility method to stop and restart the proxy. */ private IInvocationService RestartProxy(IInvocationService service) { if (service == null) { service = (IInvocationService)CacheFactory.GetService("ExtendTcpProxyControlService"); } ProxyStopInvocable invocable = new ProxyStopInvocable(); invocable.ProxyServiceName = "ExtendTcpProxyServiceCOH8230"; try { Object result = service.Query(invocable, null); } catch (Exception /* e */) { // ignore } return(service); }
public void TestMemberRemoteInvocation() { IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory; IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config.xml"); ccf.Config = config; IInvocationService service = (IInvocationService)CacheFactory.GetService("RemoteInvocationService"); IMember member = new LocalMember(); member.MachineName = "machine1"; member.MemberName = "member1"; member.ProcessName = "process1"; member.RackName = "rack1"; member.RoleName = "role1"; member.SiteName = "site1"; POFObjectInvocable invocable = new POFObjectInvocable(); invocable.PofObject = member; IDictionary result = service.Query(invocable, null); Assert.IsNotNull(result); Assert.AreEqual(result.Count, 1); IMember copy = (IMember)result[((DefaultConfigurableCacheFactory)CacheFactory .ConfigurableCacheFactory).OperationalContext.LocalMember]; Assert.AreEqual(member.MachineName, copy.MachineName); Assert.AreEqual(member.MemberName, copy.MemberName); Assert.AreEqual(member.ProcessName, copy.ProcessName); Assert.AreEqual(member.RackName, copy.RackName); Assert.AreEqual(member.RoleName, copy.RoleName); Assert.AreEqual(member.SiteName, copy.SiteName); service.Shutdown(); }
public void TestCompositeKeyRemoteInvocation() { IConfigurableCacheFactory ccf = CacheFactory.ConfigurableCacheFactory; IXmlDocument config = XmlHelper.LoadXml("assembly://Coherence.Tests/Tangosol.Resources/s4hc-cache-config.xml"); ccf.Config = config; IInvocationService service = (IInvocationService)CacheFactory.GetService("RemoteInvocationService"); CompositeKey key = new CompositeKey("abc", "xyz"); POFObjectInvocable invocable = new POFObjectInvocable(); invocable.PofObject = key; IDictionary result = service.Query(invocable, null); Assert.IsNotNull(result); Assert.AreEqual(result.Count, 1); CompositeKey copy = (CompositeKey)result[((DefaultConfigurableCacheFactory) CacheFactory.ConfigurableCacheFactory).OperationalContext.LocalMember]; Assert.AreEqual(key, copy); service.Shutdown(); }