Giter Site home page Giter Site logo

anirban-sap / yaas_java_jersey_wishlist Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sap-archive/yaas_java_jersey_wishlist

0.0 1.0 0.0 77 KB

This is an example implementation of the YaaS "Wishlist" service based on Java. It uses the RAML definition generated by the SDK without modifications. It shows how to implement a basic service and how to integrate with other services on YaaS.

License: Apache License 2.0

Java 93.22% RAML 6.78%

yaas_java_jersey_wishlist's Introduction

yaas_java_jersey_wishlist

This is an example implementation of the YaaS "Wishlist" service based on Java. It uses the RAML definition generated by the SDK without modifications. It shows how to implement a basic service and how to integrate with other services on YaaS.

License

This project is licensed under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file.

API Console

You can open the API Console in a separate window by using the following link:

API Overview

This service provides REST endpoints for interacting with several YaaS Core and Commerce services.

Document Service

The endpoint /wishlists enables you to:

  • Interact with wishlists in a CRUD fashion.
    • Get a list of all wishlists within a tenant.
    • Create a new wishlist.
    • Get a specific wishlist based on an ID.
    • Update a specific wishlist based on an ID.
    • Delete a specific wishlist based on an ID.

The endpoint /wishlists/{wishlistId}/wishlistItems enables you to:

  • get a specific wishlist and read its items
  • create a new wishlist item and add it to the specific wishlist

See also WishlistService.java.

Email Service

An email is sent to the wishlist owner when a wishlist is created. For more details, have a look at the sendMail method in WishlistService.java.

Media Service

The endpoint /wishlists/{wishlistId}/media enables you to:

  • Get a list of all media for the wishlist.
  • Create a new medium.
  • Delete a specific medium based on an ID.

See also WishlistMediaService.java

Customer Service

When a wishlist is being created, the implementation checks if its owner exists as a customer. You can find the details at the beginning of the post method in WishlistService.java.

Purpose & Benefits

Showcase how a service can be written using Java. Demonstrate the integration with other services on YaaS, including authentication. Topics covered:

  • Usage of Spring framework
  • Property handling
  • Authentication with the YaaS platform
  • Consumption of YaaS services
  • Deployment to Cloud Foundry
  • Testing

Dependencies

How to Build and Test

In order to build the service locally, you need to create an Application within your Project/Site, which subscribes to the following packages and scopes:

  • Email package (Scopes: hybris.email_send, hybris.email_manage)
  • Persistence package (Scopes: hybris.document_manage, hybris.document_view)
  • Media package (Scope: hybris.media_manage)
  • Customer Accounts package (Scope: hybris.customer_read)

You must then set the following environment variables:

  • YAAS_CLIENT: Your Application's Identifier
  • YAAS_CLIENT_ID: Your Application's Client ID
  • YAAS_CLIENT_SECRET: Your Application's Client Secret
  • YAAS_CLIENT_IS_APPLICATION: Set this parameter in default.properties to true. (Because you are using the Application's credentials, you are running in single tenant mode. Therefore, you must set this flag to true.)

You must store the ID of your Project/Site as TENANT in TestConstants.java.

You also need to create a customer in your tenant and store it as CUSTOMER in TestConstants.java.

Finally, use mvn clean install to build the service and run the tests.

To run it locally, you can call mvn jetty:run and navigate to the local API Console.

FAQ / Troubleshooting

If you get failed tests while building with mvn clean install, such as response code expected:201 but was:500", then it probably means that the test cannot connect to the Core services due to your proxy settings.

Hint: In that case, you might want to try it out with:

mvn clean install -Dhttp.proxyPort=<proxyPort> -Dhttp.proxyHost=<proxyHost> -Dhttps.proxyPort=<proxyPort> -Dhttps.proxyHost=<proxyHost>

yaas_java_jersey_wishlist's People

Contributors

vboteva avatar a-thaler avatar oemlerm avatar oviboc-hybris avatar pierrefritsch avatar agraebe avatar grumpyovi avatar

Watchers

Anirban Majumdar avatar

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.