/** * Test method for {@link com.microsoft.hpc.scheduler.session.SessionBase#getServerVersion()} . */ @Test public final void testGetServerVersion() { // Bug 13405 logger.Start("testGetServerVersion"); // functional SessionStartInfo info = new SessionStartInfo( config.Scheduler, config.ServiceName, config.UserName, config.Password); DurableSession dSession = null; try { dSession = DurableSession.createSession(info); } catch (SocketTimeoutException e) { logger.Error("Timeout when creating a durable session", e); } catch (SessionException e) { logger.Error("Session exception when creating a durable session", e); } if (dSession == null) { logger.Error("creating dSession failed"); return; } Version v = dSession.getServerVersion(); logger.Info(v.toString()); logger.assertEqual("DurableSession serverVersion major", v.getMajor(), 4); // logger.assertEqual("DurableSession serverVersion minor", v.getMinor(), // 2); // BUG to check if the server Version // boundary try { dSession.close(); } catch (SocketTimeoutException e) { // TODO Auto-generated catch block } catch (SessionException e) { // TODO Auto-generated catch block } logger.End("testGetServerVersion"); }
/** * Test method for {@link * com.microsoft.hpc.scheduler.session.SessionBase#GetServiceVersions(java.lang.String, * java.lang.String)} . */ @Test public final void testGetServiceVersions() { logger.Start("testGetServiceVersions"); try { logger.assertEqual( "ccpechosvc version", DurableSession .GetServiceVersions( config.Scheduler, config.ServiceName, config.UserName, config.Password)[0] .toString(), "3.2"); } catch (SessionException e) { logger.Error("Session exception", e); } // get other service name String serviceName = config.getValue("ServiceName"); if (serviceName != "") { try { Version[] vers = DurableSession.GetServiceVersions( config.Scheduler, serviceName, config.UserName, config.Password); for (Version ver : vers) { logger.Info(ver.toString()); } } catch (SessionException e) { logger.Error("Session exception", e); } } // boundary Version[] versions = null; try { versions = DurableSession.GetServiceVersions( "", config.ServiceName, config.UserName, config.Password); logger.Error("EE is not thrown"); } catch (IllegalArgumentException e) { logger.Info("IllegalArgumentException is thrown"); } catch (SessionException e) { logger.Info("SessionException is thrown"); } try { versions = DurableSession.GetServiceVersions( "abcxyz087879", config.ServiceName, config.UserName, config.Password); logger.Error("EE is not thrown"); } catch (WebServiceException e) { logger.Info("WebServiceException is thrown", e); } catch (SessionException e) { logger.Error("SessionException is thrown", e); } try { versions = DurableSession.GetServiceVersions(config.Scheduler, "", config.UserName, config.Password); logger.Error("EE is not thrown"); } catch (IllegalArgumentException e) { logger.Info("IllegalArgumentException is thrown"); } catch (SessionException e) { logger.Error("SessionException is thrown", e); } try { versions = DurableSession.GetServiceVersions( config.Scheduler, "abcxyz2329083", config.UserName, config.Password); logger.assertEqual("versions", versions.length, 0); } catch (IllegalArgumentException e) { logger.Error("IllegalArgumentException is thrown", e); } catch (SessionException e) { logger.Error("SessionException is thrown", e); } logger.End("testGetServiceVersions"); }