Giter Site home page Giter Site logo

bookstore-example's Introduction

Bookstore App Starter for Vaadin

A project example for a Vaadin application that only requires a Servlet 3.1 container to run (no other JEE dependencies). The UI is built with Java only.

The easiest way of using it is via https://vaadin.com/start - you can choose the package naming you want.

Prerequisites

The project can be imported into the IDE of your choice, with Java 8 or 11 installed, as a Maven project.

Project Structure

The project is following the standard Maven project layout.

Workflow

To compile the entire project, run "mvn install" in the project root.

Other basic workflow steps:

  • getting started
  • compiling the whole project
    • run mvn install in project root
  • developing the application
  • creating a production mode war
    • run mvn package -Pproduction
  • running in production mode

Running Integration Tests

Integration tests are implemented using TestBench. The tests take a few minutes to run and are therefore included in a separate Maven profile. To run the tests using Google Chrome, execute

mvn verify -Pit

and make sure you have a valid TestBench license installed. If the tests fail because of an old Chrome Driver or you want to use a different browser, you'll need to update the webdrivers.xml file in the project root.

Profile it adds the following parameters to run integration tests:

-Dwebdriver.chrome.driver=path_to_driver
-Dcom.vaadin.testbench.Parameters.runLocally=chrome

If you would like to run a separate test make sure you have added these parameters to VM Options of JUnit run configuration

Branching information:

  • master the latest version of the starter, using the latest platform version

bookstore-example's People

Contributors

alvarezguille avatar amahdy avatar anasmi avatar artur- avatar benwilsoni avatar bogdanudrescu avatar caalador avatar dependabot[bot] avatar haijian-vaadin avatar juhopiirainen avatar legioth avatar manolo avatar mehdi-vaadin avatar mikotin avatar mshabarov avatar pekam avatar platosha avatar pleku avatar samie avatar shadikhani avatar someonetoignore avatar tarekoraby avatar ujoni avatar vaadin-bot avatar zhesun88 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bookstore-example's Issues

Can’t navigate between views using the keyboard

The sidebar uses Tabs. Focusing the tabs and moving to the next tab using the Down/Up Arrow key and pressing the Space key selects the tab but does not navigate to the corresponding view.

While the tab is focused and you press the Tab key, you can focus the link within the tab and press the Space or Enter key to trigger the link, but that doesn’t navigate to the view either.

PiT 24.2: rtl branch is using BigDecimal deprecated API

running mvn -ntp -B clean install -Pproduction,it -Dheadless -Dcom.vaadin.testbench.Parameters.headless=true -Dheadless -Dmaven.compiler.showDeprecation in the rtl-demo branch reports the following deprecations

src/main/java/org/vaadin/example/bookstore/ui/inventory/ProductForm.java:[58,58] ROUND_HALF_DOWN in java.math.BigDecimal has been deprecated
src/main/java/org/vaadin/example/bookstore/ui/inventory/ProductForm.java:[58,35] setScale(int,int) in java.math.BigDecimal has been deprecated
src/main/java/org/vaadin/example/bookstore/ui/inventory/ProductForm.java:[63,48] ROUND_HALF_DOWN in java.math.BigDecimal has been deprecated
src/main/java/org/vaadin/example/bookstore/ui/inventory/ProductForm.java:[63,25] setScale(int,int) in java.math.BigDecimal has been deprecated

Error view doesn't work properly

if i try to navigate to an unexisting view, I don't get this view, but i'm routed to inventory instead.

Debugged it: the problem is in SampleCrudLogic.init where it navigates to view with null; it happens to work, but also hides any errors. The other thing is that the crud view is DEFAULT with string param; any route goes to it, not the error view.

This makes it all way more difficult: vaadin/flow#6838

Improving the authentication mechanism in order to prevent creating SampleCrudView twice

When the user tries to open the inventory view (SampleCrudView) before he/she logins an object of the type SampleCrudView is created with all its dependencies including an object of the type ProductDataProvider and the method MockDataService.getAllProducts is also called. After logging in the same repeats again.

The reason behind this is that we use BeforeEnter event of UI to check if a user is authenticated or not. It's in the class BookstoreInitListener. And, the event is raised when an object of the view class has been already created. So, the solution of this problem could be moving the authentication to another point where the view is not created yet.

Update to 24.0.2

  • adjust pom.xml
  • exchanage javax by jakarta dependency
  • TemplateRenderer replace by LitRenderer
  • replace iron elements

PiT 24.2: empty style block in vaadin-login-form breaks tests

description

When upgrading to 24.2.0.alpha10, TB test LoginScreenIT.loginForm_isLumoThemed fails, note that 24.2.0.alpha9 passes.

 LoginScreenIT.loginForm_isLumoThemed:15->AbstractViewTest.assertThemePresentOnElement:92 Element 'vaadin-login-form' should have had theme 'Lumo'.

This is the test failing and this is the function with the assertion

how to reproduce

  1. clone the project
   git clone https://github.com/vaadin/bookstore-example.git
   cd bookstore-example
  1. increase the version and enable snapshots
   perl -0777 -pi -e 's|(<vaadin.version>)([^\s]+)(</vaadin.version>)|${1}24.2.0.alpha10${3}|g' pom.xml
   perl -0777 -pi -e 's|(<snapshots>\s+<enabled>)([^\s]+)(</enabled>\s+</snapshots>)|${1}true${3}|g' pom.xml
  1. run failing test
mvn verify -Pit,production -Dit.test=LoginScreenIT

version

24.2.0.alpha10

PiT 24.3: test failing after login

Perform the following steps:

git clone https://github.com/vaadin/bookstore-example.git
cd bookstore-example
# edit pom.xml and set vaadin.version to 24.3.0.beta1
mvn install -Pproduction,it  -Dheadless

It fails with the message:

	at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:84)
	at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:230)
	at com.vaadin.testbench.ElementQuery.waitForFirst(ElementQuery.java:276)
	at com.vaadin.testbench.ElementQuery.waitForFirst(ElementQuery.java:258)
	at org.vaadin.example.about.AboutViewIT.openAboutView_showsFlowVersion(AboutViewIT.java:21)

Which is when looking for the about view after login, so login process was already submited, but the screenshot shows the login without any error, seems like login screen is loaded twice

navigation buttons in browser do not work when editing products

  • Open the app, login and go to /Inventory
  • click on the 4th item, the url changes to /Inventory/4 and edits the item.
  • click the back button in browser, Inventory is shown correctly
  • click forward button in browser, /Inventory/4 is displayed in URL, but the form editing the item is not displayed

`Image` resources are not added into the resulting war

Take the https://github.com/vaadin/bookstore-starter-flow/ repo, take the branch with Flow 2.0 used.

Build and start the app.
Login.

Expected: an icon displayed near My CRUD letters.
Actual: no icons, 404 in the network tab when a request sent

image

The image usage is in the Menu.java, see lines near the

String resolvedImage = VaadinServletService.getCurrent()
                .resolveResource("frontend://img/table-logo.png",
                        VaadinSession.getCurrent().getBrowser());

Works for Flow 1.5, so better be fixed for Flow 2.0

Duplicate scrollbars on MS Edge

Since V13, there appears to be two scrollbars visible for the products grid & the outer layout, and the scrolling of the grid is broken due to that

build warnings: prerequisites intended for maven-plugin projects

When running mvn jetty:run on a freshly cloned repo, I am getting the following warning in the build log:

[INFO] Scanning for projects...
[WARNING] The project org.vaadin.viktor:simpleapp:war:1.0-SNAPSHOT uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html

I would not want to see any such warnings in an example project that I download from vaadin.com/start.

App looks broken when running on production mode IE11

Tested with jetty:run and with package + running tomcat both with -Dvaadin.productionMode and -PproductionMode
Dark theme is not applied, and some other styling issues as seen on the following screenshot
image

Tested with vaadin 12.0.0.alpha4

build warnings: same class in multiple .jars

When running mvn jetty:run on a freshly cloned repo, I am getting the following warning in the build log:

[WARNING] com.google.common.util.concurrent.internal.InternalFutureFailureAccess scanned from multiple locations: jar:file:///Users/viktor/.m2/repository/com/google/guava/failureaccess/1.0/failureaccess-1.0.jar!/com/google/common/util/concurrent/internal/InternalFutureFailureAccess.class, jar:file:///Users/viktor/.m2/repository/com/google/guava/guava/27.0-jre/guava-27.0-jre.jar!/com/google/common/util/concurrent/internal/InternalFutureFailureAccess.class
[WARNING] com.google.common.util.concurrent.internal.InternalFutures scanned from multiple locations: jar:file:///Users/viktor/.m2/repository/com/google/guava/failureaccess/1.0/failureaccess-1.0.jar!/com/google/common/util/concurrent/internal/InternalFutures.class, jar:file:///Users/viktor/.m2/repository/com/google/guava/guava/27.0-jre/guava-27.0-jre.jar!/com/google/common/util/concurrent/internal/InternalFutures.class

I would not want to see any such warnings in an example project that I download from vaadin.com/start.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.