Search in sources :

Example 1 with SolrTestUtils

use of org.xwiki.repository.test.SolrTestUtils 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 SolrTestUtils

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

the class AbstractHttpTest method setUp.

@Before
public void setUp() throws Exception {
    random = new Random();
    JAXBContext context = JAXBContext.newInstance("org.xwiki.rest.model.jaxb");
    marshaller = context.createMarshaller();
    unmarshaller = context.createUnmarshaller();
    objectFactory = new ObjectFactory();
    // Make sure guest does not have edit right
    Page page = this.testUtils.rest().page(new DocumentReference("xwiki", "XWiki", "XWikiPreferences"));
    org.xwiki.rest.model.jaxb.Object rightObject = this.testUtils.rest().object("XWiki.XWikiGlobalRights");
    rightObject.withProperties(this.testUtils.rest().property("users", "XWiki.XWikiGuest"), this.testUtils.rest().property("levels", "edit"), this.testUtils.rest().property("allow", "0"));
    Objects objects = new Objects();
    objects.withObjectSummaries(rightObject);
    page.setObjects(objects);
    this.testUtils.rest().save(page);
    // Init solr utils
    this.solrUtils = new SolrTestUtils(this.testUtils);
}
Also used : SolrTestUtils(org.xwiki.repository.test.SolrTestUtils) Random(java.util.Random) ObjectFactory(org.xwiki.rest.model.jaxb.ObjectFactory) Objects(org.xwiki.rest.model.jaxb.Objects) JAXBContext(javax.xml.bind.JAXBContext) Page(org.xwiki.rest.model.jaxb.Page) DocumentReference(org.xwiki.model.reference.DocumentReference) Before(org.junit.Before)

Example 3 with SolrTestUtils

use of org.xwiki.repository.test.SolrTestUtils 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

SolrTestUtils (org.xwiki.repository.test.SolrTestUtils)3 File (java.io.File)2 ExtensionId (org.xwiki.extension.ExtensionId)2 RepositoryTestUtils (org.xwiki.repository.test.RepositoryTestUtils)2 Random (java.util.Random)1 JAXBContext (javax.xml.bind.JAXBContext)1 Before (org.junit.Before)1 ExtensionTestUtils (org.xwiki.extension.test.ExtensionTestUtils)1 RepositoryUtils (org.xwiki.extension.test.RepositoryUtils)1 DocumentReference (org.xwiki.model.reference.DocumentReference)1 ObjectFactory (org.xwiki.rest.model.jaxb.ObjectFactory)1 Objects (org.xwiki.rest.model.jaxb.Objects)1 Page (org.xwiki.rest.model.jaxb.Page)1