use of com.vaadin.flow.component.WebComponentExporter 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));
}
use of com.vaadin.flow.component.WebComponentExporter in project flow by vaadin.
the class WebComponentWrapperTest method constructWrapperAndGetBinding.
/**
* @param exporter
* exporter of the correct type, defines C
* @param element
* nullable root element
* @param ui
* nullable WebComponentUI
* @param <C>
* type of the exported component
* @return web component wrapper
*/
private <C extends Component> WebComponentBinding<C> constructWrapperAndGetBinding(WebComponentExporter<C> exporter, Element element, WebComponentUI ui) {
if (element == null) {
element = new Element("tag");
}
WebComponentBinding<C> binding = (WebComponentBinding<C>) new WebComponentExporter.WebComponentConfigurationFactory().create(exporter).createWebComponentBinding(new MockInstantiator(), element, Json.createObject());
wrapper = new WebComponentWrapper(element, binding) {
@Override
public Optional<UI> getUI() {
return Optional.of(ui);
}
};
return binding;
}
use of com.vaadin.flow.component.WebComponentExporter 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;
}
Aggregations