Commits

David Chui committed e80983a

Converted to plugin SDK.

Comments (0)

Files changed (3)

 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-    <parent>
-        <groupId>com.atlassian.confluence.plugin.base</groupId>
-        <artifactId>confluence-plugin-base</artifactId>
-        <version>22</version>
-    </parent>
-
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.atlassian.confluence.contributors</groupId>
     <artifactId>contributors</artifactId>
     <version>1.2.4-SNAPSHOT</version>
+    <packaging>atlassian-plugin</packaging>
 
     <name>Confluence Contributors Plugin</name>
 
     <properties>
         <atlassian.plugin.key>com.atlassian.confluence.contributors</atlassian.plugin.key>
         <atlassian.plugin.application.version.min>3.0</atlassian.plugin.application.version.min>
-        <atlassian.plugin.application.version.max>3.0</atlassian.plugin.application.version.max>
+        <atlassian.plugin.application.version.max>3.1</atlassian.plugin.application.version.max>
 
-        <atlassian.product.version>3.0-m9-r2</atlassian.product.version>
+        <atlassian.product.version>3.0.2</atlassian.product.version>
         <atlassian.product.data.version>2.10</atlassian.product.data.version>
-        <atlassian.product.test-lib.version>2.1.5-beta2</atlassian.product.test-lib.version>
-
-        <confluence.jars.to.remove.regex.list>${basedir}/src/test/resources/jar-files-to-remove-from-bundle.txt</confluence.jars.to.remove.regex.list>
-        <confluence.plugin.bundled>true</confluence.plugin.bundled>
+        <atlassian.product.test-lib.version>2.2-beta4</atlassian.product.test-lib.version>
         
         <jdkLevel>1.5</jdkLevel>
     </properties>
 
     <dependencies>
         <dependency>
+            <groupId>com.atlassian.confluence</groupId>
+            <artifactId>confluence</artifactId>
+            <version>${atlassian.product.version}</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.atlassian.confluence.plugin</groupId>
+            <artifactId>func-test-package</artifactId>
+            <version>${atlassian.product.test-lib.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>jmock</groupId>
             <artifactId>jmock-cglib</artifactId>
             <version>1.2.0</version>
     <build>
         <plugins>
             <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>${jdkLevel}</source>
+                    <target>${jdkLevel}</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>com.atlassian.maven.plugins</groupId>
+                <artifactId>maven-confluence-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <productVersion>${atlassian.product.version}</productVersion>
+                    <testResourcesVersion>${atlassian.product.data.version}</testResourcesVersion>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>com.atlassian.maven.plugins</groupId>
                 <artifactId>maven-clover2-plugin</artifactId>
                 <configuration>
             </plugin>
         </plugins>
     </build>
+
+    <distributionManagement>
+        <repository>
+            <id>atlassian-contrib</id>
+            <name>Atlassian Contrib Repository</name>
+            <url>davs://maven.atlassian.com/contrib</url>
+        </repository>
+        <snapshotRepository>
+            <id>atlassian-contrib-snapshot</id>
+            <name>Atlassian Contrib Snapshot Repository</name>
+            <url>davs://maven.atlassian.com/contrib-snapshot</url>
+        </snapshotRepository>
+    </distributionManagement>
 </project>

src/test/java/it/com/atlassian/confluence/contributors/macro/AbstractContributorsTestCase.java

 import com.atlassian.confluence.plugin.functest.helper.PageHelper;
 import com.atlassian.confluence.plugin.functest.helper.SpaceHelper;
 import com.atlassian.confluence.plugin.functest.helper.UserHelper;
-import org.apache.log4j.Logger;
 
 import java.util.ArrayList;
 import java.util.Arrays;
         userHelper.setFullName(name);
         userHelper.setEmailAddress(name + "@localhost.localdomain");
         userHelper.setPassword(name);
-        userHelper.setGroups(Arrays.asList(new String[] { "confluence-users", "confluence-administrators" }));
+        userHelper.setGroups(Arrays.asList("confluence-users", "confluence-administrators"));
 
         assertTrue(userHelper.create());
     }
 
-    protected void removeUser(final String name) {
-        assertTrue(getUserHelper(name).delete());
-    }
-
     protected void createSpace() {
         final SpaceHelper spaceHelper = getSpaceHelper();
 
         assertTrue(spaceHelper.create());
     }
 
-    protected void removeSpace() {
-        assertTrue(getSpaceHelper(testSpaceKey).delete());
-    }
-
     protected void createPageToBeContributedByUsers() {
         final PageHelper pageHelper = getPageHelper();
 
 
     protected void createJohnDoeContributions() {
         final PageHelper pageHelper = getPageHelper(idOfPageWhichContainsContributions);
-        final List pageLabels;
+        final List<String> pageLabels;
         final CommentHelper commentHelper;
 
         logout();
         assertTrue(pageHelper.update());
 
         /* Second edit */
-        pageLabels = new ArrayList(pageHelper.getLabels());
+        pageLabels = new ArrayList<String>(pageHelper.getLabels());
         pageLabels.add("label-johndoe-01");
         pageHelper.setLabels(pageLabels);
 
 
     protected void createJaneDoeContributions() {
         final PageHelper pageHelper = getPageHelper(idOfPageWhichContainsContributions);
-        final List pageLabels;
+        final List<String> pageLabels;
 
         logout();
         login(NAMES_OF_USERS_TO_CREATE[1], NAMES_OF_USERS_TO_CREATE[1]);
         assertTrue(pageHelper.update());
 
         /* Third edit */
-        pageLabels = new ArrayList(pageHelper.getLabels());
+        pageLabels = new ArrayList<String>(pageHelper.getLabels());
         pageLabels.add("label-janedoe-01");
         pageHelper.setLabels(pageLabels);
 
         updateAdminFullName();
         refreshLicense();
 
-        for (int i = 0; i < NAMES_OF_USERS_TO_CREATE.length; ++i)
-            createUser(NAMES_OF_USERS_TO_CREATE[i]);
+        for (String userName:  NAMES_OF_USERS_TO_CREATE)
+            createUser(userName);
 
         createSpace();
         createPageToBeContributedByUsers();

src/test/java/it/com/atlassian/confluence/contributors/macro/ContributorsSummaryTestCase.java

 package it.com.atlassian.confluence.contributors.macro;
 
-import com.atlassian.confluence.plugin.functest.helper.PageHelper;
 import com.atlassian.confluence.plugin.functest.helper.BlogPostHelper;
-import com.atlassian.confluence.plugin.functest.ConfluenceWebTester;
+import com.atlassian.confluence.plugin.functest.helper.PageHelper;
+import com.atlassian.confluence.plugin.functest.util.ClasspathResourceUtil;
 import org.apache.commons.lang.StringUtils;
-import org.apache.commons.io.IOUtils;
 
-import java.util.Arrays;
-import java.text.SimpleDateFormat;
-import java.text.ParseException;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.FileOutputStream;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
 
 public class ContributorsSummaryTestCase extends AbstractContributorsTestCase {
 
                 });
     }
 
-    private File copyContrb45TestData()  throws IOException {
-        InputStream in = null;
-        OutputStream out = null;
-
-        try {
-            File copyOfContrb45TestData = File.createTempFile("contrb-", ".zip");
-
-            in = new BufferedInputStream(getClass().getClassLoader().getResourceAsStream("contrb-45-site-export.zip"));
-            out = new BufferedOutputStream(new FileOutputStream(copyOfContrb45TestData));
-
-            IOUtils.copy(in, out);
-
-            return copyOfContrb45TestData;
-
-        } finally {
-            IOUtils.closeQuietly(out);
-            IOUtils.closeQuietly(in);
-        }
-    }
-
     /*
      * CONTRB-45
      */
     public void testViewContributorsAndContributorsSummaryInHistoricPage() throws IOException {
-        final File copyOfContrb45TestData = copyContrb45TestData();
-        final ConfluenceWebTester confluenceWebTester = getConfluenceWebTester();
+        final File copyOfContrb45TestData = ClasspathResourceUtil.getClassPathResourceAsTempFile("contrb-45-site-export.zip", getClass().getClassLoader(), ".zip");
 
-        confluenceWebTester.setConfluenceBackupZip(copyOfContrb45TestData);
-        restoreData();
+        try
+        {
+            getConfluenceWebTester().restoreData(copyOfContrb45TestData);
 
-        gotoPage("/display/TST/CONTRB-45");
+            gotoPage("/display/TST/CONTRB-45");
 
-        clickLink("action-view-history-link");
+            clickLink("action-view-history-link");
 
-        clickLinkWithText("v. 1");
+            clickLinkWithText("v. 1");
 
-        assertTextPresent("old version");
-        assertTextNotPresent("Error formatting macro: contributors-summary: java.lang.IllegalArgumentException: spaceKey cannot be null");
-        assertTextNotPresent("Error formatting macro: contributors: java.lang.IllegalArgumentException: spaceKey cannot be null");
+            assertTextPresent("old version");
+            assertTextNotPresent("Error formatting macro: contributors-summary: java.lang.IllegalArgumentException: spaceKey cannot be null");
+            assertTextNotPresent("Error formatting macro: contributors: java.lang.IllegalArgumentException: spaceKey cannot be null");
+        }
+        finally
+        {
+            copyOfContrb45TestData.delete();
+        }
     }
 }