Skip to content

Instantly share code, notes, and snippets.

@beyondxscratch
beyondxscratch / install-dependency-track.sh
Last active October 8, 2018 22:52
Install Dependency-Track as a Docker Container
docker pull owasp/dependency-track
docker volume create --name dependency-track
docker run -d -p 8080:8080 –name dependency-track -v dependency-track:/data owasp/dependency-track
Given a NC-17 rated showing
When a child tries to buy a ticket for this showing
Then the purchase is forbidden
Feature: Profile endpoint
Scenario: creating a profile
Given path 'profiles'
And request
"""
{ "topics": [{"name": "DDD"},{"name": "Hexagonal Architecture"}],"talksFormats": ["QUICKIE","CONFERENCE"] }
"""
When method post
Then assert responseStatus == 201
public class StepDefs implements En {
public StepDefs() {
Given("^a cinephile$", () -> me = new Cinephile("me"));
Given("^the last showing is not started yet$",
() -> lastShowing = new Showing(now().plusHours(3)));
When("^the user asks for the next showings$",
() -> nextShowings = searchShowings.searchNextShowingsFor(me));
Given the showing:
| name | schedule | director | rating | duration |
| Gore Movie | 21H00 | Jhon Doe | NC-17 | PT2H5M |
When a child tries to buy a ticket for this showing
Then the purchase is forbidden
jdbcTemplate
.queryForObject(
"Select * from users where username='" + name + "' and password='" + password + "'",
BeanPropertyRowMapper.newInstance(DBUser.class));
Select * from users where username='' OR '1'='1' LIMIT 1 --' and password=''
@beyondxscratch
beyondxscratch / BoilerplateConfiguration.java
Last active July 27, 2019 22:03
Example of a boilerplate bean factory
@Configuration
public class DomainConfiguration {
@Bean
public RetrieveSanitaryGrades retrieveSanitaryGrades() {
return new RetrieveSanitaryGrades();
}
@Bean
public SearchRestaurants restaurantsFinder(Restaurants restaurants,
import java.lang.annotation.Inherited
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
@Inherited
annotation class DomainService
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
@Inherited
/**
* <p>
* A DDD aggregate is a cluster of domain objects that is treated as a
* single unit to ensure consistency across them.
* </p>
*
* @see <a href= "https://martinfowler.com/bliki/DDD_Aggregate.html">
* Aggregates in Domain Driven Design
* </a>
*/