Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikegleasonjr/kata-iweb-datacenter
https://github.com/mikegleasonjr/kata-iweb-datacenter
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/mikegleasonjr/kata-iweb-datacenter
- Owner: mikegleasonjr
- Created: 2012-10-25T17:43:30.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2012-11-18T17:14:00.000Z (almost 12 years ago)
- Last Synced: 2024-04-14T20:07:28.843Z (7 months ago)
- Language: Java
- Size: 445 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kata-iweb-datacenter
## Context
At [iWeb Technologies](http://iweb.com/), we send a little technical test to those applying for a job. I decided to take the challenge myself and write it in TDD to learn it and practice it.
## Technical Test Description
Write a simple application that distributes virtual machines on servers in a datacenter. The application can be written in any language.
### Specifications
- A server have space to host virtual machines (pre-defined capacity)
- When hosted on a server, a virtual machine occupy a certain amount of space (size)
- The number of virtual machines a server can host vary with the capacity of the server and the size of the virtual machines
- The virtual machines must installed on a server in the order they are received as input
- The utilization percentage of each server must be as evenly distributed as possible in the datacenter
- Servers cannot host virtual machines beyond their capacity### Example Input
As input, the application must receive some servers and some virtual machines:
```javascript
{
"servers": [{
"id": "server1",
"capacity": 4
}, {
"id": "server2",
"capacity": 6
}],
"virtualMachines": [{
"id": "VM1",
"size": 1
}, {
"id": "VM2",
"size": 4
}, {
"id": "VM3",
"size": 2
}]
}
```### Example Output
As output, the application has distributed the virtual machines on the available servers:
```javascript
{
"servers": [{
"id": "server1",
"capacity": 4,
"usePercentage": 75,
"virtualMachines": [{
"id": "VM1",
"size": 1
}, {
"id": "VM3",
"size": 2
}]
}, {
"id": "server2",
"capacity": 6,
"usePercentage": 67,
"virtualMachines": [{
"id": "VM2",
"size": 4
}]
}]
}
```## Running the program
To run the tests:
```
mvn clean test
```To run the program:
```
mvn exec:java
```