Search in sources :

Example 1 with RepositoryTestUtils

use of org.xwiki.repository.test.RepositoryTestUtils in project xwiki-platform by xwiki.

the class AllTests method initExtensions.

public static void initExtensions(PersistentTestContext context) throws Exception {
    // Initialize extensions and repositories
    RepositoryTestUtils repositoryTestUtil = new RepositoryTestUtils(context.getUtil(), repositoryUtil, new SolrTestUtils(context.getUtil()));
    repositoryTestUtil.init();
    // Set integration repository and extension utils.
    context.getProperties().put(RepositoryTestUtils.PROPERTY_KEY, repositoryTestUtil);
    // Populate maven repository
    File extensionFile = repositoryTestUtil.getTestExtension(new ExtensionId("emptyjar", "1.0"), "jar").getFile().getFile();
    FileUtils.copyFile(extensionFile, new File(repositoryTestUtil.getRepositoryUtil().getMavenRepository(), "maven/extension/1.0/extension-1.0.jar"));
    FileUtils.copyFile(extensionFile, new File(repositoryTestUtil.getRepositoryUtil().getMavenRepository(), "maven/extension/2.0/extension-2.0.jar"));
    FileUtils.copyFile(extensionFile, new File(repositoryTestUtil.getRepositoryUtil().getMavenRepository(), "maven/oldextension/0.9/oldextension-0.9.jar"));
    FileUtils.copyFile(extensionFile, new File(repositoryTestUtil.getRepositoryUtil().getMavenRepository(), "maven/dependency/version/dependency-version.jar"));
}
Also used : SolrTestUtils(org.xwiki.repository.test.SolrTestUtils) RepositoryTestUtils(org.xwiki.repository.test.RepositoryTestUtils) ExtensionId(org.xwiki.extension.ExtensionId) File(java.io.File)

Example 2 with RepositoryTestUtils

use of org.xwiki.repository.test.RepositoryTestUtils in project xwiki-platform by xwiki.

the class AbstractExtensionAdminAuthenticatedTest method init.

@BeforeClass
public static void init() throws Exception {
    // Require some AbstractTest initialization
    AbstractTest.init();
    // Make sure repository and extension utils are initialized and set.
    RepositoryTestUtils repositoryTestUtils = getRepositoryTestUtils();
    // This will not be null if we are in the middle of allTests
    if (repositoryTestUtils == null) {
        AllTests.initExtensions(context);
    }
}
Also used : RepositoryTestUtils(org.xwiki.repository.test.RepositoryTestUtils) BeforeClass(org.junit.BeforeClass)

Example 3 with RepositoryTestUtils

use of org.xwiki.repository.test.RepositoryTestUtils in project xwiki-platform by xwiki.

the class AbstractExtensionAdminAuthenticatedIT method init.

@BeforeClass
public static void init() throws Exception {
    // Make sure repository and extension utils are initialized and set.
    RepositoryTestUtils repositoryTestUtils = getRepositoryTestUtils();
    ExtensionTestUtils extensionTestUtils = getExtensionTestUtils();
    // This will not be null if we are in the middle of allTests
    if (repositoryTestUtils == null || extensionTestUtils == null) {
        AllITs.initExtensions(context);
    }
}
Also used : ExtensionTestUtils(org.xwiki.extension.test.ExtensionTestUtils) RepositoryTestUtils(org.xwiki.repository.test.RepositoryTestUtils) BeforeClass(org.junit.BeforeClass)

Example 4 with RepositoryTestUtils

use of org.xwiki.repository.test.RepositoryTestUtils in project xwiki-platform by xwiki.

the class AllITs method initExtensions.

public static void initExtensions(PersistentTestContext context) throws Exception {
    // This will not be null if we are in the middle of allTests
    if (repositoryUtil == null) {
        repositoryUtil = new RepositoryUtils();
    }
    // Initialize extensions and repositories
    RepositoryTestUtils repositoryTestUtil = new RepositoryTestUtils(context.getUtil(), repositoryUtil, new SolrTestUtils(context.getUtil()));
    repositoryTestUtil.init();
    ExtensionTestUtils extensionTestUtil = new ExtensionTestUtils(context.getUtil());
    // Set integration repository and extension utils.
    context.getProperties().put(RepositoryTestUtils.PROPERTY_KEY, repositoryTestUtil);
    context.getProperties().put(ExtensionTestUtils.PROPERTY_KEY, extensionTestUtil);
    // Populate maven repository
    File extensionFile = repositoryUtil.getExtensionPackager().getExtensionFile(new ExtensionId("emptyjar", "1.0"));
    FileUtils.copyFile(extensionFile, new File(repositoryUtil.getMavenRepository(), "maven/extension/1.0/extension-1.0.jar"));
    FileUtils.copyFile(extensionFile, new File(repositoryUtil.getMavenRepository(), "maven/extension/2.0/extension-2.0.jar"));
    FileUtils.copyFile(extensionFile, new File(repositoryUtil.getMavenRepository(), "maven/oldextension/0.9/oldextension-0.9.jar"));
    FileUtils.copyFile(extensionFile, new File(repositoryUtil.getMavenRepository(), "maven/dependency/version/dependency-version.jar"));
    // Used in the Extension Manager functional tests.
    FileUtils.copyFile(extensionFile, new File(repositoryUtil.getMavenRepository(), "org/xwiki/commons/xwiki-commons-diff-api/2.7/xwiki-commons-diff-api-2.7.jar"));
    FileUtils.copyFile(extensionFile, new File(repositoryUtil.getMavenRepository(), "org/xwiki/platform/xwiki-platform-display-api/100.1/xwiki-platform-display-api-100.1.jar"));
}
Also used : RepositoryUtils(org.xwiki.extension.test.RepositoryUtils) SolrTestUtils(org.xwiki.repository.test.SolrTestUtils) ExtensionTestUtils(org.xwiki.extension.test.ExtensionTestUtils) RepositoryTestUtils(org.xwiki.repository.test.RepositoryTestUtils) ExtensionId(org.xwiki.extension.ExtensionId) File(java.io.File)

Aggregations

RepositoryTestUtils (org.xwiki.repository.test.RepositoryTestUtils)4 File (java.io.File)2 BeforeClass (org.junit.BeforeClass)2 ExtensionId (org.xwiki.extension.ExtensionId)2 ExtensionTestUtils (org.xwiki.extension.test.ExtensionTestUtils)2 SolrTestUtils (org.xwiki.repository.test.SolrTestUtils)2 RepositoryUtils (org.xwiki.extension.test.RepositoryUtils)1