Skip to content

Commit

Permalink
Fiddle with fiddly bits, release 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
booniepepper committed Oct 22, 2021
1 parent 4fca377 commit 5eaceb7
Show file tree
Hide file tree
Showing 2 changed files with 152 additions and 131 deletions.
275 changes: 148 additions & 127 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,141 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>

<groupId>so.dang.cool</groupId>
<artifactId>singleton</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<groupId>so.dang.cool</groupId>
<artifactId>singleton</artifactId>
<version>1</version>
<packaging>jar</packaging>

<name>singleton</name>
<description>A simple singleton interface.</description>
<url>https://github.com/hiljusti/singleton</url>
<name>singleton</name>
<description>A simple singleton interface.</description>
<url>https://github.com/hiljusti/singleton</url>

<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/hiljusti/singleton/blob/HEAD/LICENSE</url>
<distribution>https://github.com/hiljusti/singleton</distribution>
</license>
</licenses>
<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/hiljusti/singleton/blob/HEAD/LICENSE</url>
<distribution>https://github.com/hiljusti/singleton</distribution>
</license>
</licenses>

<developers>
<developer>
<name>J.R. Hill</name>
<email>[email protected]</email>
<url>https://so.dang.cool</url>
</developer>
</developers>
<developers>
<developer>
<name>J.R. Hill</name>
<email>[email protected]</email>
<url>https://so.dang.cool</url>
</developer>
</developers>

<scm>
<connection>scm:git:git://github.com/hiljusti/singleton.git</connection>
<developerConnection>scm:git:[email protected]:hiljusti/singleton.git</developerConnection>
<url>https://github.com/hiljusti/singleton/tree/core</url>
<tag>v1.0.0</tag>
</scm>
<scm>
<connection>scm:git:git://github.com/hiljusti/singleton.git</connection>
<developerConnection>scm:git:[email protected]:hiljusti/singleton.git</developerConnection>
<url>https://github.com/hiljusti/singleton/tree/core</url>
<tag>v1</tag>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<!-- https://central.sonatype.org/publish/publish-maven/ -->
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<!-- https://central.sonatype.org/publish/publish-maven/ -->
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<build>
<plugins>
<!-- QUALITY OF LIFE-->
<!-- Provides: mvn buildplan:list -->
<plugin>
<groupId>fr.jcgay.maven.plugins</groupId>
<artifactId>buildplan-maven-plugin</artifactId>
<version>1.5</version>
</plugin>

<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
<!-- PACKAGE & PUBLISH -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<keyname>${gpg.keyname}</keyname>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

<!-- TESTING AND QUALITY -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.2</version>
</plugin>
</plugins>
</build>

<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>
8 changes: 4 additions & 4 deletions src/test/java/so/dang/cool/singleton/SingletonClassTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public void stateObjExample() {

Supplier<String> slowNameSupplier = () -> {
try {
long tenSeconds = 10 * 1000;
Thread.sleep(tenSeconds);
long twoSeconds = 2 * 1000;
Thread.sleep(twoSeconds);
} catch (InterruptedException e) {
// Hijinks occurred, but not important to the test.
e.printStackTrace();
Expand All @@ -94,14 +94,14 @@ public void stateObjExample() {
// A "warm-up" get.
Instant beforeSlowGet = Instant.now();
assertEquals(name, jackie.getName());
assertSlowerThan(Duration.ofSeconds(10), beforeSlowGet, Instant.now());
assertSlowerThan(Duration.ofSeconds(2), beforeSlowGet, Instant.now());

// "Warmed-up" gets
Instant beforeFastGet = Instant.now();
assertEquals(name, jackie.getName());
assertEquals(number, jackie.getNumber());
assertTrue(jackie.isCool());
assertFasterThan(Duration.ofSeconds(1), beforeFastGet, Instant.now());
assertFasterThan(Duration.ofMillis(50), beforeFastGet, Instant.now());
}

private void assertSlowerThan(Duration expected, Instant start, Instant end) {
Expand Down

0 comments on commit 5eaceb7

Please sign in to comment.