49 50 @Test 51 public void testGetCommercialFeaturesService() throws ConnectionException { 52 getCommercialFeaturesService(); 53 } 54 55 @Test 56 public void testReadCommercialFeaturesState() throws ConnectionException { 57 ICommercialFeaturesService service = getCommercialFeaturesService(); 58 // Check state. Any state is okay, but we want to catch exceptions. 59 service.isCommercialFeaturesEnabled(); 60 } 61 62 @Test 63 public void testSetCommercialFeaturesState() throws Exception { 64 ICommercialFeaturesService service = getCommercialFeaturesService(); 65 // Check state. Any state is okay, but we want to catch exceptions. 66 if (!service.isCommercialFeaturesEnabled()) { 67 service.enableCommercialFeatures(); 68 } 69 assertTrue("Commercial features should now be enabled!", service.isCommercialFeaturesEnabled()); //$NON-NLS-1$ 70 } 71 72 private ICommercialFeaturesService getCommercialFeaturesService() throws ConnectionException { 73 IConnectionHandle handle = getConnectionHandle(); 74 75 // LocalRJMXTestToolkit.createDefaultConnectionHandle(getConnectionManager()); 76 assumeHotSpot7u4OrLater(handle); 77 78 ICommercialFeaturesService service = handle.getServiceOrNull(ICommercialFeaturesService.class); 79 80 assertNotNull( 81 "Could not retrieve the commercial features service. Please make sure that you are connecting to a Java 7u4 or later JVM.", //$NON-NLS-1$ 82 service); 83 return service; 84 } 85 } | 49 50 @Test 51 public void testGetCommercialFeaturesService() throws ConnectionException { 52 getCommercialFeaturesService(); 53 } 54 55 @Test 56 public void testReadCommercialFeaturesState() throws ConnectionException { 57 ICommercialFeaturesService service = getCommercialFeaturesService(); 58 // Check state. Any state is okay, but we want to catch exceptions. 59 service.isCommercialFeaturesEnabled(); 60 } 61 62 @Test 63 public void testSetCommercialFeaturesState() throws Exception { 64 ICommercialFeaturesService service = getCommercialFeaturesService(); 65 // Check state. Any state is okay, but we want to catch exceptions. 66 if (!service.isCommercialFeaturesEnabled()) { 67 service.enableCommercialFeatures(); 68 } 69 assertTrue("Commercial features should now be enabled!", service.isCommercialFeaturesEnabled()); 70 } 71 72 private ICommercialFeaturesService getCommercialFeaturesService() throws ConnectionException { 73 IConnectionHandle handle = getConnectionHandle(); 74 75 // LocalRJMXTestToolkit.createDefaultConnectionHandle(getConnectionManager()); 76 assumeHotSpot7u4OrLater(handle); 77 78 ICommercialFeaturesService service = handle.getServiceOrNull(ICommercialFeaturesService.class); 79 80 assertNotNull( 81 "Could not retrieve the commercial features service. Please make sure that you are connecting to a Java 7u4 or later JVM.", 82 service); 83 return service; 84 } 85 } |