Merge pull request #8125 from eugenp/revert-8119-BAEL-3275-2

Revert "BAEL-3275: Using blocking queue for pub-sub"
This commit is contained in:
Eric Martin
2019-10-31 20:43:47 -05:00
committed by GitHub
parent db85c8f275
commit 3225470df5
20543 changed files with 1642750 additions and 0 deletions
@@ -0,0 +1,19 @@
package com.baeldung.serenity.github;
public class GitHubUser {
private String login;
public GitHubUser() {
super();
}
public String getLogin() {
return login;
}
public void setLogin(final String login) {
this.login = login;
}
}
@@ -0,0 +1,16 @@
package com.baeldung.serenity.membership;
/**
* @author aiet
*/
public enum Commodity {
MacBookPro(1499), GoProHero5(400);
public final int price;
Commodity(int price) {
this.price = price;
}
}
@@ -0,0 +1,38 @@
package com.baeldung.serenity.membership;
import static com.baeldung.serenity.membership.MemberGrade.Bronze;
import static com.baeldung.serenity.membership.MemberGrade.Gold;
import static com.baeldung.serenity.membership.MemberGrade.Silver;
/**
* @author aiet
*/
public class Member {
private int points;
private Member(int points) {
if (points < 0)
throw new IllegalArgumentException("points must not be negative!");
this.points = points;
}
public static Member withInitialPoints(int initialPoints) {
return new Member(initialPoints);
}
public MemberGrade getGrade() {
if (points < 1000)
return Bronze;
else if (points >= 1000 && points < 5000)
return Silver;
else
return Gold;
}
public void spend(int moneySpent) {
points += moneySpent / 10;
}
}
@@ -0,0 +1,10 @@
package com.baeldung.serenity.membership;
/**
* @author aiet
*/
public enum MemberGrade {
Bronze, Silver, Gold;
}
@@ -0,0 +1,29 @@
package com.baeldung.serenity.spring;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
* @author aiet
*/
@RequestMapping(value = "/adder", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RestController
public class AdderController {
private AdderService adderService;
public AdderController(AdderService adderService) {
this.adderService = adderService;
}
@GetMapping("/current")
public int currentNum() {
return adderService.currentBase();
}
@PostMapping
public int add(@RequestParam int num) {
return adderService.add(num);
}
}
@@ -0,0 +1,25 @@
package com.baeldung.serenity.spring;
import org.springframework.stereotype.Service;
@Service
public class AdderService {
private int num;
public void baseNum(int base) {
this.num = base;
}
public int currentBase() {
return num;
}
public int add(int adder) {
return this.num + adder;
}
public int accumulate(int adder) {
return this.num += adder;
}
}
@@ -0,0 +1,26 @@
package com.baeldung.serenity.spring;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
* @author aiet
*/
@RequestMapping(value = "/adder", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RestController
public class PlainAdderController {
private final int currentNumber = RandomUtils.nextInt();
@GetMapping("/current")
public int currentNum() {
return currentNumber;
}
@PostMapping
public int add(@RequestParam int num) {
return currentNumber + num;
}
}