Package org.xwiki.test.ui

Examples of org.xwiki.test.ui.TestExtension


    @Test
    public void testRepositorySelector() throws Exception
    {
        // Setup the extension.
        ExtensionId extensionId = new ExtensionId("alice-xar-extension", "1.3");
        TestExtension extension = getRepositoryTestUtils().getTestExtension(extensionId, "xar");
        getRepositoryTestUtils().addExtension(extension);

        // Check if the section links point to the right repository.
        ExtensionAdministrationPage adminPage = ExtensionAdministrationPage.gotoPage().clickAddExtensionsSection();
        Select repositorySelect = adminPage.getSearchBar().getRepositorySelect();
View Full Code Here


    @Test
    public void testShowDetails() throws Exception
    {
        // Setup the extension.
        ExtensionId extensionId = new ExtensionId("alice-xar-extension", "1.3");
        TestExtension extension = getRepositoryTestUtils().getTestExtension(extensionId, "xar");
        extension.setName("Alice Wiki Macro");
        extension.setSummary("A **useless** macro");
        extension.addAuthor(new DefaultExtensionAuthor("Thomas", null));
        extension.addAuthor(new DefaultExtensionAuthor("Marius", null));
        extension.addLicense(new ExtensionLicense("My own license", null));
        extension.setWebsite("http://www.alice.com");
        getRepositoryTestUtils().addExtension(extension);

        // Search the extension and assert the displayed information.
        ExtensionAdministrationPage adminPage = ExtensionAdministrationPage.gotoPage().clickAddExtensionsSection();
        ExtensionPane extensionPane =
            adminPage.getSearchBar().clickAdvancedSearch().search(extensionId).getExtension(0);
        Assert.assertEquals("remote", extensionPane.getStatus());
        Assert.assertNull(extensionPane.getStatusMessage());
        Assert.assertEquals(extension.getName(), extensionPane.getName());
        Assert.assertEquals(extensionId.getVersion().getValue(), extensionPane.getVersion());
        List<WebElement> authors = extensionPane.getAuthors();
        Assert.assertEquals(2, authors.size());
        Assert.assertEquals("Thomas", authors.get(0).getText());
        Assert.assertEquals("Marius", authors.get(1).getText());
        Assert.assertEquals(extension.getSummary(), extensionPane.getSummary());

        // Check the extension details.
        ExtensionDescriptionPane descriptionPane = extensionPane.openDescriptionSection();
        Assert.assertEquals(extension.getLicenses().iterator().next().getName(), descriptionPane.getLicense());
        Assert.assertEquals(extension.getId().getId(), descriptionPane.getId());
        Assert.assertEquals(extension.getType(), descriptionPane.getType());
        WebElement webSiteLink = descriptionPane.getWebSite();
        Assert.assertEquals(extension.getWebSite().substring("http://".length()), webSiteLink.getText());
        Assert.assertEquals(extension.getWebSite() + '/', webSiteLink.getAttribute("href"));
    }
View Full Code Here

    @Test
    public void testDependencies() throws Exception
    {
        // Setup the extension and its dependencies.
        ExtensionId dependencyId = new ExtensionId("bob-xar-extension", "2.5-milestone-2");
        TestExtension dependency = getRepositoryTestUtils().getTestExtension(dependencyId, "xar");
        dependency.setName("Bob Wiki Macro");
        dependency.setSummary("Required by Alice");
        getRepositoryTestUtils().addExtension(dependency);

        ExtensionId extensionId = new ExtensionId("alice-xar-extension", "1.3");
        TestExtension extension = getRepositoryTestUtils().getTestExtension(extensionId, "xar");
        extension.addDependency(new DefaultExtensionDependency(dependencyId.getId(), new DefaultVersionConstraint(
            dependencyId.getVersion().getValue())));
        extension.addDependency(new DefaultExtensionDependency("missing-dependency",
            new DefaultVersionConstraint("135")));
        extension.addDependency(new DefaultExtensionDependency("org.xwiki.platform:xwiki-platform-sheet-api",
            new DefaultVersionConstraint("[3.2,)")));
        extension.addDependency(new DefaultExtensionDependency("org.xwiki.commons:xwiki-commons-diff-api",
            new DefaultVersionConstraint("2.7")));
        extension.addDependency(new DefaultExtensionDependency("org.xwiki.platform:xwiki-platform-display-api",
            new DefaultVersionConstraint("100.1")));
        getRepositoryTestUtils().addExtension(extension);

        // Search the extension and assert the list of dependencies.
        ExtensionAdministrationPage adminPage = ExtensionAdministrationPage.gotoPage().clickAddExtensionsSection();
View Full Code Here

    @Test
    public void testInstall() throws Exception
    {
        // Setup the extension and its dependencies.
        ExtensionId extensionId = new ExtensionId("alice-xar-extension", "1.3");
        TestExtension extension = getRepositoryTestUtils().getTestExtension(extensionId, "xar");

        ExtensionId dependencyId = new ExtensionId("bob-xar-extension", "2.5-milestone-2");
        getRepositoryTestUtils().addExtension(getRepositoryTestUtils().getTestExtension(dependencyId, "xar"));
        extension.addDependency(new DefaultExtensionDependency(dependencyId.getId(), new DefaultVersionConstraint(
            dependencyId.getVersion().getValue())));

        extension.addDependency(new DefaultExtensionDependency("org.xwiki.platform:xwiki-platform-sheet-api",
            new DefaultVersionConstraint("[3.2,)")));
        getRepositoryTestUtils().addExtension(extension);

        // Search the extension and install it.
        ExtensionAdministrationPage adminPage = ExtensionAdministrationPage.gotoPage().clickAddExtensionsSection();
View Full Code Here

        // Setup the extension and its dependencies.
        ExtensionId dependencyId = new ExtensionId("bob-xar-extension", "2.5-milestone-2");
        getRepositoryTestUtils().addExtension(getRepositoryTestUtils().getTestExtension(dependencyId, "xar"));

        ExtensionId extensionId = new ExtensionId("alice-xar-extension", "1.3");
        TestExtension extension = getRepositoryTestUtils().getTestExtension(extensionId, "xar");
        extension.addDependency(new DefaultExtensionDependency(dependencyId.getId(), new DefaultVersionConstraint(
            dependencyId.getVersion().getValue())));
        getRepositoryTestUtils().addExtension(extension);

        // Install the extensions.
        getExtensionTestUtils().install(extensionId);
View Full Code Here

    {
        // Setup the extension.
        String extensionId = "alice-xar-extension";
        String oldVersion = "1.3";
        String newVersion = "2.1.4";
        TestExtension oldExtension =
            getRepositoryTestUtils().getTestExtension(new ExtensionId(extensionId, oldVersion), "xar");
        getRepositoryTestUtils().addExtension(oldExtension);
        TestExtension newExtension =
            getRepositoryTestUtils().getTestExtension(new ExtensionId(extensionId, newVersion), "xar");
        getRepositoryTestUtils().attachFile(newExtension);
        getRepositoryTestUtils().addVersionObject(newExtension, newVersion,
            "attach:" + newExtension.getFile().getName());

        // Make sure the old version is installed.
        getExtensionTestUtils().install(new ExtensionId(extensionId, oldVersion));

        // Upgrade the extension.
View Full Code Here

    {
        // Setup the extension.
        String extensionId = "alice-xar-extension";
        String oldVersion = "1.3";
        String newVersion = "2.1.4";
        TestExtension oldExtension =
            getRepositoryTestUtils().getTestExtension(new ExtensionId(extensionId, oldVersion), "xar");
        getRepositoryTestUtils().addExtension(oldExtension);
        TestExtension newExtension =
            getRepositoryTestUtils().getTestExtension(new ExtensionId(extensionId, newVersion), "xar");
        getRepositoryTestUtils().attachFile(newExtension);
        getRepositoryTestUtils().addVersionObject(newExtension, newVersion,
            "attach:" + newExtension.getFile().getName());

        // Make sure the old version is installed.
        getExtensionTestUtils().install(new ExtensionId(extensionId, oldVersion));

        // Edit the installed version so that we have a merge conflict.
View Full Code Here

    {
        // Setup the extension.
        String extensionId = "alice-xar-extension";
        String oldVersion = "1.3";
        String newVersion = "2.1.4";
        TestExtension oldExtension =
            getRepositoryTestUtils().getTestExtension(new ExtensionId(extensionId, oldVersion), "xar");
        getRepositoryTestUtils().addExtension(oldExtension);
        TestExtension newExtension =
            getRepositoryTestUtils().getTestExtension(new ExtensionId(extensionId, newVersion), "xar");
        getRepositoryTestUtils().attachFile(newExtension);
        getRepositoryTestUtils().addVersionObject(newExtension, newVersion,
            "attach:" + newExtension.getFile().getName());

        // Make sure the new version is installed.
        getExtensionTestUtils().install(new ExtensionId(extensionId, newVersion));

        // Downgrade the extension.
View Full Code Here

                    + "$services.greeter.greet('XWiki', 'default'){{/velocity}}", "");
        Assert.assertFalse(viewPage.getContent().contains("Hello world! Hello XWiki!"));

        // Setup the extension.
        ExtensionId extensionId = new ExtensionId("scriptServiceJarExtension", "4.2-milestone-1");
        TestExtension extension = getRepositoryTestUtils().getTestExtension(extensionId, "jar");
        getRepositoryTestUtils().addExtension(extension);

        // Search the extension and install it.
        ExtensionAdministrationPage adminPage = ExtensionAdministrationPage.gotoPage().clickAddExtensionsSection();
        ExtensionPane extensionPane =
View Full Code Here

        Assert.assertEquals("1.1", extensionPage.getMetaDataValue("version"));
        Assert.assertTrue(extensionPage.isValidExtension());

        // 2.0

        TestExtension emptyExtension =
            getRepositoryTestUtils().getTestExtension(new ExtensionId("emptyjar", "1.0"), "jar");

        long fileSize = FileUtils.sizeOf(emptyExtension.getFile().getFile());

        ExtensionVersion extension =
            getUtil().getRESTResource(Resources.EXTENSION_VERSION, null, "maven:extension", "2.0");

        Assert.assertEquals("maven:extension", extension.getId());
        Assert.assertEquals("jar", extension.getType());
        Assert.assertEquals("2.0", extension.getVersion());
        Assert.assertEquals("name", extension.getName());
        Assert.assertEquals("summary2", extension.getSummary());
        Assert.assertEquals("summary2\n      some more details", extension.getDescription());
        Assert.assertEquals("Administrator", extension.getAuthors().get(0).getName());
        Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl());
        Assert.assertEquals(Arrays.asList("maven:oldextension"), extension.getFeatures());
        Assert.assertEquals("GNU Lesser General Public License 2.1", extension.getLicenses().get(0).getName());

        Assert.assertEquals(fileSize,
            getUtil().getRESTBuffer(Resources.EXTENSION_VERSION_FILE, null, "maven:extension", "2.0").length);

        // 1.0

        extension = getUtil().getRESTResource(Resources.EXTENSION_VERSION, null, "maven:extension", "1.0");

        Assert.assertEquals("maven:extension", extension.getId());
        Assert.assertEquals("jar", extension.getType());
        Assert.assertEquals("1.0", extension.getVersion());
        Assert.assertEquals("name", extension.getName());
        Assert.assertEquals("summary2", extension.getSummary());
        Assert.assertEquals("summary2\n      some more details", extension.getDescription());
        Assert.assertEquals("Administrator", extension.getAuthors().get(0).getName());
        Assert.assertEquals(this.baseAuthor.getURL().toString(), extension.getAuthors().get(0).getUrl());
        Assert.assertEquals(Arrays.asList("maven:oldextension"), extension.getFeatures());
        Assert.assertEquals("GNU Lesser General Public License 2.1", extension.getLicenses().get(0).getName());

        Assert.assertEquals(FileUtils.sizeOf(emptyExtension.getFile().getFile()),
            getUtil().getRESTBuffer(Resources.EXTENSION_VERSION_FILE, null, "maven:extension", "1.0").length);

        // 0.9

        extension = getUtil().getRESTResource(Resources.EXTENSION_VERSION, null, "maven:extension", "0.9");
View Full Code Here

TOP

Related Classes of org.xwiki.test.ui.TestExtension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.