You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@labs.apache.org by si...@apache.org on 2009/10/05 23:21:55 UTC
svn commit: r822022 [11/11] - in /labs/magma/branches/0.0.2: ./
beans-richtext/ beans-richtext/src/main/java/org/apache/magma/beans/
beans-richtext/src/main/java/org/apache/magma/beans/richtext/
beans-richtext/src/main/java/org/apache/magma/conversion/...
Modified: labs/magma/branches/0.0.2/website-velocity/src/test/java/org/apache/magma/website/velocity/FakeBean.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/website-velocity/src/test/java/org/apache/magma/website/velocity/FakeBean.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/website-velocity/src/test/java/org/apache/magma/website/velocity/FakeBean.java (original)
+++ labs/magma/branches/0.0.2/website-velocity/src/test/java/org/apache/magma/website/velocity/FakeBean.java Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * 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.magma.website.velocity;
import java.util.Date;
@@ -13,6 +29,7 @@
private Date date = null;
private String string = null;
private String richtext = null;
+ private double natval = 0.5;
@Format(format="yyyy/MM/dd")
public Date getDate() {
@@ -44,4 +61,15 @@
public void setRichtext(String richtext) {
this.richtext = richtext;
}
+
+ @Format(format="percent-2")
+ public double getNatval() {
+ return natval;
+ }
+
+ public void setNatval(double natval) {
+ this.natval = natval;
+ }
+
+
}
Modified: labs/magma/branches/0.0.2/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java (original)
+++ labs/magma/branches/0.0.2/website-velocity/src/test/java/org/apache/magma/website/velocity/TestGettersFormatting.java Mon Oct 5 21:21:39 2009
@@ -1,3 +1,19 @@
+/*
+ * 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.magma.website.velocity;
import static junit.framework.Assert.assertEquals;
@@ -51,6 +67,17 @@
String str = new String(baos.toByteArray(), "UTF-8");
assertEquals("1979/03/05", str.trim());
}
+
+ @Test
+ public void formattedPrimitive() throws Exception {
+ FakeBean fb = new FakeBean();
+ VelocityHtmlProducer prod = new VelocityHtmlProducer("testPrimitiveFormatting.vm");
+ prod.addParameter("bean", fb);
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ prod.produce(baos);
+ String str = new String(baos.toByteArray(), "UTF-8");
+ assertEquals("50%", str.trim());
+ }
@Test
public void escapeHtml() throws Exception {
Modified: labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testEscapeHtml.vm
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testEscapeHtml.vm?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testEscapeHtml.vm (original)
+++ labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testEscapeHtml.vm Mon Oct 5 21:21:39 2009
@@ -1 +1,16 @@
-$bean.string,$bean.richtext
\ No newline at end of file
+## 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.
+
+$bean.string,$bean.richtext
Modified: labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testGettersFormatting.vm
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testGettersFormatting.vm?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testGettersFormatting.vm (original)
+++ labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testGettersFormatting.vm Mon Oct 5 21:21:39 2009
@@ -1 +1,16 @@
-$bean.date
\ No newline at end of file
+## 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.
+
+$bean.date
Modified: labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testNested.vm
URL: http://svn.apache.org/viewvc/labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testNested.vm?rev=822022&r1=822021&r2=822022&view=diff
==============================================================================
--- labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testNested.vm (original)
+++ labs/magma/branches/0.0.2/website-velocity/src/test/resources/org/apache/magma/website/velocity/testNested.vm Mon Oct 5 21:21:39 2009
@@ -1 +1,16 @@
-$bean.me.string
\ No newline at end of file
+## 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.
+
+$bean.me.string
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org