Search in sources :

Example 1 with DefaultWebComponentExporterFactory

use of com.vaadin.flow.component.WebComponentExporterFactory.DefaultWebComponentExporterFactory in project flow by vaadin.

the class WebComponentExporterUtilsTest method assertFactories.

private void assertFactories(WebComponentExporterFactory factory, WebComponentExporterFactory anotherFactory) {
    Assert.assertTrue(anotherFactory instanceof DefaultWebComponentExporterFactory);
    WebComponentExporter exporter = anotherFactory.create();
    MatcherAssert.assertThat(exporter, CoreMatchers.instanceOf(GoodExporter.class));
    exporter = factory.create();
    MatcherAssert.assertThat(exporter, CoreMatchers.instanceOf(NoDefaultCtorExporter.class));
}
Also used : WebComponentExporter(com.vaadin.flow.component.WebComponentExporter) DefaultWebComponentExporterFactory(com.vaadin.flow.component.WebComponentExporterFactory.DefaultWebComponentExporterFactory)

Example 2 with DefaultWebComponentExporterFactory

use of com.vaadin.flow.component.WebComponentExporterFactory.DefaultWebComponentExporterFactory in project flow by vaadin.

the class WebComponentProviderTest method setupConfigurations.

@SuppressWarnings({ "unchecked", "rawtypes" })
@SafeVarargs
private final WebComponentConfigurationRegistry setupConfigurations(Class<? extends WebComponentExporter<? extends Component>>... exporters) {
    WebComponentConfigurationRegistry registry = setUpRegistry();
    final Set<Class<? extends WebComponentExporter<? extends Component>>> set = Stream.of(exporters).collect(Collectors.toSet());
    WebComponentExporter.WebComponentConfigurationFactory factory = new WebComponentExporter.WebComponentConfigurationFactory();
    Set<WebComponentConfiguration<? extends Component>> configurations = new HashSet<>();
    for (Class<? extends WebComponentExporter<? extends Component>> exporter : exporters) configurations.add(factory.create(new DefaultWebComponentExporterFactory(exporter).create()));
    registry.setConfigurations(configurations);
    return registry;
}
Also used : WebComponentConfiguration(com.vaadin.flow.component.webcomponent.WebComponentConfiguration) WebComponentConfigurationRegistry(com.vaadin.flow.server.webcomponent.WebComponentConfigurationRegistry) WebComponent(com.vaadin.flow.component.webcomponent.WebComponent) Component(com.vaadin.flow.component.Component) WebComponentExporter(com.vaadin.flow.component.WebComponentExporter) HashSet(java.util.HashSet) DefaultWebComponentExporterFactory(com.vaadin.flow.component.WebComponentExporterFactory.DefaultWebComponentExporterFactory)

Aggregations

WebComponentExporter (com.vaadin.flow.component.WebComponentExporter)2 DefaultWebComponentExporterFactory (com.vaadin.flow.component.WebComponentExporterFactory.DefaultWebComponentExporterFactory)2 Component (com.vaadin.flow.component.Component)1 WebComponent (com.vaadin.flow.component.webcomponent.WebComponent)1 WebComponentConfiguration (com.vaadin.flow.component.webcomponent.WebComponentConfiguration)1 WebComponentConfigurationRegistry (com.vaadin.flow.server.webcomponent.WebComponentConfigurationRegistry)1 HashSet (java.util.HashSet)1