|
24 | 24 | import org.labkey.api.assay.plate.Plate; |
25 | 25 | import org.labkey.api.assay.plate.PlateCustomField; |
26 | 26 | import org.labkey.api.assay.plate.PlateLayoutHandler; |
| 27 | +import org.labkey.api.assay.plate.PlateService; |
27 | 28 | import org.labkey.api.assay.plate.PlateSet; |
28 | 29 | import org.labkey.api.assay.plate.PlateSetType; |
29 | 30 | import org.labkey.api.assay.plate.PlateType; |
|
55 | 56 | import org.labkey.api.query.QueryUpdateService; |
56 | 57 | import org.labkey.api.query.ValidationException; |
57 | 58 | import org.labkey.api.security.User; |
| 59 | +import org.labkey.api.settings.OptionalFeatureService; |
58 | 60 | import org.labkey.api.util.JunitUtil; |
59 | 61 | import org.labkey.api.util.Pair; |
60 | 62 | import org.labkey.api.util.TestContext; |
@@ -99,6 +101,7 @@ public final class PlateManagerTest |
99 | 101 | private static Container container; |
100 | 102 | private static ExpSampleType sampleType; |
101 | 103 | private static User user; |
| 104 | + private static boolean primaryPlateSetFlag; |
102 | 105 |
|
103 | 106 | private enum PlateMetadataFields |
104 | 107 | { |
@@ -126,6 +129,10 @@ public static void setupTest() throws Exception |
126 | 129 | container.setActiveModules(newActiveModules); |
127 | 130 | } |
128 | 131 |
|
| 132 | + // Configure optional feature flag |
| 133 | + primaryPlateSetFlag = OptionalFeatureService.get().isFeatureEnabled(PlateService.DEPRECATE_PRIMARY_PLATE_SET_FLAG); |
| 134 | + OptionalFeatureService.get().setFeatureEnabled(PlateService.DEPRECATE_PRIMARY_PLATE_SET_FLAG, true, user); |
| 135 | + |
129 | 136 | Domain domain = PlateManager.get().getPlateMetadataDomain(container, user); |
130 | 137 | if (domain != null) |
131 | 138 | domain.delete(user); |
@@ -201,11 +208,33 @@ public static void setupTest() throws Exception |
201 | 208 | @AfterClass |
202 | 209 | public static void cleanup() |
203 | 210 | { |
| 211 | + // Restore optional feature flag |
| 212 | + OptionalFeatureService.get().setFeatureEnabled(PlateService.DEPRECATE_PRIMARY_PLATE_SET_FLAG, primaryPlateSetFlag, user); |
| 213 | + |
204 | 214 | deleteTestContainer(); |
205 | 215 | container = null; |
206 | 216 | user = null; |
207 | 217 | } |
208 | 218 |
|
| 219 | + @Test |
| 220 | + public void testDeprecatePrimaryPlateSetFlag() |
| 221 | + { |
| 222 | + try |
| 223 | + { |
| 224 | + OptionalFeatureService.get().setFeatureEnabled(PlateService.DEPRECATE_PRIMARY_PLATE_SET_FLAG, false, user); |
| 225 | + |
| 226 | + PlateSetImpl plateSetImpl = new PlateSetImpl(); |
| 227 | + plateSetImpl.setType(PlateSetType.primary); |
| 228 | + plateSetImpl.setName("testDeprecatePrimaryPlateSetFlag"); |
| 229 | + |
| 230 | + assertCreatePlateSetThrows("The primary plate set feature is not enabled.", plateSetImpl, null, null); |
| 231 | + } |
| 232 | + finally |
| 233 | + { |
| 234 | + OptionalFeatureService.get().setFeatureEnabled(PlateService.DEPRECATE_PRIMARY_PLATE_SET_FLAG, true, user); |
| 235 | + } |
| 236 | + } |
| 237 | + |
209 | 238 | @Test |
210 | 239 | public void testCreatePlateTemplate() throws Exception |
211 | 240 | { |
|
0 commit comments