You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jspwiki.apache.org by ju...@apache.org on 2017/12/03 18:57:04 UTC
[12/15] jspwiki git commit: get rid of easy to fix compilation
warnings
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
index cbb407a..6fb6171 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/AnonymousLoginModuleTest.java
@@ -14,10 +14,11 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.login;
+import java.security.Principal;
import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
@@ -28,8 +29,6 @@ import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
import javax.servlet.http.HttpServletRequest;
-import junit.framework.TestCase;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
import org.apache.wiki.auth.WikiPrincipal;
@@ -37,6 +36,8 @@ import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.user.UserDatabase;
import org.apache.wiki.auth.user.XMLUserDatabase;
+import junit.framework.TestCase;
+
/**
*/
public class AnonymousLoginModuleTest extends TestCase
@@ -58,7 +59,7 @@ public class AnonymousLoginModuleTest extends TestCase
module.initialize( m_subject, handler, new HashMap<String, Object>(), new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
assertFalse( principals.contains( Role.ANONYMOUS ) );
@@ -78,12 +79,12 @@ public class AnonymousLoginModuleTest extends TestCase
{
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new AnonymousLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "127.0.0.1" ) ) );
assertFalse( principals.contains( Role.ANONYMOUS ) );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
index 8b0ee8b..277a017 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/CookieAssertionLoginModuleTest.java
@@ -14,10 +14,11 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.login;
+import java.security.Principal;
import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
@@ -28,9 +29,6 @@ import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
import javax.servlet.http.Cookie;
-import junit.framework.TestCase;
-import net.sourceforge.stripes.mock.MockHttpServletRequest;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
import org.apache.wiki.auth.WikiPrincipal;
@@ -38,6 +36,9 @@ import org.apache.wiki.auth.authorize.Role;
import org.apache.wiki.auth.user.UserDatabase;
import org.apache.wiki.auth.user.XMLUserDatabase;
+import junit.framework.TestCase;
+import net.sourceforge.stripes.mock.MockHttpServletRequest;
+
/**
*/
public class CookieAssertionLoginModuleTest extends TestCase
@@ -62,12 +63,12 @@ public class CookieAssertionLoginModuleTest extends TestCase
m_subject = new Subject();
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new CookieAssertionLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "Bullwinkle" ) ) );
assertFalse( principals.contains( Role.ASSERTED ) );
@@ -89,12 +90,12 @@ public class CookieAssertionLoginModuleTest extends TestCase
{
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new CookieAssertionLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "Bullwinkle" ) ) );
assertFalse( principals.contains( Role.ANONYMOUS ) );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
index 5144d4e..97cbe50 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/UserDatabaseLoginModuleTest.java
@@ -14,10 +14,11 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.login;
+import java.security.Principal;
import java.util.HashMap;
import java.util.Properties;
import java.util.Set;
@@ -54,23 +55,23 @@ public class UserDatabaseLoginModuleTest extends TestCase
// Log in with a user that isn't in the database
CallbackHandler handler = new WikiCallbackHandler( m_engine, null, "user", "password" );
LoginModule module = new UserDatabaseLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "user", WikiPrincipal.LOGIN_NAME ) ) );
assertFalse( principals.contains( Role.AUTHENTICATED ) );
assertFalse( principals.contains( Role.ALL ) );
-
+
// Login with a user that IS in the database
m_subject = new Subject();
handler = new WikiCallbackHandler( m_engine, null, "janne", "myP@5sw0rd" );
module = new UserDatabaseLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
@@ -78,7 +79,7 @@ public class UserDatabaseLoginModuleTest extends TestCase
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "janne", WikiPrincipal.LOGIN_NAME ) ) );
assertFalse( principals.contains( Role.AUTHENTICATED ) );
- assertFalse( principals.contains( Role.ALL ) );
+ assertFalse( principals.contains( Role.ALL ) );
}
catch( LoginException e )
{
@@ -93,12 +94,12 @@ public class UserDatabaseLoginModuleTest extends TestCase
{
CallbackHandler handler = new WikiCallbackHandler( m_engine, null, "user", "password" );
LoginModule module = new UserDatabaseLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>() );
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( new WikiPrincipal( "user", WikiPrincipal.LOGIN_NAME ) ) );
assertFalse( principals.contains( Role.AUTHENTICATED ) );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
index b6db88f..86c3405 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/login/WebContainerLoginModuleTest.java
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.login;
@@ -58,12 +58,12 @@ public class WebContainerLoginModuleTest extends TestCase
// Test using Principal (WebContainerLoginModule succeeds)
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new WebContainerLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>());
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( principal ) );
assertFalse( principals.contains( Role.ANONYMOUS ) );
@@ -87,12 +87,12 @@ public class WebContainerLoginModuleTest extends TestCase
{
CallbackHandler handler = new WebContainerCallbackHandler( m_engine, request );
LoginModule module = new WebContainerLoginModule();
- module.initialize( m_subject, handler,
- new HashMap<String, Object>(),
+ module.initialize( m_subject, handler,
+ new HashMap<String, Object>(),
new HashMap<String, Object>());
module.login();
module.commit();
- Set principals = m_subject.getPrincipals();
+ Set< Principal > principals = m_subject.getPrincipals();
assertEquals( 1, principals.size() );
assertTrue( principals.contains( principal ) );
assertFalse( principals.contains( Role.AUTHENTICATED ) );
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
index 948c4b7..10c5d12 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/auth/permissions/AllPermissionCollectionTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.auth.permissions;
@@ -59,7 +59,7 @@ public class AllPermissionCollectionTest extends TestCase
c_all.add( all4 );
assertEquals( 3, count( c_all ) );
}
-
+
public void testAddPagePermission()
{
PagePermission p1 = new PagePermission( "JSPWiki:Main", "edit" );
@@ -80,7 +80,7 @@ public class AllPermissionCollectionTest extends TestCase
c_all.add( p4 );
assertEquals( 3, count( c_all ) );
}
-
+
public void testAddWikiPermission()
{
WikiPermission p1 = new WikiPermission( "JSPWiki", "login" );
@@ -101,7 +101,7 @@ public class AllPermissionCollectionTest extends TestCase
c_all.add( p4 );
assertEquals( 3, count( c_all ) );
}
-
+
public void testReadOnly()
{
AllPermission all1 = new AllPermission( "*" );
@@ -202,7 +202,7 @@ public class AllPermissionCollectionTest extends TestCase
assertTrue( c_all.implies( new WikiPermission( "myWiki", "editPreferences" ) ) );
assertTrue( c_all.implies( new WikiPermission( "bigTimeWiki", "login" ) ) );
}
-
+
public void testImpliesMixedPermissions()
{
Permission p1 = new AllPermission( "JSPWiki" );
@@ -229,7 +229,7 @@ public class AllPermissionCollectionTest extends TestCase
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
-
+
c_all.add( p3 );
assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
@@ -239,7 +239,7 @@ public class AllPermissionCollectionTest extends TestCase
assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "edit" ) ) );
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
assertFalse( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
-
+
c_all.add( p4 );
assertTrue( c_all.implies( new WikiPermission( "JSPWiki", "login" ) ) );
assertTrue( c_all.implies( new PagePermission( "JSPWiki:FooBar", "edit" ) ) );
@@ -250,11 +250,11 @@ public class AllPermissionCollectionTest extends TestCase
assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:FooBar", "delete" ) ) );
assertTrue( c_all.implies( new PagePermission( "bigTimeWiki:Bar", "delete" ) ) );
}
-
+
private int count( AllPermissionCollection collection )
{
int i = 0;
- Enumeration perms = collection.elements();
+ Enumeration< Permission > perms = collection.elements();
while( perms.hasMoreElements() )
{
perms.nextElement();
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java b/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java
index 462b485..dc10d00 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/plugin/SamplePlugin3.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.plugin;
@@ -38,10 +38,10 @@ public class SamplePlugin3
{
}
- public String execute( WikiContext context, Map params )
+ public String execute( WikiContext context, Map< String, String > params )
throws PluginException
{
- return (String)params.get("text");
+ return params.get("text");
}
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java
index 3be134c..8cc5b2b 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/rss/RSSGeneratorTest.java
@@ -27,18 +27,17 @@ import java.util.Date;
import java.util.List;
import java.util.Properties;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-import net.sf.ehcache.CacheManager;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
import org.apache.wiki.plugin.WeblogEntryPlugin;
import org.apache.wiki.plugin.WeblogPlugin;
import org.apache.wiki.providers.FileSystemProvider;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import net.sf.ehcache.CacheManager;
+
/**
*
* @since
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java
index 0cab8ac..c1966b2 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/url/DefaultURLConstructorTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,49 +14,48 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
/*
* (C) Janne Jalkanen 2005
- *
+ *
*/
package org.apache.wiki.url;
import java.util.Properties;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
import org.apache.wiki.api.exceptions.WikiException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
public class DefaultURLConstructorTest extends TestCase
{
TestEngine testEngine;
Properties props = TestEngine.getTestProperties();
-
+
private URLConstructor getConstructor( String prefix )
throws WikiException
{
if( prefix != null ) props.setProperty( ShortViewURLConstructor.PROP_PREFIX, prefix );
-
+
testEngine = new TestEngine(props);
URLConstructor constr = new DefaultURLConstructor();
-
+
constr.initialize( testEngine, props );
-
+
return constr;
}
-
+
public void testViewURL1()
throws Exception
{
URLConstructor c = getConstructor("wiki/" );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -64,15 +63,15 @@ public class DefaultURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
public void testViewURL3()
throws Exception
- {
+ {
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -80,7 +79,7 @@ public class DefaultURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",false,null) );
}
@@ -88,15 +87,15 @@ public class DefaultURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor( "" );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
-
+
public void testViewURL6()
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Wiki.jsp?page=Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -112,7 +111,7 @@ public class DefaultURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/Edit.jsp?page=Main", c.makeURL(WikiContext.EDIT,"Main",true,null) );
}
@@ -139,12 +138,12 @@ public class DefaultURLConstructorTest extends TestCase
assertEquals( "/test/foo.jsp", c.makeURL(WikiContext.NONE,"foo.jsp",true,null) );
}
-
+
public void testOtherURL2()
throws Exception
{
URLConstructor c = getConstructor( null );
-
+
assertEquals( "/test/foo.jsp?a=1&b=2", c.makeURL(WikiContext.NONE,"foo.jsp",true,"a=1&b=2") );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
index 6b7de52..75a8726 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortURLConstructorTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,49 +14,48 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
/*
* (C) Janne Jalkanen 2005
- *
+ *
*/
package org.apache.wiki.url;
import java.util.Properties;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
import org.apache.wiki.api.exceptions.WikiException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
public class ShortURLConstructorTest extends TestCase
{
TestEngine testEngine;
Properties props = TestEngine.getTestProperties();
-
+
private URLConstructor getConstructor(String prefix)
throws WikiException
{
if( prefix != null ) props.setProperty( ShortURLConstructor.PROP_PREFIX, prefix );
-
+
testEngine = new TestEngine(props);
URLConstructor constr = new ShortURLConstructor();
-
+
constr.initialize( testEngine, props );
-
+
return constr;
}
-
+
public void testViewURL1()
throws Exception
{
URLConstructor c = getConstructor("wiki/" );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -64,15 +63,15 @@ public class ShortURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
public void testViewURL3()
throws Exception
- {
+ {
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -80,7 +79,7 @@ public class ShortURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",false,null) );
}
@@ -88,15 +87,15 @@ public class ShortURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor("" );
-
+
assertEquals( "/test/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
-
+
public void testViewURL6()
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -112,7 +111,7 @@ public class ShortURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main?do=Edit", c.makeURL(WikiContext.EDIT,"Main",true,null) );
}
@@ -139,12 +138,12 @@ public class ShortURLConstructorTest extends TestCase
assertEquals( "/test/foo.jsp", c.makeURL(WikiContext.NONE,"foo.jsp",true,null) );
}
-
+
public void testOtherURL2()
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/foo.jsp?a=1&b=2", c.makeURL(WikiContext.NONE,"foo.jsp",true,"a=1&b=2") );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
index 3270a59..cdc4b19 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/url/ShortViewURLConstructorTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,49 +14,48 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
/*
* (C) Janne Jalkanen 2005
- *
+ *
*/
package org.apache.wiki.url;
import java.util.Properties;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
import org.apache.wiki.TestEngine;
import org.apache.wiki.WikiContext;
-import org.apache.wiki.WikiEngine;
import org.apache.wiki.api.exceptions.WikiException;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
public class ShortViewURLConstructorTest extends TestCase
{
TestEngine testEngine;
Properties props = TestEngine.getTestProperties();
-
+
private URLConstructor getConstructor(String prefix)
throws WikiException
{
if( prefix != null ) props.setProperty( ShortViewURLConstructor.PROP_PREFIX, prefix );
-
+
testEngine = new TestEngine(props);
URLConstructor constr = new ShortViewURLConstructor();
-
+
constr.initialize( testEngine, props );
-
+
return constr;
}
-
+
public void testViewURL1()
throws Exception
{
URLConstructor c = getConstructor("wiki/" );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -64,15 +63,15 @@ public class ShortViewURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
public void testViewURL3()
throws Exception
- {
+ {
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -80,7 +79,7 @@ public class ShortViewURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",false,null) );
}
@@ -88,15 +87,15 @@ public class ShortViewURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor("" );
-
+
assertEquals( "/test/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
-
+
public void testViewURL6()
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/wiki/Main", c.makeURL(WikiContext.VIEW,"Main",true,null) );
}
@@ -112,7 +111,7 @@ public class ShortViewURLConstructorTest extends TestCase
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/Edit.jsp?page=Main", c.makeURL(WikiContext.EDIT,"Main",true,null) );
}
@@ -139,12 +138,12 @@ public class ShortViewURLConstructorTest extends TestCase
assertEquals( "/test/foo.jsp", c.makeURL(WikiContext.NONE,"foo.jsp",true,null) );
}
-
+
public void testOtherURL2()
throws Exception
{
URLConstructor c = getConstructor(null );
-
+
assertEquals( "/test/foo.jsp?a=1&b=2", c.makeURL(WikiContext.NONE,"foo.jsp",true,"a=1&b=2") );
}
http://git-wip-us.apache.org/repos/asf/jspwiki/blob/1cd2e94b/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java b/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java
index 0b564df..683b613 100644
--- a/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java
+++ b/jspwiki-war/src/test/java/org/apache/wiki/util/PriorityListTest.java
@@ -1,4 +1,4 @@
-/*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -14,7 +14,7 @@
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
- under the License.
+ under the License.
*/
package org.apache.wiki.util;
@@ -27,14 +27,14 @@ public class PriorityListTest extends TestCase
{
super( s );
}
-
+
public void testInsert()
{
- PriorityList p = new PriorityList();
+ PriorityList< String > p = new PriorityList< String >();
p.add( "One", 1 );
p.add( "Two", 2 );
-
+
assertEquals( "size", 2, p.size() );
assertEquals( "Two", "Two", p.get(0) );
@@ -47,11 +47,11 @@ public class PriorityListTest extends TestCase
*/
public void testInsertSame()
{
- PriorityList p = new PriorityList();
+ PriorityList< String > p = new PriorityList< String >();
p.add( "One", 1 );
p.add( "Two", 1 );
-
+
assertEquals( "size", 2, p.size() );
assertEquals( "One", "One", p.get(0) );
@@ -60,12 +60,12 @@ public class PriorityListTest extends TestCase
public void testInsertSame2()
{
- PriorityList p = new PriorityList();
+ PriorityList< String > p = new PriorityList< String >();
p.add( "One", 1 );
p.add( "Two", 2 );
p.add( "Three", 3 );
-
+
assertEquals( "size", 3, p.size() );
assertEquals( "Three", "Three", p.get(0) );
@@ -84,14 +84,14 @@ public class PriorityListTest extends TestCase
public void testInsertSame3()
{
- PriorityList p = new PriorityList();
+ PriorityList< String > p = new PriorityList< String >();
p.add( "One", 1 );
p.add( "Two", 2 );
p.add( "Two2", 2 );
p.add( "Two3", 2 );
p.add( "Three", 3 );
-
+
assertEquals( "size", 5, p.size() );
assertEquals( "Three", "Three", p.get(0) );