You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2010/10/24 20:41:24 UTC

svn commit: r1026861 - in /wicket/trunk/wicket/src: main/java/org/apache/wicket/resource/ test/java/org/apache/wicket/resource/

Author: mgrigorov
Date: Sun Oct 24 18:41:23 2010
New Revision: 1026861

URL: http://svn.apache.org/viewvc?rev=1026861&view=rev
Log:
WICKET-2035 Change naming convention for xml properties files to *.properties.xml instead of *.xml

Change the file extension used for XML based property files.
Until now the extension was .xml, from now on it is .properties.xml.

Added:
    wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties.java   (with props)
    wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_en_US.properties.xml   (with props)
    wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_fr_FR.properties.xml   (with props)
    wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/XmlFilePropertiesLoaderTest.java   (with props)
Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java?rev=1026861&r1=1026860&r2=1026861&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/resource/PropertiesFactory.java Sun Oct 24 18:41:23 2010
@@ -78,7 +78,7 @@ public class PropertiesFactory implement
 		propertiesLoader = new ArrayList<IPropertiesLoader>();
 		propertiesLoader.add(new IsoPropertiesFilePropertiesLoader("properties"));
 		propertiesLoader.add(new UtfPropertiesFilePropertiesLoader("utf8.properties", "utf-8"));
-		propertiesLoader.add(new XmlFilePropertiesLoader("xml"));
+		propertiesLoader.add(new XmlFilePropertiesLoader("properties.xml"));
 	}
 
 	/**

Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties.java?rev=1026861&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties.java (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties.java Sun Oct 24 18:41:23 2010
@@ -0,0 +1,42 @@
+/*
+ * 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 regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "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.
+ */
+package org.apache.wicket.resource;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.wicket.util.tester.DummyHomePage;
+
+/**
+ * Test page for WICKET-2035
+ */
+public class PageWithXmlProperties extends DummyHomePage
+{
+	/***/
+	public PageWithXmlProperties()
+	{
+	}
+
+	@Override
+	public void onInitialize()
+	{
+		super.onInitialize();
+
+		String expected = XmlFilePropertiesLoaderTest.EXPECTED_LOCALIZATIONS.get(getSession().getLocale());
+		String actual = getString("testProperty");
+		assertEquals(expected, actual);
+	}
+}
\ No newline at end of file

Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_en_US.properties.xml
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_en_US.properties.xml?rev=1026861&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_en_US.properties.xml (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_en_US.properties.xml Sun Oct 24 18:41:23 2010
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   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 regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "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.
+-->
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<properties>
+	<entry key="testProperty">value</entry>
+</properties>
\ No newline at end of file

Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_en_US.properties.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_fr_FR.properties.xml
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_fr_FR.properties.xml?rev=1026861&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_fr_FR.properties.xml (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_fr_FR.properties.xml Sun Oct 24 18:41:23 2010
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+   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 regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "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.
+-->
+<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
+<properties>
+	<entry key="testProperty">valeur</entry>
+</properties>
\ No newline at end of file

Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/PageWithXmlProperties_fr_FR.properties.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/XmlFilePropertiesLoaderTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/XmlFilePropertiesLoaderTest.java?rev=1026861&view=auto
==============================================================================
--- wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/XmlFilePropertiesLoaderTest.java (added)
+++ wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/XmlFilePropertiesLoaderTest.java Sun Oct 24 18:41:23 2010
@@ -0,0 +1,59 @@
+/*
+ * 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 regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "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.
+ */
+package org.apache.wicket.resource;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.wicket.util.tester.WicketTester;
+import org.junit.Test;
+
+/**
+ * WICKET-2035 Change naming convention for xml properties files to *.properties.xml instead of
+ * *.xml
+ */
+public class XmlFilePropertiesLoaderTest
+{
+	static Map<Locale, String> EXPECTED_LOCALIZATIONS = new HashMap<Locale, String>();
+	static
+	{
+		EXPECTED_LOCALIZATIONS.put(Locale.US, "value");
+		EXPECTED_LOCALIZATIONS.put(Locale.FRANCE, "valeur");
+	}
+
+	/**
+	 * Tests that the localizations for {@link PageWithXmlProperties} are successfully loaded from
+	 * (PageWithXmlProperties_locale).properties.xml
+	 */
+	@Test
+	public void wicket2035()
+	{
+
+		WicketTester tester = new WicketTester();
+
+		Iterator<Locale> iterator = EXPECTED_LOCALIZATIONS.keySet().iterator();
+		while (iterator.hasNext())
+		{
+			Locale locale = iterator.next();
+			tester.getSession().setLocale(locale);
+			tester.startPage(PageWithXmlProperties.class);
+		}
+	}
+}

Propchange: wicket/trunk/wicket/src/test/java/org/apache/wicket/resource/XmlFilePropertiesLoaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native