Merge branch 'master' of https://github.com/eugenp/tutorials into task/BAEL-21545_persistencemodules
This commit is contained in:
commit
579eddd624
|
@ -31,10 +31,10 @@ public class UserServerUnitTest extends JUnitRouteTest {
|
|||
.assertStatusCode(404);
|
||||
|
||||
appRoute.run(HttpRequest.DELETE("/users/1"))
|
||||
.assertStatusCode(200);
|
||||
.assertStatusCode(405);
|
||||
|
||||
appRoute.run(HttpRequest.DELETE("/users/42"))
|
||||
.assertStatusCode(200);
|
||||
.assertStatusCode(405);
|
||||
|
||||
appRoute.run(HttpRequest.POST("/users")
|
||||
.withEntity(HttpEntities.create(ContentTypes.APPLICATION_JSON, zaphod())))
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.baeldung.poi.excel;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class ExcelCellMergerUnitTest {
|
||||
private static final String FILE_NAME = "ExcelCellFormatterTest.xlsx";
|
||||
private String fileLocation;
|
||||
|
||||
@Before
|
||||
public void setup() throws IOException, URISyntaxException {
|
||||
fileLocation = Paths.get(ClassLoader.getSystemResource(FILE_NAME).toURI()).toString();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCellIndex_whenAddMergeRegion_thenMergeRegionCreated() throws IOException {
|
||||
Workbook workbook = new XSSFWorkbook(fileLocation);
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
assertEquals(0, sheet.getNumMergedRegions());
|
||||
int firstRow = 0;
|
||||
int lastRow = 0;
|
||||
int firstCol = 0;
|
||||
int lastCol = 2;
|
||||
sheet.addMergedRegion(new CellRangeAddress(firstRow, lastRow, firstCol, lastCol));
|
||||
assertEquals(1, sheet.getNumMergedRegions());
|
||||
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenCellRefString_whenAddMergeRegion_thenMergeRegionCreated() throws IOException {
|
||||
Workbook workbook = new XSSFWorkbook(fileLocation);
|
||||
Sheet sheet = workbook.getSheetAt(0);
|
||||
|
||||
assertEquals(0, sheet.getNumMergedRegions());
|
||||
sheet.addMergedRegion(CellRangeAddress.valueOf("A1:C1"));
|
||||
assertEquals(1, sheet.getNumMergedRegions());
|
||||
|
||||
workbook.close();
|
||||
}
|
||||
|
||||
}
|
|
@ -61,7 +61,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<classifier>spring-boot</classifier>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>libs/</classpathPrefix>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
@ -94,7 +94,7 @@
|
|||
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
|
@ -118,7 +118,7 @@
|
|||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
|
@ -133,7 +133,7 @@
|
|||
<executions>
|
||||
<execution>
|
||||
<configuration>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<attachToBuild>true</attachToBuild>
|
||||
<filename>${project.build.finalName}-onejar.${project.packaging}</filename>
|
||||
</configuration>
|
||||
|
@ -155,7 +155,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<classifier>spring-boot</classifier>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.collections;
|
||||
package com.baeldung.collections;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import org.junit.Before;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.collections;
|
||||
package com.baeldung.collections;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import org.apache.commons.collections4.ListUtils;
|
|
@ -3,13 +3,13 @@
|
|||
This module contains articles about the Java List collection
|
||||
|
||||
### Relevant Articles:
|
||||
- [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality)
|
||||
- [Check If Two Lists are Equal in Java](https://www.baeldung.com/java-test-a-list-for-ordinality-and-equality)
|
||||
- [Java 8 Streams: Find Items From One List Based On Values From Another List](https://www.baeldung.com/java-streams-find-list-items)
|
||||
- [A Guide to the Java LinkedList](http://www.baeldung.com/java-linkedlist)
|
||||
- [Java List UnsupportedOperationException](http://www.baeldung.com/java-list-unsupported-operation-exception)
|
||||
- [A Guide to the Java LinkedList](https://www.baeldung.com/java-linkedlist)
|
||||
- [Java List UnsupportedOperationException](https://www.baeldung.com/java-list-unsupported-operation-exception)
|
||||
- [Java List Initialization in One Line](https://www.baeldung.com/java-init-list-one-line)
|
||||
- [Ways to Iterate Over a List in Java](https://www.baeldung.com/java-iterate-list)
|
||||
- [Flattening Nested Collections in Java](http://www.baeldung.com/java-flatten-nested-collections)
|
||||
- [Flattening Nested Collections in Java](https://www.baeldung.com/java-flatten-nested-collections)
|
||||
- [Intersection of Two Lists in Java](https://www.baeldung.com/java-lists-intersection)
|
||||
- [Searching for a String in an ArrayList](https://www.baeldung.com/java-search-string-arraylist)
|
||||
- [[<-- Prev]](/core-java-modules/core-java-collections-list)[[Next -->]](/core-java-modules/core-java-collections-list-3)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.lists;
|
||||
package com.baeldung.java.list;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.lists;
|
||||
package com.baeldung.java.list;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.lists;
|
||||
package com.baeldung.java.list;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
### Relevant Articles:
|
||||
- [Check If Two Lists are Equal in Java](http://www.baeldung.com/java-test-a-list-for-ordinality-and-equality)
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.collections;
|
||||
package com.baeldung.collections;
|
||||
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
import static org.junit.Assert.assertThat;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung;
|
||||
package com.baeldung.list.random;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.junit.Test;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.streams;
|
||||
package com.baeldung.java.stream;
|
||||
|
||||
import org.junit.Test;
|
||||
|
|
@ -4,6 +4,7 @@ import org.junit.Test;
|
|||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
@ -18,12 +19,19 @@ public class ConvertToOffsetDateTimeUnitTest {
|
|||
|
||||
@Test
|
||||
public void givenDate_whenHasOffset_thenConvertWithOffset() {
|
||||
TimeZone prevTimezone = TimeZone.getDefault();
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
|
||||
|
||||
Date date = new Date();
|
||||
date.setHours(6);
|
||||
date.setMinutes(30);
|
||||
|
||||
OffsetDateTime odt = ConvertToOffsetDateTime.convert(date, 3, 30);
|
||||
assertEquals(10, odt.getHour());
|
||||
assertEquals(0, odt.getMinute());
|
||||
|
||||
// Reset the timezone to its original value to prevent side effects
|
||||
TimeZone.setDefault(prevTimezone);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>libs/</classpathPrefix>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
@ -118,7 +118,7 @@
|
|||
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
|
@ -142,7 +142,7 @@
|
|||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
|
@ -157,7 +157,7 @@
|
|||
<executions>
|
||||
<execution>
|
||||
<configuration>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<attachToBuild>true</attachToBuild>
|
||||
<filename>${project.build.finalName}-onejar.${project.packaging}</filename>
|
||||
</configuration>
|
||||
|
@ -179,7 +179,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<classifier>spring-boot</classifier>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -24,9 +24,14 @@
|
|||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
<version>5.5.1</version>
|
||||
<version>${jupiter.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>${jupiter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.springframework.mock.jndi.SimpleNamingContextBuilder;
|
|||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class JndiExceptionsUnitTest {
|
||||
|
||||
@Disabled
|
||||
@Test
|
||||
@Order(1)
|
||||
void givenNoContext_whenLookupObject_thenThrowNoInitialContext() {
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>libs/</classpathPrefix>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
<manifest>
|
||||
<addClasspath>true</addClasspath>
|
||||
<classpathPrefix>libs/</classpathPrefix>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
@ -118,7 +118,7 @@
|
|||
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
<descriptorRefs>
|
||||
|
@ -142,7 +142,7 @@
|
|||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
|
@ -157,7 +157,7 @@
|
|||
<executions>
|
||||
<execution>
|
||||
<configuration>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<attachToBuild>true</attachToBuild>
|
||||
<filename>${project.build.finalName}-onejar.${project.packaging}</filename>
|
||||
</configuration>
|
||||
|
@ -179,7 +179,7 @@
|
|||
</goals>
|
||||
<configuration>
|
||||
<classifier>spring-boot</classifier>
|
||||
<mainClass>org.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
<mainClass>com.baeldung.executable.ExecutableMavenJar</mainClass>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package org.baeldung.executable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class ExecutableMavenJar {
|
||||
|
||||
public static void main(String[] args) {
|
||||
JOptionPane.showMessageDialog(null, "It worked!", "Executable Jar with Maven", 1);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java;
|
||||
package com.baeldung;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.arrays;
|
||||
package com.baeldung.arrays;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.rawtypes;
|
||||
package com.baeldung.rawtypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,4 +1,4 @@
|
|||
package org.baeldung.java.sandbox;
|
||||
package com.baeldung.sandbox;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
|
@ -9,14 +9,16 @@
|
|||
<name>gs-scheduling-tasks</name>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.6.RELEASE</version>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<awaitility.version>3.1.2</awaitility.version>
|
||||
<spring-boot.version>2.1.6.RELEASE</spring-boot.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
@ -45,5 +47,4 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<module>jackson-conversions-2</module>
|
||||
<module>jackson-custom-conversions</module>
|
||||
<module>jackson-exceptions</module>
|
||||
<module>jackson-simple</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -16,4 +16,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring
|
|||
|
||||
### NOTE:
|
||||
|
||||
Since this is a module tied to an e-book, it should **not** be used to store the code for any further article.
|
||||
Since this is a module tied to an e-book, it should **not** be moved or used to store the code for any further article.
|
|
@ -8,11 +8,18 @@
|
|||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>jackson-modules</artifactId>
|
||||
<artifactId>parent-java</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-java</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<!--jackson for xml -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.dataformat</groupId>
|
||||
<artifactId>jackson-dataformat-xml</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<!-- test scoped -->
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
|
@ -18,7 +18,7 @@ Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-m
|
|||
- [Key Value Store with Chronicle Map](https://www.baeldung.com/java-chronicle-map)
|
||||
- [Guide to MapDB](https://www.baeldung.com/mapdb)
|
||||
- [A Guide to Apache Mesos](https://www.baeldung.com/apache-mesos)
|
||||
- [JasperReports with Spring](https://www.baeldung.com/spring-jasper)]
|
||||
- [JasperReports with Spring](https://www.baeldung.com/spring-jasper)
|
||||
- [Jetty ReactiveStreams HTTP Client](https://www.baeldung.com/jetty-reactivestreams-http-client)
|
||||
- More articles [[<-- prev]](/libraries)
|
||||
|
||||
|
|
|
@ -58,6 +58,11 @@
|
|||
<artifactId>javase</artifactId>
|
||||
<version>${qrgen.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.rvesse</groupId>
|
||||
<artifactId>airline</artifactId>
|
||||
<version>${airline.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.cactoos</groupId>
|
||||
<artifactId>cactoos</artifactId>
|
||||
|
@ -82,5 +87,6 @@
|
|||
<qrgen.version>2.6.0</qrgen.version>
|
||||
|
||||
<cactoos.version>0.43</cactoos.version>
|
||||
<airline.version>2.7.2</airline.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package com.baeldung.airline;
|
||||
|
||||
import com.github.rvesse.airline.annotations.Cli;
|
||||
import com.github.rvesse.airline.help.Help;
|
||||
|
||||
@Cli(name = "baeldung-cli",
|
||||
description = "Baeldung Airline Tutorial",
|
||||
defaultCommand = Help.class,
|
||||
commands = { DatabaseSetupCommand.class, LoggingCommand.class, Help.class })
|
||||
public class CommandLine {
|
||||
|
||||
public static void main(String[] args) {
|
||||
com.github.rvesse.airline.Cli<Runnable> cli = new com.github.rvesse.airline.Cli<>(CommandLine.class);
|
||||
Runnable cmd = cli.parse(args);
|
||||
cmd.run();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.baeldung.airline;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.github.rvesse.airline.HelpOption;
|
||||
import com.github.rvesse.airline.annotations.Command;
|
||||
import com.github.rvesse.airline.annotations.Option;
|
||||
import com.github.rvesse.airline.annotations.OptionType;
|
||||
import com.github.rvesse.airline.annotations.restrictions.AllowedRawValues;
|
||||
import com.github.rvesse.airline.annotations.restrictions.MutuallyExclusiveWith;
|
||||
import com.github.rvesse.airline.annotations.restrictions.Pattern;
|
||||
import com.github.rvesse.airline.annotations.restrictions.RequiredOnlyIf;
|
||||
|
||||
@Command(name = "setup-db", description = "Setup our database")
|
||||
public class DatabaseSetupCommand implements Runnable {
|
||||
@Inject
|
||||
private HelpOption<DatabaseSetupCommand> help;
|
||||
|
||||
@Option(type = OptionType.COMMAND,
|
||||
name = {"-d", "--database"},
|
||||
description = "Type of RDBMS.",
|
||||
title = "RDBMS type: mysql|postgresql|mongodb")
|
||||
@AllowedRawValues(allowedValues = { "mysql", "postgres", "mongodb" })
|
||||
protected String rdbmsMode = "mysql";
|
||||
|
||||
@Option(type = OptionType.COMMAND,
|
||||
name = {"--rdbms:url", "--url"},
|
||||
description = "URL to use for connection to RDBMS.",
|
||||
title = "RDBMS URL")
|
||||
@MutuallyExclusiveWith(tag="mode")
|
||||
@Pattern(pattern="^(http://.*):(d*)(.*)u=(.*)&p=(.*)")
|
||||
protected String rdbmsUrl = "";
|
||||
|
||||
@Option(type = OptionType.COMMAND,
|
||||
name = {"--rdbms:host", "--host"},
|
||||
description = "Host to use for connection to RDBMS.",
|
||||
title = "RDBMS host")
|
||||
@MutuallyExclusiveWith(tag="mode")
|
||||
protected String rdbmsHost = "";
|
||||
|
||||
@RequiredOnlyIf(names={"--rdbms:host", "--host"})
|
||||
@Option(type = OptionType.COMMAND,
|
||||
name = {"--rdbms:user", "-u", "--user"},
|
||||
description = "User for login to RDBMS.",
|
||||
title = "RDBMS user")
|
||||
protected String rdbmsUser;
|
||||
|
||||
@RequiredOnlyIf(names={"--rdbms:host", "--host"})
|
||||
@Option(type = OptionType.COMMAND,
|
||||
name = {"--rdbms:password", "--password"},
|
||||
description = "Password for login to RDBMS.",
|
||||
title = "RDBMS password")
|
||||
protected String rdbmsPassword;
|
||||
|
||||
@Option(type = OptionType.COMMAND,
|
||||
name = {"--driver", "--jars"},
|
||||
description = "List of drivers",
|
||||
title = "--driver <PATH_TO_YOUR_JAR> --driver <PATH_TO_YOUR_JAR>")
|
||||
protected List<String> jars = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//skipping store our choices...
|
||||
if (!help.showHelpIfRequested()) {
|
||||
if(!"".equals(rdbmsHost)) {
|
||||
System.out.println("Connecting to database host: " + rdbmsHost);
|
||||
System.out.println("Credential: " + rdbmsUser + " / " + rdbmsPassword);
|
||||
} else {
|
||||
System.out.println("Connecting to database url: " + rdbmsUrl);
|
||||
}
|
||||
System.out.println(jars.toString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.baeldung.airline;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import com.github.rvesse.airline.HelpOption;
|
||||
import com.github.rvesse.airline.annotations.Command;
|
||||
import com.github.rvesse.airline.annotations.Option;
|
||||
|
||||
@Command(name = "setup-log", description = "Setup our log")
|
||||
public class LoggingCommand implements Runnable {
|
||||
|
||||
@Inject
|
||||
private HelpOption<LoggingCommand> help;
|
||||
|
||||
@Option(name = { "-v", "--verbose" }, description = "Set log verbosity on/off")
|
||||
private boolean verbose = false;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
//skipping store user choice
|
||||
if (!help.showHelpIfRequested())
|
||||
System.out.println("Verbosity: " + verbose);
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@
|
|||
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>
|
||||
<artifactId>genie</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>Genie</name>
|
||||
<packaging>jar</packaging>
|
||||
<description>Sample project for Netflix Genie</description>
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue