Re: Git team workflow

2017-12-07 Thread Tobias Soloschenko
Hi,

if you don‘t be sure if everything is right you can also push your changes into 
a separate branch at your repo and create a PR to the target branch at your own 
repo (with the github ui) This way you can review your changes before pushing 
them to the wickstuff or even provide a PR there.

kind regards

Tobias

> Am 08.12.2017 um 08:16 schrieb Dieter Tremel :
> 
> Hello wicketstuff team,
> 
> as newbie wicketstuff contributor (gchart) I have to ask some questions
> around team workflow.
> 
> Sorry if my knowledge here is not sufficient, I work mostly alone for a
> long time, so I had to improve my git and github handling a lot. And of
> course I don't want initiate any silly or destructive actions on the
> github repository.
> 
> I have improved gchart in 5 commits and this should be moved to the
> repository. This is my setup including my fork:
> 
>> $ git remote -v
>> origin  https://tre...@github.com/tremel/core.git (fetch)
>> origin  https://tre...@github.com/tremel/core.git (push)
>> upstreamhttps://tre...@github.com/wicketstuff/core.git (fetch)
>> upstreamhttps://tre...@github.com/wicketstuff/core.git (push)
> 
> I already pulled and merged the actual master from wicketstuff/core and
> pushed to tremel/core. So I could easily start a pull request.
> 
> My commits are in a branch named gchart-ajax-fix, pushed to tremel/core
> too. As far as I understand, as a contributor I could commit directly to
> wicketstuff/core/gchart ("no merge commits") but also start a pull
> request from tremel/core. What is the right way to to it?
> 
> I suppose small commits like typos in gchart I should do without
> disturbing you with a pull request, larger improvements you should look
> at by pull request from tremel/core. Right?
> 
> Thank you for some advice.
> Dieter
> 


Re: Git team workflow

2017-12-07 Thread Maxim Solodovnik
Hello Dieter,

You are the "component owner" so you can commit directly in case "you
feel lucky (c)" and don't need a review
PR is necessary in case you need second opinion or two :)

On Fri, Dec 8, 2017 at 2:16 PM, Dieter Tremel  wrote:
> Hello wicketstuff team,
>
> as newbie wicketstuff contributor (gchart) I have to ask some questions
> around team workflow.
>
> Sorry if my knowledge here is not sufficient, I work mostly alone for a
> long time, so I had to improve my git and github handling a lot. And of
> course I don't want initiate any silly or destructive actions on the
> github repository.
>
> I have improved gchart in 5 commits and this should be moved to the
> repository. This is my setup including my fork:
>
>> $ git remote -v
>> origin  https://tre...@github.com/tremel/core.git (fetch)
>> origin  https://tre...@github.com/tremel/core.git (push)
>> upstreamhttps://tre...@github.com/wicketstuff/core.git (fetch)
>> upstreamhttps://tre...@github.com/wicketstuff/core.git (push)
>
> I already pulled and merged the actual master from wicketstuff/core and
> pushed to tremel/core. So I could easily start a pull request.
>
> My commits are in a branch named gchart-ajax-fix, pushed to tremel/core
> too. As far as I understand, as a contributor I could commit directly to
> wicketstuff/core/gchart ("no merge commits") but also start a pull
> request from tremel/core. What is the right way to to it?
>
> I suppose small commits like typos in gchart I should do without
> disturbing you with a pull request, larger improvements you should look
> at by pull request from tremel/core. Right?
>
> Thank you for some advice.
> Dieter
>



-- 
WBR
Maxim aka solomax


Git team workflow

2017-12-07 Thread Dieter Tremel
Hello wicketstuff team,

as newbie wicketstuff contributor (gchart) I have to ask some questions
around team workflow.

Sorry if my knowledge here is not sufficient, I work mostly alone for a
long time, so I had to improve my git and github handling a lot. And of
course I don't want initiate any silly or destructive actions on the
github repository.

I have improved gchart in 5 commits and this should be moved to the
repository. This is my setup including my fork:

> $ git remote -v
> origin  https://tre...@github.com/tremel/core.git (fetch)
> origin  https://tre...@github.com/tremel/core.git (push)
> upstreamhttps://tre...@github.com/wicketstuff/core.git (fetch)
> upstreamhttps://tre...@github.com/wicketstuff/core.git (push)

I already pulled and merged the actual master from wicketstuff/core and
pushed to tremel/core. So I could easily start a pull request.

My commits are in a branch named gchart-ajax-fix, pushed to tremel/core
too. As far as I understand, as a contributor I could commit directly to
wicketstuff/core/gchart ("no merge commits") but also start a pull
request from tremel/core. What is the right way to to it?

I suppose small commits like typos in gchart I should do without
disturbing you with a pull request, larger improvements you should look
at by pull request from tremel/core. Right?

Thank you for some advice.
Dieter



[GitHub] wicket pull request #249: independent component renderer

2017-12-07 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/wicket/pull/249


---


[GitHub] wicket pull request #249: independent component renderer

2017-12-07 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/249#discussion_r155481407
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
 ---
@@ -16,35 +16,321 @@
  */
 package org.apache.wicket.core.util.string;
 
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Supplier;
+
 import org.apache.wicket.Application;
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.RuntimeConfigurationType;
+import org.apache.wicket.Session;
 import org.apache.wicket.ThreadContext;
 import org.apache.wicket.core.request.handler.PageProvider;
 import org.apache.wicket.markup.IMarkupCacheKeyProvider;
 import org.apache.wicket.markup.IMarkupResourceStreamProvider;
 import org.apache.wicket.markup.MarkupNotFoundException;
 import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.mock.MockApplication;
+import org.apache.wicket.mock.MockWebRequest;
 import org.apache.wicket.protocol.http.BufferedWebResponse;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.mock.MockServletContext;
+import org.apache.wicket.request.Request;
 import org.apache.wicket.request.Response;
+import org.apache.wicket.request.Url;
 import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.http.WebRequest;
+import org.apache.wicket.serialize.ISerializer;
+import org.apache.wicket.session.ISessionStore;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.StringResourceStream;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * A helper class for rendering components and pages.
- *
- * Note: {@link #renderComponent(Component)} does 
not
- * support rendering {@link org.apache.wicket.markup.html.panel.Fragment} 
instances!
+ * 
+ * With the static methods of this class components and pages can be 
rendered on a thread already
+ * processing an {@link Application}.
+ * 
+ * If you want to render independently from any web request processing 
(e.g. generating an email
+ * body on a worker thread), you can create an instance of this class.
+ * You may use an existing application, create a fresh one or just use the 
defaults of
+ * {@link #ComponentRenderer()} for a mocked application with sensible 
defaults.
+ * 
+ * Note: For performance instances can and should be reused, be sure to 
call {@link #destroy()} when
+ * they are no longer needed.
  */
 public class ComponentRenderer
 {
private static final Logger LOGGER = 
LoggerFactory.getLogger(ComponentRenderer.class);
 
+   private WebApplication application;
+
+   /**
+* A renderer using a default mocked application, which
+* 
+* never shares anything in a session
+* never serializes anything
+* 
+*/
+   public ComponentRenderer()
+   {
+   this(new MockApplication()
+   {
+   @Override
+   public RuntimeConfigurationType getConfigurationType()
+   {
+   return RuntimeConfigurationType.DEPLOYMENT;
+   }
+
+   @Override
+   protected void init()
+   {
+   super.init();
+
+   setSessionStoreProvider(() -> new 
NeverSessionStore());
+   getFrameworkSettings().setSerializer(new 
NeverSerializer());
+   }
+   });
+   }
+
+   /**
+* A renderer using the given application.
+* 
+* If the application was not yet initialized - e.g. it is not reused 
from an already running
+* web container - it will be initialized.
+*/
+   public ComponentRenderer(WebApplication application)
+   {
+   this.application = application;
+
+   if (application.getName() == null)
+   {
+   // not yet initialized
+
+   inThreadContext(() -> {
+   application.setServletContext(new 
MockServletContext(application, null));
+   application.setName(
+   "ComponentRenderer[" + 
System.identityHashCode(ComponentRenderer.this) + "]");
+   application.initApplication();
+   });
+   }
+   }
+
+   /**
+* Destroy this renderer.
+*/
+   

[GitHub] wicket pull request #249: independent component renderer

2017-12-07 Thread svenmeier
Github user svenmeier commented on a diff in the pull request:

https://github.com/apache/wicket/pull/249#discussion_r155472740
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
 ---
@@ -16,35 +16,321 @@
  */
 package org.apache.wicket.core.util.string;
 
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Supplier;
+
 import org.apache.wicket.Application;
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.RuntimeConfigurationType;
+import org.apache.wicket.Session;
 import org.apache.wicket.ThreadContext;
 import org.apache.wicket.core.request.handler.PageProvider;
 import org.apache.wicket.markup.IMarkupCacheKeyProvider;
 import org.apache.wicket.markup.IMarkupResourceStreamProvider;
 import org.apache.wicket.markup.MarkupNotFoundException;
 import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.mock.MockApplication;
+import org.apache.wicket.mock.MockWebRequest;
 import org.apache.wicket.protocol.http.BufferedWebResponse;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.mock.MockServletContext;
+import org.apache.wicket.request.Request;
 import org.apache.wicket.request.Response;
+import org.apache.wicket.request.Url;
 import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.http.WebRequest;
+import org.apache.wicket.serialize.ISerializer;
+import org.apache.wicket.session.ISessionStore;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.StringResourceStream;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * A helper class for rendering components and pages.
- *
- * Note: {@link #renderComponent(Component)} does 
not
- * support rendering {@link org.apache.wicket.markup.html.panel.Fragment} 
instances!
+ * 
+ * With the static methods of this class components and pages can be 
rendered on a thread already
+ * processing an {@link Application}.
+ * 
+ * If you want to render independently from any web request processing 
(e.g. generating an email
+ * body on a worker thread), you can create an instance of this class.
+ * You may use an existing application, create a fresh one or just use the 
defaults of
+ * {@link #ComponentRenderer()} for a mocked application with sensible 
defaults.
+ * 
+ * Note: For performance instances can and should be reused, be sure to 
call {@link #destroy()} when
+ * they are no longer needed.
  */
 public class ComponentRenderer
 {
private static final Logger LOGGER = 
LoggerFactory.getLogger(ComponentRenderer.class);
 
+   private WebApplication application;
+
+   /**
+* A renderer using a default mocked application, which
+* 
+* never shares anything in a session
+* never serializes anything
+* 
+*/
+   public ComponentRenderer()
+   {
+   this(new MockApplication()
+   {
+   @Override
+   public RuntimeConfigurationType getConfigurationType()
+   {
+   return RuntimeConfigurationType.DEPLOYMENT;
+   }
+
+   @Override
+   protected void init()
+   {
+   super.init();
+
+   setSessionStoreProvider(() -> new 
NeverSessionStore());
+   getFrameworkSettings().setSerializer(new 
NeverSerializer());
+   }
+   });
+   }
+
+   /**
+* A renderer using the given application.
+* 
+* If the application was not yet initialized - e.g. it is not reused 
from an already running
+* web container - it will be initialized.
+*/
+   public ComponentRenderer(WebApplication application)
+   {
+   this.application = application;
+
+   if (application.getName() == null)
+   {
+   // not yet initialized
+
+   inThreadContext(() -> {
+   application.setServletContext(new 
MockServletContext(application, null));
+   application.setName(
+   "ComponentRenderer[" + 
System.identityHashCode(ComponentRenderer.this) + "]");
+   application.initApplication();
+   });
+   }
+   }
+
+   /**
+* Destroy this renderer.
+*/
+   

[GitHub] wicket pull request #249: independent component renderer

2017-12-07 Thread solomax
Github user solomax commented on a diff in the pull request:

https://github.com/apache/wicket/pull/249#discussion_r155466396
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
 ---
@@ -16,35 +16,321 @@
  */
 package org.apache.wicket.core.util.string;
 
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Supplier;
+
 import org.apache.wicket.Application;
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.RuntimeConfigurationType;
+import org.apache.wicket.Session;
 import org.apache.wicket.ThreadContext;
 import org.apache.wicket.core.request.handler.PageProvider;
 import org.apache.wicket.markup.IMarkupCacheKeyProvider;
 import org.apache.wicket.markup.IMarkupResourceStreamProvider;
 import org.apache.wicket.markup.MarkupNotFoundException;
 import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.mock.MockApplication;
+import org.apache.wicket.mock.MockWebRequest;
 import org.apache.wicket.protocol.http.BufferedWebResponse;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.mock.MockServletContext;
+import org.apache.wicket.request.Request;
 import org.apache.wicket.request.Response;
+import org.apache.wicket.request.Url;
 import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.http.WebRequest;
+import org.apache.wicket.serialize.ISerializer;
+import org.apache.wicket.session.ISessionStore;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.StringResourceStream;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * A helper class for rendering components and pages.
- *
- * Note: {@link #renderComponent(Component)} does 
not
- * support rendering {@link org.apache.wicket.markup.html.panel.Fragment} 
instances!
+ * 
+ * With the static methods of this class components and pages can be 
rendered on a thread already
+ * processing an {@link Application}.
+ * 
+ * If you want to render independently from any web request processing 
(e.g. generating an email
+ * body on a worker thread), you can create an instance of this class.
+ * You may use an existing application, create a fresh one or just use the 
defaults of
+ * {@link #ComponentRenderer()} for a mocked application with sensible 
defaults.
+ * 
+ * Note: For performance instances can and should be reused, be sure to 
call {@link #destroy()} when
+ * they are no longer needed.
  */
 public class ComponentRenderer
 {
private static final Logger LOGGER = 
LoggerFactory.getLogger(ComponentRenderer.class);
 
+   private WebApplication application;
+
+   /**
+* A renderer using a default mocked application, which
+* 
+* never shares anything in a session
+* never serializes anything
+* 
+*/
+   public ComponentRenderer()
+   {
+   this(new MockApplication()
+   {
+   @Override
+   public RuntimeConfigurationType getConfigurationType()
+   {
+   return RuntimeConfigurationType.DEPLOYMENT;
+   }
+
+   @Override
+   protected void init()
+   {
+   super.init();
+
+   setSessionStoreProvider(() -> new 
NeverSessionStore());
+   getFrameworkSettings().setSerializer(new 
NeverSerializer());
+   }
+   });
+   }
+
+   /**
+* A renderer using the given application.
+* 
+* If the application was not yet initialized - e.g. it is not reused 
from an already running
+* web container - it will be initialized.
+*/
+   public ComponentRenderer(WebApplication application)
+   {
+   this.application = application;
+
+   if (application.getName() == null)
+   {
+   // not yet initialized
+
+   inThreadContext(() -> {
+   application.setServletContext(new 
MockServletContext(application, null));
+   application.setName(
+   "ComponentRenderer[" + 
System.identityHashCode(ComponentRenderer.this) + "]");
+   application.initApplication();
+   });
+   }
+   }
+
+   /**
+* Destroy this renderer.
+*/
+   

[GitHub] wicket pull request #249: independent component renderer

2017-12-07 Thread martin-g
Github user martin-g commented on a diff in the pull request:

https://github.com/apache/wicket/pull/249#discussion_r155464694
  
--- Diff: 
wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
 ---
@@ -16,35 +16,321 @@
  */
 package org.apache.wicket.core.util.string;
 
+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Supplier;
+
 import org.apache.wicket.Application;
 import org.apache.wicket.Component;
 import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.RuntimeConfigurationType;
+import org.apache.wicket.Session;
 import org.apache.wicket.ThreadContext;
 import org.apache.wicket.core.request.handler.PageProvider;
 import org.apache.wicket.markup.IMarkupCacheKeyProvider;
 import org.apache.wicket.markup.IMarkupResourceStreamProvider;
 import org.apache.wicket.markup.MarkupNotFoundException;
 import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.mock.MockApplication;
+import org.apache.wicket.mock.MockWebRequest;
 import org.apache.wicket.protocol.http.BufferedWebResponse;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.mock.MockServletContext;
+import org.apache.wicket.request.Request;
 import org.apache.wicket.request.Response;
+import org.apache.wicket.request.Url;
 import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.http.WebRequest;
+import org.apache.wicket.serialize.ISerializer;
+import org.apache.wicket.session.ISessionStore;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.apache.wicket.util.resource.StringResourceStream;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * A helper class for rendering components and pages.
- *
- * Note: {@link #renderComponent(Component)} does 
not
- * support rendering {@link org.apache.wicket.markup.html.panel.Fragment} 
instances!
+ * 
+ * With the static methods of this class components and pages can be 
rendered on a thread already
+ * processing an {@link Application}.
+ * 
+ * If you want to render independently from any web request processing 
(e.g. generating an email
+ * body on a worker thread), you can create an instance of this class.
+ * You may use an existing application, create a fresh one or just use the 
defaults of
+ * {@link #ComponentRenderer()} for a mocked application with sensible 
defaults.
+ * 
+ * Note: For performance instances can and should be reused, be sure to 
call {@link #destroy()} when
+ * they are no longer needed.
  */
 public class ComponentRenderer
 {
private static final Logger LOGGER = 
LoggerFactory.getLogger(ComponentRenderer.class);
 
+   private WebApplication application;
+
+   /**
+* A renderer using a default mocked application, which
+* 
+* never shares anything in a session
+* never serializes anything
+* 
+*/
+   public ComponentRenderer()
+   {
+   this(new MockApplication()
+   {
+   @Override
+   public RuntimeConfigurationType getConfigurationType()
+   {
+   return RuntimeConfigurationType.DEPLOYMENT;
+   }
+
+   @Override
+   protected void init()
+   {
+   super.init();
+
+   setSessionStoreProvider(() -> new 
NeverSessionStore());
+   getFrameworkSettings().setSerializer(new 
NeverSerializer());
+   }
+   });
+   }
+
+   /**
+* A renderer using the given application.
+* 
+* If the application was not yet initialized - e.g. it is not reused 
from an already running
+* web container - it will be initialized.
+*/
+   public ComponentRenderer(WebApplication application)
+   {
+   this.application = application;
+
+   if (application.getName() == null)
+   {
+   // not yet initialized
+
+   inThreadContext(() -> {
+   application.setServletContext(new 
MockServletContext(application, null));
+   application.setName(
+   "ComponentRenderer[" + 
System.identityHashCode(ComponentRenderer.this) + "]");
+   application.initApplication();
+   });
+   }
+   }
+
+   /**
+* Destroy this renderer.
+*/
+   

[GitHub] wicket issue #249: independent component renderer

2017-12-07 Thread solomax
Github user solomax commented on the issue:

https://github.com/apache/wicket/pull/249
  
We are currently using WicketTester for this, I'll try this later tonight 
and will give huge +1 :))


---


[GitHub] wicket pull request #249: independent component renderer

2017-12-07 Thread svenmeier
GitHub user svenmeier opened a pull request:

https://github.com/apache/wicket/pull/249

independent component renderer

ComponentRenderer makes it easy to render components, but it still needs 
the thread to be attached to a WebApplication's ThreadContext: I've seen 
projects use WicketTester for that or rolling their own solution.

IMHO we could improve ComponentRender to officially support independent 
rendering of components.

WDYT?

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/apache/wicket sandbox/component-renderer

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/wicket/pull/249.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #249


commit 6e6c273fd32325a447cc32c751d5ce0c083e7ed1
Author: Sven Meier 
Date:   2017-12-07T08:24:12Z

render independently from web or tester

commit 0baab8c3027bbaafb1a218f3cf87edf0040d856f
Author: Sven Meier 
Date:   2017-12-07T08:44:47Z

use lambdas, fixed imports




---


Re: wicket git commit: render independently from web or tester

2017-12-07 Thread Sven Meier

Wow, you're fast :P

Sven


Am 07.12.2017 um 09:29 schrieb Maxim Solodovnik:

Hello Sven,

Is this correct import?
import com.google.common.base.Supplier;

On Thu, Dec 7, 2017 at 3:24 PM,   wrote:

Repository: wicket
Updated Branches:
   refs/heads/sandbox/component-renderer [created] 6e6c273fd


render independently from web or tester


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/6e6c273f
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/6e6c273f
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/6e6c273f

Branch: refs/heads/sandbox/component-renderer
Commit: 6e6c273fd32325a447cc32c751d5ce0c083e7ed1
Parents: 693dad3
Author: Sven Meier 
Authored: Thu Dec 7 09:24:12 2017 +0100
Committer: Sven Meier 
Committed: Thu Dec 7 09:24:12 2017 +0100

--
  .../core/util/string/ComponentRenderer.java | 324 ++-
  .../ComponentRendererInstanceTest.java  |  52 +++
  2 files changed, 369 insertions(+), 7 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/wicket/blob/6e6c273f/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
--
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
 
b/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
index 0cf63bf..e971bc2 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
@@ -16,35 +16,341 @@
   */
  package org.apache.wicket.core.util.string;

+import java.io.Serializable;
+import java.util.List;
+import java.util.Set;
+
  import org.apache.wicket.Application;
  import org.apache.wicket.Component;
  import org.apache.wicket.MarkupContainer;
+import org.apache.wicket.Page;
+import org.apache.wicket.RuntimeConfigurationType;
+import org.apache.wicket.Session;
  import org.apache.wicket.ThreadContext;
  import org.apache.wicket.core.request.handler.PageProvider;
  import org.apache.wicket.markup.IMarkupCacheKeyProvider;
  import org.apache.wicket.markup.IMarkupResourceStreamProvider;
  import org.apache.wicket.markup.MarkupNotFoundException;
  import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.mock.MockApplication;
+import org.apache.wicket.mock.MockWebRequest;
  import org.apache.wicket.protocol.http.BufferedWebResponse;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.mock.MockServletContext;
+import org.apache.wicket.request.Request;
  import org.apache.wicket.request.Response;
+import org.apache.wicket.request.Url;
  import org.apache.wicket.request.cycle.RequestCycle;
+import org.apache.wicket.request.http.WebRequest;
+import org.apache.wicket.serialize.ISerializer;
+import org.apache.wicket.session.ISessionStore;
  import org.apache.wicket.util.resource.IResourceStream;
  import org.apache.wicket.util.resource.StringResourceStream;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;

+import com.google.common.base.Supplier;
+
  /**
   * A helper class for rendering components and pages.
- *
- * Note: {@link #renderComponent(Component)} does 
not
- * support rendering {@link org.apache.wicket.markup.html.panel.Fragment} 
instances!
+ * 
+ * With the static methods of this class components and pages can be rendered
+ * on a thread already processing an {@link Application}.
+ * 
+ * If you want to render independently from any web request processing (e.g. 
generating an email
+ * body on a worker thread), you can create an instance of this class.
+ * You may use an existing application, create a fresh one or just use the 
defaults of
+ * {@link #ComponentRenderer()} for a mocked application with sensible 
defaults.
+ * 
+ * Note: For performance instances can and should be reused, be sure to call 
{@link #destroy()}
+ * when they are no longer needed.
   */
  public class ComponentRenderer
  {
 private static final Logger LOGGER = 
LoggerFactory.getLogger(ComponentRenderer.class);

+   private WebApplication application;
+
+   /**
+* A renderer using a default mocked application, which
+* 
+* never shares anything in a session
+* never serializes anything
+* 
+*/
+   public ComponentRenderer()
+   {
+   this(new MockApplication()
+   {
+   @Override
+   public RuntimeConfigurationType getConfigurationType()
+   {
+   return RuntimeConfigurationType.DEPLOYMENT;
+   }
+
+   

Re: wicket git commit: render independently from web or tester

2017-12-07 Thread Maxim Solodovnik
Hello Sven,

Is this correct import?
import com.google.common.base.Supplier;

On Thu, Dec 7, 2017 at 3:24 PM,   wrote:
> Repository: wicket
> Updated Branches:
>   refs/heads/sandbox/component-renderer [created] 6e6c273fd
>
>
> render independently from web or tester
>
>
> Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
> Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/6e6c273f
> Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/6e6c273f
> Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/6e6c273f
>
> Branch: refs/heads/sandbox/component-renderer
> Commit: 6e6c273fd32325a447cc32c751d5ce0c083e7ed1
> Parents: 693dad3
> Author: Sven Meier 
> Authored: Thu Dec 7 09:24:12 2017 +0100
> Committer: Sven Meier 
> Committed: Thu Dec 7 09:24:12 2017 +0100
>
> --
>  .../core/util/string/ComponentRenderer.java | 324 ++-
>  .../ComponentRendererInstanceTest.java  |  52 +++
>  2 files changed, 369 insertions(+), 7 deletions(-)
> --
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/6e6c273f/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
> --
> diff --git 
> a/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
>  
> b/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
> index 0cf63bf..e971bc2 100644
> --- 
> a/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
> +++ 
> b/wicket-core/src/main/java/org/apache/wicket/core/util/string/ComponentRenderer.java
> @@ -16,35 +16,341 @@
>   */
>  package org.apache.wicket.core.util.string;
>
> +import java.io.Serializable;
> +import java.util.List;
> +import java.util.Set;
> +
>  import org.apache.wicket.Application;
>  import org.apache.wicket.Component;
>  import org.apache.wicket.MarkupContainer;
> +import org.apache.wicket.Page;
> +import org.apache.wicket.RuntimeConfigurationType;
> +import org.apache.wicket.Session;
>  import org.apache.wicket.ThreadContext;
>  import org.apache.wicket.core.request.handler.PageProvider;
>  import org.apache.wicket.markup.IMarkupCacheKeyProvider;
>  import org.apache.wicket.markup.IMarkupResourceStreamProvider;
>  import org.apache.wicket.markup.MarkupNotFoundException;
>  import org.apache.wicket.markup.html.WebPage;
> +import org.apache.wicket.mock.MockApplication;
> +import org.apache.wicket.mock.MockWebRequest;
>  import org.apache.wicket.protocol.http.BufferedWebResponse;
> +import org.apache.wicket.protocol.http.WebApplication;
> +import org.apache.wicket.protocol.http.mock.MockServletContext;
> +import org.apache.wicket.request.Request;
>  import org.apache.wicket.request.Response;
> +import org.apache.wicket.request.Url;
>  import org.apache.wicket.request.cycle.RequestCycle;
> +import org.apache.wicket.request.http.WebRequest;
> +import org.apache.wicket.serialize.ISerializer;
> +import org.apache.wicket.session.ISessionStore;
>  import org.apache.wicket.util.resource.IResourceStream;
>  import org.apache.wicket.util.resource.StringResourceStream;
>  import org.slf4j.Logger;
>  import org.slf4j.LoggerFactory;
>
> +import com.google.common.base.Supplier;
> +
>  /**
>   * A helper class for rendering components and pages.
> - *
> - * Note: {@link #renderComponent(Component)} does 
> not
> - * support rendering {@link org.apache.wicket.markup.html.panel.Fragment} 
> instances!
> + * 
> + * With the static methods of this class components and pages can be rendered
> + * on a thread already processing an {@link Application}.
> + * 
> + * If you want to render independently from any web request processing (e.g. 
> generating an email
> + * body on a worker thread), you can create an instance of this class.
> + * You may use an existing application, create a fresh one or just use the 
> defaults of
> + * {@link #ComponentRenderer()} for a mocked application with sensible 
> defaults.
> + * 
> + * Note: For performance instances can and should be reused, be sure to call 
> {@link #destroy()}
> + * when they are no longer needed.
>   */
>  public class ComponentRenderer
>  {
> private static final Logger LOGGER = 
> LoggerFactory.getLogger(ComponentRenderer.class);
>
> +   private WebApplication application;
> +
> +   /**
> +* A renderer using a default mocked application, which
> +* 
> +* never shares anything in a session
> +* never serializes anything
> +* 
> +*/
> +   public ComponentRenderer()
> +   {
> +   this(new MockApplication()
> +   {
> +   @Override
> +   public RuntimeConfigurationType getConfigurationType()
> +