Coder Social home page Coder Social logo

test-bli's Introduction

Environment:

  • Java version: 1.8
  • Maven version: 3.*
  • Spring Boot version: 2.2.1.RELEASE

Read-Only Files:

  • src/test/*

Data:

Structure of a file object when stored in database:

{
   "id": 1,
   "fileGroup": "certificates",
   "fileName": "certificate1",
   "file": "bytes of file data"
}

Requirements:

The REST service needs to expose 2 API endpoints for files upload and download. Uploaded files needs to be stored in database. By default it supports H2 database.

Validations to be performed:

  • If a file size exceeds 100KB, return status code INTERNAL_SERVER_ERROR and don't store file in database.
  • Here you are expected to use file size limit constraint using configuration instead of doing programmatically.

Required API endpoints to be exposed

POST request to /uploader :

  • this endpoint should be able to receive two parameters fileGroup and files
  • store the files into database and return status code 201 as response
  • if the user uploads same name's file with the same fileGroup again, the previous file should be replaced with the latest one and return status code 201.

GET request to /downloader:

  • accept the fileGroup as a request parameter
  • if there are more than one files under that fileGroup then it should return all the files of that group as a single zipped file like 'file_group_name.zip' with status code 200.
  • if there is only one file then return that single file like fileName without zipping with status code 200.
  • if there is no any files under that fileGroup then return 404 status code.

Your task is to complete the given project so that it passes all the test cases when running the provided unit tests. Required model class XFile for file has been already provided. You just need to implement the 2 endpoints in the controller class.

Commands

  • run:
mvn clean package; java -jar target/project_jar-1.0.jar
  • install:
mvn clean install
  • test:
mvn clean test

test-bli's People

Watchers

Mohammad Izzudin Pamungkas 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.