|
| 1 | +/* |
| 2 | + * Copyright (c) 2019 LabKey Corporation |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package org.labkey.ldk.query; |
| 17 | + |
| 18 | +import org.junit.Assert; |
| 19 | +import org.labkey.api.data.Container; |
| 20 | +import org.labkey.api.data.ContainerManager; |
| 21 | +import org.labkey.api.security.User; |
| 22 | +import org.labkey.api.util.TestContext; |
| 23 | + |
| 24 | +public class AbstractIntegrationTest extends Assert |
| 25 | +{ |
| 26 | + protected static void doInitialSetUp(String projectName) |
| 27 | + { |
| 28 | + //pre-clean |
| 29 | + doCleanup(projectName); |
| 30 | + |
| 31 | + Container project = ContainerManager.getForPath(projectName); |
| 32 | + if (project == null) |
| 33 | + { |
| 34 | + ContainerManager.createContainer(ContainerManager.getRoot(), projectName); |
| 35 | + } |
| 36 | + } |
| 37 | + |
| 38 | + protected static void doCleanup(String projectName) |
| 39 | + { |
| 40 | + Container project = ContainerManager.getForPath(projectName); |
| 41 | + if (project != null) |
| 42 | + { |
| 43 | + ContainerManager.delete(project, getUser()); |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + protected static User getUser() |
| 48 | + { |
| 49 | + return TestContext.get().getUser(); |
| 50 | + } |
| 51 | +} |
0 commit comments