Skip to content

Instantly share code, notes, and snippets.

🍺
Codes for beer

Jakub Zalas jakzal

🍺
Codes for beer
Block or report user

Report or block jakzal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jakzal
jakzal / DatabaseConfig.java
Created Jul 19, 2019
Reload AWS RDS/Aurora token every x minutes in Spring Boot
View DatabaseConfig.java
package acme.config;
import com.amazonaws.auth.DefaultAWSCredentialsProviderChain;
import com.amazonaws.services.rds.auth.GetIamAuthTokenRequest;
import com.amazonaws.services.rds.auth.RdsIamAuthTokenGenerator;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@jakzal
jakzal / EnvironmentActiveProfileResolver.java
Created Jun 19, 2019
Overriding Spring Boot test configuration on the CI server
View EnvironmentActiveProfileResolver.java
package acme.test;
import org.springframework.test.context.ActiveProfilesResolver;
public class EnvironmentActiveProfileResolver implements ActiveProfilesResolver {
@Override
public String[] resolve(Class<?> aClass) {
return new String[]{System.getenv("BUILD_ID") == null ? "test" : "test,ci"};
}
}
@jakzal
jakzal / DatabaseContainerExtension.java
Last active Jun 19, 2019
Test containers with Spring Boot
View DatabaseContainerExtension.java
package acme.testcontainers;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Testcontainers;
@Testcontainers
public class DatabaseContainerExtension implements BeforeAllCallback {
private final PostgreSQLContainer postgreSQLContainer = SharedPostgreSQLContainer.getInstance();
View SearchPage.php
<?php declare(strict_types=1);
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Session;
use Zalas\PageObject\Annotation\FindBy;
use Zalas\PageObject\Annotation\MinkSession;
class SearchPage
{
/**
@jakzal
jakzal / DoublesTest.php
Last active Sep 26, 2018
Test double examples
View DoublesTest.php
<?php declare(strict_types=1);
namespace App\Tests\Doubles;
use PHPUnit\Framework\TestCase;
class Item
{
}
@jakzal
jakzal / MockerTest.php
Last active Jul 27, 2018
[Idea] Automated injection of test doubles into phpunit test cases
View MockerTest.php
<?php
declare(strict_types=1);
namespace Zalas\Injector\Tests\Service;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Zalas\Injector\PHPUnit\TestCase\ServiceContainerTestCase;
View keybase.md

Keybase proof

I hereby claim:

  • I am jakzal on github.
  • I am jakubzalas (https://keybase.io/jakubzalas) on keybase.
  • I have a public key ASDymt67mEWq_8pwxEXefRL4POa25z_680ovmggZWKTKHQo

To claim this, I am signing this object:

@jakzal
jakzal / DataSet.php
Created Jun 12, 2018
Execute your markdown specs
View DataSet.php
<?php
declare(strict_types=1);
namespace Zalas\Test\MarkdownSpec;
class DataSet implements \IteratorAggregate
{
/**
* @var array
*/
@jakzal
jakzal / war.sc
Last active May 14, 2018
War Card Game in Scala
View war.sc
sealed trait Suit
sealed case class Hearts() extends Suit {
override def toString = ""
}
sealed case class Diamonds() extends Suit {
override def toString = ""
}
sealed case class Clubs() extends Suit {
override def toString = ""
}
@jakzal
jakzal / SymfonyKernel.php
Created Mar 2, 2018
Replacement for Symfony's KernelTestCase
View SymfonyKernel.php
<?php
declare(strict_types=1);
namespace Zalas\PHPUnit\Injector\Symfony\TestCase;
use Symfony\Component\DependencyInjection\ResettableContainerInterface;
use Symfony\Component\HttpKernel\KernelInterface;
/**
* Mimics the behaviour of Symfony's KernelTestCase.
You can’t perform that action at this time.