root/trunk/components/server/test/ome/server/itests/ConfigTest.java
| Revision 1167, 3.4 kB (checked in by jmoore, 2 years ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /* |
| 2 | * $Id$ |
| 3 | * |
| 4 | * Copyright 2006 University of Dundee. All rights reserved. |
| 5 | * Use is subject to license terms supplied in LICENSE.txt |
| 6 | */ |
| 7 | package ome.server.itests; |
| 8 | |
| 9 | import java.util.UUID; |
| 10 | |
| 11 | import ome.api.IConfig; |
| 12 | |
| 13 | import org.testng.annotations.*; |
| 14 | |
| 15 | /** |
| 16 | * simple server-side test of the ome.api.IConfig service. |
| 17 | * |
| 18 | * Also used as the main developer example for developing |
| 19 | * (stateless/client-side) tests. See source code documentation for more. |
| 20 | * |
| 21 | * @author Josh Moore, josh.moore at gmx.de |
| 22 | * @version $Revision$, $Date$ |
| 23 | * @since 3.0-M3 |
| 24 | */ |
| 25 | /* |
| 26 | * Developer notes: --------------- The "integration" group is important for |
| 27 | * having tests run properly. It's not actually needed here because it's also |
| 28 | * defined on the super class. The "ticket:306" group works as a pointer to why |
| 29 | * certain tests were created, allowing for acceptance test-like functionality |
| 30 | * (TBD). |
| 31 | * |
| 32 | * It should be noted that server side integration tests DO NOT test the |
| 33 | * application server in any way. You are using the server-side code as a |
| 34 | * library at that point and no deployment has been made. (This may change if we |
| 35 | * start to use an embedded container like the one available from JBoss for |
| 36 | * testing, in which case there should be an AbstractEmbeddedContextTest) |
| 37 | * |
| 38 | * Also to explain, the AbstractInternalContextTest which is a close parallel to |
| 39 | * AbstractManagedContextTest is partially deprecated and should only really be |
| 40 | * used when testing specific parts of the internal plumbing of Omero, Spring, |
| 41 | * or Hibernate, such as flushing or transactions. |
| 42 | */ |
| 43 | @Test(groups = { "ticket:306", "config", "integration" }) |
| 44 | public class ConfigTest extends AbstractManagedContextTest { |
| 45 | |
| 46 | /* |
| 47 | * Developer notes: --------------- The name of the method is unimportant |
| 48 | * for testng. We continue to use test<name> for the possibility of having |
| 49 | * the tests also run onJunit 3.8. |
| 50 | */ |
| 51 | @Test |
| 52 | public void testConfigGetServerTime() throws Exception { |
| 53 | |
| 54 | /* |
| 55 | * Developer notes: --------------- An iConfig instance has also be set |
| 56 | * on the super class as has been done with almost all our interfaces. |
| 57 | * It is reset before each method call |
| 58 | */ |
| 59 | IConfig test = factory.getConfigService(); |
| 60 | |
| 61 | assertNotNull(test.getServerTime()); |
| 62 | } |
| 63 | |
| 64 | @Test |
| 65 | public void testConfigGetDBTime() throws Exception { |
| 66 | /* |
| 67 | * Developer notes: --------------- Using the instance variable |
| 68 | */ |
| 69 | assertNotNull(iConfig.getDatabaseTime()); |
| 70 | } |
| 71 | |
| 72 | @Test |
| 73 | public void testGetMissingConfigValue() throws Exception { |
| 74 | |
| 75 | /* |
| 76 | * Developer notes: --------------- HIGHLY unlikely that the UUID string |
| 77 | * will be available |
| 78 | */ |
| 79 | String value = iConfig.getConfigValue(UUID.randomUUID().toString()); |
| 80 | assertNull(value); |
| 81 | |
| 82 | } |
| 83 | |
| 84 | /* |
| 85 | * Developer notes: --------------- Tests that should not be run, either |
| 86 | * because they're not yet finished, or because they're waiting on a known |
| 87 | * issue, can be added to the "ignore" or "broken" group or marked "enabled = |
| 88 | * false" |
| 89 | */ |
| 90 | @Test(groups = "ignore") |
| 91 | public void testThisTestUsuallyWontBeCalled() throws Exception { |
| 92 | fail("This usually won't be called. You're probably using " |
| 93 | + "the developer test suite; don't worry about this."); |
| 94 | } |
| 95 | |
| 96 | @Test(enabled = false) |
| 97 | public void testThisTestWontBeCalled() throws Exception { |
| 98 | fail("Error in TestNG!"); |
| 99 | } |
| 100 | |
| 101 | } |
Note: See TracBrowser
for help on using the browser.
