diff --git a/algorithms/README.md b/algorithms/README.md index f1e12ee243..dc12b528da 100644 --- a/algorithms/README.md +++ b/algorithms/README.md @@ -6,3 +6,5 @@ - [Validating Input With Finite Automata in Java](http://www.baeldung.com/finite-automata-java) - [Introduction to Jenetics Library](http://www.baeldung.com/jenetics) - [Check If a Number Is Prime in Java](http://www.baeldung.com/java-prime-numbers) +- [Example of Hill Climbing Algorithm](http://www.baeldung.com/java-hill-climbing-algorithm) +- [Monte Carlo Tree Search for Tic-Tac-Toe Game](http://www.baeldung.com/java-monte-carlo-tree-search) diff --git a/algorithms/src/main/java/com/baeldung/algorithms/minimax/MiniMax.java b/algorithms/src/main/java/com/baeldung/algorithms/minimax/MiniMax.java index ce2ba03af5..fed4ebed48 100644 --- a/algorithms/src/main/java/com/baeldung/algorithms/minimax/MiniMax.java +++ b/algorithms/src/main/java/com/baeldung/algorithms/minimax/MiniMax.java @@ -18,12 +18,12 @@ public class MiniMax { constructTree(root); } - private void constructTree(Node node) { - List listofPossibleHeaps = GameOfBones.getPossibleStates(node.getNoOfBones()); - boolean isMaxPlayer = !node.isMaxPlayer(); + private void constructTree(Node parentNode) { + List listofPossibleHeaps = GameOfBones.getPossibleStates(parentNode.getNoOfBones()); + boolean isChildMaxPlayer = !parentNode.isMaxPlayer(); listofPossibleHeaps.forEach(n -> { - Node newNode = new Node(n, isMaxPlayer); - node.addChild(newNode); + Node newNode = new Node(n, isChildMaxPlayer); + parentNode.addChild(newNode); if (newNode.getNoOfBones() > 0) { constructTree(newNode); } diff --git a/asciidoctor/pom.xml b/asciidoctor/pom.xml index 989f6e5354..a602cd11b9 100644 --- a/asciidoctor/pom.xml +++ b/asciidoctor/pom.xml @@ -35,7 +35,12 @@ src/docs/asciidoc target/docs/asciidoc + + ${project.basedir}/src/themes + custom + pdf + book diff --git a/asciidoctor/src/docs/asciidoc/test.adoc b/asciidoctor/src/docs/asciidoc/test.adoc index 5a86a00440..fec1f73584 100644 --- a/asciidoctor/src/docs/asciidoc/test.adoc +++ b/asciidoctor/src/docs/asciidoc/test.adoc @@ -1,3 +1,13 @@ -== Introduction Section +:icons: font -Hi. I'm a simple test to see if this Maven build is working. If you see me in a nice PDF, then it means everything is [red]#working#. \ No newline at end of file + += Generating book with AsciiDoctorj +Baeldung + +[abstract] +This is the actual content. + +== First Section + +This is first section of the book where you can include some nice icons like icon:comment[]. +You can also create http://www.baeldung.com[links] diff --git a/asciidoctor/src/themes/custom-theme.yml b/asciidoctor/src/themes/custom-theme.yml new file mode 100644 index 0000000000..a3c8c00510 --- /dev/null +++ b/asciidoctor/src/themes/custom-theme.yml @@ -0,0 +1,29 @@ +title_page: + align: left + +page: + layout: portrait + margin: [0.75in, 1in, 0.75in, 1in] + size: A4 +base: + font_color: #333333 + line_height_length: 17 + line_height: $base_line_height_length / $base_font_size +link: + font_color: #009900 + +header: + height: 0.5in + line_height: 1 + recto_content: + center: '{document-title}' + verso_content: + center: '{document-title}' + +footer: + height: 0.5in + line_height: 1 + recto_content: + right: '{chapter-title} | *{page-number}*' + verso_content: + left: '*{page-number}* | {chapter-title}' \ No newline at end of file diff --git a/aws/pom.xml b/aws/pom.xml index 8d60240c87..c66c420fae 100644 --- a/aws/pom.xml +++ b/aws/pom.xml @@ -18,9 +18,41 @@ 1.3.0 1.1.0 2.8.0 + 1.11.154 + 4.12 + 2.8.9 + 3.8.0 + + + com.amazonaws + aws-java-sdk + ${aws-java-sdk.version} + + + + junit + junit + ${junit.version} + test + + + + org.mockito + mockito-core + ${mockito-core.version} + test + + + + org.assertj + assertj-core + ${assertj-core.version} + test + + com.amazonaws aws-lambda-java-core diff --git a/aws/src/main/java/com/baeldung/s3/AWSS3Service.java b/aws/src/main/java/com/baeldung/s3/AWSS3Service.java new file mode 100644 index 0000000000..792e41a188 --- /dev/null +++ b/aws/src/main/java/com/baeldung/s3/AWSS3Service.java @@ -0,0 +1,87 @@ +package com.baeldung.s3; + +import java.io.File; +import java.util.List; + +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3Client; +import com.amazonaws.services.s3.model.Bucket; +import com.amazonaws.services.s3.model.CopyObjectResult; +import com.amazonaws.services.s3.model.DeleteObjectsRequest; +import com.amazonaws.services.s3.model.DeleteObjectsResult; +import com.amazonaws.services.s3.model.ObjectListing; +import com.amazonaws.services.s3.model.PutObjectResult; +import com.amazonaws.services.s3.model.S3Object; + +public class AWSS3Service { + private final AmazonS3 s3client; + + public AWSS3Service() { + this(new AmazonS3Client() { + }); + } + + public AWSS3Service(AmazonS3 s3client) { + this.s3client = s3client; + } + + //is bucket exist? + public boolean doesBucketExist(String bucketName) { + return s3client.doesBucketExist(bucketName); + } + + //create a bucket + public Bucket createBucket(String bucketName) { + return s3client.createBucket(bucketName); + } + + //list all buckets + public List listBuckets() { + return s3client.listBuckets(); + } + + //delete a bucket + public void deleteBucket(String bucketName) { + s3client.deleteBucket(bucketName); + } + + //uploading object + public PutObjectResult putObject(String bucketName, String key, File file) { + return s3client.putObject(bucketName, key, file); + } + + //listing objects + public ObjectListing listObjects(String bucketName) { + return s3client.listObjects(bucketName); + } + + //get an object + public S3Object getObject(String bucketName, String objectKey) { + return s3client.getObject(bucketName, objectKey); + } + + //copying an object + public CopyObjectResult copyObject( + String sourceBucketName, + String sourceKey, + String destinationBucketName, + String destinationKey + ) { + return s3client.copyObject( + sourceBucketName, + sourceKey, + destinationBucketName, + destinationKey + ); + } + + //deleting an object + public void deleteObject(String bucketName, String objectKey) { + s3client.deleteObject(bucketName, objectKey); + } + + //deleting multiple Objects + public DeleteObjectsResult deleteObjects(DeleteObjectsRequest delObjReq) { + return s3client.deleteObjects(delObjReq); + } +} diff --git a/aws/src/main/java/com/baeldung/s3/S3Application.java b/aws/src/main/java/com/baeldung/s3/S3Application.java new file mode 100644 index 0000000000..fdfb909f73 --- /dev/null +++ b/aws/src/main/java/com/baeldung/s3/S3Application.java @@ -0,0 +1,101 @@ +package com.baeldung.s3; + +import java.io.File; +import java.io.IOException; + +import org.apache.commons.io.FileUtils; + +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.regions.Regions; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import com.amazonaws.services.s3.model.Bucket; +import com.amazonaws.services.s3.model.DeleteObjectsRequest; +import com.amazonaws.services.s3.model.ObjectListing; +import com.amazonaws.services.s3.model.S3Object; +import com.amazonaws.services.s3.model.S3ObjectInputStream; +import com.amazonaws.services.s3.model.S3ObjectSummary; + +public class S3Application { + + private static final AWSCredentials credentials; + private static String bucketName; + + static { + //put your accesskey and secretkey here + credentials = new BasicAWSCredentials( + "", + "" + ); + } + + public static void main(String[] args) throws IOException { + //set-up the client + AmazonS3 s3client = AmazonS3ClientBuilder + .standard() + .withCredentials(new AWSStaticCredentialsProvider(credentials)) + .withRegion(Regions.US_EAST_2) + .build(); + + AWSS3Service awsService = new AWSS3Service(s3client); + + bucketName = "baeldung-bucket"; + + //creating a bucket + if(awsService.doesBucketExist(bucketName)) { + System.out.println("Bucket name is not available." + + " Try again with a different Bucket name."); + return; + } + awsService.createBucket(bucketName); + + //list all the buckets + for(Bucket s : awsService.listBuckets() ) { + System.out.println(s.getName()); + } + + //deleting bucket + awsService.deleteBucket("baeldung-bucket-test2"); + + //uploading object + awsService.putObject( + bucketName, + "Document/hello.txt", + new File("/Users/user/Document/hello.txt") + ); + + //listing objects + ObjectListing objectListing = awsService.listObjects(bucketName); + for(S3ObjectSummary os : objectListing.getObjectSummaries()) { + System.out.println(os.getKey()); + } + + //downloading an object + S3Object s3object = awsService.getObject(bucketName, "Document/hello.txt"); + S3ObjectInputStream inputStream = s3object.getObjectContent(); + FileUtils.copyInputStreamToFile(inputStream, new File("/Users/user/Desktop/hello.txt")); + + //copying an object + awsService.copyObject( + "baeldung-bucket", + "picture/pic.png", + "baeldung-bucket2", + "Document/picture.png" + ); + + //deleting an object + awsService.deleteObject(bucketName, "Document/hello.txt"); + + //deleting multiple objects + String objkeyArr[] = { + "Document/hello2.txt", + "Document/picture.png" + }; + + DeleteObjectsRequest delObjReq = new DeleteObjectsRequest("baeldung-bucket") + .withKeys(objkeyArr); + awsService.deleteObjects(delObjReq); + } +} diff --git a/aws/src/test/java/com/baeldung/s3/AWSS3ServiceIntegrationTest.java b/aws/src/test/java/com/baeldung/s3/AWSS3ServiceIntegrationTest.java new file mode 100644 index 0000000000..d386704513 --- /dev/null +++ b/aws/src/test/java/com/baeldung/s3/AWSS3ServiceIntegrationTest.java @@ -0,0 +1,113 @@ +package com.baeldung.s3; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.File; + +import org.junit.Before; +import org.junit.Test; + +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.model.CopyObjectResult; +import com.amazonaws.services.s3.model.DeleteObjectsRequest; +import com.amazonaws.services.s3.model.DeleteObjectsResult; +import com.amazonaws.services.s3.model.PutObjectResult; + +public class AWSS3ServiceIntegrationTest { + + private static final String BUCKET_NAME = "bucket_name"; + private static final String KEY_NAME = "key_name"; + private static final String BUCKET_NAME2 = "bucket_name2"; + private static final String KEY_NAME2 = "key_name2"; + + private AmazonS3 s3; + private AWSS3Service service; + + @Before + public void setUp() { + s3 = mock(AmazonS3.class); + service = new AWSS3Service(s3); + } + + @Test + public void whenInitializingAWSS3Service_thenNotNull() { + assertThat(new AWSS3Service()).isNotNull(); + } + + @Test + public void whenVerifyingIfS3BucketExist_thenCorrect() { + service.doesBucketExist(BUCKET_NAME); + verify(s3).doesBucketExist(BUCKET_NAME); + } + + @Test + public void whenVerifyingCreationOfS3Bucket_thenCorrect() { + service.createBucket(BUCKET_NAME); + verify(s3).createBucket(BUCKET_NAME); + } + + @Test + public void whenVerifyingListBuckets_thenCorrect() { + service.listBuckets(); + verify(s3).listBuckets(); + } + + @Test + public void whenDeletingBucket_thenCorrect() { + service.deleteBucket(BUCKET_NAME); + verify(s3).deleteBucket(BUCKET_NAME); + } + + @Test + public void whenVerifyingPutObject_thenCorrect() { + File file = mock(File.class); + PutObjectResult result = mock(PutObjectResult.class); + when(s3.putObject(anyString(), anyString(), (File) any())).thenReturn(result); + + assertThat(service.putObject(BUCKET_NAME, KEY_NAME, file)).isEqualTo(result); + verify(s3).putObject(BUCKET_NAME, KEY_NAME, file); + } + + @Test + public void whenVerifyingListObjects_thenCorrect() { + service.listObjects(BUCKET_NAME); + verify(s3).listObjects(BUCKET_NAME); + } + + @Test + public void whenVerifyingGetObject_thenCorrect() { + service.getObject(BUCKET_NAME, KEY_NAME); + verify(s3).getObject(BUCKET_NAME, KEY_NAME); + } + + @Test + public void whenVerifyingCopyObject_thenCorrect() { + CopyObjectResult result = mock(CopyObjectResult.class); + when(s3.copyObject(anyString(), anyString(), anyString(), anyString())).thenReturn(result); + + assertThat(service.copyObject(BUCKET_NAME, KEY_NAME, BUCKET_NAME2, KEY_NAME2)).isEqualTo(result); + verify(s3).copyObject(BUCKET_NAME, KEY_NAME, BUCKET_NAME2, KEY_NAME2); + } + + @Test + public void whenVerifyingDeleteObject_thenCorrect() { + service.deleteObject(BUCKET_NAME, KEY_NAME); + verify(s3).deleteObject(BUCKET_NAME, KEY_NAME); + } + + @Test + public void whenVerifyingDeleteObjects_thenCorrect() { + DeleteObjectsRequest request = mock(DeleteObjectsRequest.class); + DeleteObjectsResult result = mock(DeleteObjectsResult.class); + when(s3.deleteObjects((DeleteObjectsRequest)any())).thenReturn(result); + + assertThat(service.deleteObjects(request)).isEqualTo(result); + verify(s3).deleteObjects(request); + } + +} diff --git a/camel-api/src/main/java/com/baeldung/camel/Application.java b/camel-api/src/main/java/com/baeldung/camel/Application.java index f805385ff9..aadd37a3b4 100644 --- a/camel-api/src/main/java/com/baeldung/camel/Application.java +++ b/camel-api/src/main/java/com/baeldung/camel/Application.java @@ -13,14 +13,13 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.web.servlet.ServletRegistrationBean; -import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.stereotype.Component; @SpringBootApplication @ComponentScan(basePackages="com.baeldung.camel") -public class Application extends SpringBootServletInitializer { +public class Application{ @Value("${server.port}") String serverPort; @@ -62,10 +61,12 @@ public class Application extends SpringBootServletInitializer { .bindingMode(RestBindingMode.json) .dataFormatProperty("prettyPrint", "true"); /** -The Rest DSL supports automatic binding json/xml contents to/from POJOs using Camels Data Format. -By default the binding mode is off, meaning there is no automatic binding happening for incoming and outgoing messages. -You may want to use binding if you develop POJOs that maps to your REST services request and response types. -This allows you, as a developer, to work with the POJOs in Java code. +The Rest DSL supports automatic binding json/xml contents to/from +POJOs using Camels Data Format. +By default the binding mode is off, meaning there is no automatic +binding happening for incoming and outgoing messages. +You may want to use binding if you develop POJOs that maps to +your REST services request and response types. */ rest("/api/").description("Teste REST Service") diff --git a/core-java-9/README.md b/core-java-9/README.md index 3e82ffe14b..22d6903f06 100644 --- a/core-java-9/README.md +++ b/core-java-9/README.md @@ -13,3 +13,6 @@ - [Java 9 Process API Improvements](http://www.baeldung.com/java-9-process-api) - [Introduction to Java 9 StackWalking API](http://www.baeldung.com/java-9-stackwalking-api) - [Introduction to Project Jigsaw](http://www.baeldung.com/project-jigsaw-java-modularity) +- [Java 9 Optional API Additions](http://www.baeldung.com/java-9-optional) +- [Java 9 Reactive Streams](http://www.baeldung.com/java-9-reactive-streams) +- [How to Get All Dates Between Two Dates?](http://www.baeldung.com/java-between-dates) diff --git a/core-java/README.md b/core-java/README.md index 559507e472..dabf6f39be 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -113,6 +113,16 @@ - [Difference Between Wait and Sleep in Java](http://www.baeldung.com/java-wait-and-sleep) - [LongAdder and LongAccumulator in Java](http://www.baeldung.com/java-longadder-and-longaccumulator) - [Using Java MappedByteBuffer](http://www.baeldung.com/java-mapped-byte-buffer) +- [The Dining Philosophers Problem in Java](http://www.baeldung.com/java-dining-philoshophers) +- [The Difference Between map() and flatMap()](http://www.baeldung.com/java-difference-map-and-flatmap) +- [How to Round a Number to N Decimal Places in Java](http://www.baeldung.com/java-round-decimal-number) +- [Changing Annotation Parameters At Runtime](http://www.baeldung.com/java-reflection-change-annotation-params) +- [How to Find all Getters Returning Null](http://www.baeldung.com/java-getters-returning-null) +- [Converting String to Stream of chars](http://www.baeldung.com/java-string-to-stream) +- [Changing the Order in a Sum Operation Can Produce Different Results?](http://www.baeldung.com/java-floating-point-sum-order) +- [How to Get a Name of a Method Being Executed?](http://www.baeldung.com/java-name-of-executing-method) +- [Iterate over a Map in Java](http://www.baeldung.com/java-iterate-map) +- [CyclicBarrier in Java](http://www.baeldung.com/java-cyclic-barrier) - [Dynamic Proxies in Java](http://www.baeldung.com/java-dynamic-proxies) - [How to Copy an Array in Java](http://www.baeldung.com/java-array-copy) - [Introduction to JDBC](http://www.baeldung.com/java-jdbc) diff --git a/core-java/hashcode/pom.xml b/core-java/hashcode/pom.xml new file mode 100644 index 0000000000..393aa69153 --- /dev/null +++ b/core-java/hashcode/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + com.baeldung.hashcode + hashcode + 1.0 + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + + + + junit + junit + 4.12 + test + + + org.slf4j + slf4j-api + 1.7.25 + + + org.slf4j + slf4j-simple + 1.7.25 + + + \ No newline at end of file diff --git a/core-java/hashcode/src/main/java/com/baeldung/application/Application.java b/core-java/hashcode/src/main/java/com/baeldung/application/Application.java new file mode 100644 index 0000000000..08c670c82f --- /dev/null +++ b/core-java/hashcode/src/main/java/com/baeldung/application/Application.java @@ -0,0 +1,23 @@ +package com.baeldung.application; + +import com.baeldung.entities.User; +import java.util.HashMap; +import java.util.Map; + +public class Application { + + public static void main(String[] args) { + Map users = new HashMap<>(); + User user1 = new User(1L, "John", "john@domain.com"); + User user2 = new User(2L, "Jennifer", "jennifer@domain.com"); + User user3 = new User(3L, "Mary", "mary@domain.com"); + + users.put(user1, user1); + users.put(user2, user2); + users.put(user3, user3); + + if (users.containsKey(user1)) { + System.out.print("User found in the collection"); + } + } +} diff --git a/core-java/hashcode/src/main/java/com/baeldung/entities/User.java b/core-java/hashcode/src/main/java/com/baeldung/entities/User.java new file mode 100644 index 0000000000..a976233562 --- /dev/null +++ b/core-java/hashcode/src/main/java/com/baeldung/entities/User.java @@ -0,0 +1,38 @@ +package com.baeldung.entities; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class User { + + private final Logger logger = LoggerFactory.getLogger(User.class); + private long id; + private String name; + private String email; + + public User(long id, String name, String email) { + this.id = id; + this.name = name; + this.email = email; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null) return false; + if (this.getClass() != o.getClass()) return false; + User user = (User) o; + return id != user.id && (!name.equals(user.name) && !email.equals(user.email)); + } + + @Override + public int hashCode() { + int hash = 7; + hash = 31 * hash + (int) id; + hash = 31 * hash + (name == null ? 0 : name.hashCode()); + hash = 31 * hash + (email == null ? 0 : email.hashCode()); + logger.info("hashCode() method called - Computed hash: " + hash); + return hash; + } + // getters and setters here +} diff --git a/core-java/hashcode/src/test/java/com/baeldung/application/ApplicationTest.java b/core-java/hashcode/src/test/java/com/baeldung/application/ApplicationTest.java new file mode 100644 index 0000000000..dcd853f451 --- /dev/null +++ b/core-java/hashcode/src/test/java/com/baeldung/application/ApplicationTest.java @@ -0,0 +1,30 @@ +package com.baeldung.application; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import static org.junit.Assert.assertEquals; + +public class ApplicationTest { + + private ByteArrayOutputStream outContent; + + @Before + public void setUpPrintStreamInstance() throws Exception { + this.outContent = new ByteArrayOutputStream(); + System.setOut(new PrintStream(outContent)); + } + + @After + public void tearDownByteArrayOutputStream() throws Exception { + outContent = null; + } + + @Test + public void main_NoInputState_TextPrintedToConsole() throws Exception { + Application.main(new String[]{}); + assertEquals("User found in the collection", outContent.toString()); + } +} \ No newline at end of file diff --git a/core-java/hashcode/src/test/java/com/baeldung/entities/UserTest.java b/core-java/hashcode/src/test/java/com/baeldung/entities/UserTest.java new file mode 100644 index 0000000000..01f6085d7e --- /dev/null +++ b/core-java/hashcode/src/test/java/com/baeldung/entities/UserTest.java @@ -0,0 +1,34 @@ +package com.baeldung.entities; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class UserTest { + + private User user; + private User comparisonUser; + + @Before + public void setUpUserInstances() { + this.user = new User(1L, "test", "test@domain.com"); + this.comparisonUser = this.user; + } + + @After + public void tearDownUserInstances() { + user = null; + comparisonUser = null; + } + + @Test + public void equals_EqualUserInstance_TrueAssertion(){ + Assert.assertTrue(user.equals(comparisonUser)); + } + + @Test + public void hashCode_UserHash_TrueAssertion() { + Assert.assertEquals(1792276941, user.hashCode()); + } +} \ No newline at end of file diff --git a/core-java/pom.xml b/core-java/pom.xml index ee0d6b4b4a..78338fc439 100644 --- a/core-java/pom.xml +++ b/core-java/pom.xml @@ -382,7 +382,7 @@ - + 2.8.5 @@ -408,7 +408,7 @@ 1.3 4.12 - 1.10.19 + 2.8.9 3.6.1 1.7.0 diff --git a/core-java/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java b/core-java/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java new file mode 100644 index 0000000000..b77019eea5 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/Scheduledexecutorservice/ScheduledExecutorServiceDemo.java @@ -0,0 +1,34 @@ +package com.baeldung.concurrent.Scheduledexecutorservice; + +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +public class ScheduledExecutorServiceDemo { + + public void execute() { + ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor(); + + ScheduledFuture scheduledFuture = executorService.schedule(() -> { + // Task + }, 1, TimeUnit.SECONDS); + + executorService.scheduleAtFixedRate(() -> { + // Task + }, 1, 10, TimeUnit.SECONDS); + + executorService.scheduleWithFixedDelay(() -> { + // Task + }, 1, 10, TimeUnit.SECONDS); + + Future future = executorService.schedule(() -> { + // Task + return "Hellow world"; + }, 1, TimeUnit.SECONDS); + + executorService.shutdown(); + } + +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java b/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java new file mode 100644 index 0000000000..38633011bf --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithLock.java @@ -0,0 +1,13 @@ +package com.baeldung.concurrent.atomic; + +public class SafeCounterWithLock { + private volatile int counter; + + public int getValue() { + return counter; + } + + public synchronized void increment() { + counter++; + } +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java b/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java new file mode 100644 index 0000000000..41e10789a6 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/atomic/SafeCounterWithoutLock.java @@ -0,0 +1,21 @@ +package com.baeldung.concurrent.atomic; + +import java.util.concurrent.atomic.AtomicInteger; + +public class SafeCounterWithoutLock { + private final AtomicInteger counter = new AtomicInteger(0); + + public int getValue() { + return counter.get(); + } + + public void increment() { + while(true) { + int existingValue = getValue(); + int newValue = existingValue + 1; + if(counter.compareAndSet(existingValue, newValue)) { + return; + } + } + } +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java b/core-java/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java new file mode 100644 index 0000000000..8a72788842 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/atomic/UnsafeCounter.java @@ -0,0 +1,13 @@ +package com.baeldung.concurrent.atomic; + +public class UnsafeCounter { + int counter; + + public int getValue() { + return counter; + } + + public void increment() { + counter++; + } +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java b/core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java new file mode 100644 index 0000000000..a9b92d9f4a --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/CyclicBarrierExample.java @@ -0,0 +1,24 @@ +package com.baeldung.concurrent.cyclicbarrier; + +import java.util.concurrent.CyclicBarrier; + +public class CyclicBarrierExample { + + public void start() { + CyclicBarrier cyclicBarrier = new CyclicBarrier(3, () -> { + // Task + System.out.println("All previous tasks are completed"); + }); + + Thread t1 = new Thread(new Task(cyclicBarrier), "T1"); + Thread t2 = new Thread(new Task(cyclicBarrier), "T2"); + Thread t3 = new Thread(new Task(cyclicBarrier), "T3"); + + if (!cyclicBarrier.isBroken()) { + t1.start(); + t2.start(); + t3.start(); + } + } +} + diff --git a/core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java b/core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java new file mode 100644 index 0000000000..cc9ed105dc --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/cyclicbarrier/Task.java @@ -0,0 +1,24 @@ +package com.baeldung.concurrent.cyclicbarrier; + +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CyclicBarrier; + +public class Task implements Runnable { + + private CyclicBarrier barrier; + + public Task(CyclicBarrier barrier) { + this.barrier = barrier; + } + + @Override + public void run() { + try { + System.out.println("Thread : " + Thread.currentThread().getName() + " is waiting"); + barrier.await(); + System.out.println("Thread : " + Thread.currentThread().getName() + " is released"); + } catch (InterruptedException | BrokenBarrierException e) { + e.printStackTrace(); + } + } +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java b/core-java/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java new file mode 100644 index 0000000000..84998cb489 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/executor/ExecutorDemo.java @@ -0,0 +1,14 @@ +package com.baeldung.concurrent.executor; + +import java.util.concurrent.Executor; + +public class ExecutorDemo { + + public void execute() { + Executor executor = new Invoker(); + executor.execute(()->{ + // task to be performed + }); + } + +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/executor/Invoker.java b/core-java/src/main/java/com/baeldung/concurrent/executor/Invoker.java new file mode 100644 index 0000000000..d9f11986d6 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/executor/Invoker.java @@ -0,0 +1,12 @@ +package com.baeldung.concurrent.executor; + +import java.util.concurrent.Executor; + +public class Invoker implements Executor { + + @Override + public void execute(Runnable r) { + r.run(); + } + +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java b/core-java/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java new file mode 100644 index 0000000000..ae2b279d9a --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/executorservice/ExecutorServiceDemo.java @@ -0,0 +1,27 @@ +package com.baeldung.concurrent.executorservice; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class ExecutorServiceDemo { + + ExecutorService executor = Executors.newFixedThreadPool(10); + + public void execute() { + + executor.submit(() -> { + new Task(); + }); + + executor.shutdown(); + executor.shutdownNow(); + try { + executor.awaitTermination(20l, TimeUnit.NANOSECONDS); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + } + +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/executorservice/Task.java b/core-java/src/main/java/com/baeldung/concurrent/executorservice/Task.java new file mode 100644 index 0000000000..9a21bca80c --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/executorservice/Task.java @@ -0,0 +1,10 @@ +package com.baeldung.concurrent.executorservice; + +public class Task implements Runnable { + + @Override + public void run() { + // task details + } + +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/future/FutureDemo.java b/core-java/src/main/java/com/baeldung/concurrent/future/FutureDemo.java new file mode 100644 index 0000000000..7cb611be0f --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/future/FutureDemo.java @@ -0,0 +1,44 @@ +package com.baeldung.concurrent.future; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class FutureDemo { + + public String invoke() { + + String str = null; + + ExecutorService executorService = Executors.newFixedThreadPool(10); + + Future future = executorService.submit(() -> { + // Task + Thread.sleep(10000l); + return "Hellow world"; + }); + + future.cancel(false); + + try { + future.get(20, TimeUnit.SECONDS); + } catch (InterruptedException | ExecutionException | TimeoutException e1) { + e1.printStackTrace(); + } + + if (future.isDone() && !future.isCancelled()) { + try { + str = future.get(); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + } + + return str; + + } + +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java b/core-java/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java new file mode 100644 index 0000000000..3a1d8555d3 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/semaphore/SemaPhoreDemo.java @@ -0,0 +1,22 @@ +package com.baeldung.concurrent.semaphore; + +import java.util.concurrent.Semaphore; + +public class SemaPhoreDemo { + + static Semaphore semaphore = new Semaphore(10); + + public void execute() throws InterruptedException { + + System.out.println("Available permit : " + semaphore.availablePermits()); + System.out.println("Number of threads waiting to acquire: " + semaphore.getQueueLength()); + + if (semaphore.tryAcquire()) { + semaphore.acquire(); + // perform some critical operations + semaphore.release(); + } + + } + +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java b/core-java/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java new file mode 100644 index 0000000000..8744027e40 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/threadfactory/BaeldungThreadFactory.java @@ -0,0 +1,23 @@ +package com.baeldung.concurrent.threadfactory; + +import java.util.concurrent.ThreadFactory; + +public class BaeldungThreadFactory implements ThreadFactory { + + private int threadId; + private String name; + + public BaeldungThreadFactory(String name) { + threadId = 1; + this.name = name; + } + + @Override + public Thread newThread(Runnable r) { + Thread t = new Thread(r, name + "-Thread_" + threadId); + System.out.println("created new thread with id : " + threadId + " and name : " + t.getName()); + threadId++; + return t; + } + +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java b/core-java/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java new file mode 100644 index 0000000000..d2af97b761 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/threadfactory/Demo.java @@ -0,0 +1,13 @@ +package com.baeldung.concurrent.threadfactory; + +public class Demo { + + public void execute() { + BaeldungThreadFactory factory = new BaeldungThreadFactory("BaeldungThreadFactory"); + for (int i = 0; i < 10; i++) { + Thread t = factory.newThread(new Task()); + t.start(); + } + } + +} diff --git a/core-java/src/main/java/com/baeldung/concurrent/threadfactory/Task.java b/core-java/src/main/java/com/baeldung/concurrent/threadfactory/Task.java new file mode 100644 index 0000000000..04ba62d457 --- /dev/null +++ b/core-java/src/main/java/com/baeldung/concurrent/threadfactory/Task.java @@ -0,0 +1,10 @@ +package com.baeldung.concurrent.threadfactory; + +public class Task implements Runnable { + + @Override + public void run() { + // task details + } + +} diff --git a/core-java/src/main/java/com/baeldung/deserialization/AppleProduct.java b/core-java/src/main/java/com/baeldung/deserialization/AppleProduct.java index d672b9a4f5..a10499b362 100644 --- a/core-java/src/main/java/com/baeldung/deserialization/AppleProduct.java +++ b/core-java/src/main/java/com/baeldung/deserialization/AppleProduct.java @@ -4,12 +4,12 @@ import java.io.Serializable; public class AppleProduct implements Serializable { - private static final long serialVersionUID = 1234567L; // user-defined (i.e. not default or generated) -// private static final long serialVersionUID = 7654321L; // user-defined (i.e. not default or generated) + private static final long serialVersionUID = 1234567L; // user-defined (i.e. not default or generated) + // private static final long serialVersionUID = 7654321L; // user-defined (i.e. not default or generated) public String headphonePort; public String thunderboltPort; - public String lighteningPort; + public String lightningPort; public String getHeadphonePort() { return headphonePort; @@ -23,4 +23,8 @@ public class AppleProduct implements Serializable { return serialVersionUID; } + public String getLightningPort() { + return lightningPort; + } + } \ No newline at end of file diff --git a/core-java/src/main/java/com/baeldung/deserialization/DeserializationUtility.java b/core-java/src/main/java/com/baeldung/deserialization/DeserializationUtility.java index 3ed2b8be1d..ad8e929898 100644 --- a/core-java/src/main/java/com/baeldung/deserialization/DeserializationUtility.java +++ b/core-java/src/main/java/com/baeldung/deserialization/DeserializationUtility.java @@ -9,11 +9,12 @@ public class DeserializationUtility { public static void main(String[] args) throws ClassNotFoundException, IOException { - String serializedObj = "rO0ABXNyACljb20uYmFlbGR1bmcuZGVzZXJpYWxpemF0aW9uLkFwcGxlUHJvZHVjdAAAAAAAEtaHAgADTAANaGVhZHBob25lUG9ydHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wADmxpZ2h0ZW5pbmdQb3J0cQB+AAFMAA90aHVuZGVyYm9sdFBvcnRxAH4AAXhwdAARaGVhZHBob25lUG9ydDIwMjBwdAATdGh1bmRlcmJvbHRQb3J0MjAyMA=="; + String serializedObj = "rO0ABXNyACljb20uYmFlbGR1bmcuZGVzZXJpYWxpemF0aW9uLkFwcGxlUHJvZHVjdAAAAAAAEtaHAgADTAANaGVhZHBob25lUG9ydHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wADWxpZ2h0bmluZ1BvcnRxAH4AAUwAD3RodW5kZXJib2x0UG9ydHEAfgABeHB0ABFoZWFkcGhvbmVQb3J0MjAyMHQAEWxpZ2h0bmluZ1BvcnQyMDIwdAATdGh1bmRlcmJvbHRQb3J0MjAyMA=="; System.out.println("Deserializing AppleProduct..."); AppleProduct deserializedObj = (AppleProduct) deSerializeObjectFromString(serializedObj); System.out.println("Headphone port of AppleProduct:" + deserializedObj.getHeadphonePort()); System.out.println("Thunderbolt port of AppleProduct:" + deserializedObj.getThunderboltPort()); + System.out.println("LightningPort port of AppleProduct:" + deserializedObj.getLightningPort()); } public static Object deSerializeObjectFromString(String s) throws IOException, ClassNotFoundException { diff --git a/core-java/src/main/java/com/baeldung/deserialization/SerializationUtility.java b/core-java/src/main/java/com/baeldung/deserialization/SerializationUtility.java index 1dbcc40e6b..aa7f66659a 100644 --- a/core-java/src/main/java/com/baeldung/deserialization/SerializationUtility.java +++ b/core-java/src/main/java/com/baeldung/deserialization/SerializationUtility.java @@ -13,6 +13,7 @@ public class SerializationUtility { AppleProduct macBook = new AppleProduct(); macBook.headphonePort = "headphonePort2020"; macBook.thunderboltPort = "thunderboltPort2020"; + macBook.lightningPort = "lightningPort2020"; String serializedObj = serializeObjectToString(macBook); System.out.println("Serialized AppleProduct object to string:"); diff --git a/core-java/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java b/core-java/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java index ab491bee66..bfb6681f7c 100644 --- a/core-java/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java +++ b/core-java/src/main/java/com/baeldung/temporaladjuster/CustomTemporalAdjuster.java @@ -10,14 +10,13 @@ public class CustomTemporalAdjuster implements TemporalAdjuster { @Override public Temporal adjustInto(Temporal temporal) { - DayOfWeek dayOfWeek = DayOfWeek.of(temporal.get(ChronoField.DAY_OF_WEEK)); - int daysToAdd; - if (dayOfWeek == DayOfWeek.FRIDAY) - daysToAdd = 3; - else if (dayOfWeek == DayOfWeek.SATURDAY) - daysToAdd = 2; - else - daysToAdd = 1; - return temporal.plus(daysToAdd, ChronoUnit.DAYS); + switch (DayOfWeek.of(temporal.get(ChronoField.DAY_OF_WEEK))) { + case FRIDAY: + return temporal.plus(3, ChronoUnit.DAYS); + case SATURDAY: + return temporal.plus(2, ChronoUnit.DAYS); + default: + return temporal.plus(1, ChronoUnit.DAYS); + } } } diff --git a/core-java/src/main/java/org/baeldung/equalshashcode/entities/Rectangle.java b/core-java/src/main/java/org/baeldung/equalshashcode/entities/Rectangle.java index 1e1423f0b3..5e38eb6088 100644 --- a/core-java/src/main/java/org/baeldung/equalshashcode/entities/Rectangle.java +++ b/core-java/src/main/java/org/baeldung/equalshashcode/entities/Rectangle.java @@ -4,7 +4,7 @@ public class Rectangle extends Shape { private double width; private double length; - public Rectangle(double width, double length) { + Rectangle(double width, double length) { this.width = width; this.length = length; } diff --git a/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java b/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java index 09344902b7..d291ac0d3b 100644 --- a/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java +++ b/core-java/src/main/java/org/baeldung/executable/ExecutableMavenJar.java @@ -1,11 +1,10 @@ package org.baeldung.executable; -import javax.swing.JOptionPane; +import javax.swing.*; public class ExecutableMavenJar { public static void main(String[] args) { JOptionPane.showMessageDialog(null, "It worked!", "Executable Jar with Maven", 1); } - } diff --git a/core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterTest.java b/core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterTest.java new file mode 100644 index 0000000000..e9b2e164ae --- /dev/null +++ b/core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadSafeCounterTest.java @@ -0,0 +1,38 @@ +package com.baeldung.concurrent.atomic; + +import static org.junit.Assert.assertEquals; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +import org.junit.Test; + +public class ThreadSafeCounterTest { + + @Test + public void givenMultiThread_whenSafeCounterWithLockIncrement() throws InterruptedException { + ExecutorService service = Executors.newFixedThreadPool(3); + SafeCounterWithLock safeCounter = new SafeCounterWithLock(); + + IntStream.range(0, 1000) + .forEach(count -> service.submit(safeCounter::increment)); + service.awaitTermination(100, TimeUnit.MILLISECONDS); + + assertEquals(1000, safeCounter.getValue()); + } + + @Test + public void givenMultiThread_whenSafeCounterWithoutLockIncrement() throws InterruptedException { + ExecutorService service = Executors.newFixedThreadPool(3); + SafeCounterWithoutLock safeCounter = new SafeCounterWithoutLock(); + + IntStream.range(0, 1000) + .forEach(count -> service.submit(safeCounter::increment)); + service.awaitTermination(100, TimeUnit.MILLISECONDS); + + assertEquals(1000, safeCounter.getValue()); + } + +} diff --git a/core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java b/core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java new file mode 100644 index 0000000000..cc7cc18bb5 --- /dev/null +++ b/core-java/src/test/java/com/baeldung/concurrent/atomic/ThreadUnsafeCounterManualTest.java @@ -0,0 +1,33 @@ +package com.baeldung.concurrent.atomic; + +import static org.junit.Assert.assertEquals; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; + +import org.junit.Test; + +/** + * This test shows the behaviour of a thread-unsafe class in a multithreaded scenario. We are calling + * the increment methods 1000 times from a pool of 3 threads. In most of the cases, the counter will + * less than 1000, because of lost updates, however, occasionally it may reach 1000, when no threads + * called the method simultaneously. This may cause the build to fail occasionally. Hence excluding this + * test from build by adding this in manual test + */ +public class ThreadUnsafeCounterManualTest { + + @Test + public void givenMultiThread_whenUnsafeCounterIncrement() throws InterruptedException { + ExecutorService service = Executors.newFixedThreadPool(3); + UnsafeCounter unsafeCounter = new UnsafeCounter(); + + IntStream.range(0, 1000) + .forEach(count -> service.submit(unsafeCounter::increment)); + service.awaitTermination(100, TimeUnit.MILLISECONDS); + + assertEquals(1000, unsafeCounter.getValue()); + } + +} diff --git a/core-java/src/test/java/com/baeldung/deserialization/DeserializationUnitTest.java b/core-java/src/test/java/com/baeldung/deserialization/DeserializationUnitTest.java index 887e7e41da..d7c1ee17d4 100644 --- a/core-java/src/test/java/com/baeldung/deserialization/DeserializationUnitTest.java +++ b/core-java/src/test/java/com/baeldung/deserialization/DeserializationUnitTest.java @@ -12,7 +12,7 @@ import org.junit.Test; public class DeserializationUnitTest { - private static final String serializedObj = "rO0ABXNyACljb20uYmFlbGR1bmcuZGVzZXJpYWxpemF0aW9uLkFwcGxlUHJvZHVjdAAAAAAAEtaHAgADTAANaGVhZHBob25lUG9ydHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wADmxpZ2h0ZW5pbmdQb3J0cQB+AAFMAA90aHVuZGVyYm9sdFBvcnRxAH4AAXhwdAARaGVhZHBob25lUG9ydDIwMjBwdAATdGh1bmRlcmJvbHRQb3J0MjAyMA=="; + private static final String serializedObj = "rO0ABXNyACljb20uYmFlbGR1bmcuZGVzZXJpYWxpemF0aW9uLkFwcGxlUHJvZHVjdAAAAAAAdMuxAgADTAANaGVhZHBob25lUG9ydHQAEkxqYXZhL2xhbmcvU3RyaW5nO0wADWxpZ2h0bmluZ1BvcnRxAH4AAUwAD3RodW5kZXJib2x0UG9ydHEAfgABeHB0ABFoZWFkcGhvbmVQb3J0MjAyMHQAEWxpZ2h0bmluZ1BvcnQyMDIwdAATdGh1bmRlcmJvbHRQb3J0MjAyMA"; private static long userDefinedSerialVersionUID = 1234567L; @@ -25,20 +25,22 @@ public class DeserializationUnitTest { public void testDeserializeObj_compatible() throws IOException, ClassNotFoundException { assertEquals(userDefinedSerialVersionUID, AppleProduct.getSerialVersionUID()); - + AppleProduct macBook = new AppleProduct(); macBook.headphonePort = "headphonePort2020"; macBook.thunderboltPort = "thunderboltPort2020"; - + macBook.lightningPort = "lightningPort2020"; + // serializes the "AppleProduct" object String serializedProduct = SerializationUtility.serializeObjectToString(macBook); // deserializes the "AppleProduct" object AppleProduct deserializedProduct = (AppleProduct) DeserializationUtility.deSerializeObjectFromString(serializedProduct); - + assertTrue(deserializedProduct.headphonePort.equalsIgnoreCase(macBook.headphonePort)); assertTrue(deserializedProduct.thunderboltPort.equalsIgnoreCase(macBook.thunderboltPort)); - + assertTrue(deserializedProduct.lightningPort.equalsIgnoreCase(macBook.lightningPort)); + } /** @@ -59,7 +61,6 @@ public class DeserializationUnitTest { public void testDeserializeObj_incompatible() throws ClassNotFoundException, IOException { assertNotEquals(userDefinedSerialVersionUID, AppleProduct.getSerialVersionUID()); - // attempts to deserialize the "AppleProduct" object DeserializationUtility.deSerializeObjectFromString(serializedObj); } diff --git a/core-java/src/test/java/com/baeldung/mappedbytebuffer/MappedByteBufferUnitTest.java b/core-java/src/test/java/com/baeldung/mappedbytebuffer/MappedByteBufferUnitTest.java index 3c2d9904d4..0a0993a0d7 100644 --- a/core-java/src/test/java/com/baeldung/mappedbytebuffer/MappedByteBufferUnitTest.java +++ b/core-java/src/test/java/com/baeldung/mappedbytebuffer/MappedByteBufferUnitTest.java @@ -63,6 +63,6 @@ public class MappedByteBufferUnitTest { private Path getFileURIFromResources(String fileName) throws Exception { ClassLoader classLoader = getClass().getClassLoader(); - return Paths.get(classLoader.getResource(fileName).getPath()); + return Paths.get(classLoader.getResource(fileName).toURI()); } } diff --git a/core-java/src/test/java/com/baeldung/money/JavaMoneyUnitTest.java b/core-java/src/test/java/com/baeldung/money/JavaMoneyUnitTest.java index 8948d1ebf7..3d52a9eea9 100644 --- a/core-java/src/test/java/com/baeldung/money/JavaMoneyUnitTest.java +++ b/core-java/src/test/java/com/baeldung/money/JavaMoneyUnitTest.java @@ -179,7 +179,7 @@ public class JavaMoneyUnitTest { MonetaryAmountFormat customFormat = MonetaryFormats.getAmountFormat(AmountFormatQueryBuilder .of(Locale.US) .set(CurrencyStyle.NAME) - .set("pattern", "00000.00 ¤") + .set("pattern", "00000.00 ") .build()); String customFormatted = customFormat.format(oneDollar); diff --git a/core-java/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterTest.java b/core-java/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterTest.java index a7acc9f743..7b5f781620 100644 --- a/core-java/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterTest.java +++ b/core-java/src/test/java/com/baeldung/temporaladjusters/CustomTemporalAdjusterTest.java @@ -1,34 +1,34 @@ package com.baeldung.temporaladjusters; -import java.time.DayOfWeek; -import java.time.LocalDate; -import java.time.Period; -import java.time.temporal.TemporalAdjuster; -import java.time.temporal.TemporalAdjusters; - +import com.baeldung.temporaladjuster.CustomTemporalAdjuster; import org.junit.Assert; import org.junit.Test; -import com.baeldung.temporaladjuster.CustomTemporalAdjuster; +import java.time.LocalDate; +import java.time.Period; +import java.time.temporal.TemporalAdjuster; + +import static org.junit.Assert.assertEquals; public class CustomTemporalAdjusterTest { + private static final TemporalAdjuster NEXT_WORKING_DAY = new CustomTemporalAdjuster(); + @Test public void whenAdjustAndImplementInterface_thenNextWorkingDay() { LocalDate localDate = LocalDate.of(2017, 07, 8); CustomTemporalAdjuster temporalAdjuster = new CustomTemporalAdjuster(); LocalDate nextWorkingDay = localDate.with(temporalAdjuster); - Assert.assertEquals("2017-07-10", nextWorkingDay.toString()); + assertEquals("2017-07-10", nextWorkingDay.toString()); } @Test public void whenAdjust_thenNextWorkingDay() { LocalDate localDate = LocalDate.of(2017, 07, 8); - TemporalAdjuster temporalAdjuster = NEXT_WORKING_DAY; - LocalDate date = localDate.with(temporalAdjuster); + LocalDate date = localDate.with(NEXT_WORKING_DAY); - Assert.assertEquals("2017-07-10", date.toString()); + assertEquals("2017-07-10", date.toString()); } @Test @@ -39,18 +39,6 @@ public class CustomTemporalAdjusterTest { String fourteenDaysAfterDate = "2017-07-22"; - Assert.assertEquals(fourteenDaysAfterDate, result.toString()); + assertEquals(fourteenDaysAfterDate, result.toString()); } - - static TemporalAdjuster NEXT_WORKING_DAY = TemporalAdjusters.ofDateAdjuster(date -> { - DayOfWeek dayOfWeek = date.getDayOfWeek(); - int daysToAdd; - if (dayOfWeek == DayOfWeek.FRIDAY) - daysToAdd = 3; - else if (dayOfWeek == DayOfWeek.SATURDAY) - daysToAdd = 2; - else - daysToAdd = 1; - return date.plusDays(daysToAdd); - }); -} +} \ No newline at end of file diff --git a/core-java/src/test/java/org/baeldung/java/io/JavaScannerUnitTest.java b/core-java/src/test/java/org/baeldung/java/io/JavaScannerUnitTest.java index 5af286dbca..1c16a5d435 100644 --- a/core-java/src/test/java/org/baeldung/java/io/JavaScannerUnitTest.java +++ b/core-java/src/test/java/org/baeldung/java/io/JavaScannerUnitTest.java @@ -11,6 +11,7 @@ import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; import java.io.InputStream; +import java.util.Locale; import java.util.Scanner; import org.junit.Test; @@ -105,6 +106,7 @@ public class JavaScannerUnitTest { public void whenScanString_thenCorrect() throws IOException { final String input = "Hello 1 F 3.5"; final Scanner scanner = new Scanner(input); + scanner.useLocale(Locale.US); assertEquals("Hello", scanner.next()); assertEquals(1, scanner.nextInt()); diff --git a/ejb/README.md b/ejb/README.md index 08392bc80d..3b729318d4 100644 --- a/ejb/README.md +++ b/ejb/README.md @@ -1,3 +1,4 @@ ## Relevant articles: - [Guide to EJB Set-up](http://www.baeldung.com/ejb-intro) +- [Java EE Session Beans](http://www.baeldung.com/ejb-session-beans) diff --git a/feign/pom.xml b/feign/pom.xml index 9c3868c82f..78e1bbcf4c 100644 --- a/feign/pom.xml +++ b/feign/pom.xml @@ -1,12 +1,9 @@ - + 4.0.0 com.baeldung.feign feign-client - 1.0.0-SNAPSHOT com.baeldung diff --git a/guava/README.md b/guava/README.md index 56d282560b..7ab70cb01f 100644 --- a/guava/README.md +++ b/guava/README.md @@ -28,3 +28,4 @@ - [Guide to Guava ClassToInstanceMap](http://www.baeldung.com/guava-class-to-instance-map) - [Guide to Guava MinMaxPriorityQueue and EvictingQueue](http://www.baeldung.com/guava-minmax-priority-queue-and-evicting-queue) - [Guide to Mathematical Utilities in Guava](http://www.baeldung.com/guava-math) +- [Bloom Filter in Java using Guava](http://www.baeldung.com/guava-bloom-filter) diff --git a/guava21/pom.xml b/guava21/pom.xml index d6e556e4a0..930def2a67 100644 --- a/guava21/pom.xml +++ b/guava21/pom.xml @@ -4,8 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung.guava - tutorial + guava21 1.0-SNAPSHOT @@ -15,12 +14,17 @@ - com.google.guava guava 21.0 + + + org.jooq + jool + 0.9.12 + diff --git a/libraries/src/test/java/com/baeldung/zip/ZipCollectionTest.java b/guava21/src/test/java/com.baeldung.guava.zip/ZipCollectionTest.java similarity index 94% rename from libraries/src/test/java/com/baeldung/zip/ZipCollectionTest.java rename to guava21/src/test/java/com.baeldung.guava.zip/ZipCollectionTest.java index 6f6a7b765f..866e09c6a0 100644 --- a/libraries/src/test/java/com/baeldung/zip/ZipCollectionTest.java +++ b/guava21/src/test/java/com.baeldung.guava.zip/ZipCollectionTest.java @@ -1,4 +1,4 @@ -package com.baeldung.zip; +package com.baeldung.guava.zip; import com.google.common.collect.Streams; import org.jooq.lambda.Seq; @@ -15,9 +15,9 @@ import static org.junit.Assert.assertEquals; public class ZipCollectionTest { - List names; - List ages; - List expectedOutput; + private List names; + private List ages; + private List expectedOutput; @Before public void setUp() throws Exception { diff --git a/guava21/src/test/java/AtomicLongMapIntegrationTest.java b/guava21/src/test/java/com/baeldung/guava/tutorial/AtomicLongMapIntegrationTest.java similarity index 97% rename from guava21/src/test/java/AtomicLongMapIntegrationTest.java rename to guava21/src/test/java/com/baeldung/guava/tutorial/AtomicLongMapIntegrationTest.java index 9024329a56..273683710c 100644 --- a/guava21/src/test/java/AtomicLongMapIntegrationTest.java +++ b/guava21/src/test/java/com/baeldung/guava/tutorial/AtomicLongMapIntegrationTest.java @@ -1,3 +1,5 @@ +package com.baeldung.guava.tutorial; + import com.google.common.util.concurrent.AtomicLongMap; import org.junit.Test; diff --git a/guava21/src/test/java/ComparatorsUnitTest.java b/guava21/src/test/java/com/baeldung/guava/tutorial/ComparatorsUnitTest.java similarity index 98% rename from guava21/src/test/java/ComparatorsUnitTest.java rename to guava21/src/test/java/com/baeldung/guava/tutorial/ComparatorsUnitTest.java index 3d1f2e9e81..0183e6cf3a 100644 --- a/guava21/src/test/java/ComparatorsUnitTest.java +++ b/guava21/src/test/java/com/baeldung/guava/tutorial/ComparatorsUnitTest.java @@ -1,3 +1,5 @@ +package com.baeldung.guava.tutorial; + import com.google.common.collect.Comparators; import org.junit.Assert; import org.junit.Test; diff --git a/guava21/src/test/java/GuavaStreamsUnitTest.java b/guava21/src/test/java/com/baeldung/guava/tutorial/GuavaStreamsUnitTest.java similarity index 50% rename from guava21/src/test/java/GuavaStreamsUnitTest.java rename to guava21/src/test/java/com/baeldung/guava/tutorial/GuavaStreamsUnitTest.java index 96b4a2ffdb..3d3163cba6 100644 --- a/guava21/src/test/java/GuavaStreamsUnitTest.java +++ b/guava21/src/test/java/com/baeldung/guava/tutorial/GuavaStreamsUnitTest.java @@ -1,21 +1,33 @@ +package com.baeldung.guava.tutorial; + import com.google.common.collect.Streams; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import java.util.*; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Optional; +import java.util.OptionalDouble; +import java.util.OptionalInt; +import java.util.OptionalLong; +import java.util.stream.Collectors; import java.util.stream.DoubleStream; import java.util.stream.IntStream; import java.util.stream.LongStream; import java.util.stream.Stream; +import static com.baeldung.guava.tutorial.StreamUtility.assertStreamEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + public class GuavaStreamsUnitTest { - List numbers; + private List numbers; @Before public void setUp() { - numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); + numbers = IntStream.rangeClosed(1, 20).boxed().collect(Collectors.toList()); } @Test @@ -24,17 +36,17 @@ public class GuavaStreamsUnitTest { Stream streamFromCollection = Streams.stream(numbers); //Assert.assertNotNull(streamFromCollection); - StreamUtility.assertStreamEquals(streamFromCollection, numbers.stream()); + assertStreamEquals(streamFromCollection, numbers.stream()); } @Test public void createStreamsWithIterable() { - Iterable numbersIterable = (Iterable) numbers; + Iterable numbersIterable = numbers; Stream streamFromIterable = Streams.stream(numbersIterable); - Assert.assertNotNull(streamFromIterable); - StreamUtility.assertStreamEquals(streamFromIterable, numbers.stream()); + assertNotNull(streamFromIterable); + assertStreamEquals(streamFromIterable, numbers.stream()); } @Test @@ -43,8 +55,8 @@ public class GuavaStreamsUnitTest { Stream streamFromIterator = Streams.stream(numbersIterator); - Assert.assertNotNull(streamFromIterator); - StreamUtility.assertStreamEquals(streamFromIterator, numbers.stream()); + assertNotNull(streamFromIterator); + assertStreamEquals(streamFromIterator, numbers.stream()); } @Test @@ -52,8 +64,8 @@ public class GuavaStreamsUnitTest { Stream streamFromOptional = Streams.stream(Optional.of(1)); - Assert.assertNotNull(streamFromOptional); - Assert.assertEquals(streamFromOptional.count(), 1); + assertNotNull(streamFromOptional); + assertEquals(streamFromOptional.count(), 1); } @Test @@ -61,8 +73,8 @@ public class GuavaStreamsUnitTest { LongStream streamFromOptionalLong = Streams.stream(OptionalLong.of(1)); - Assert.assertNotNull(streamFromOptionalLong); - Assert.assertEquals(streamFromOptionalLong.count(), 1); + assertNotNull(streamFromOptionalLong); + assertEquals(streamFromOptionalLong.count(), 1); } @Test @@ -71,7 +83,7 @@ public class GuavaStreamsUnitTest { IntStream streamFromOptionalInt = Streams.stream(OptionalInt.of(1)); //Assert.assertNotNull(streamFromOptionalInt); - Assert.assertEquals(streamFromOptionalInt.count(), 1); + assertEquals(streamFromOptionalInt.count(), 1); } @Test @@ -80,63 +92,54 @@ public class GuavaStreamsUnitTest { DoubleStream streamFromOptionalDouble = Streams.stream(OptionalDouble.of(1.0)); //Assert.assertNotNull(streamFromOptionalDouble); - Assert.assertEquals(streamFromOptionalDouble.count(), 1); + assertEquals(streamFromOptionalDouble.count(), 1); } @Test public void concatStreamsOfSameType() { - Stream oddNumbers = Arrays - .asList(1, 3, 5, 7, 9, 11, 13, 15, 17, 19) - .stream(); - Stream evenNumbers = Arrays - .asList(2, 4, 6, 8, 10, 12, 14, 16, 18, 20) - .stream(); + List oddNumbers = Arrays + .asList(1, 3, 5, 7, 9, 11, 13, 15, 17, 19); + List evenNumbers = Arrays + .asList(2, 4, 6, 8, 10, 12, 14, 16, 18, 20); - Stream combinedStreams = Streams.concat(oddNumbers, evenNumbers); + Stream combinedStreams = Streams.concat(oddNumbers.stream(), evenNumbers.stream()); //Assert.assertNotNull(combinedStreams); - StreamUtility.assertStreamEquals(combinedStreams, Stream.concat(oddNumbers, evenNumbers)); + assertStreamEquals(combinedStreams, Stream.concat(oddNumbers.stream(), evenNumbers.stream())); } @Test public void concatStreamsOfTypeLongStream() { - LongStream firstTwenty = LongStream.range(1, 20); - LongStream nextTwenty = LongStream.range(21, 40); + LongStream combinedStreams = Streams.concat(LongStream.range(1, 21), LongStream.range(21, 40)); - LongStream combinedStreams = Streams.concat(firstTwenty, nextTwenty); - - Assert.assertNotNull(combinedStreams); - StreamUtility.assertStreamEquals(combinedStreams, LongStream.concat(firstTwenty, nextTwenty)); + assertNotNull(combinedStreams); + assertStreamEquals(combinedStreams, LongStream.range(1, 40)); } @Test public void concatStreamsOfTypeIntStream() { - IntStream firstTwenty = IntStream.range(1, 20); - IntStream nextTwenty = IntStream.range(21, 40); + IntStream combinedStreams = Streams.concat(IntStream.range(1, 20), IntStream.range(21, 40)); - IntStream combinedStreams = Streams.concat(firstTwenty, nextTwenty); - - Assert.assertNotNull(combinedStreams); - StreamUtility.assertStreamEquals(combinedStreams, IntStream.concat(firstTwenty, nextTwenty)); + assertNotNull(combinedStreams); + assertStreamEquals(combinedStreams, IntStream.concat(IntStream.range(1, 20), IntStream.range(21, 40))); } @Test public void findLastOfStream() { Optional lastElement = Streams.findLast(numbers.stream()); - Assert.assertNotNull(lastElement.get()); - Assert.assertEquals(lastElement.get(), numbers.get(20)); + assertEquals(lastElement.get(), numbers.get(19)); } @Test public void mapWithIndexTest() { - Stream stringSream = Stream.of("a", "b", "c"); + Stream stringStream = Stream.of("a", "b", "c"); - Stream mappedStream = Streams.mapWithIndex(stringSream, (str, index) -> str + ":" + index); + Stream mappedStream = Streams.mapWithIndex(stringStream, (str, index) -> str + ":" + index); //Assert.assertNotNull(mappedStream); - Assert.assertEquals(mappedStream + assertEquals(mappedStream .findFirst() .get(), "a:0"); @@ -144,12 +147,12 @@ public class GuavaStreamsUnitTest { @Test public void streamsZipTest() { - Stream stringSream = Stream.of("a", "b", "c"); - Stream intStream = Stream.of(1, 2, 3); + Stream stringSream = Stream.of("a", "b", "c"); + Stream intStream = Stream.of(1, 2, 3); Stream mappedStream = Streams.zip(stringSream, intStream, (str, index) -> str + ":" + index); //Assert.assertNotNull(mappedStream); - Assert.assertEquals(mappedStream + assertEquals(mappedStream .findFirst() .get(), "a:1"); diff --git a/guava21/src/test/java/InternBuilderUnitTest.java b/guava21/src/test/java/com/baeldung/guava/tutorial/InternBuilderUnitTest.java similarity index 91% rename from guava21/src/test/java/InternBuilderUnitTest.java rename to guava21/src/test/java/com/baeldung/guava/tutorial/InternBuilderUnitTest.java index 183e3eeb43..13d8f5f3b7 100644 --- a/guava21/src/test/java/InternBuilderUnitTest.java +++ b/guava21/src/test/java/com/baeldung/guava/tutorial/InternBuilderUnitTest.java @@ -1,3 +1,5 @@ +package com.baeldung.guava.tutorial; + import com.google.common.collect.Interner; import com.google.common.collect.Interners; import org.junit.Assert; diff --git a/guava21/src/test/java/MonitorUnitTest.java b/guava21/src/test/java/com/baeldung/guava/tutorial/MonitorUnitTest.java similarity index 97% rename from guava21/src/test/java/MonitorUnitTest.java rename to guava21/src/test/java/com/baeldung/guava/tutorial/MonitorUnitTest.java index e29d4a1eeb..a3a9a4f838 100644 --- a/guava21/src/test/java/MonitorUnitTest.java +++ b/guava21/src/test/java/com/baeldung/guava/tutorial/MonitorUnitTest.java @@ -1,3 +1,5 @@ +package com.baeldung.guava.tutorial; + import com.google.common.util.concurrent.Monitor; import org.junit.Assert; import org.junit.Test; diff --git a/guava21/src/test/java/MoreCollectorsUnitTest.java b/guava21/src/test/java/com/baeldung/guava/tutorial/MoreCollectorsUnitTest.java similarity index 95% rename from guava21/src/test/java/MoreCollectorsUnitTest.java rename to guava21/src/test/java/com/baeldung/guava/tutorial/MoreCollectorsUnitTest.java index 5950997788..acd03022d2 100644 --- a/guava21/src/test/java/MoreCollectorsUnitTest.java +++ b/guava21/src/test/java/com/baeldung/guava/tutorial/MoreCollectorsUnitTest.java @@ -1,3 +1,5 @@ +package com.baeldung.guava.tutorial; + import com.google.common.collect.MoreCollectors; import org.junit.Assert; import org.junit.Test; diff --git a/guava21/src/test/java/StreamUtility.java b/guava21/src/test/java/com/baeldung/guava/tutorial/StreamUtility.java similarity index 97% rename from guava21/src/test/java/StreamUtility.java rename to guava21/src/test/java/com/baeldung/guava/tutorial/StreamUtility.java index 1eb866fb88..b730fbf558 100644 --- a/guava21/src/test/java/StreamUtility.java +++ b/guava21/src/test/java/com/baeldung/guava/tutorial/StreamUtility.java @@ -1,3 +1,5 @@ +package com.baeldung.guava.tutorial; + import org.junit.Assert; import java.util.Iterator; diff --git a/httpclient/pom.xml b/httpclient/pom.xml index 562b3e9bcd..b7567e0c4b 100644 --- a/httpclient/pom.xml +++ b/httpclient/pom.xml @@ -147,7 +147,7 @@ 2.5.1 4.4.5 - 4.5.2 + 4.5.3 1.6.1 diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java index f2086f2633..d39697c0a9 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpAsyncClientLiveTest.java @@ -101,12 +101,7 @@ public class HttpAsyncClientLiveTest { @Test public void whenUseSSLWithHttpAsyncClient_thenCorrect() throws Exception { - final TrustStrategy acceptingTrustStrategy = new TrustStrategy() { - @Override - public final boolean isTrusted(final X509Certificate[] certificate, final String authType) { - return true; - } - }; + final TrustStrategy acceptingTrustStrategy = (certificate, authType) -> true; final SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); final CloseableHttpAsyncClient client = HttpAsyncClients.custom().setSSLHostnameVerifier(SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER).setSSLContext(sslContext).build(); @@ -160,7 +155,7 @@ public class HttpAsyncClientLiveTest { private final HttpContext context; private final HttpGet request; - public GetThread(final CloseableHttpAsyncClient client, final HttpGet request) { + GetThread(final CloseableHttpAsyncClient client, final HttpGet request) { this.client = client; context = HttpClientContext.create(); this.request = request; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientHeadersLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientHeadersLiveTest.java index ebd67512e4..51c3817da5 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientHeadersLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientHeadersLiveTest.java @@ -1,11 +1,7 @@ package org.baeldung.httpclient; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - +import com.google.common.collect.Lists; import org.apache.http.Header; -import org.apache.http.HttpEntity; import org.apache.http.HttpHeaders; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; @@ -20,7 +16,8 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; -import com.google.common.collect.Lists; +import java.io.IOException; +import java.util.List; public class HttpClientHeadersLiveTest { @@ -37,19 +34,7 @@ public class HttpClientHeadersLiveTest { @After public final void after() throws IllegalStateException, IOException { - if (response == null) { - return; - } - - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } // tests - headers - deprecated diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java index 954236a56f..9912e73c2b 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientMultipartLiveTest.java @@ -1,22 +1,7 @@ package org.baeldung.httpclient; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.net.URL; -import java.util.logging.Level; -import java.util.logging.Logger; - import org.apache.http.HttpEntity; import org.apache.http.HttpStatus; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; @@ -30,6 +15,20 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.URL; +import java.util.logging.Level; +import java.util.logging.Logger; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + public class HttpClientMultipartLiveTest { // No longer available @@ -48,7 +47,7 @@ public class HttpClientMultipartLiveTest { @Before public final void before() { client = HttpClientBuilder.create() - .build(); + .build(); post = new HttpPost(SERVER); } @@ -67,15 +66,7 @@ public class HttpClientMultipartLiveTest { LOGGER.log(Level.SEVERE, e.getMessage(), e); throw e; } - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } // tests @@ -83,8 +74,8 @@ public class HttpClientMultipartLiveTest { @Test public final void givenFileandMultipleTextParts_whenUploadwithAddPart_thenNoExceptions() throws IOException { final URL url = Thread.currentThread() - .getContextClassLoader() - .getResource("uploads/" + TEXTFILENAME); + .getContextClassLoader() + .getResource("uploads/" + TEXTFILENAME); final File file = new File(url.getPath()); final FileBody fileBody = new FileBody(file, ContentType.DEFAULT_BINARY); @@ -102,7 +93,7 @@ public class HttpClientMultipartLiveTest { response = client.execute(post); final int statusCode = response.getStatusLine() - .getStatusCode(); + .getStatusCode(); final String responseString = getContent(); final String contentTypeInHeader = getContentTypeHeader(); assertThat(statusCode, equalTo(HttpStatus.SC_OK)); @@ -113,10 +104,10 @@ public class HttpClientMultipartLiveTest { } @Test - public final void givenFileandTextPart_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoExeption() throws ClientProtocolException, IOException { + public final void givenFileandTextPart_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoExeption() throws IOException { final URL url = Thread.currentThread() - .getContextClassLoader() - .getResource("uploads/" + TEXTFILENAME); + .getContextClassLoader() + .getResource("uploads/" + TEXTFILENAME); final File file = new File(url.getPath()); final String message = "This is a multipart post"; final MultipartEntityBuilder builder = MultipartEntityBuilder.create(); @@ -127,7 +118,7 @@ public class HttpClientMultipartLiveTest { post.setEntity(entity); response = client.execute(post); final int statusCode = response.getStatusLine() - .getStatusCode(); + .getStatusCode(); final String responseString = getContent(); final String contentTypeInHeader = getContentTypeHeader(); assertThat(statusCode, equalTo(HttpStatus.SC_OK)); @@ -138,13 +129,13 @@ public class HttpClientMultipartLiveTest { } @Test - public final void givenFileAndInputStreamandText_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoException() throws ClientProtocolException, IOException { + public final void givenFileAndInputStreamandText_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoException() throws IOException { final URL url = Thread.currentThread() - .getContextClassLoader() - .getResource("uploads/" + ZIPFILENAME); + .getContextClassLoader() + .getResource("uploads/" + ZIPFILENAME); final URL url2 = Thread.currentThread() - .getContextClassLoader() - .getResource("uploads/" + IMAGEFILENAME); + .getContextClassLoader() + .getResource("uploads/" + IMAGEFILENAME); final InputStream inputStream = new FileInputStream(url.getPath()); final File file = new File(url2.getPath()); final String message = "This is a multipart post"; @@ -157,7 +148,7 @@ public class HttpClientMultipartLiveTest { post.setEntity(entity); response = client.execute(post); final int statusCode = response.getStatusLine() - .getStatusCode(); + .getStatusCode(); final String responseString = getContent(); final String contentTypeInHeader = getContentTypeHeader(); assertThat(statusCode, equalTo(HttpStatus.SC_OK)); @@ -169,7 +160,7 @@ public class HttpClientMultipartLiveTest { } @Test - public final void givenCharArrayandText_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoException() throws ClientProtocolException, IOException { + public final void givenCharArrayandText_whenUploadwithAddBinaryBodyandAddTextBody_ThenNoException() throws IOException { final String message = "This is a multipart post"; final byte[] bytes = "binary code".getBytes(); final MultipartEntityBuilder builder = MultipartEntityBuilder.create(); @@ -180,7 +171,7 @@ public class HttpClientMultipartLiveTest { post.setEntity(entity); response = client.execute(post); final int statusCode = response.getStatusLine() - .getStatusCode(); + .getStatusCode(); final String responseString = getContent(); final String contentTypeInHeader = getContentTypeHeader(); assertThat(statusCode, equalTo(HttpStatus.SC_OK)); @@ -192,21 +183,21 @@ public class HttpClientMultipartLiveTest { // UTIL - final String getContent() throws IOException { + private String getContent() throws IOException { rd = new BufferedReader(new InputStreamReader(response.getEntity() - .getContent())); + .getContent())); String body = ""; - String content = ""; + StringBuilder content = new StringBuilder(); while ((body = rd.readLine()) != null) { - content += body + "\n"; + content.append(body).append("\n"); } - return content.trim(); + return content.toString().trim(); } - final String getContentTypeHeader() throws IOException { + private String getContentTypeHeader() throws IOException { return post.getEntity() - .getContentType() - .toString(); + .getContentType() + .toString(); } } diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingLiveTest.java index ada5667f0b..39ed8f09ef 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientPostingLiveTest.java @@ -1,20 +1,10 @@ package org.baeldung.httpclient; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.auth.AuthenticationException; import org.apache.http.auth.UsernamePasswordCredentials; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.fluent.Form; import org.apache.http.client.fluent.Request; @@ -29,17 +19,26 @@ import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; import org.junit.Test; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; + /* * NOTE : Need module spring-rest to be running */ public class HttpClientPostingLiveTest { - private static final String SAMPLE_URL = "http://localhost:8080/spring-rest/users"; + private static final String SAMPLE_URL = "http://localhost:8082/spring-rest/users"; private static final String URL_SECURED_BY_BASIC_AUTHENTICATION = "http://browserspy.dk/password-ok.php"; private static final String DEFAULT_USER = "test"; private static final String DEFAULT_PASS = "test"; @Test - public void whenSendPostRequestUsingHttpClient_thenCorrect() throws ClientProtocolException, IOException { + public void whenSendPostRequestUsingHttpClient_thenCorrect() throws IOException { final CloseableHttpClient client = HttpClients.createDefault(); final HttpPost httpPost = new HttpPost(SAMPLE_URL); @@ -54,7 +53,7 @@ public class HttpClientPostingLiveTest { } @Test - public void whenSendPostRequestWithAuthorizationUsingHttpClient_thenCorrect() throws ClientProtocolException, IOException, AuthenticationException { + public void whenSendPostRequestWithAuthorizationUsingHttpClient_thenCorrect() throws IOException, AuthenticationException { final CloseableHttpClient client = HttpClients.createDefault(); final HttpPost httpPost = new HttpPost(URL_SECURED_BY_BASIC_AUTHENTICATION); @@ -68,7 +67,7 @@ public class HttpClientPostingLiveTest { } @Test - public void whenPostJsonUsingHttpClient_thenCorrect() throws ClientProtocolException, IOException { + public void whenPostJsonUsingHttpClient_thenCorrect() throws IOException { final CloseableHttpClient client = HttpClients.createDefault(); final HttpPost httpPost = new HttpPost(SAMPLE_URL + "/detail"); @@ -84,14 +83,14 @@ public class HttpClientPostingLiveTest { } @Test - public void whenPostFormUsingHttpClientFluentAPI_thenCorrect() throws ClientProtocolException, IOException { + public void whenPostFormUsingHttpClientFluentAPI_thenCorrect() throws IOException { final HttpResponse response = Request.Post(SAMPLE_URL).bodyForm(Form.form().add("username", DEFAULT_USER).add("password", DEFAULT_PASS).build()).execute().returnResponse(); assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); } @Test - public void whenSendMultipartRequestUsingHttpClient_thenCorrect() throws ClientProtocolException, IOException { + public void whenSendMultipartRequestUsingHttpClient_thenCorrect() throws IOException { final CloseableHttpClient client = HttpClients.createDefault(); final HttpPost httpPost = new HttpPost(SAMPLE_URL + "/multipart"); @@ -109,7 +108,7 @@ public class HttpClientPostingLiveTest { } @Test - public void whenUploadFileUsingHttpClient_thenCorrect() throws ClientProtocolException, IOException { + public void whenUploadFileUsingHttpClient_thenCorrect() throws IOException { final CloseableHttpClient client = HttpClients.createDefault(); final HttpPost httpPost = new HttpPost(SAMPLE_URL + "/upload"); @@ -125,7 +124,7 @@ public class HttpClientPostingLiveTest { } @Test - public void whenGetUploadFileProgressUsingHttpClient_thenCorrect() throws ClientProtocolException, IOException { + public void whenGetUploadFileProgressUsingHttpClient_thenCorrect() throws IOException { final CloseableHttpClient client = HttpClients.createDefault(); final HttpPost httpPost = new HttpPost(SAMPLE_URL + "/upload"); @@ -133,12 +132,7 @@ public class HttpClientPostingLiveTest { builder.addBinaryBody("file", new File("src/test/resources/test.in"), ContentType.APPLICATION_OCTET_STREAM, "file.ext"); final HttpEntity multipart = builder.build(); - final ProgressEntityWrapper.ProgressListener pListener = new ProgressEntityWrapper.ProgressListener() { - @Override - public void progress(final float percentage) { - assertFalse(Float.compare(percentage, 100) > 0); - } - }; + final ProgressEntityWrapper.ProgressListener pListener = percentage -> assertFalse(Float.compare(percentage, 100) > 0); httpPost.setEntity(new ProgressEntityWrapper(multipart, pListener)); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java index 3cb02dc767..a501367a6b 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientRedirectLiveTest.java @@ -1,13 +1,5 @@ package org.baeldung.httpclient; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.io.InputStream; - -import org.apache.http.HttpEntity; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpHead; @@ -21,6 +13,12 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.io.IOException; +import java.util.Arrays; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + public class HttpClientRedirectLiveTest { private CloseableHttpClient instance; @@ -34,25 +32,13 @@ public class HttpClientRedirectLiveTest { @After public final void after() throws IllegalStateException, IOException { - if (response == null) { - return; - } - - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } // tests @Test - public final void givenRedirectsAreDisabledViaNewApi_whenConsumingUrlWhichRedirects_thenNotRedirected() throws ClientProtocolException, IOException { + public final void givenRedirectsAreDisabledViaNewApi_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException { instance = HttpClients.custom().disableRedirectHandling().build(); final HttpGet httpGet = new HttpGet("http://t.co/I5YYd9tddw"); @@ -62,7 +48,7 @@ public class HttpClientRedirectLiveTest { } @Test - public final void givenRedirectsAreDisabled_whenConsumingUrlWhichRedirects_thenNotRedirected() throws ClientProtocolException, IOException { + public final void givenRedirectsAreDisabled_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException { instance = HttpClientBuilder.create().disableRedirectHandling().build(); response = instance.execute(new HttpGet("http://t.co/I5YYd9tddw")); assertThat(response.getStatusLine().getStatusCode(), equalTo(301)); @@ -71,26 +57,22 @@ public class HttpClientRedirectLiveTest { // redirect with POST @Test - public final void givenPostRequest_whenConsumingUrlWhichRedirects_thenNotRedirected() throws ClientProtocolException, IOException { + public final void givenPostRequest_whenConsumingUrlWhichRedirects_thenNotRedirected() throws IOException { instance = HttpClientBuilder.create().build(); response = instance.execute(new HttpPost("http://t.co/I5YYd9tddw")); assertThat(response.getStatusLine().getStatusCode(), equalTo(301)); } @Test - public final void givenRedirectingPOSTViaPost4_2Api_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws ClientProtocolException, IOException { + public final void givenRedirectingPOSTViaPost4_2Api_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws IOException { final CloseableHttpClient client = HttpClients.custom().setRedirectStrategy(new DefaultRedirectStrategy() { /** Redirectable methods. */ - private final String[] REDIRECT_METHODS = new String[] { HttpGet.METHOD_NAME, HttpPost.METHOD_NAME, HttpHead.METHOD_NAME }; + private final String[] REDIRECT_METHODS = new String[]{HttpGet.METHOD_NAME, HttpPost.METHOD_NAME, HttpHead.METHOD_NAME}; @Override protected boolean isRedirectable(final String method) { - for (final String m : REDIRECT_METHODS) { - if (m.equalsIgnoreCase(method)) { - return true; - } - } - return false; + return Arrays.stream(REDIRECT_METHODS) + .anyMatch(m -> m.equalsIgnoreCase(method)); } }).build(); @@ -99,7 +81,7 @@ public class HttpClientRedirectLiveTest { } @Test - public final void givenRedirectingPOSTVia4_2Api_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws ClientProtocolException, IOException { + public final void givenRedirectingPOSTVia4_2Api_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws IOException { final CloseableHttpClient client = HttpClients.custom().setRedirectStrategy(new LaxRedirectStrategy()).build(); response = client.execute(new HttpPost("http://t.co/I5YYd9tddw")); @@ -107,7 +89,7 @@ public class HttpClientRedirectLiveTest { } @Test - public final void givenRedirectingPOST_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws ClientProtocolException, IOException { + public final void givenRedirectingPOST_whenConsumingUrlWhichRedirectsWithPOST_thenRedirected() throws IOException { instance = HttpClientBuilder.create().setRedirectStrategy(new LaxRedirectStrategy()).build(); response = instance.execute(new HttpPost("http://t.co/I5YYd9tddw")); assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientTimeoutLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientTimeoutLiveTest.java index 7e7dbe2146..74255e416c 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpClientTimeoutLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpClientTimeoutLiveTest.java @@ -1,13 +1,5 @@ package org.baeldung.httpclient; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.io.InputStream; - -import org.apache.http.HttpEntity; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -18,31 +10,24 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.junit.After; import org.junit.Test; +import java.io.IOException; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + public class HttpClientTimeoutLiveTest { private CloseableHttpResponse response; @After public final void after() throws IllegalStateException, IOException { - if (response == null) { - return; - } - - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } // tests @Test - public final void givenUsingNewApi_whenSettingTimeoutViaRequestConfig_thenCorrect() throws ClientProtocolException, IOException { + public final void givenUsingNewApi_whenSettingTimeoutViaRequestConfig_thenCorrect() throws IOException { final int timeout = 2; final RequestConfig config = RequestConfig.custom().setConnectTimeout(timeout * 1000).setConnectionRequestTimeout(timeout * 1000).setSocketTimeout(timeout * 1000).build(); final CloseableHttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).build(); @@ -56,7 +41,7 @@ public class HttpClientTimeoutLiveTest { } @Test - public final void givenUsingNewApi_whenSettingTimeoutViaSocketConfig_thenCorrect() throws ClientProtocolException, IOException { + public final void givenUsingNewApi_whenSettingTimeoutViaSocketConfig_thenCorrect() throws IOException { final int timeout = 2; final SocketConfig config = SocketConfig.custom().setSoTimeout(timeout * 1000).build(); @@ -70,7 +55,7 @@ public class HttpClientTimeoutLiveTest { } @Test - public final void givenUsingNewApi_whenSettingTimeoutViaHighLevelApi_thenCorrect() throws ClientProtocolException, IOException { + public final void givenUsingNewApi_whenSettingTimeoutViaHighLevelApi_thenCorrect() throws IOException { final int timeout = 5; final RequestConfig config = RequestConfig.custom().setConnectTimeout(timeout * 1000).setConnectionRequestTimeout(timeout * 1000).setSocketTimeout(timeout * 1000).build(); @@ -87,7 +72,7 @@ public class HttpClientTimeoutLiveTest { * This simulates a timeout against a domain with multiple routes/IPs to it (not a single raw IP) */ @Test(expected = HttpHostConnectException.class) - public final void givenTimeoutIsConfigured_whenTimingOut_thenTimeoutException() throws ClientProtocolException, IOException { + public final void givenTimeoutIsConfigured_whenTimingOut_thenTimeoutException() throws IOException { final int timeout = 3; final RequestConfig config = RequestConfig.custom().setConnectTimeout(timeout * 1000).setConnectionRequestTimeout(timeout * 1000).setSocketTimeout(timeout * 1000).build(); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/HttpsClientSslLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/HttpsClientSslLiveTest.java index 5dfecb85aa..4eadfe24d5 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/HttpsClientSslLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/HttpsClientSslLiveTest.java @@ -1,14 +1,5 @@ package org.baeldung.httpclient; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.security.GeneralSecurityException; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLHandshakeException; - import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.conn.ClientConnectionManager; @@ -28,6 +19,14 @@ import org.apache.http.ssl.SSLContextBuilder; import org.apache.http.ssl.SSLContexts; import org.junit.Test; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLHandshakeException; +import java.io.IOException; +import java.security.GeneralSecurityException; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertThat; + /** * This test requires a localhost server over HTTPS
* It should only be manually run, not part of the automated build diff --git a/httpclient/src/test/java/org/baeldung/httpclient/ProgressEntityWrapper.java b/httpclient/src/test/java/org/baeldung/httpclient/ProgressEntityWrapper.java index f0b7e0e559..cd00d8711a 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/ProgressEntityWrapper.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/ProgressEntityWrapper.java @@ -10,7 +10,7 @@ import org.apache.http.entity.HttpEntityWrapper; public class ProgressEntityWrapper extends HttpEntityWrapper { private final ProgressListener listener; - public ProgressEntityWrapper(final HttpEntity entity, final ProgressListener listener) { + ProgressEntityWrapper(final HttpEntity entity, final ProgressListener listener) { super(entity); this.listener = listener; } @@ -20,7 +20,7 @@ public class ProgressEntityWrapper extends HttpEntityWrapper { super.writeTo(new CountingOutputStream(outstream, listener, getContentLength())); } - public static interface ProgressListener { + public interface ProgressListener { void progress(float percentage); } @@ -30,7 +30,7 @@ public class ProgressEntityWrapper extends HttpEntityWrapper { private long transferred; private long totalBytes; - public CountingOutputStream(final OutputStream out, final ProgressListener listener, final long totalBytes) { + CountingOutputStream(final OutputStream out, final ProgressListener listener, final long totalBytes) { super(out); this.listener = listener; transferred = 0; diff --git a/httpclient/src/test/java/org/baeldung/httpclient/ResponseUtil.java b/httpclient/src/test/java/org/baeldung/httpclient/ResponseUtil.java new file mode 100644 index 0000000000..fd38b95cbe --- /dev/null +++ b/httpclient/src/test/java/org/baeldung/httpclient/ResponseUtil.java @@ -0,0 +1,26 @@ +package org.baeldung.httpclient; + +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; + +import java.io.IOException; + +public final class ResponseUtil { + private ResponseUtil() { + } + + public static void closeResponse(CloseableHttpResponse response) throws IOException { + if (response == null) { + return; + } + + try { + final HttpEntity entity = response.getEntity(); + if (entity != null) { + entity.getContent().close(); + } + } finally { + response.close(); + } + } +} diff --git a/httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java b/httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java index b5a76241d1..77d5a298c1 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/advancedconfig/HttpClientAdvancedConfigurationIntegrationTest.java @@ -24,7 +24,14 @@ import org.junit.Test; import java.io.IOException; -import static com.github.tomakehurst.wiremock.client.WireMock.*; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.containing; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; import static org.junit.Assert.assertEquals; public class HttpClientAdvancedConfigurationIntegrationTest { @@ -40,9 +47,9 @@ public class HttpClientAdvancedConfigurationIntegrationTest { //given String userAgent = "BaeldungAgent/1.0"; serviceMock.stubFor(get(urlEqualTo("/detail")) - .withHeader("User-Agent", equalTo(userAgent)) - .willReturn(aResponse() - .withStatus(200))); + .withHeader("User-Agent", equalTo(userAgent)) + .willReturn(aResponse() + .withStatus(200))); HttpClient httpClient = HttpClients.createDefault(); HttpGet httpGet = new HttpGet("http://localhost:8089/detail"); @@ -60,10 +67,10 @@ public class HttpClientAdvancedConfigurationIntegrationTest { //given String xmlBody = "1"; serviceMock.stubFor(post(urlEqualTo("/person")) - .withHeader("Content-Type", equalTo("application/xml")) - .withRequestBody(equalTo(xmlBody)) - .willReturn(aResponse() - .withStatus(200))); + .withHeader("Content-Type", equalTo("application/xml")) + .withRequestBody(equalTo(xmlBody)) + .willReturn(aResponse() + .withStatus(200))); HttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost("http://localhost:8089/person"); @@ -83,17 +90,17 @@ public class HttpClientAdvancedConfigurationIntegrationTest { public void givenServerThatIsBehindProxy_whenClientIsConfiguredToSendRequestViaProxy_shouldReturn200() throws IOException { //given proxyMock.stubFor(get(urlMatching(".*")) - .willReturn(aResponse().proxiedFrom("http://localhost:8089/"))); + .willReturn(aResponse().proxiedFrom("http://localhost:8089/"))); serviceMock.stubFor(get(urlEqualTo("/private")) - .willReturn(aResponse().withStatus(200))); + .willReturn(aResponse().withStatus(200))); HttpHost proxy = new HttpHost("localhost", 8090); DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy); HttpClient httpclient = HttpClients.custom() - .setRoutePlanner(routePlanner) - .build(); + .setRoutePlanner(routePlanner) + .build(); //when final HttpGet httpGet = new HttpGet("http://localhost:8089/private"); @@ -109,9 +116,9 @@ public class HttpClientAdvancedConfigurationIntegrationTest { public void givenServerThatIsBehindAuthorizationProxy_whenClientSendRequest_shouldAuthorizeProperly() throws IOException { //given proxyMock.stubFor(get(urlMatching("/private")) - .willReturn(aResponse().proxiedFrom("http://localhost:8089/"))); + .willReturn(aResponse().proxiedFrom("http://localhost:8089/"))); serviceMock.stubFor(get(urlEqualTo("/private")) - .willReturn(aResponse().withStatus(200))); + .willReturn(aResponse().withStatus(200))); HttpHost proxy = new HttpHost("localhost", 8090); @@ -120,7 +127,7 @@ public class HttpClientAdvancedConfigurationIntegrationTest { // Client credentials CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(new AuthScope(proxy), - new UsernamePasswordCredentials("username_admin", "secret_password")); + new UsernamePasswordCredentials("username_admin", "secret_password")); // Create AuthCache instance @@ -135,9 +142,9 @@ public class HttpClientAdvancedConfigurationIntegrationTest { HttpClient httpclient = HttpClients.custom() - .setRoutePlanner(routePlanner) - .setDefaultCredentialsProvider(credentialsProvider) - .build(); + .setRoutePlanner(routePlanner) + .setDefaultCredentialsProvider(credentialsProvider) + .build(); //when diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicLiveTest.java index 2a101ec816..fee9dc4343 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicLiveTest.java @@ -1,13 +1,5 @@ package org.baeldung.httpclient.base; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.notNullValue; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.io.InputStream; - -import org.apache.http.HttpEntity; import org.apache.http.HttpStatus; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; @@ -16,10 +8,17 @@ import org.apache.http.entity.ContentType; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; +import org.baeldung.httpclient.ResponseUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.io.IOException; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.notNullValue; +import static org.junit.Assert.assertThat; + public class HttpClientBasicLiveTest { private static final String SAMPLE_URL = "http://www.github.com"; @@ -35,19 +34,7 @@ public class HttpClientBasicLiveTest { @After public final void after() throws IllegalStateException, IOException { - if (response == null) { - return; - } - - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } // tests diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java index 7eb078b18b..fe275be082 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientBasicPostLiveTest.java @@ -1,22 +1,20 @@ package org.baeldung.httpclient.base; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.http.HttpEntity; import org.apache.http.auth.AuthenticationException; import org.apache.http.auth.UsernamePasswordCredentials; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.auth.BasicScheme; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; +import org.baeldung.httpclient.ResponseUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.io.IOException; + public class HttpClientBasicPostLiveTest { private static final String SAMPLE_URL = "http://www.github.com"; @@ -32,37 +30,25 @@ public class HttpClientBasicPostLiveTest { @After public final void after() throws IllegalStateException, IOException { - if (response == null) { - return; - } - - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } // tests - non-GET @Test - public final void whenExecutingPostRequest_thenNoExceptions() throws ClientProtocolException, IOException { + public final void whenExecutingPostRequest_thenNoExceptions() throws IOException { instance.execute(new HttpPost(SAMPLE_URL)); } @Test - public final void whenExecutingPostRequestWithBody_thenNoExceptions() throws ClientProtocolException, IOException { + public final void whenExecutingPostRequestWithBody_thenNoExceptions() throws IOException { final HttpPost request = new HttpPost(SAMPLE_URL); request.setEntity(new StringEntity("in the body of the POST")); instance.execute(request); } @Test - public final void givenAuth_whenExecutingPostRequestWithBody_thenNoExceptions() throws ClientProtocolException, IOException, AuthenticationException { + public final void givenAuth_whenExecutingPostRequestWithBody_thenNoExceptions() throws IOException, AuthenticationException { final HttpPost request = new HttpPost(SAMPLE_URL); request.setEntity(new StringEntity("in the body of the POST")); final UsernamePasswordCredentials creds = new UsernamePasswordCredentials("username", "password"); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java index 878d220f67..78097227e7 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientLiveTest.java @@ -11,12 +11,12 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.BasicHttpClientConnectionManager; +import org.baeldung.httpclient.ResponseUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.IOException; -import java.io.InputStream; import static org.hamcrest.Matchers.emptyArray; import static org.hamcrest.Matchers.not; @@ -37,19 +37,7 @@ public class HttpClientLiveTest { @After public final void after() throws IllegalStateException, IOException { - if (response == null) { - return; - } - - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } // tests diff --git a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java index 40216a70a5..d945d075f2 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/base/HttpClientSandboxLiveTest.java @@ -1,9 +1,5 @@ package org.baeldung.httpclient.base; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.http.HttpEntity; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; @@ -12,8 +8,11 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; +import org.baeldung.httpclient.ResponseUtil; import org.junit.Test; +import java.io.IOException; + /* * NOTE : Need module spring-security-rest-basic-auth to be running */ @@ -32,15 +31,6 @@ public class HttpClientSandboxLiveTest { System.out.println(response.getStatusLine()); - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - // EntityUtils.consume(entity); - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } } diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java index e04cd32d65..0f8ebefe6c 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/conn/HttpClientConnectionManagementLiveTest.java @@ -1,11 +1,5 @@ package org.baeldung.httpclient.conn; -import static org.junit.Assert.assertTrue; - -import java.io.IOException; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeUnit; - import org.apache.http.HeaderElement; import org.apache.http.HeaderElementIterator; import org.apache.http.HttpClientConnection; @@ -36,6 +30,12 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Test; +import java.io.IOException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertTrue; + public class HttpClientConnectionManagementLiveTest { private static final String SERVER1 = "http://www.petrikainulainen.net/"; private static final String SERVER7 = "http://www.baeldung.com/"; @@ -129,7 +129,7 @@ public class HttpClientConnectionManagementLiveTest { @Test // @Ignore // Example 3.2. TESTER VERSION - /*tester*/public final void whenTwoConnectionsForTwoRequests_thenTwoConnectionsAreLeased() throws InterruptedException { + /*tester*/ public final void whenTwoConnectionsForTwoRequests_thenTwoConnectionsAreLeased() throws InterruptedException { poolingConnManager = new PoolingHttpClientConnectionManager(); final CloseableHttpClient client1 = HttpClients.custom().setConnectionManager(poolingConnManager).build(); final CloseableHttpClient client2 = HttpClients.custom().setConnectionManager(poolingConnManager).build(); @@ -173,7 +173,7 @@ public class HttpClientConnectionManagementLiveTest { @Test // @Ignore // 4.2 Tester Version - /*tester*/public final void whenExecutingSameRequestsInDifferentThreads_thenUseDefaultConnLimit() throws InterruptedException, IOException { + /*tester*/ public final void whenExecutingSameRequestsInDifferentThreads_thenUseDefaultConnLimit() throws InterruptedException, IOException { poolingConnManager = new PoolingHttpClientConnectionManager(); client = HttpClients.custom().setConnectionManager(poolingConnManager).build(); final TesterVersion_MultiHttpClientConnThread thread1 = new TesterVersion_MultiHttpClientConnThread(client, new HttpGet("http://www.google.com"), poolingConnManager); @@ -266,7 +266,7 @@ public class HttpClientConnectionManagementLiveTest { @Test // @Ignore // 6.2 TESTER VERSION - /*tester*/public final void whenConnectionsNeededGreaterThanMaxTotal_thenReuseConnections() throws InterruptedException { + /*tester*/ public final void whenConnectionsNeededGreaterThanMaxTotal_thenReuseConnections() throws InterruptedException { poolingConnManager = new PoolingHttpClientConnectionManager(); poolingConnManager.setDefaultMaxPerRoute(5); poolingConnManager.setMaxTotal(5); @@ -333,7 +333,7 @@ public class HttpClientConnectionManagementLiveTest { @Test @Ignore("Very Long Running") // 8.2 TESTER VERSION - /*tester*/public final void whenCustomizedIdleConnMonitor_thenEliminateIdleConns() throws InterruptedException, IOException { + /*tester*/ public final void whenCustomizedIdleConnMonitor_thenEliminateIdleConns() throws InterruptedException, IOException { poolingConnManager = new PoolingHttpClientConnectionManager(); client = HttpClients.custom().setConnectionManager(poolingConnManager).build(); final IdleConnectionMonitorThread staleMonitor = new IdleConnectionMonitorThread(poolingConnManager); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java b/httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java index 2a1c419e41..ffe4155a78 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/conn/IdleConnectionMonitorThread.java @@ -9,7 +9,7 @@ public class IdleConnectionMonitorThread extends Thread { private final HttpClientConnectionManager connMgr; private volatile boolean shutdown; - public IdleConnectionMonitorThread(final PoolingHttpClientConnectionManager connMgr) { + IdleConnectionMonitorThread(final PoolingHttpClientConnectionManager connMgr) { super(); this.connMgr = connMgr; } @@ -31,7 +31,7 @@ public class IdleConnectionMonitorThread extends Thread { } } - public final void shutdown() { + private void shutdown() { shutdown = true; synchronized (this) { notifyAll(); diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java b/httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java index 071b964710..3794943f02 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/conn/MultiHttpClientConnThread.java @@ -18,23 +18,23 @@ public class MultiHttpClientConnThread extends Thread { private final HttpGet get; private PoolingHttpClientConnectionManager connManager; - public int leasedConn; + private int leasedConn; - public MultiHttpClientConnThread(final CloseableHttpClient client, final HttpGet get, final PoolingHttpClientConnectionManager connManager) { + MultiHttpClientConnThread(final CloseableHttpClient client, final HttpGet get, final PoolingHttpClientConnectionManager connManager) { this.client = client; this.get = get; this.connManager = connManager; leasedConn = 0; } - public MultiHttpClientConnThread(final CloseableHttpClient client, final HttpGet get) { + MultiHttpClientConnThread(final CloseableHttpClient client, final HttpGet get) { this.client = client; this.get = get; } // API - public final int getLeasedConn() { + final int getLeasedConn() { return leasedConn; } @@ -61,8 +61,6 @@ public class MultiHttpClientConnThread extends Thread { } EntityUtils.consume(response.getEntity()); - } catch (final ClientProtocolException ex) { - logger.error("", ex); } catch (final IOException ex) { logger.error("", ex); } diff --git a/httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java b/httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java index 62cd466596..9cc6480e74 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/conn/TesterVersion_MultiHttpClientConnThread.java @@ -18,7 +18,7 @@ public class TesterVersion_MultiHttpClientConnThread extends Thread { private final HttpGet get; private PoolingHttpClientConnectionManager connManager; - public TesterVersion_MultiHttpClientConnThread(final CloseableHttpClient client, final HttpGet get, final PoolingHttpClientConnectionManager connManager) { + TesterVersion_MultiHttpClientConnThread(final CloseableHttpClient client, final HttpGet get, final PoolingHttpClientConnectionManager connManager) { this.client = client; this.get = get; this.connManager = Preconditions.checkNotNull(connManager); @@ -38,8 +38,6 @@ public class TesterVersion_MultiHttpClientConnThread extends Thread { logger.info("After - Leased Connections = " + connManager.getTotalStats().getLeased()); logger.info("After - Available Connections = " + connManager.getTotalStats().getAvailable()); - } catch (final ClientProtocolException ex) { - logger.error("", ex); } catch (final IOException ex) { logger.error("", ex); } diff --git a/httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java index a185e99639..8fc79baed9 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/rare/HttpClientUnshortenLiveTest.java @@ -1,12 +1,7 @@ package org.baeldung.httpclient.rare; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.http.Header; @@ -20,8 +15,12 @@ import org.apache.http.util.EntityUtils; import org.junit.Before; import org.junit.Test; -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; public class HttpClientUnshortenLiveTest { @@ -52,7 +51,7 @@ public class HttpClientUnshortenLiveTest { // API - final String expand(final String urlArg) throws IOException { + private String expand(final String urlArg) throws IOException { String originalUrl = urlArg; String newUrl = expandSingleLevel(originalUrl); while (!originalUrl.equals(newUrl)) { @@ -81,7 +80,7 @@ public class HttpClientUnshortenLiveTest { return newUrl; } - final Pair expandSingleLevelSafe(final String url) throws IOException { + private Pair expandSingleLevelSafe(final String url) throws IOException { HttpHead request = null; HttpEntity httpEntity = null; InputStream entityContentStream = null; @@ -95,15 +94,15 @@ public class HttpClientUnshortenLiveTest { final int statusCode = httpResponse.getStatusLine().getStatusCode(); if (statusCode != 301 && statusCode != 302) { - return new ImmutablePair(statusCode, url); + return new ImmutablePair<>(statusCode, url); } final Header[] headers = httpResponse.getHeaders(HttpHeaders.LOCATION); Preconditions.checkState(headers.length == 1); final String newUrl = headers[0].getValue(); - return new ImmutablePair(statusCode, newUrl); + return new ImmutablePair<>(statusCode, newUrl); } catch (final IllegalArgumentException uriEx) { - return new ImmutablePair(500, url); + return new ImmutablePair<>(500, url); } finally { if (request != null) { request.releaseConnection(); @@ -117,7 +116,7 @@ public class HttpClientUnshortenLiveTest { } } - final String expandSingleLevel(final String url) throws IOException { + private String expandSingleLevel(final String url) throws IOException { HttpHead request = null; try { @@ -130,9 +129,8 @@ public class HttpClientUnshortenLiveTest { } final Header[] headers = httpResponse.getHeaders(HttpHeaders.LOCATION); Preconditions.checkState(headers.length == 1); - final String newUrl = headers[0].getValue(); - return newUrl; + return headers[0].getValue(); } catch (final IllegalArgumentException uriEx) { return url; } finally { diff --git a/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java index e98dd4d14f..7a75729ea5 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientAuthLiveTest.java @@ -1,21 +1,12 @@ package org.baeldung.httpclient.sec; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.Charset; - import org.apache.commons.codec.binary.Base64; -import org.apache.http.HttpEntity; import org.apache.http.HttpHeaders; import org.apache.http.HttpHost; import org.apache.http.HttpStatus; import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.AuthCache; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -26,10 +17,17 @@ import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.protocol.HttpContext; +import org.baeldung.httpclient.ResponseUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.io.IOException; +import java.nio.charset.Charset; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + /* * NOTE : Need module spring-security-rest-basic-auth to be running */ @@ -51,25 +49,13 @@ public class HttpClientAuthLiveTest { @After public final void after() throws IllegalStateException, IOException { - if (response == null) { - return; - } - - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } // tests @Test - public final void whenExecutingBasicGetRequestWithBasicAuthenticationEnabled_thenSuccess() throws ClientProtocolException, IOException { + public final void whenExecutingBasicGetRequestWithBasicAuthenticationEnabled_thenSuccess() throws IOException { client = HttpClientBuilder.create().setDefaultCredentialsProvider(provider()).build(); response = client.execute(new HttpGet(URL_SECURED_BY_BASIC_AUTHENTICATION)); @@ -79,7 +65,7 @@ public class HttpClientAuthLiveTest { } @Test - public final void givenAuthenticationIsPreemptive_whenExecutingBasicGetRequestWithBasicAuthenticationEnabled_thenSuccess() throws ClientProtocolException, IOException { + public final void givenAuthenticationIsPreemptive_whenExecutingBasicGetRequestWithBasicAuthenticationEnabled_thenSuccess() throws IOException { client = HttpClientBuilder.create().build(); response = client.execute(new HttpGet(URL_SECURED_BY_BASIC_AUTHENTICATION), context()); @@ -88,7 +74,7 @@ public class HttpClientAuthLiveTest { } @Test - public final void givenAuthorizationHeaderIsSetManually_whenExecutingGetRequest_thenSuccess() throws ClientProtocolException, IOException { + public final void givenAuthorizationHeaderIsSetManually_whenExecutingGetRequest_thenSuccess() throws IOException { client = HttpClientBuilder.create().build(); final HttpGet request = new HttpGet(URL_SECURED_BY_BASIC_AUTHENTICATION); @@ -100,7 +86,7 @@ public class HttpClientAuthLiveTest { } @Test - public final void givenAuthorizationHeaderIsSetManually_whenExecutingGetRequest_thenSuccess2() throws ClientProtocolException, IOException { + public final void givenAuthorizationHeaderIsSetManually_whenExecutingGetRequest_thenSuccess2() throws IOException { final HttpGet request = new HttpGet(URL_SECURED_BY_BASIC_AUTHENTICATION); final String auth = DEFAULT_USER + ":" + DEFAULT_PASS; final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("ISO-8859-1"))); @@ -116,14 +102,14 @@ public class HttpClientAuthLiveTest { // UTILS - private final CredentialsProvider provider() { + private CredentialsProvider provider() { final CredentialsProvider provider = new BasicCredentialsProvider(); final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(DEFAULT_USER, DEFAULT_PASS); provider.setCredentials(AuthScope.ANY, credentials); return provider; } - private final HttpContext context() { + private HttpContext context() { final HttpHost targetHost = new HttpHost("localhost", 8080, "http"); final CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(DEFAULT_USER, DEFAULT_PASS)); @@ -141,12 +127,11 @@ public class HttpClientAuthLiveTest { return context; } - private final String authorizationHeader(final String username, final String password) { + private String authorizationHeader(final String username, final String password) { final String auth = username + ":" + password; final byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("ISO-8859-1"))); - final String authHeader = "Basic " + new String(encodedAuth); - return authHeader; + return "Basic " + new String(encodedAuth); } } diff --git a/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientCookieLiveTest.java b/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientCookieLiveTest.java index 7da9ad04e4..ba27aca08d 100644 --- a/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientCookieLiveTest.java +++ b/httpclient/src/test/java/org/baeldung/httpclient/sec/HttpClientCookieLiveTest.java @@ -1,13 +1,5 @@ package org.baeldung.httpclient.sec; -import static org.hamcrest.Matchers.equalTo; -import static org.junit.Assert.assertThat; - -import java.io.IOException; -import java.io.InputStream; - -import org.apache.http.HttpEntity; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; @@ -18,10 +10,16 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.cookie.BasicClientCookie; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; +import org.baeldung.httpclient.ResponseUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; +import java.io.IOException; + +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertThat; + public class HttpClientCookieLiveTest { private CloseableHttpClient instance; @@ -35,25 +33,13 @@ public class HttpClientCookieLiveTest { @After public final void after() throws IllegalStateException, IOException { - if (response == null) { - return; - } - - try { - final HttpEntity entity = response.getEntity(); - if (entity != null) { - final InputStream instream = entity.getContent(); - instream.close(); - } - } finally { - response.close(); - } + ResponseUtil.closeResponse(response); } // tests @Test - public final void whenSettingCookiesOnARequest_thenCorrect() throws ClientProtocolException, IOException { + public final void whenSettingCookiesOnARequest_thenCorrect() throws IOException { instance = HttpClientBuilder.create().build(); final HttpGet request = new HttpGet("http://www.github.com"); request.setHeader("Cookie", "JSESSIONID=1234"); @@ -64,7 +50,7 @@ public class HttpClientCookieLiveTest { } @Test - public final void givenUsingDeprecatedApi_whenSettingCookiesOnTheHttpClient_thenCorrect() throws ClientProtocolException, IOException { + public final void givenUsingDeprecatedApi_whenSettingCookiesOnTheHttpClient_thenCorrect() throws IOException { final BasicCookieStore cookieStore = new BasicCookieStore(); final BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", "1234"); cookie.setDomain(".github.com"); @@ -80,7 +66,7 @@ public class HttpClientCookieLiveTest { } @Test - public final void whenSettingCookiesOnTheHttpClient_thenCookieSentCorrectly() throws ClientProtocolException, IOException { + public final void whenSettingCookiesOnTheHttpClient_thenCookieSentCorrectly() throws IOException { final BasicCookieStore cookieStore = new BasicCookieStore(); final BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", "1234"); cookie.setDomain(".github.com"); @@ -96,7 +82,7 @@ public class HttpClientCookieLiveTest { } @Test - public final void whenSettingCookiesOnTheRequest_thenCookieSentCorrectly() throws ClientProtocolException, IOException { + public final void whenSettingCookiesOnTheRequest_thenCookieSentCorrectly() throws IOException { final BasicCookieStore cookieStore = new BasicCookieStore(); final BasicClientCookie cookie = new BasicClientCookie("JSESSIONID", "1234"); cookie.setDomain(".github.com"); diff --git a/javax-servlets/pom.xml b/javax-servlets/pom.xml index 1934102c68..7407666309 100644 --- a/javax-servlets/pom.xml +++ b/javax-servlets/pom.xml @@ -39,7 +39,7 @@ 3.1.0 - 4.5.2 + 4.5.3
\ No newline at end of file diff --git a/javax-servlets/src/test/java/com/baeldung/servlets/FormServletLiveTest.java b/javax-servlets/src/test/java/com/baeldung/servlets/FormServletLiveTest.java index dca725ae32..120a555c5b 100644 --- a/javax-servlets/src/test/java/com/baeldung/servlets/FormServletLiveTest.java +++ b/javax-servlets/src/test/java/com/baeldung/servlets/FormServletLiveTest.java @@ -1,24 +1,24 @@ package com.baeldung.servlets; -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; -import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicNameValuePair; import org.junit.Test; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; + public class FormServletLiveTest { @Test public void whenPostRequestUsingHttpClient_thenCorrect() throws Exception { - HttpClient client = new DefaultHttpClient(); + HttpClient client = HttpClientBuilder.create().build(); HttpPost method = new HttpPost("http://localhost:8080/calculateServlet"); List nvps = new ArrayList<>(); diff --git a/jmh/pom.xml b/jmh/pom.xml index 8ecfaa9651..ef5c3f1bbf 100644 --- a/jmh/pom.xml +++ b/jmh/pom.xml @@ -1,52 +1,60 @@ - 4.0.0 - com.baeldung - jmh - jar - 1.0-SNAPSHOT - jmh - http://maven.apache.org + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + com.baeldung + jmh + jar + 1.0-SNAPSHOT + jmh + http://maven.apache.org - - UTF-8 - UTF-8 - 1.8 - + + UTF-8 + UTF-8 + 1.8 + 1.6 + 1.6 + - - - org.openjdk.jmh - jmh-core - 1.19 - - - org.openjdk.jmh - jmh-generator-annprocess - 1.19 - - - junit - junit - 3.8.1 - test - - + + + org.openjdk.jmh + jmh-core + 1.19 + + + org.openjdk.jmh + jmh-generator-annprocess + 1.19 + + + junit + junit + 3.8.1 + test + - - - - org.apache.maven.plugins - maven-jar-plugin - - - - com.baeldung.Application - - - - - - + + com.google.guava + guava + 21.0 + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + com.baeldung.BenchmarkRunner + + + + + + \ No newline at end of file diff --git a/jmh/src/main/java/com/baeldung/Application.java b/jmh/src/main/java/com/baeldung/Application.java deleted file mode 100644 index 28e70740e0..0000000000 --- a/jmh/src/main/java/com/baeldung/Application.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung; - -import java.io.IOException; - -import org.openjdk.jmh.Main; -import org.openjdk.jmh.runner.RunnerException; - -public class Application { - - public static void main(String[] args) throws RunnerException, IOException { - Main.main(args); - } - -} diff --git a/jmh/src/main/java/com/baeldung/BenchMark.java b/jmh/src/main/java/com/baeldung/BenchMark.java index f2b984d211..b0e1caf4dc 100644 --- a/jmh/src/main/java/com/baeldung/BenchMark.java +++ b/jmh/src/main/java/com/baeldung/BenchMark.java @@ -1,12 +1,48 @@ package com.baeldung; -import org.openjdk.jmh.annotations.Benchmark; +import com.google.common.hash.HashFunction; +import com.google.common.hash.Hasher; +import com.google.common.hash.Hashing; +import org.openjdk.jmh.annotations.*; + +import java.nio.charset.Charset; public class BenchMark { - @Benchmark - public void init() { - - } + @State(Scope.Benchmark) + public static class ExecutionPlan { + + @Param({ "100", "200", "300", "500", "1000" }) + public int iterations; + + public Hasher murmur3; + + public String password = "4v3rys3kur3p455w0rd"; + + @Setup(Level.Invocation) + public void setUp() { + murmur3 = Hashing.murmur3_128().newHasher(); + } + } + + @Fork(value = 1, warmups = 1) + @Benchmark + @BenchmarkMode(Mode.Throughput) + @Warmup(iterations = 5) + public void benchMurmur3_128(ExecutionPlan plan) { + + for (int i = plan.iterations; i > 0; i--) { + plan.murmur3.putString(plan.password, Charset.defaultCharset()); + } + + plan.murmur3.hash(); + } + + @Benchmark + @Fork(value = 1, warmups = 1) + @BenchmarkMode(Mode.Throughput) + public void init() { + // Do nothing + } } diff --git a/jmh/src/main/java/com/baeldung/BenchmarkRunner.java b/jmh/src/main/java/com/baeldung/BenchmarkRunner.java new file mode 100644 index 0000000000..ed6a5bb617 --- /dev/null +++ b/jmh/src/main/java/com/baeldung/BenchmarkRunner.java @@ -0,0 +1,9 @@ +package com.baeldung; + +public class BenchmarkRunner { + + public static void main(String[] args) throws Exception { + org.openjdk.jmh.Main.main(args); + } + +} diff --git a/jmh/src/test/java/com/baeldung/AppTest.java b/jmh/src/test/java/com/baeldung/AppTest.java deleted file mode 100644 index c9f61455bd..0000000000 --- a/jmh/src/test/java/com/baeldung/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/jooby/conf/application.conf b/jooby/conf/application.conf new file mode 100644 index 0000000000..2f89e0eb6b --- /dev/null +++ b/jooby/conf/application.conf @@ -0,0 +1,2 @@ +#application.secret = 2o128940921eo298e21 +#db = /url/to/the/datastore \ No newline at end of file diff --git a/jooby/conf/logback.xml b/jooby/conf/logback.xml new file mode 100644 index 0000000000..50733ee6d6 --- /dev/null +++ b/jooby/conf/logback.xml @@ -0,0 +1,42 @@ + + + + + [%d{ISO8601}]-[%thread] %-5level %logger - %msg%n + + + + + log/jooby.log + + log/jooby.%d{yyyy-MM-dd}.log + 1mb + 7 + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n + + + + + log/access.log + + log/access.%d{yyyy-MM-dd}.log + 1mb + 7 + + + + %msg%n + + + + + + + + + + + diff --git a/jooby/pom.xml b/jooby/pom.xml new file mode 100644 index 0000000000..1935c646ee --- /dev/null +++ b/jooby/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + jooby + com.baeldung.jooby + 1.0 + jooby + + + org.jooby + modules + 1.1.3 + + + + 1.1.3 + com.baeldung.jooby.App + + + + + org.jooby + jooby-netty + + + org.jooby + jooby-jedis + 1.1.3 + + + ch.qos.logback + logback-classic + + + junit + junit + test + + + io.rest-assured + rest-assured + test + + + + + + + org.apache.maven.plugins + maven-shade-plugin + + + + + diff --git a/jooby/public/form.html b/jooby/public/form.html new file mode 100644 index 0000000000..a23620812a --- /dev/null +++ b/jooby/public/form.html @@ -0,0 +1,17 @@ + + + + +Insert title here + + +
+ + + + + + +
+ + \ No newline at end of file diff --git a/jooby/public/welcome.html b/jooby/public/welcome.html new file mode 100644 index 0000000000..cd21fb1988 --- /dev/null +++ b/jooby/public/welcome.html @@ -0,0 +1,10 @@ + + + + +Insert title here + + +i m welcomed + + \ No newline at end of file diff --git a/jooby/src/etc/stork.yml b/jooby/src/etc/stork.yml new file mode 100644 index 0000000000..f2f2790cd1 --- /dev/null +++ b/jooby/src/etc/stork.yml @@ -0,0 +1,41 @@ +# Name of application (make sure it has no spaces) +name: "${project.artifactId}" + +# Display name of application (can have spaces) +display_name: "${project.name}" + +# Type of launcher (CONSOLE or DAEMON) +type: DAEMON + +# Java class to run +main_class: "${application.class}" + +domain: "${project.groupId}" + +short_description: "${project.artifactId}" + +# Platform launchers to generate (WINDOWS, LINUX, MAC_OSX) +# Linux launcher is suitable for Bourne shells (e.g. Linux/BSD) +platforms: [ LINUX ] + +# Working directory for app +# RETAIN will not change the working directory +# APP_HOME will change the working directory to the home of the app +# (where it was intalled) before running the main class +working_dir_mode: RETAIN + +# Minimum version of java required (system will be searched for acceptable jvm) +min_java_version: "1.8" + +# Min/max fixed memory (measured in MB) +min_java_memory: 512 +max_java_memory: 512 + +# Min/max memory by percentage of system +#min_java_memory_pct: 10 +#max_java_memory_pct: 20 + +# Try to create a symbolic link to java executable in /run with +# the name of "-java" so that commands like "ps" will make it +# easier to find your app +symlink_java: true diff --git a/jooby/src/main/java/com/baeldung/jooby/App.java b/jooby/src/main/java/com/baeldung/jooby/App.java new file mode 100644 index 0000000000..94a24048c2 --- /dev/null +++ b/jooby/src/main/java/com/baeldung/jooby/App.java @@ -0,0 +1,95 @@ +package com.baeldung.jooby; + +import org.jooby.Jooby; +import org.jooby.Mutant; +import org.jooby.Session; +import org.jooby.jedis.Redis; +import org.jooby.jedis.RedisSessionStore; + +import com.baeldung.jooby.bean.Employee; + +public class App extends Jooby { + + { + port(8080); + securePort(8443); + } + + { + get("/", () -> "Hello World!"); + } + + { + get("/user/{id}", req -> "Hello user : " + req.param("id").value()); + get("/user/:id", req -> "Hello user: " + req.param("id").value()); + get("/uid:{id}", req -> "Hello User with id : uid" + req.param("id").value()); + } + + { + onStart(() -> { + System.out.println("starting app"); + }); + + onStop(() -> { + System.out.println("stopping app"); + }); + + onStarted(() -> { + System.out.println("app started"); + }); + } + + { + get("/login", () -> "Hello from Baeldung"); + } + + { + post("/save", req -> { + Mutant token = req.param("token"); + return token.intValue(); + }); + } + + { + { + assets("/employee", "form.html"); + } + + post("/submitForm", req -> { + Employee employee = req.params(Employee.class); + // TODO + return "empoyee data saved successfullly"; + }); + } + + { + get("/filter", (req, resp, chain) -> { + // TODO + // resp.send(...); + chain.next(req, resp); + }); + get("/filter", (req, resp) -> { + resp.send("filter response"); + }); + } + + { +// cookieSession(); + +// use(new Redis()); +// +// session(RedisSessionStore.class); + + get("/session", req -> { + Session session = req.session(); + session.set("token", "value"); + return session.get("token").value(); + }); + } + + public static void main(final String[] args) { + + run(App::new, args); + } + +} diff --git a/jooby/src/main/java/com/baeldung/jooby/bean/Employee.java b/jooby/src/main/java/com/baeldung/jooby/bean/Employee.java new file mode 100644 index 0000000000..2c4a1038b5 --- /dev/null +++ b/jooby/src/main/java/com/baeldung/jooby/bean/Employee.java @@ -0,0 +1,16 @@ +package com.baeldung.jooby.bean; + +public class Employee { + + String id; + String name; + String email; + + public Employee(String id, String name, String email) { + super(); + this.id = id; + this.name = name; + this.email = email; + } + +} diff --git a/jooby/src/main/java/com/baeldung/jooby/mvc/GetController.java b/jooby/src/main/java/com/baeldung/jooby/mvc/GetController.java new file mode 100644 index 0000000000..a2c51bae70 --- /dev/null +++ b/jooby/src/main/java/com/baeldung/jooby/mvc/GetController.java @@ -0,0 +1,22 @@ +package com.baeldung.jooby.mvc; + +import org.jooby.Result; +import org.jooby.Results; +import org.jooby.mvc.GET; +import org.jooby.mvc.Path; + +@Path("/hello") +public class GetController { + + @GET + public String hello() { + return "Hello Baeldung"; + } + + @GET + @Path("/home") + public Result home() { + return Results.html("welcome").put("model", new Object()); + } + +} diff --git a/jooby/src/main/java/com/baeldung/jooby/mvc/PostController.java b/jooby/src/main/java/com/baeldung/jooby/mvc/PostController.java new file mode 100644 index 0000000000..df00e47da5 --- /dev/null +++ b/jooby/src/main/java/com/baeldung/jooby/mvc/PostController.java @@ -0,0 +1,14 @@ +package com.baeldung.jooby.mvc; + +import org.jooby.mvc.POST; +import org.jooby.mvc.Path; + +@Path("/submit") +public class PostController { + + @POST + public String hello() { + return "Submit Baeldung"; + } + +} diff --git a/jooby/src/test/java/com/baeldung/jooby/AppTest.java b/jooby/src/test/java/com/baeldung/jooby/AppTest.java new file mode 100644 index 0000000000..af2626c046 --- /dev/null +++ b/jooby/src/test/java/com/baeldung/jooby/AppTest.java @@ -0,0 +1,29 @@ +package com.baeldung.jooby; + +import static io.restassured.RestAssured.get; +import static org.hamcrest.Matchers.equalTo; +import static org.junit.Assert.assertEquals; + +import org.jooby.test.JoobyRule; +import org.jooby.test.MockRouter; +import org.junit.ClassRule; +import org.junit.Test; + +public class AppTest { + + @ClassRule + public static JoobyRule app = new JoobyRule(new App()); + + @Test + public void given_defaultUrl_expect_fixedString() { + get("/").then().assertThat().body(equalTo("Hello World!")).statusCode(200) + .contentType("text/html;charset=UTF-8"); + } + + @Test + public void given_defaultUrl_with_mockrouter_expect_fixedString() throws Throwable { + String result = new MockRouter(new App()).get("/"); + assertEquals("Hello World!", result); + } + +} diff --git a/json-path/pom.xml b/json-path/pom.xml index e81bc1dcf9..8384ba68ed 100644 --- a/json-path/pom.xml +++ b/json-path/pom.xml @@ -23,6 +23,6 @@ - 2.2.0 + 2.4.0
\ No newline at end of file diff --git a/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java b/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java index cb5c695cd8..855f524dbe 100644 --- a/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java +++ b/json-path/src/test/java/com/baeldung/jsonpath/introduction/OperationIntegrationTest.java @@ -1,10 +1,10 @@ package com.baeldung.jsonpath.introduction; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.not; - +import com.jayway.jsonpath.Criteria; +import com.jayway.jsonpath.DocumentContext; +import com.jayway.jsonpath.Filter; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Predicate; import org.junit.Test; import java.io.InputStream; @@ -12,15 +12,14 @@ import java.util.List; import java.util.Map; import java.util.Scanner; -import com.jayway.jsonpath.Criteria; -import com.jayway.jsonpath.DocumentContext; -import com.jayway.jsonpath.Filter; -import com.jayway.jsonpath.JsonPath; -import com.jayway.jsonpath.Predicate; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; public class OperationIntegrationTest { - InputStream jsonInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_api.json"); - String jsonDataSourceString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z").next(); + private InputStream jsonInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_api.json"); + private String jsonDataSourceString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z").next(); @Test public void givenJsonPathWithoutPredicates_whenReading_thenCorrect() { @@ -46,12 +45,7 @@ public class OperationIntegrationTest { @Test public void givenJsonPathWithCustomizedPredicate_whenReading_thenCorrect() { - Predicate expensivePredicate = new Predicate() { - public boolean apply(PredicateContext context) { - String value = context.item(Map.class).get("price").toString(); - return Float.valueOf(value) > 20.00; - } - }; + Predicate expensivePredicate = context -> Float.valueOf(context.item(Map.class).get("price").toString()) > 20.00; List> expensive = JsonPath.parse(jsonDataSourceString).read("$['book'][?]", expensivePredicate); predicateUsageAssertionHelper(expensive); } diff --git a/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceTest.java b/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceTest.java index 868acac8d0..d5cfa50e80 100644 --- a/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceTest.java +++ b/json-path/src/test/java/com/baeldung/jsonpath/introduction/ServiceTest.java @@ -1,9 +1,9 @@ package com.baeldung.jsonpath.introduction; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertEquals; -import static org.hamcrest.CoreMatchers.containsString; - +import com.jayway.jsonpath.Configuration; +import com.jayway.jsonpath.DocumentContext; +import com.jayway.jsonpath.JsonPath; +import com.jayway.jsonpath.Option; import org.junit.Test; import java.io.InputStream; @@ -13,14 +13,13 @@ import java.util.List; import java.util.Map; import java.util.Scanner; -import com.jayway.jsonpath.Configuration; -import com.jayway.jsonpath.DocumentContext; -import com.jayway.jsonpath.JsonPath; -import com.jayway.jsonpath.Option; +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; public class ServiceTest { - InputStream jsonInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_service.json"); - String jsonString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z").next(); + private InputStream jsonInputStream = this.getClass().getClassLoader().getResourceAsStream("intro_service.json"); + private String jsonString = new Scanner(jsonInputStream, "UTF-8").useDelimiter("\\Z").next(); @Test public void givenId_whenRequestingRecordData_thenSucceed() { diff --git a/junit5/README.md b/junit5/README.md index c1ff0eab63..49cd8e61a4 100644 --- a/junit5/README.md +++ b/junit5/README.md @@ -4,3 +4,4 @@ - [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) - [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test) - [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) +- [A Guied to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions) diff --git a/junit5/pom.xml b/junit5/pom.xml index 6cc1405de8..2316b034e9 100644 --- a/junit5/pom.xml +++ b/junit5/pom.xml @@ -9,7 +9,7 @@ junit5 Intro to JUnit 5 - + com.baeldung parent-modules @@ -19,16 +19,24 @@ UTF-8 1.8 - 5.0.0-M4 - 1.0.0-M4 - 4.12.0-M4 - 4.12 + 5.0.0-M5 + 1.0.0-M5 + 4.12.0-M5 + 2.8.2 + 1.4.196 3.6.0 2.19.1 + 4.12 + + + src/test/resources + true + + maven-compiler-plugin @@ -49,44 +57,60 @@
+ + org.codehaus.mojo + exec-maven-plugin + 1.6.0 + + + + java + + + + + com.baeldung.TestLauncher + + - - - junit - junit - ${junit4.version} - test - - - - org.junit.jupiter - junit-jupiter-api - ${junit.jupiter.version} - test - - org.junit.jupiter junit-jupiter-engine ${junit.jupiter.version} test - - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test - - - + org.junit.platform + junit-platform-runner + ${junit.platform.version} + test + + + org.junit.vintage + junit-vintage-engine + ${junit.vintage.version} + test + + + org.apache.logging.log4j + log4j-core + ${log4j2.version} + + + com.h2database + h2 + ${h2.version} + + + junit + junit + ${junit4.version} + test + + + \ No newline at end of file diff --git a/junit5/src/test/java/com/baeldung/EmployeesTest.java b/junit5/src/test/java/com/baeldung/EmployeesTest.java new file mode 100644 index 0000000000..1a6da37d72 --- /dev/null +++ b/junit5/src/test/java/com/baeldung/EmployeesTest.java @@ -0,0 +1,48 @@ +package com.baeldung; + +import java.sql.SQLException; + +import org.apache.logging.log4j.Logger; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import com.baeldung.extensions.EmployeeDaoParameterResolver; +import com.baeldung.extensions.EmployeeDatabaseSetupExtension; +import com.baeldung.extensions.EnvironmentExtension; +import com.baeldung.extensions.IgnoreFileNotFoundExceptionExtension; +import com.baeldung.extensions.LoggingExtension; +import com.baeldung.helpers.Employee; +import com.baeldung.helpers.EmployeeJdbcDao; + +import static org.junit.jupiter.api.Assertions.*; + +@ExtendWith({ EnvironmentExtension.class, EmployeeDatabaseSetupExtension.class, EmployeeDaoParameterResolver.class }) +@ExtendWith(LoggingExtension.class) +@ExtendWith(IgnoreFileNotFoundExceptionExtension.class) +public class EmployeesTest { + + private EmployeeJdbcDao employeeDao; + + private Logger logger; + + public EmployeesTest(EmployeeJdbcDao employeeDao) { + this.employeeDao = employeeDao; + } + + @Test + public void whenAddEmployee_thenGetEmployee() throws SQLException { + Employee emp = new Employee(1, "john"); + employeeDao.add(emp); + assertEquals(1, employeeDao.findAll().size()); + } + + @Test + public void whenGetEmployees_thenEmptyList() throws SQLException { + assertEquals(0, employeeDao.findAll().size()); + } + + public void setLogger(Logger logger) { + this.logger = logger; + } + +} diff --git a/junit5/src/test/java/com/baeldung/TestLauncher.java b/junit5/src/test/java/com/baeldung/TestLauncher.java new file mode 100644 index 0000000000..d0354e19a9 --- /dev/null +++ b/junit5/src/test/java/com/baeldung/TestLauncher.java @@ -0,0 +1,37 @@ +package com.baeldung; + +import org.junit.platform.launcher.LauncherDiscoveryRequest; +import org.junit.platform.launcher.TestExecutionListener; +import org.junit.platform.launcher.TestPlan; +import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder; +import org.junit.platform.launcher.core.LauncherFactory; +import org.junit.platform.launcher.listeners.SummaryGeneratingListener; + +import static org.junit.platform.engine.discovery.DiscoverySelectors.selectClass; + +import java.io.PrintWriter; + +import org.junit.platform.launcher.Launcher; + +public class TestLauncher { + public static void main(String[] args) { + + //@formatter:off + LauncherDiscoveryRequest request = LauncherDiscoveryRequestBuilder.request() + .selectors(selectClass("com.baeldung.EmployeesTest")) + .configurationParameter("junit.conditions.deactivate", "com.baeldung.extensions.*") + .configurationParameter("junit.extensions.autodetection.enabled", "true") + .build(); + + //@formatter:on + + TestPlan plan = LauncherFactory.create().discover(request); + Launcher launcher = LauncherFactory.create(); + SummaryGeneratingListener summaryGeneratingListener = new SummaryGeneratingListener(); + launcher.execute(request, new TestExecutionListener[] { summaryGeneratingListener }); + launcher.execute(request); + + summaryGeneratingListener.getSummary().printTo(new PrintWriter(System.out)); + + } +} diff --git a/junit5/src/test/java/com/baeldung/extensions/EmployeeDaoParameterResolver.java b/junit5/src/test/java/com/baeldung/extensions/EmployeeDaoParameterResolver.java new file mode 100644 index 0000000000..2626266454 --- /dev/null +++ b/junit5/src/test/java/com/baeldung/extensions/EmployeeDaoParameterResolver.java @@ -0,0 +1,23 @@ +package com.baeldung.extensions; + +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.ParameterContext; +import org.junit.jupiter.api.extension.ParameterResolutionException; +import org.junit.jupiter.api.extension.ParameterResolver; + +import com.baeldung.helpers.EmployeeJdbcDao; +import com.baeldung.helpers.JdbcConnectionUtil; + +public class EmployeeDaoParameterResolver implements ParameterResolver { + + @Override + public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { + return parameterContext.getParameter().getType().equals(EmployeeJdbcDao.class); + } + + @Override + public Object resolveParameter(ParameterContext parameterContext, ExtensionContext extensionContext) throws ParameterResolutionException { + return new EmployeeJdbcDao(JdbcConnectionUtil.getConnection()); + } + +} diff --git a/junit5/src/test/java/com/baeldung/extensions/EmployeeDatabaseSetupExtension.java b/junit5/src/test/java/com/baeldung/extensions/EmployeeDatabaseSetupExtension.java new file mode 100644 index 0000000000..69e420b28a --- /dev/null +++ b/junit5/src/test/java/com/baeldung/extensions/EmployeeDatabaseSetupExtension.java @@ -0,0 +1,46 @@ +package com.baeldung.extensions; + +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Savepoint; + +import org.junit.jupiter.api.extension.AfterAllCallback; +import org.junit.jupiter.api.extension.AfterEachCallback; +import org.junit.jupiter.api.extension.BeforeAllCallback; +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; + +import com.baeldung.helpers.EmployeeJdbcDao; +import com.baeldung.helpers.JdbcConnectionUtil; + +public class EmployeeDatabaseSetupExtension implements BeforeAllCallback, AfterAllCallback, BeforeEachCallback, AfterEachCallback { + + private Connection con = JdbcConnectionUtil.getConnection(); + private EmployeeJdbcDao employeeDao = new EmployeeJdbcDao(con); + private Savepoint savepoint; + + @Override + public void afterAll(ExtensionContext context) throws SQLException { + if (con != null) { + con.close(); + } + } + + @Override + public void beforeAll(ExtensionContext context) throws SQLException { + employeeDao.createTable(); + + } + + @Override + public void afterEach(ExtensionContext context) throws SQLException { + con.rollback(savepoint); + } + + @Override + public void beforeEach(ExtensionContext context) throws SQLException { + con.setAutoCommit(false); + savepoint = con.setSavepoint("before"); + } + +} diff --git a/junit5/src/test/java/com/baeldung/extensions/EnvironmentExtension.java b/junit5/src/test/java/com/baeldung/extensions/EnvironmentExtension.java new file mode 100644 index 0000000000..e2c335799b --- /dev/null +++ b/junit5/src/test/java/com/baeldung/extensions/EnvironmentExtension.java @@ -0,0 +1,27 @@ +package com.baeldung.extensions; + +import java.io.IOException; +import java.util.Properties; + +import org.junit.jupiter.api.extension.ConditionEvaluationResult; +import org.junit.jupiter.api.extension.ExecutionCondition; +import org.junit.jupiter.api.extension.ExtensionContext; + +public class EnvironmentExtension implements ExecutionCondition { + + @Override + public ConditionEvaluationResult evaluateExecutionCondition(ExtensionContext context) { + Properties props = new Properties(); + + try { + props.load(EnvironmentExtension.class.getResourceAsStream("application.properties")); + String env = props.getProperty("env"); + if ("qa".equalsIgnoreCase(env)) { + return ConditionEvaluationResult.disabled("Test disabled on QA environment"); + } + } catch (IOException e) { + e.printStackTrace(); + } + return ConditionEvaluationResult.enabled("Test enabled on QA environment"); + } +} diff --git a/junit5/src/test/java/com/baeldung/extensions/IgnoreFileNotFoundExceptionExtension.java b/junit5/src/test/java/com/baeldung/extensions/IgnoreFileNotFoundExceptionExtension.java new file mode 100644 index 0000000000..7216c68c1a --- /dev/null +++ b/junit5/src/test/java/com/baeldung/extensions/IgnoreFileNotFoundExceptionExtension.java @@ -0,0 +1,23 @@ +package com.baeldung.extensions; + +import java.io.FileNotFoundException; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.TestExecutionExceptionHandler; + +public class IgnoreFileNotFoundExceptionExtension implements TestExecutionExceptionHandler { + + Logger logger = LogManager.getLogger(IgnoreFileNotFoundExceptionExtension.class); + + @Override + public void handleTestExecutionException(ExtensionContext context, Throwable throwable) throws Throwable { + + if (throwable instanceof FileNotFoundException) { + logger.error("File not found:" + throwable.getMessage()); + return; + } + throw throwable; + } +} diff --git a/junit5/src/test/java/com/baeldung/extensions/LoggingExtension.java b/junit5/src/test/java/com/baeldung/extensions/LoggingExtension.java new file mode 100644 index 0000000000..437c5c24de --- /dev/null +++ b/junit5/src/test/java/com/baeldung/extensions/LoggingExtension.java @@ -0,0 +1,16 @@ +package com.baeldung.extensions; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.junit.jupiter.api.extension.TestInstancePostProcessor; + +public class LoggingExtension implements TestInstancePostProcessor { + + @Override + public void postProcessTestInstance(Object testInstance, ExtensionContext context) throws Exception { + Logger logger = LogManager.getLogger(testInstance.getClass()); + testInstance.getClass().getMethod("setLogger", Logger.class).invoke(testInstance, logger); + } + +} diff --git a/junit5/src/test/java/com/baeldung/helpers/EmployeeJdbcDao.java b/junit5/src/test/java/com/baeldung/helpers/EmployeeJdbcDao.java new file mode 100644 index 0000000000..7600f763cd --- /dev/null +++ b/junit5/src/test/java/com/baeldung/helpers/EmployeeJdbcDao.java @@ -0,0 +1,51 @@ +package com.baeldung.helpers; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class EmployeeJdbcDao { + + private Connection con; + + public EmployeeJdbcDao(Connection con) { + this.con = con; + } + + public void createTable() throws SQLException { + String createQuery = "CREATE TABLE employees(id long primary key, firstName varchar(50))"; + PreparedStatement pstmt = con.prepareStatement(createQuery); + + pstmt.execute(); + } + + public void add(Employee emp) throws SQLException { + String insertQuery = "INSERT INTO employees(id, firstName) VALUES(?,?)"; + PreparedStatement pstmt = con.prepareStatement(insertQuery); + pstmt.setLong(1, emp.getId()); + pstmt.setString(2, emp.getFirstName()); + + pstmt.executeUpdate(); + + } + + public List findAll() throws SQLException { + List employees = new ArrayList<>(); + String query = "SELECT * FROM employees"; + PreparedStatement pstmt = con.prepareStatement(query); + + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + Employee emp = new Employee(rs.getLong("id"), rs.getString("firstName")); + employees.add(emp); + } + + return employees; + } +} \ No newline at end of file diff --git a/junit5/src/test/java/com/baeldung/helpers/JdbcConnectionUtil.java b/junit5/src/test/java/com/baeldung/helpers/JdbcConnectionUtil.java new file mode 100644 index 0000000000..f380f9674c --- /dev/null +++ b/junit5/src/test/java/com/baeldung/helpers/JdbcConnectionUtil.java @@ -0,0 +1,32 @@ +package com.baeldung.helpers; + +import java.io.IOException; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +public class JdbcConnectionUtil { + + private static Connection con; + + public static Connection getConnection() { + if (con == null) { + try { + Properties props = new Properties(); + props.load(JdbcConnectionUtil.class.getResourceAsStream("jdbc.properties")); + Class.forName(props.getProperty("jdbc.driver")); + con = DriverManager.getConnection(props.getProperty("jdbc.url"), props.getProperty("jdbc.user"), props.getProperty("jdbc.password")); + return con; + } catch (IOException exc) { + exc.printStackTrace(); + } catch (ClassNotFoundException exc) { + exc.printStackTrace(); + } catch (SQLException exc) { + exc.printStackTrace(); + } + return null; + } + return con; + } +} diff --git a/junit5/src/test/java/com/baeldung/migration/junit5/extensions/TraceUnitExtension.java b/junit5/src/test/java/com/baeldung/migration/junit5/extensions/TraceUnitExtension.java index 104d311bc0..db5d3e2573 100644 --- a/junit5/src/test/java/com/baeldung/migration/junit5/extensions/TraceUnitExtension.java +++ b/junit5/src/test/java/com/baeldung/migration/junit5/extensions/TraceUnitExtension.java @@ -2,17 +2,17 @@ package com.baeldung.migration.junit5.extensions; import org.junit.jupiter.api.extension.AfterEachCallback; import org.junit.jupiter.api.extension.BeforeEachCallback; -import org.junit.jupiter.api.extension.TestExtensionContext; +import org.junit.jupiter.api.extension.ExtensionContext; public class TraceUnitExtension implements AfterEachCallback, BeforeEachCallback { @Override - public void beforeEach(TestExtensionContext context) throws Exception { + public void beforeEach(ExtensionContext context) throws Exception { System.out.println("Starting test ... " + context.getDisplayName()); } @Override - public void afterEach(TestExtensionContext context) throws Exception { + public void afterEach(ExtensionContext context) throws Exception { System.out.println("... test finished. " + context.getDisplayName()); } diff --git a/junit5/src/test/java/com/baeldung/suites/AllTests.java b/junit5/src/test/java/com/baeldung/suites/AllTests.java index 24af1e733b..69f28373eb 100644 --- a/junit5/src/test/java/com/baeldung/suites/AllTests.java +++ b/junit5/src/test/java/com/baeldung/suites/AllTests.java @@ -1,7 +1,11 @@ package com.baeldung.suites; -//@RunWith(JUnitPlatform.class) -//@SelectPackages("com.baeldung") +import org.junit.platform.runner.JUnitPlatform; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.runner.RunWith; + +@RunWith(JUnitPlatform.class) +@SelectPackages("com.baeldung") //@SelectClasses({AssertionTest.class, AssumptionTest.class, ExceptionTest.class}) public class AllTests { diff --git a/junit5/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension b/junit5/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension new file mode 100644 index 0000000000..6bd0136b96 --- /dev/null +++ b/junit5/src/test/resources/META-INF/services/org.junit.jupiter.api.extension.Extension @@ -0,0 +1 @@ +com.baeldung.extensions.EmployeeDaoParameterResolver \ No newline at end of file diff --git a/junit5/src/test/resources/com/baeldung/extensions/application.properties b/junit5/src/test/resources/com/baeldung/extensions/application.properties new file mode 100644 index 0000000000..601f964ff3 --- /dev/null +++ b/junit5/src/test/resources/com/baeldung/extensions/application.properties @@ -0,0 +1 @@ +env=dev \ No newline at end of file diff --git a/junit5/src/test/resources/com/baeldung/helpers/jdbc.properties b/junit5/src/test/resources/com/baeldung/helpers/jdbc.properties new file mode 100644 index 0000000000..8783ea2375 --- /dev/null +++ b/junit5/src/test/resources/com/baeldung/helpers/jdbc.properties @@ -0,0 +1,5 @@ +#h2 db +jdbc.driver=org.h2.Driver +jdbc.url=jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1 +jdbc.user=sa +jdbc.password= \ No newline at end of file diff --git a/kotlin/README.md b/kotlin/README.md index 1408bc1ebd..6b3fb93dcc 100644 --- a/kotlin/README.md +++ b/kotlin/README.md @@ -6,3 +6,4 @@ - [Kotlin Java Interoperability](http://www.baeldung.com/kotlin-java-interoperability) - [Difference Between “==” and “===” in Kotlin](http://www.baeldung.com/kotlin-equality-operators) - [Generics in Kotlin](http://www.baeldung.com/kotlin-generics) +- [Introduction to Kotlin Coroutines](http://www.baeldung.com/kotlin-coroutines) diff --git a/kotlin/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java b/kotlin/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java new file mode 100644 index 0000000000..273749e17e --- /dev/null +++ b/kotlin/src/main/java/com/baeldung/lazy/ClassWithHeavyInitialization.java @@ -0,0 +1,14 @@ +package com.baeldung.lazy; + +public class ClassWithHeavyInitialization { + private ClassWithHeavyInitialization() { + } + + private static class LazyHolder { + public static final ClassWithHeavyInitialization INSTANCE = new ClassWithHeavyInitialization(); + } + + public static ClassWithHeavyInitialization getInstance() { + return LazyHolder.INSTANCE; + } +} \ No newline at end of file diff --git a/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt b/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt new file mode 100644 index 0000000000..d3167ce033 --- /dev/null +++ b/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Person.kt @@ -0,0 +1,3 @@ +package com.baeldung.destructuringdeclarations + +data class Person(var id: Int, var name: String, var age: Int) \ No newline at end of file diff --git a/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt b/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt new file mode 100644 index 0000000000..e3da9b46a4 --- /dev/null +++ b/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Result.kt @@ -0,0 +1,3 @@ +package com.baeldung.destructuringdeclarations + +data class Result(val result: Int, val status: String) \ No newline at end of file diff --git a/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt b/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt new file mode 100644 index 0000000000..a5018d93c8 --- /dev/null +++ b/kotlin/src/main/kotlin/com/baeldung/destructuringdeclarations/Sandbox.kt @@ -0,0 +1,44 @@ +package com.baeldung.destructuringdeclarations + +import com.baeldung.destructuringdeclarations.Person + +fun main(args: Array) { + + //2.1. Objects + val person = Person(1, "Jon Snow", 20) + val(id, name, age) = person + + println(id) //1 + println(name) //Jon Snow + println(age) //20 + + //2.2. Functions + fun getPersonInfo() = Person(2, "Ned Stark", 45) + val(idf, namef, agef) = getPersonInfo() + + fun twoValuesReturn(): Pair { + + // needed code + + return Pair(1, "success") + } + + // Now, to use this function: + val (result, status) = twoValuesReturn() + + //2.3. Collections and For-loops + var map: HashMap = HashMap() + map.put(1, person) + + for((key, value) in map){ + println("Key: $key, Value: $value") + } + + //2.4. Underscore and Destructuring in Lambdas + val (_, name2, age2) = person + val (id3, name3) = person + + map.mapValues { entry -> "${entry.value}!" } + map.mapValues { (key, value) -> "$value!" } + +} \ No newline at end of file diff --git a/kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java b/kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java new file mode 100644 index 0000000000..e2fe58d537 --- /dev/null +++ b/kotlin/src/test/java/com/baeldung/kotlin/LazyJavaUnitTest.java @@ -0,0 +1,20 @@ +package com.baeldung.kotlin; + + +import com.baeldung.lazy.ClassWithHeavyInitialization; +import org.junit.Test; + +import static junit.framework.TestCase.assertTrue; + +public class LazyJavaUnitTest { + + @Test + public void giveHeavyClass_whenInitLazy_thenShouldReturnInstanceOnFirstCall() { + //when + ClassWithHeavyInitialization classWithHeavyInitialization = ClassWithHeavyInitialization.getInstance(); + ClassWithHeavyInitialization classWithHeavyInitialization2 = ClassWithHeavyInitialization.getInstance(); + + //then + assertTrue(classWithHeavyInitialization == classWithHeavyInitialization2); + } +} diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt b/kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt new file mode 100644 index 0000000000..59d6adccac --- /dev/null +++ b/kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt @@ -0,0 +1,146 @@ +package com.baeldung.kotlin + +import org.junit.Test +import kotlin.test.assertTrue +import kotlin.test.assertFalse +import kotlin.test.assertEquals + +class CollectionsTest { + + @Test + fun whenUseDifferentCollections_thenSuccess () { + val theList = listOf("one", "two", "three") + assertTrue(theList.contains("two")) + + val theMutableList = mutableListOf("one", "two", "three") + theMutableList.add("four") + assertTrue(theMutableList.contains("four")) + + val theSet = setOf("one", "two", "three") + assertTrue(theSet.contains("three")) + + val theMutableSet = mutableSetOf("one", "two", "three") + theMutableSet.add("four") + assertTrue(theMutableSet.contains("four")) + + val theMap = mapOf(1 to "one", 2 to "two", 3 to "three") + assertEquals(theMap[2],"two") + + val theMutableMap = mutableMapOf(1 to "one", 2 to "two", 3 to "three") + theMutableMap[4] = "four" + assertEquals(theMutableMap[4],"four") + } + + @Test + fun whenSliceCollection_thenSuccess () { + val theList = listOf("one", "two", "three") + val resultList = theList.slice(1..2) + + assertEquals(2, resultList.size) + assertTrue(resultList.contains("two")) + } + + @Test + fun whenJoinTwoCollections_thenSuccess () { + val firstList = listOf("one", "two", "three") + val secondList = listOf("four", "five", "six") + val resultList = firstList + secondList + + assertEquals(6, resultList.size) + assertTrue(resultList.contains("two")) + assertTrue(resultList.contains("five")) + } + + @Test + fun whenFilterNullValues_thenSuccess () { + val theList = listOf("one", null, "two", null, "three") + val resultList = theList.filterNotNull() + + assertEquals(3, resultList.size) + } + + @Test + fun whenFilterNonPositiveValues_thenSuccess () { + val theList = listOf(1, 2, -3, -4, 5, -6) + val resultList = theList.filter{ it > 0} + //val resultList = theList.filter{ x -> x > 0} + + assertEquals(3, resultList.size) + assertTrue(resultList.contains(1)) + assertFalse(resultList.contains(-4)) + } + + @Test + fun whenDropFirstItems_thenRemoved () { + val theList = listOf("one", "two", "three", "four") + val resultList = theList.drop(2) + + assertEquals(2, resultList.size) + assertFalse(resultList.contains("one")) + assertFalse(resultList.contains("two")) + } + + @Test + fun whenDropFirstItemsBasedOnCondition_thenRemoved () { + val theList = listOf("one", "two", "three", "four") + val resultList = theList.dropWhile{ it.length < 4 } + + assertEquals(2, resultList.size) + assertFalse(resultList.contains("one")) + assertFalse(resultList.contains("two")) + } + + @Test + fun whenExcludeItems_thenRemoved () { + val firstList = listOf("one", "two", "three") + val secondList = listOf("one", "three") + val resultList = firstList - secondList + + assertEquals(1, resultList.size) + assertTrue(resultList.contains("two")) + } + + @Test + fun whenSearchForExistingItem_thenFound () { + val theList = listOf("one", "two", "three") + + assertTrue("two" in theList) + } + + @Test + fun whenGroupItems_thenSuccess () { + val theList = listOf(1, 2, 3, 4, 5, 6) + val resultMap = theList.groupBy{ it % 3} + + assertEquals(3, resultMap.size) + print(resultMap[1]) + assertTrue(resultMap[1]!!.contains(1)) + assertTrue(resultMap[2]!!.contains(5)) + } + + @Test + fun whenApplyFunctionToAllItems_thenSuccess () { + val theList = listOf(1, 2, 3, 4, 5, 6) + val resultList = theList.map{ it * it } + print(resultList) + assertEquals(4, resultList[1]) + assertEquals(9, resultList[2]) + } + + @Test + fun whenApplyMultiOutputFunctionToAllItems_thenSuccess () { + val theList = listOf("John", "Tom") + val resultList = theList.flatMap{ it.toLowerCase().toList()} + print(resultList) + assertEquals(7, resultList.size) + assertTrue(resultList.contains('j')) + } + + @Test + fun whenApplyFunctionToAllItemsWithStartingValue_thenSuccess () { + val theList = listOf(1, 2, 3, 4, 5, 6) + val finalResult = theList.fold( 1000, { oldResult, currentItem -> oldResult + (currentItem *currentItem)}) + print(finalResult) + assertEquals(1091, finalResult) + } +} \ No newline at end of file diff --git a/kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt b/kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt new file mode 100644 index 0000000000..9e4179f4fe --- /dev/null +++ b/kotlin/src/test/kotlin/com/baeldung/kotlin/LazyUnitTest.kt @@ -0,0 +1,68 @@ +package com.baeldung.kotlin + +import org.junit.Test +import java.util.concurrent.CountDownLatch +import java.util.concurrent.Executors +import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicInteger +import kotlin.test.assertEquals + +class LazyUnitTest { + @Test + fun givenLazyValue_whenGetIt_thenShouldInitializeItOnlyOnce() { + //given + val numberOfInitializations: AtomicInteger = AtomicInteger() + val lazyValue: ClassWithHeavyInitialization by lazy { + numberOfInitializations.incrementAndGet() + ClassWithHeavyInitialization() + } + //when + println(lazyValue) + println(lazyValue) + + //then + assertEquals(numberOfInitializations.get(), 1) + } + + @Test + fun givenLazyValue_whenGetItUsingPublication_thenCouldInitializeItMoreThanOnce() { + //given + val numberOfInitializations: AtomicInteger = AtomicInteger() + val lazyValue: ClassWithHeavyInitialization by lazy(LazyThreadSafetyMode.PUBLICATION) { + numberOfInitializations.incrementAndGet() + ClassWithHeavyInitialization() + } + val executorService = Executors.newFixedThreadPool(2) + val countDownLatch = CountDownLatch(1) + //when + executorService.submit { countDownLatch.await(); println(lazyValue) } + executorService.submit { countDownLatch.await(); println(lazyValue) } + countDownLatch.countDown() + + //then + executorService.awaitTermination(1, TimeUnit.SECONDS) + executorService.shutdown() + assertEquals(numberOfInitializations.get(), 2) + } + + class ClassWithHeavyInitialization { + + } + + + lateinit var a: String + @Test + fun givenLateInitProperty_whenAccessItAfterInit_thenPass() { + //when + a = "it" + println(a) + + //then not throw + } + + @Test(expected = UninitializedPropertyAccessException::class) + fun givenLateInitProperty_whenAccessItWithoutInit_thenThrow() { + //when + println(a) + } +} \ No newline at end of file diff --git a/libraries/README.md b/libraries/README.md index 293e11cf0c..f0484ec710 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -12,13 +12,21 @@ - [Introduction to Apache Commons Math](http://www.baeldung.com/apache-commons-math) - [Intro to JaVer](http://www.baeldung.com/serenity-bdd) - [Introduction to Netty](http://www.baeldung.com/netty) +- [Merging Streams in Java](http://www.baeldung.com/java-merge-streams) +- [Serenity BDD and Screenplay](http://www.baeldung.com/serenity-screenplay) +- [Introduction to Quartz](http://www.baeldung.com/quartz) +- [How to Warm Up the JVM](http://www.baeldung.com/java-jvm-warmup) +- [Apache Commons Collections SetUtils](http://www.baeldung.com/apache-commons-setutils) - [Guide to Java Data Objects](http://www.baeldung.com/jdo) - [Software Transactional Memory in Java Using Multiverse](http://www.baeldung.com/java-multiverse-stm) - [Introduction to HikariCP](http://www.baeldung.com/hikaricp) - [Serenity BDD with Spring and JBehave](http://www.baeldung.com/serenity-spring-jbehave) - [Locality-Sensitive Hashing in Java Using Java-LSH](http://www.baeldung.com/locality-sensitive-hashing) - [Apache Commons Collections OrderedMap](http://www.baeldung.com/apache-commons-ordered-map) - +- [A Guide to Apache Commons DbUtils](http://www.baeldung.com/apache-commons-dbutils) +- [Introduction to Awaitility](http://www.baeldung.com/awaitlity-testing) +- [Guide to the HyperLogLog Algorithm](http://www.baeldung.com/java-hyperloglog) +- [Introduction to Neuroph](http://www.baeldung.com/intro-to-neuroph) The libraries module contains examples related to small libraries that are relatively easy to use and does not require any separate module of its own. diff --git a/libraries/pom.xml b/libraries/pom.xml index 0373d54429..a655f5267a 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -7,7 +7,6 @@ 1.0.0-SNAPSHOT 4.0.0 - libraries libraries @@ -59,7 +58,8 @@ ${basedir}/datanucleus.properties ${basedir}/log4j.properties true - false + false + @@ -70,10 +70,51 @@ + + + org.apache.maven.plugins + maven-jar-plugin + 3.0.2 + + + **/log4j.properties + + + + com.baeldung.neuroph.NeurophXOR + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.18.1 + + + test + test + + test + + + + test/java/com/baeldung/neuroph/XORTest.java + + + + + + - + + + org.beykery + neuroph + ${neuroph.version} + cglib @@ -157,6 +198,16 @@ commons-io ${commons.io.version} + + commons-chain + commons-chain + ${commons-chain.version} + + + commons-dbutils + commons-dbutils + ${commons.dbutils.version} + org.apache.flink flink-core @@ -256,6 +307,11 @@ datanucleus-xml 5.0.0-release + + net.openhft + chronicle + 3.6.4 + org.springframework spring-web @@ -299,7 +355,7 @@ com.h2database h2 - 1.4.195 + ${h2.version} pl.pragmatists @@ -312,7 +368,6 @@ quartz 2.3.0 - one.util streamex @@ -349,12 +404,6 @@ java-lsh ${java-lsh.version} - - - com.google.guava - guava - 21.0 - au.com.dius pact-jvm-consumer-junit_2.11 @@ -378,6 +427,32 @@ ${awaitility.version} test + + org.hamcrest + java-hamcrest + ${org.hamcrest.java-hamcrest.version} + test + + + net.agkn + hll + ${hll.version} + + + net.bytebuddy + byte-buddy + ${bytebuddy.version} + + + net.bytebuddy + byte-buddy-agent + ${bytebuddy.version} + + + org.pcollections + pcollections + ${pcollections.version} + 0.7.0 @@ -385,6 +460,7 @@ 3.5 1.1 1.9.3 + 1.2 1.9.2 1.2 3.21.0-GA @@ -394,11 +470,14 @@ 9.4.3.v20170317 4.5.3 2.5 + 1.6 + 1.4.196 9.4.2.v20170220 4.5.3 2.5 1.2.0 2.8.5 + 2.92 1.4.0 1.24.0 1.1.3-rc.5 @@ -410,6 +489,9 @@ 0.10 3.5.0 3.0.0 + 2.0.0.0 + 1.6.0 + 1.7.1 + 2.1.2 - diff --git a/libraries/src/main/java/com/baeldung/bytebuddy/Bar.java b/libraries/src/main/java/com/baeldung/bytebuddy/Bar.java new file mode 100644 index 0000000000..d0362a6c92 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/bytebuddy/Bar.java @@ -0,0 +1,16 @@ +package com.baeldung.bytebuddy; + +import net.bytebuddy.implementation.bind.annotation.BindingPriority; + +public class Bar { + + @BindingPriority(3) + public static String sayHelloBar() { return "Holla in Bar!"; } + + @BindingPriority(2) + public static String sayBar() { return "bar"; } + + public String bar() { return Bar.class.getSimpleName() + " - Bar"; } + + +} diff --git a/libraries/src/main/java/com/baeldung/bytebuddy/Foo.java b/libraries/src/main/java/com/baeldung/bytebuddy/Foo.java new file mode 100644 index 0000000000..4be06785b1 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/bytebuddy/Foo.java @@ -0,0 +1,7 @@ +package com.baeldung.bytebuddy; + +public class Foo { + + public String sayHelloFoo() { return "Hello in Foo!"; } + +} diff --git a/libraries/src/main/java/com/baeldung/chronicle/queue/ChronicleQueue.java b/libraries/src/main/java/com/baeldung/chronicle/queue/ChronicleQueue.java new file mode 100644 index 0000000000..b7770e0b78 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/chronicle/queue/ChronicleQueue.java @@ -0,0 +1,23 @@ +package com.baeldung.chronicle.queue; + +import java.io.IOException; + +import net.openhft.chronicle.Chronicle; +import net.openhft.chronicle.ExcerptAppender; + +public class ChronicleQueue { + + public static void writeToQueue( + Chronicle chronicle, String stringValue, int intValue, long longValue, double doubleValue) + throws IOException { + ExcerptAppender appender = chronicle.createAppender(); + appender.startExcerpt(); + appender.writeUTF(stringValue); + appender.writeInt(intValue); + appender.writeLong(longValue); + appender.writeDouble(doubleValue); + appender.finish(); + appender.close(); + } + +} diff --git a/libraries/src/main/java/com/baeldung/commons/chain/AbstractDenominationDispenser.java b/libraries/src/main/java/com/baeldung/commons/chain/AbstractDenominationDispenser.java new file mode 100644 index 0000000000..cbcf03c7d4 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/chain/AbstractDenominationDispenser.java @@ -0,0 +1,23 @@ +package com.baeldung.commons.chain; + +import org.apache.commons.chain.Command; +import org.apache.commons.chain.Context; + +import static com.baeldung.commons.chain.AtmConstants.AMOUNT_LEFT_TO_BE_WITHDRAWN; + +public abstract class AbstractDenominationDispenser implements Command { + + @Override + public boolean execute(Context context) throws Exception { + int amountLeftToBeWithdrawn = (int) context.get(AMOUNT_LEFT_TO_BE_WITHDRAWN); + if (amountLeftToBeWithdrawn >= getDenominationValue()) { + context.put(getDenominationString(), amountLeftToBeWithdrawn / getDenominationValue()); + context.put(AMOUNT_LEFT_TO_BE_WITHDRAWN, amountLeftToBeWithdrawn % getDenominationValue()); + } + return false; + } + + protected abstract String getDenominationString(); + + protected abstract int getDenominationValue(); +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/chain/AtmCatalog.java b/libraries/src/main/java/com/baeldung/commons/chain/AtmCatalog.java new file mode 100644 index 0000000000..768517e19a --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/chain/AtmCatalog.java @@ -0,0 +1,13 @@ +package com.baeldung.commons.chain; + +import org.apache.commons.chain.impl.CatalogBase; + +import static com.baeldung.commons.chain.AtmConstants.ATM_WITHDRAWAL_CHAIN; + +public class AtmCatalog extends CatalogBase { + + public AtmCatalog() { + super(); + addCommand(ATM_WITHDRAWAL_CHAIN, new AtmWithdrawalChain()); + } +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/chain/AtmConstants.java b/libraries/src/main/java/com/baeldung/commons/chain/AtmConstants.java new file mode 100644 index 0000000000..d9425fcfac --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/chain/AtmConstants.java @@ -0,0 +1,10 @@ +package com.baeldung.commons.chain; + +public class AtmConstants { + public static final String TOTAL_AMOUNT_TO_BE_WITHDRAWN = "totalAmountToBeWithdrawn"; + public static final String AMOUNT_LEFT_TO_BE_WITHDRAWN = "amountLeftToBeWithdrawn"; + public static final String NO_OF_HUNDREDS_DISPENSED = "noOfHundredsDispensed"; + public static final String NO_OF_FIFTIES_DISPENSED = "noOfFiftiesDispensed"; + public static final String NO_OF_TENS_DISPENSED = "noOfTensDispensed"; + public static final String ATM_WITHDRAWAL_CHAIN = "atmWithdrawalChain"; +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/chain/AtmRequestContext.java b/libraries/src/main/java/com/baeldung/commons/chain/AtmRequestContext.java new file mode 100644 index 0000000000..ee089705ad --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/chain/AtmRequestContext.java @@ -0,0 +1,52 @@ +package com.baeldung.commons.chain; + +import org.apache.commons.chain.impl.ContextBase; + +public class AtmRequestContext extends ContextBase { + + int totalAmountToBeWithdrawn; + int noOfHundredsDispensed; + int noOfFiftiesDispensed; + int noOfTensDispensed; + int amountLeftToBeWithdrawn; + + public int getTotalAmountToBeWithdrawn() { + return totalAmountToBeWithdrawn; + } + + public void setTotalAmountToBeWithdrawn(int totalAmountToBeWithdrawn) { + this.totalAmountToBeWithdrawn = totalAmountToBeWithdrawn; + } + + public int getNoOfHundredsDispensed() { + return noOfHundredsDispensed; + } + + public void setNoOfHundredsDispensed(int noOfHundredsDispensed) { + this.noOfHundredsDispensed = noOfHundredsDispensed; + } + + public int getNoOfFiftiesDispensed() { + return noOfFiftiesDispensed; + } + + public void setNoOfFiftiesDispensed(int noOfFiftiesDispensed) { + this.noOfFiftiesDispensed = noOfFiftiesDispensed; + } + + public int getNoOfTensDispensed() { + return noOfTensDispensed; + } + + public void setNoOfTensDispensed(int noOfTensDispensed) { + this.noOfTensDispensed = noOfTensDispensed; + } + + public int getAmountLeftToBeWithdrawn() { + return amountLeftToBeWithdrawn; + } + + public void setAmountLeftToBeWithdrawn(int amountLeftToBeWithdrawn) { + this.amountLeftToBeWithdrawn = amountLeftToBeWithdrawn; + } +} diff --git a/libraries/src/main/java/com/baeldung/commons/chain/AtmWithdrawalChain.java b/libraries/src/main/java/com/baeldung/commons/chain/AtmWithdrawalChain.java new file mode 100644 index 0000000000..fdea5e5744 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/chain/AtmWithdrawalChain.java @@ -0,0 +1,14 @@ +package com.baeldung.commons.chain; + +import org.apache.commons.chain.impl.ChainBase; + +public class AtmWithdrawalChain extends ChainBase { + + public AtmWithdrawalChain() { + super(); + addCommand(new HundredDenominationDispenser()); + addCommand(new FiftyDenominationDispenser()); + addCommand(new TenDenominationDispenser()); + addCommand(new AuditFilter()); + } +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/chain/AuditFilter.java b/libraries/src/main/java/com/baeldung/commons/chain/AuditFilter.java new file mode 100644 index 0000000000..973e2d498e --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/chain/AuditFilter.java @@ -0,0 +1,18 @@ +package com.baeldung.commons.chain; + +import org.apache.commons.chain.Context; +import org.apache.commons.chain.Filter; + +public class AuditFilter implements Filter { + + @Override + public boolean postprocess(Context context, Exception exception) { + // Send notification to customer & bank. + return false; + } + + @Override + public boolean execute(Context context) throws Exception { + return false; + } +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/chain/FiftyDenominationDispenser.java b/libraries/src/main/java/com/baeldung/commons/chain/FiftyDenominationDispenser.java new file mode 100644 index 0000000000..f0f5959764 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/chain/FiftyDenominationDispenser.java @@ -0,0 +1,15 @@ +package com.baeldung.commons.chain; + +import static com.baeldung.commons.chain.AtmConstants.NO_OF_FIFTIES_DISPENSED; + +public class FiftyDenominationDispenser extends AbstractDenominationDispenser { + @Override + protected String getDenominationString() { + return NO_OF_FIFTIES_DISPENSED; + } + + @Override + protected int getDenominationValue() { + return 50; + } +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/chain/HundredDenominationDispenser.java b/libraries/src/main/java/com/baeldung/commons/chain/HundredDenominationDispenser.java new file mode 100644 index 0000000000..e65d0d34c9 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/chain/HundredDenominationDispenser.java @@ -0,0 +1,15 @@ +package com.baeldung.commons.chain; + +import static com.baeldung.commons.chain.AtmConstants.NO_OF_HUNDREDS_DISPENSED; + +public class HundredDenominationDispenser extends AbstractDenominationDispenser { + @Override + protected String getDenominationString() { + return NO_OF_HUNDREDS_DISPENSED; + } + + @Override + protected int getDenominationValue() { + return 100; + } +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/chain/TenDenominationDispenser.java b/libraries/src/main/java/com/baeldung/commons/chain/TenDenominationDispenser.java new file mode 100644 index 0000000000..423440bc4d --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/chain/TenDenominationDispenser.java @@ -0,0 +1,15 @@ +package com.baeldung.commons.chain; + +import static com.baeldung.commons.chain.AtmConstants.NO_OF_TENS_DISPENSED; + +public class TenDenominationDispenser extends AbstractDenominationDispenser { + @Override + protected String getDenominationString() { + return NO_OF_TENS_DISPENSED; + } + + @Override + protected int getDenominationValue() { + return 10; + } +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/dbutils/Email.java b/libraries/src/main/java/com/baeldung/commons/dbutils/Email.java new file mode 100644 index 0000000000..c82798d52d --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/dbutils/Email.java @@ -0,0 +1,38 @@ +package com.baeldung.commons.dbutils; + +public class Email { + private Integer id; + private Integer employeeId; + private String address; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getEmployeeId() { + return employeeId; + } + + public void setEmployeeId(Integer employeeId) { + this.employeeId = employeeId; + } + + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + return "Email{" + "id=" + id + ", address=" + address + '}'; + } + +} diff --git a/libraries/src/main/java/com/baeldung/commons/dbutils/Employee.java b/libraries/src/main/java/com/baeldung/commons/dbutils/Employee.java new file mode 100644 index 0000000000..e6f34c0201 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/dbutils/Employee.java @@ -0,0 +1,67 @@ +package com.baeldung.commons.dbutils; + +import java.util.Date; +import java.util.List; + +public class Employee { + private Integer id; + private String firstName; + private String lastName; + private Double salary; + private Date hiredDate; + private List emails; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public Double getSalary() { + return salary; + } + + public void setSalary(Double salary) { + this.salary = salary; + } + + public Date getHiredDate() { + return hiredDate; + } + + public void setHiredDate(Date hiredDate) { + this.hiredDate = hiredDate; + } + + public List getEmails() { + return emails; + } + + public void setEmails(List emails) { + this.emails = emails; + } + + @Override + public String toString() { + return "Employee{" + "id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + ", salary=" + salary + ", hiredDate=" + hiredDate + '}'; + } + +} \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/commons/dbutils/EmployeeHandler.java b/libraries/src/main/java/com/baeldung/commons/dbutils/EmployeeHandler.java new file mode 100644 index 0000000000..6f68bafe57 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/commons/dbutils/EmployeeHandler.java @@ -0,0 +1,45 @@ +package com.baeldung.commons.dbutils; + +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.apache.commons.dbutils.BasicRowProcessor; +import org.apache.commons.dbutils.BeanProcessor; + +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; + +public class EmployeeHandler extends BeanListHandler { + + private Connection connection; + + public EmployeeHandler(Connection con) { + super(Employee.class, new BasicRowProcessor(new BeanProcessor(getColumnsToFieldsMap()))); + this.connection = con; + } + + @Override + public List handle(ResultSet rs) throws SQLException { + List employees = super.handle(rs); + + QueryRunner runner = new QueryRunner(); + BeanListHandler handler = new BeanListHandler<>(Email.class); + String query = "SELECT * FROM email WHERE employeeid = ?"; + for (Employee employee : employees) { + List emails = runner.query(connection, query, handler, employee.getId()); + employee.setEmails(emails); + } + return employees; + } + + public static Map getColumnsToFieldsMap() { + Map columnsToFieldsMap = new HashMap<>(); + columnsToFieldsMap.put("FIRST_NAME", "firstName"); + columnsToFieldsMap.put("LAST_NAME", "lastName"); + columnsToFieldsMap.put("HIRED_DATE", "hiredDate"); + return columnsToFieldsMap; + } +} diff --git a/libraries/src/main/java/com/baeldung/jetty/JettyServer.java b/libraries/src/main/java/com/baeldung/jetty/JettyServer.java index 1033a7266d..364b05473a 100644 --- a/libraries/src/main/java/com/baeldung/jetty/JettyServer.java +++ b/libraries/src/main/java/com/baeldung/jetty/JettyServer.java @@ -6,11 +6,11 @@ import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.util.thread.QueuedThreadPool; -public class JettyServer { +class JettyServer { private Server server; - public void start() throws Exception { + void start() throws Exception { int maxThreads = 100; int minThreads = 10; @@ -33,7 +33,7 @@ public class JettyServer { } - public void stop() throws Exception { + void stop() throws Exception { server.stop(); } } diff --git a/libraries/src/main/java/com/baeldung/junitparams/SafeAdditionUtil.java b/libraries/src/main/java/com/baeldung/junitparams/SafeAdditionUtil.java index a2c1573dca..60436865a9 100644 --- a/libraries/src/main/java/com/baeldung/junitparams/SafeAdditionUtil.java +++ b/libraries/src/main/java/com/baeldung/junitparams/SafeAdditionUtil.java @@ -1,8 +1,8 @@ package com.baeldung.junitparams; -public class SafeAdditionUtil { +class SafeAdditionUtil { - public int safeAdd(int a, int b) { + int safeAdd(int a, int b) { long result = ((long) a) + b; if (result > Integer.MAX_VALUE) { return Integer.MAX_VALUE; diff --git a/libraries/src/main/java/com/baeldung/netty/NettyServer.java b/libraries/src/main/java/com/baeldung/netty/NettyServer.java index b9d35859d0..319829b7b6 100644 --- a/libraries/src/main/java/com/baeldung/netty/NettyServer.java +++ b/libraries/src/main/java/com/baeldung/netty/NettyServer.java @@ -13,7 +13,7 @@ public class NettyServer { private int port; - public NettyServer(int port) { + private NettyServer(int port) { this.port = port; } @@ -27,7 +27,7 @@ public class NettyServer { new NettyServer(port).run(); } - public void run() throws Exception { + private void run() throws Exception { EventLoopGroup bossGroup = new NioEventLoopGroup(); EventLoopGroup workerGroup = new NioEventLoopGroup(); try { diff --git a/libraries/src/main/java/com/baeldung/netty/RequestData.java b/libraries/src/main/java/com/baeldung/netty/RequestData.java index e7404c1663..402aa1ef91 100644 --- a/libraries/src/main/java/com/baeldung/netty/RequestData.java +++ b/libraries/src/main/java/com/baeldung/netty/RequestData.java @@ -4,27 +4,27 @@ public class RequestData { private int intValue; private String stringValue; - public int getIntValue() { + int getIntValue() { return intValue; } - public void setIntValue(int intValue) { + void setIntValue(int intValue) { this.intValue = intValue; } - public String getStringValue() { + String getStringValue() { return stringValue; } - public void setStringValue(String stringValue) { + void setStringValue(String stringValue) { this.stringValue = stringValue; } @Override public String toString() { return "RequestData{" + - "intValue=" + intValue + - ", stringValue='" + stringValue + '\'' + - '}'; + "intValue=" + intValue + + ", stringValue='" + stringValue + '\'' + + '}'; } } diff --git a/libraries/src/main/java/com/baeldung/netty/ResponseData.java b/libraries/src/main/java/com/baeldung/netty/ResponseData.java index ce388a9a3d..51d1adaafb 100644 --- a/libraries/src/main/java/com/baeldung/netty/ResponseData.java +++ b/libraries/src/main/java/com/baeldung/netty/ResponseData.java @@ -3,11 +3,11 @@ package com.baeldung.netty; public class ResponseData { private int intValue; - public int getIntValue() { + int getIntValue() { return intValue; } - public void setIntValue(int intValue) { + void setIntValue(int intValue) { this.intValue = intValue; } diff --git a/libraries/src/main/java/com/baeldung/netty/ResponseDataDecoder.java b/libraries/src/main/java/com/baeldung/netty/ResponseDataDecoder.java index ee33679dfe..16e2a61bd3 100644 --- a/libraries/src/main/java/com/baeldung/netty/ResponseDataDecoder.java +++ b/libraries/src/main/java/com/baeldung/netty/ResponseDataDecoder.java @@ -1,11 +1,11 @@ package com.baeldung.netty; -import java.util.List; - import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.ReplayingDecoder; +import java.util.List; + public class ResponseDataDecoder extends ReplayingDecoder { @Override diff --git a/libraries/src/main/java/com/baeldung/neuroph/NeurophXOR.java b/libraries/src/main/java/com/baeldung/neuroph/NeurophXOR.java new file mode 100644 index 0000000000..fb6a01d4c1 --- /dev/null +++ b/libraries/src/main/java/com/baeldung/neuroph/NeurophXOR.java @@ -0,0 +1,73 @@ +package com.baeldung.neuroph; + +import org.neuroph.core.Layer; +import org.neuroph.core.NeuralNetwork; +import org.neuroph.core.Neuron; +import org.neuroph.core.data.DataSet; +import org.neuroph.core.data.DataSetRow; +import org.neuroph.nnet.learning.BackPropagation; +import org.neuroph.util.ConnectionFactory; +import org.neuroph.util.NeuralNetworkType; + +public class NeurophXOR { + + public static NeuralNetwork assembleNeuralNetwork() { + + Layer inputLayer = new Layer(); + inputLayer.addNeuron(new Neuron()); + inputLayer.addNeuron(new Neuron()); + + Layer hiddenLayerOne = new Layer(); + hiddenLayerOne.addNeuron(new Neuron()); + hiddenLayerOne.addNeuron(new Neuron()); + hiddenLayerOne.addNeuron(new Neuron()); + hiddenLayerOne.addNeuron(new Neuron()); + + Layer hiddenLayerTwo = new Layer(); + hiddenLayerTwo.addNeuron(new Neuron()); + hiddenLayerTwo.addNeuron(new Neuron()); + hiddenLayerTwo.addNeuron(new Neuron()); + hiddenLayerTwo.addNeuron(new Neuron()); + + Layer outputLayer = new Layer(); + outputLayer.addNeuron(new Neuron()); + + NeuralNetwork ann = new NeuralNetwork(); + + ann.addLayer(0, inputLayer); + ann.addLayer(1, hiddenLayerOne); + ConnectionFactory.fullConnect(ann.getLayerAt(0), ann.getLayerAt(1)); + ann.addLayer(2, hiddenLayerTwo); + ConnectionFactory.fullConnect(ann.getLayerAt(1), ann.getLayerAt(2)); + ann.addLayer(3, outputLayer); + ConnectionFactory.fullConnect(ann.getLayerAt(2), ann.getLayerAt(3)); + ConnectionFactory.fullConnect(ann.getLayerAt(0), ann.getLayerAt(ann.getLayersCount()-1), false); + + ann.setInputNeurons(inputLayer.getNeurons()); + ann.setOutputNeurons(outputLayer.getNeurons()); + + ann.setNetworkType(NeuralNetworkType.MULTI_LAYER_PERCEPTRON); + return ann; + } + + public static NeuralNetwork trainNeuralNetwork(NeuralNetwork ann) { + int inputSize = 2; + int outputSize = 1; + DataSet ds = new DataSet(inputSize, outputSize); + + DataSetRow rOne = new DataSetRow(new double[] {0, 1}, new double[] {1}); + ds.addRow(rOne); + DataSetRow rTwo = new DataSetRow(new double[] {1, 1}, new double[] {0}); + ds.addRow(rTwo); + DataSetRow rThree = new DataSetRow(new double[] {0, 0}, new double[] {0}); + ds.addRow(rThree); + DataSetRow rFour = new DataSetRow(new double[] {1, 0}, new double[] {1}); + ds.addRow(rFour); + + BackPropagation backPropagation = new BackPropagation(); + backPropagation.setMaxIterations(1000); + + ann.learn(ds, backPropagation); + return ann; + } +} diff --git a/libraries/src/main/java/com/baeldung/quartz/QuartzExample.java b/libraries/src/main/java/com/baeldung/quartz/QuartzExample.java index 20853aa01b..4757d912f8 100644 --- a/libraries/src/main/java/com/baeldung/quartz/QuartzExample.java +++ b/libraries/src/main/java/com/baeldung/quartz/QuartzExample.java @@ -20,44 +20,44 @@ public class QuartzExample { Scheduler sched = schedFact.getScheduler(); JobDetail job = JobBuilder.newJob(SimpleJob.class) - .withIdentity("myJob", "group1") - .usingJobData("jobSays", "Hello World!") - .usingJobData("myFloatValue", 3.141f) - .build(); + .withIdentity("myJob", "group1") + .usingJobData("jobSays", "Hello World!") + .usingJobData("myFloatValue", 3.141f) + .build(); Trigger trigger = TriggerBuilder.newTrigger() - .withIdentity("myTrigger", "group1") - .startNow() - .withSchedule(SimpleScheduleBuilder.simpleSchedule() - .withIntervalInSeconds(40) - .repeatForever()) - .build(); - + .withIdentity("myTrigger", "group1") + .startNow() + .withSchedule(SimpleScheduleBuilder.simpleSchedule() + .withIntervalInSeconds(40) + .repeatForever()) + .build(); + JobDetail jobA = JobBuilder.newJob(JobA.class) - .withIdentity("jobA", "group2") - .build(); - + .withIdentity("jobA", "group2") + .build(); + JobDetail jobB = JobBuilder.newJob(JobB.class) - .withIdentity("jobB", "group2") - .build(); - + .withIdentity("jobB", "group2") + .build(); + Trigger triggerA = TriggerBuilder.newTrigger() - .withIdentity("triggerA", "group2") - .startNow() - .withPriority(15) - .withSchedule(SimpleScheduleBuilder.simpleSchedule() - .withIntervalInSeconds(40) - .repeatForever()) - .build(); - - Trigger triggerB = TriggerBuilder.newTrigger() - .withIdentity("triggerB", "group2") - .startNow() - .withPriority(10) - .withSchedule(SimpleScheduleBuilder.simpleSchedule() - .withIntervalInSeconds(20) - .repeatForever()) - .build(); + .withIdentity("triggerA", "group2") + .startNow() + .withPriority(15) + .withSchedule(SimpleScheduleBuilder.simpleSchedule() + .withIntervalInSeconds(40) + .repeatForever()) + .build(); + + Trigger triggerB = TriggerBuilder.newTrigger() + .withIdentity("triggerB", "group2") + .startNow() + .withPriority(10) + .withSchedule(SimpleScheduleBuilder.simpleSchedule() + .withIntervalInSeconds(20) + .repeatForever()) + .build(); sched.scheduleJob(job, trigger); sched.scheduleJob(jobA, triggerA); diff --git a/libraries/src/main/java/com/baeldung/quartz/SimpleJob.java b/libraries/src/main/java/com/baeldung/quartz/SimpleJob.java index 986c5e96e5..554d3b9358 100644 --- a/libraries/src/main/java/com/baeldung/quartz/SimpleJob.java +++ b/libraries/src/main/java/com/baeldung/quartz/SimpleJob.java @@ -9,13 +9,11 @@ public class SimpleJob implements Job { public void execute(JobExecutionContext context) throws JobExecutionException { JobDataMap dataMap = context.getJobDetail() - .getJobDataMap(); + .getJobDataMap(); String jobSays = dataMap.getString("jobSays"); float myFloatValue = dataMap.getFloat("myFloatValue"); System.out.println("Job says: " + jobSays + ", and val is: " + myFloatValue); - } - } \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/stm/Account.java b/libraries/src/main/java/com/baeldung/stm/Account.java index 734d332308..8b17f87120 100644 --- a/libraries/src/main/java/com/baeldung/stm/Account.java +++ b/libraries/src/main/java/com/baeldung/stm/Account.java @@ -10,20 +10,20 @@ public class Account { private final TxnLong lastUpdate; private final TxnInteger balance; - public Account(final int balance) { + Account(final int balance) { this.lastUpdate = StmUtils.newTxnLong(System.currentTimeMillis()); this.balance = StmUtils.newTxnInteger(balance); } - public Integer getBalance() { + Integer getBalance() { return balance.atomicGet(); } - public void adjustBy(final int amount) { + void adjustBy(final int amount) { adjustBy(amount, System.currentTimeMillis()); } - public void adjustBy(final int amount, final long date) { + private void adjustBy(final int amount, final long date) { StmUtils.atomic(() -> { balance.increment(amount); lastUpdate.set(date); @@ -34,7 +34,7 @@ public class Account { }); } - public void transferTo(final Account other, final int amount) { + void transferTo(final Account other, final int amount) { StmUtils.atomic(() -> { final long date = System.currentTimeMillis(); adjustBy(-amount, date); @@ -45,6 +45,6 @@ public class Account { @Override public String toString() { return StmUtils.atomic((TxnCallable) - txn -> "Balance: " + balance.get(txn) + " lastUpdateDate: " + lastUpdate.get(txn)); + txn -> "Balance: " + balance.get(txn) + " lastUpdateDate: " + lastUpdate.get(txn)); } } \ No newline at end of file diff --git a/libraries/src/main/java/com/baeldung/zip/ZipCollectionExample.java b/libraries/src/main/java/com/baeldung/zip/ZipCollectionExample.java deleted file mode 100644 index 3df9baad69..0000000000 --- a/libraries/src/main/java/com/baeldung/zip/ZipCollectionExample.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.zip; - -import com.google.common.collect.Streams; -import org.jooq.lambda.Seq; - -import java.util.Arrays; -import java.util.List; -import java.util.stream.IntStream; - -public class ZipCollectionExample { - static List names = Arrays.asList("John", "Jane", "Jack", "Dennis"); - - static List ages = Arrays.asList(24, 25, 27); - - public static void main(String[] args) { - // Using Streams API from Guava 21 - Streams - .zip(names.stream(), ages.stream(), (name, age) -> name + ":" + age) - .forEach(System.out::println); - - // Using native Java 8 Int Stream - IntStream - .range(0, Math.min(names.size(), ages.size())) - .mapToObj(i -> names.get(i) + ":" + ages.get(i)) - .forEach(System.out::println); - - // Using jOOL - Seq - .of("John", "Jane", "Dennis") - .zip(Seq.of(24, 25, 27)); - - Seq - .of("John", "Jane", "Dennis") - .zip(Seq.of(24, 25, 27), (x, y) -> x + ":" + y); - - Seq - .of("a", "b", "c") - .zipWithIndex(); - } -} diff --git a/libraries/src/test/java/com/baeldung/awaitility/AsyncServiceUnitTest.java b/libraries/src/test/java/com/baeldung/awaitility/AsyncServiceUnitTest.java index 677d989fba..43537965f8 100644 --- a/libraries/src/test/java/com/baeldung/awaitility/AsyncServiceUnitTest.java +++ b/libraries/src/test/java/com/baeldung/awaitility/AsyncServiceUnitTest.java @@ -3,7 +3,6 @@ package com.baeldung.awaitility; import org.awaitility.Awaitility; import org.awaitility.Duration; import org.junit.Before; -import org.junit.BeforeClass; import org.junit.Test; import java.util.concurrent.Callable; diff --git a/libraries/src/test/java/com/baeldung/bytebuddy/ByteBuddyUnitTest.java b/libraries/src/test/java/com/baeldung/bytebuddy/ByteBuddyUnitTest.java new file mode 100644 index 0000000000..6b7364a0a5 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/bytebuddy/ByteBuddyUnitTest.java @@ -0,0 +1,89 @@ +package com.baeldung.bytebuddy; + +import net.bytebuddy.ByteBuddy; +import net.bytebuddy.agent.ByteBuddyAgent; +import net.bytebuddy.dynamic.DynamicType; +import net.bytebuddy.dynamic.loading.ClassLoadingStrategy; +import net.bytebuddy.dynamic.loading.ClassReloadingStrategy; +import net.bytebuddy.implementation.FixedValue; +import net.bytebuddy.implementation.MethodDelegation; +import net.bytebuddy.matcher.ElementMatchers; +import org.junit.Test; + +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; + +import static net.bytebuddy.matcher.ElementMatchers.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class ByteBuddyUnitTest { + + @Test + public void givenObject_whenToString_thenReturnHelloWorldString() throws InstantiationException, IllegalAccessException { + DynamicType.Unloaded unloadedType = new ByteBuddy() + .subclass(Object.class) + .method(ElementMatchers.isToString()) + .intercept(FixedValue.value("Hello World ByteBuddy!")) + .make(); + + Class dynamicType = unloadedType.load(getClass().getClassLoader()) + .getLoaded(); + + assertEquals(dynamicType.newInstance().toString(), "Hello World ByteBuddy!"); + } + + @Test + public void givenFoo_whenRedefined_thenReturnFooRedefined() throws Exception { + ByteBuddyAgent.install(); + new ByteBuddy() + .redefine(Foo.class) + .method(named("sayHelloFoo")) + .intercept(FixedValue.value("Hello Foo Redefined")) + .make() + .load(Foo.class.getClassLoader(), ClassReloadingStrategy.fromInstalledAgent()); + Foo f = new Foo(); + assertEquals(f.sayHelloFoo(), "Hello Foo Redefined"); + } + + @Test + public void givenSayHelloFoo_whenMethodDelegation_thenSayHelloBar() throws IllegalAccessException, InstantiationException { + + String r = new ByteBuddy() + .subclass(Foo.class) + .method( + named("sayHelloFoo") + .and(isDeclaredBy(Foo.class) + .and(returns(String.class))) + ) + .intercept(MethodDelegation.to(Bar.class)) + .make() + .load(getClass().getClassLoader()) + .getLoaded() + .newInstance() + .sayHelloFoo(); + + assertEquals(r, Bar.sayHelloBar()); + } + + @Test + public void givenMethodName_whenDefineMethod_thenCreateMethod() throws Exception { + Class type = new ByteBuddy() + .subclass(Object.class) + .name("MyClassName") + .defineMethod("custom", String.class, Modifier.PUBLIC) + .intercept(MethodDelegation.to(Bar.class)) + .defineField("x", String.class, Modifier.PUBLIC) + .make() + .load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER) + .getLoaded(); + + Method m = type.getDeclaredMethod("custom", null); + + assertEquals(m.invoke(type.newInstance()), Bar.sayHelloBar()); + assertNotNull(type.getDeclaredField("x")); + + } + + +} diff --git a/libraries/src/test/java/com/baeldung/cglib/proxy/BeanGeneratorIntegrationTest.java b/libraries/src/test/java/com/baeldung/cglib/proxy/BeanGeneratorIntegrationTest.java index 033cc47c74..1224d73724 100644 --- a/libraries/src/test/java/com/baeldung/cglib/proxy/BeanGeneratorIntegrationTest.java +++ b/libraries/src/test/java/com/baeldung/cglib/proxy/BeanGeneratorIntegrationTest.java @@ -19,14 +19,14 @@ public class BeanGeneratorIntegrationTest { beanGenerator.addProperty("name", String.class); Object myBean = beanGenerator.create(); Method setter = myBean - .getClass() - .getMethod("setName", String.class); + .getClass() + .getMethod("setName", String.class); setter.invoke(myBean, "some string value set by a cglib"); //then Method getter = myBean - .getClass() - .getMethod("getName"); + .getClass() + .getMethod("getName"); assertEquals("some string value set by a cglib", getter.invoke(myBean)); } } diff --git a/libraries/src/test/java/com/baeldung/cglib/proxy/MixinUnitTest.java b/libraries/src/test/java/com/baeldung/cglib/proxy/MixinUnitTest.java index a89d9fe2c3..93b34bf92b 100644 --- a/libraries/src/test/java/com/baeldung/cglib/proxy/MixinUnitTest.java +++ b/libraries/src/test/java/com/baeldung/cglib/proxy/MixinUnitTest.java @@ -1,6 +1,10 @@ package com.baeldung.cglib.proxy; -import com.baeldung.cglib.mixin.*; +import com.baeldung.cglib.mixin.Class1; +import com.baeldung.cglib.mixin.Class2; +import com.baeldung.cglib.mixin.Interface1; +import com.baeldung.cglib.mixin.Interface2; +import com.baeldung.cglib.mixin.MixinInterface; import net.sf.cglib.proxy.Mixin; import org.junit.Test; @@ -12,8 +16,8 @@ public class MixinUnitTest { public void givenTwoClasses_whenMixedIntoOne_thenMixinShouldHaveMethodsFromBothClasses() throws Exception { //when Mixin mixin = Mixin.create( - new Class[]{Interface1.class, Interface2.class, MixinInterface.class}, - new Object[]{new Class1(), new Class2()} + new Class[]{Interface1.class, Interface2.class, MixinInterface.class}, + new Object[]{new Class1(), new Class2()} ); MixinInterface mixinDelegate = (MixinInterface) mixin; diff --git a/libraries/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueTest.java b/libraries/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueTest.java new file mode 100644 index 0000000000..e64aaed544 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/chronicle/queue/ChronicleQueueTest.java @@ -0,0 +1,43 @@ +package com.baeldung.chronicle.queue; + +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + +import org.junit.Test; + +import net.openhft.chronicle.Chronicle; +import net.openhft.chronicle.ChronicleQueueBuilder; +import net.openhft.chronicle.ExcerptTailer; +import net.openhft.chronicle.tools.ChronicleTools; + +public class ChronicleQueueTest { + + @Test + public void givenSetOfValues_whenWriteToQueue_thenWriteSuccesfully() throws IOException { + File queueDir = Files.createTempDirectory("chronicle-queue").toFile(); + ChronicleTools.deleteOnExit(queueDir.getPath()); + + Chronicle chronicle = ChronicleQueueBuilder.indexed(queueDir).build(); + String stringVal = "Hello World"; + int intVal = 101; + long longVal = System.currentTimeMillis(); + double doubleVal = 90.00192091d; + + ChronicleQueue.writeToQueue(chronicle, stringVal, intVal, longVal, doubleVal); + + ExcerptTailer tailer = chronicle.createTailer(); + while (tailer.nextIndex()) { + assertEquals(stringVal, tailer.readUTF()); + assertEquals(intVal, tailer.readInt()); + assertEquals(longVal, tailer.readLong()); + assertEquals((Double) doubleVal, (Double) tailer.readDouble()); + } + tailer.finish(); + tailer.close(); + chronicle.close(); + } + +} diff --git a/libraries/src/test/java/com/baeldung/circularfifoqueue/CircularFifoQueueTest.java b/libraries/src/test/java/com/baeldung/circularfifoqueue/CircularFifoQueueTest.java new file mode 100644 index 0000000000..9f670af03c --- /dev/null +++ b/libraries/src/test/java/com/baeldung/circularfifoqueue/CircularFifoQueueTest.java @@ -0,0 +1,159 @@ +package com.baeldung.circularfifoqueue; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.collections4.queue.CircularFifoQueue; +import org.junit.Assert; +import org.junit.Test; + +public class CircularFifoQueueTest { + + private static final int DEFAULT_SIZE = 32; + + private static final int FIXED_SIZE = 5; + + private static final int COLLECTION_SIZE = 7; + + private static final String TEST_COLOR = "Red"; + + private static final String TEST_COLOR_BY_INDEX = "Blue"; + + @Test + public void whenUsingDefualtConstructor_correctSizeQueue() { + CircularFifoQueue bits = new CircularFifoQueue<>(); + + Assert.assertEquals(DEFAULT_SIZE, bits.maxSize()); + } + + @Test + public void givenAddElements_whenUsingIntConstructor_correctSizeQueue() { + CircularFifoQueue colors = new CircularFifoQueue<>(5); + colors.add("Red"); + colors.add("Blue"); + colors.add("Green"); + colors.offer("White"); + colors.offer("Black"); + + Assert.assertEquals(FIXED_SIZE, colors.maxSize()); + } + + @Test + public void whenUsingCollectionConstructor_correctSizeQueue() { + List days = new ArrayList<>(); + days.add("Monday"); + days.add("Tuesday"); + days.add("Wednesday"); + days.add("Thursday"); + days.add("Friday"); + days.add("Saturday"); + days.add("Sunday"); + + CircularFifoQueue daysOfWeek = new CircularFifoQueue<>(days); + + Assert.assertEquals(COLLECTION_SIZE, daysOfWeek.maxSize()); + } + + @Test + public void givenAddElements_whenGetElement_correctElement() { + CircularFifoQueue colors = new CircularFifoQueue<>(5); + colors.add("Red"); + colors.add("Blue"); + colors.add("Green"); + colors.offer("White"); + colors.offer("Black"); + + Assert.assertEquals(TEST_COLOR_BY_INDEX, colors.get(1)); + } + + @Test + public void givenAddElements_whenPollElement_correctElement() { + CircularFifoQueue colors = new CircularFifoQueue<>(5); + colors.add("Red"); + colors.add("Blue"); + colors.add("Green"); + colors.offer("White"); + colors.offer("Black"); + + Assert.assertEquals(TEST_COLOR, colors.poll()); + } + + @Test + public void givenAddElements_whenPeekQueue_correctElement() { + CircularFifoQueue colors = new CircularFifoQueue<>(5); + colors.add("Red"); + colors.add("Blue"); + colors.add("Green"); + colors.offer("White"); + colors.offer("Black"); + + Assert.assertEquals(TEST_COLOR, colors.peek()); + } + + @Test + public void givenAddElements_whenElementQueue_correctElement() { + CircularFifoQueue colors = new CircularFifoQueue<>(5); + colors.add("Red"); + colors.add("Blue"); + colors.add("Green"); + colors.offer("White"); + colors.offer("Black"); + + Assert.assertEquals(TEST_COLOR, colors.element()); + } + + @Test + public void givenAddElements_whenRemoveElement_correctElement() { + CircularFifoQueue colors = new CircularFifoQueue<>(5); + colors.add("Red"); + colors.add("Blue"); + colors.add("Green"); + colors.offer("White"); + colors.offer("Black"); + + Assert.assertEquals(TEST_COLOR, colors.remove()); + } + + @Test + public void givenFullQueue_whenClearQueue_getIsEmpty() { + CircularFifoQueue colors = new CircularFifoQueue<>(5); + colors.add("Red"); + colors.add("Blue"); + colors.add("Green"); + colors.offer("White"); + colors.offer("Black"); + + colors.clear(); + + Assert.assertEquals(true, colors.isEmpty()); + } + + @Test + public void givenFullQueue_whenCheckFull_getIsFull() { + CircularFifoQueue colors = new CircularFifoQueue<>(5); + colors.add("Red"); + colors.add("Blue"); + colors.add("Green"); + colors.offer("White"); + colors.offer("Black"); + + Assert.assertEquals(false, colors.isFull()); + } + + @Test + public void givenFullQueue_whenAddMoreElements_getIsAtFullCapacity() { + CircularFifoQueue colors = new CircularFifoQueue<>(5); + colors.add("Red"); + colors.add("Blue"); + colors.add("Green"); + colors.offer("White"); + colors.offer("Black"); + + colors.add("Orange"); + colors.add("Violet"); + colors.add("Pink"); + + Assert.assertEquals(true, colors.isAtFullCapacity()); + } + +} diff --git a/libraries/src/test/java/com/baeldung/commons/chain/AtmChainTest.java b/libraries/src/test/java/com/baeldung/commons/chain/AtmChainTest.java new file mode 100644 index 0000000000..cd9a7baaf3 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/commons/chain/AtmChainTest.java @@ -0,0 +1,37 @@ +package com.baeldung.commons.chain; + +import org.apache.commons.chain.Catalog; +import org.apache.commons.chain.Command; +import org.apache.commons.chain.Context; +import org.junit.Assert; +import org.junit.Test; + +import static com.baeldung.commons.chain.AtmConstants.*; + +public class AtmChainTest { + + public static final int EXPECTED_TOTAL_AMOUNT_TO_BE_WITHDRAWN = 460; + public static final int EXPECTED_AMOUNT_LEFT_TO_BE_WITHDRAWN = 0; + public static final int EXPECTED_NO_OF_HUNDREDS_DISPENSED = 4; + public static final int EXPECTED_NO_OF_FIFTIES_DISPENSED = 1; + public static final int EXPECTED_NO_OF_TENS_DISPENSED = 1; + + @Test + public void givenInputsToContext_whenAppliedChain_thenExpectedContext() { + Context context = new AtmRequestContext(); + context.put(TOTAL_AMOUNT_TO_BE_WITHDRAWN, 460); + context.put(AMOUNT_LEFT_TO_BE_WITHDRAWN, 460); + Catalog catalog = new AtmCatalog(); + Command atmWithdrawalChain = catalog.getCommand(ATM_WITHDRAWAL_CHAIN); + try { + atmWithdrawalChain.execute(context); + } catch (Exception e) { + e.printStackTrace(); + } + Assert.assertEquals(EXPECTED_TOTAL_AMOUNT_TO_BE_WITHDRAWN, (int) context.get(TOTAL_AMOUNT_TO_BE_WITHDRAWN)); + Assert.assertEquals(EXPECTED_AMOUNT_LEFT_TO_BE_WITHDRAWN, (int) context.get(AMOUNT_LEFT_TO_BE_WITHDRAWN)); + Assert.assertEquals(EXPECTED_NO_OF_HUNDREDS_DISPENSED, (int) context.get(NO_OF_HUNDREDS_DISPENSED)); + Assert.assertEquals(EXPECTED_NO_OF_FIFTIES_DISPENSED, (int) context.get(NO_OF_FIFTIES_DISPENSED)); + Assert.assertEquals(EXPECTED_NO_OF_TENS_DISPENSED, (int) context.get(NO_OF_TENS_DISPENSED)); + } +} \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/commons/collections/BidiMapUnitTest.java b/libraries/src/test/java/com/baeldung/commons/collections/BidiMapUnitTest.java index 64a3932fb3..e46d8654a2 100644 --- a/libraries/src/test/java/com/baeldung/commons/collections/BidiMapUnitTest.java +++ b/libraries/src/test/java/com/baeldung/commons/collections/BidiMapUnitTest.java @@ -2,16 +2,12 @@ package com.baeldung.commons.collections; import org.apache.commons.collections4.BidiMap; import org.apache.commons.collections4.bidimap.DualHashBidiMap; -import org.apache.commons.collections4.bidimap.DualLinkedHashBidiMap; -import org.apache.commons.collections4.bidimap.DualTreeBidiMap; -import org.apache.commons.collections4.bidimap.TreeBidiMap; import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; -/** - * Created by smatt on 03/07/2017. - */ public class BidiMapUnitTest { @Test diff --git a/libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java b/libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java index 90e30b01dc..aa8b799c9d 100644 --- a/libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java +++ b/libraries/src/test/java/com/baeldung/commons/collections/CollectionUtilsGuideTest.java @@ -3,14 +3,17 @@ package com.baeldung.commons.collections; import com.baeldung.commons.collectionutil.Address; import com.baeldung.commons.collectionutil.Customer; -import org.apache.commons.collections4.Closure; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.Predicate; import org.apache.commons.collections4.Transformer; import org.junit.Before; import org.junit.Test; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.LinkedList; +import java.util.List; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -36,13 +39,13 @@ public class CollectionUtilsGuideTest { linkedList1 = new LinkedList<>(list1); } - + @Test public void givenList_whenAddIgnoreNull_thenNoNullAdded() { CollectionUtils.addIgnoreNull(list1, null); assertFalse(list1.contains(null)); } - + @Test public void givenTwoSortedLists_whenCollated_thenSorted() { List sortedList = CollectionUtils.collate(list1, list2); @@ -51,7 +54,7 @@ public class CollectionUtilsGuideTest { assertTrue(sortedList.get(0).getName().equals("Bob")); assertTrue(sortedList.get(2).getName().equals("Daniel")); } - + @Test public void givenListOfCustomers_whenTransformed_thenListOfAddress() { Collection
addressCol = CollectionUtils.collect(list1, new Transformer() { @@ -59,61 +62,61 @@ public class CollectionUtilsGuideTest { return new Address(customer.getLocality(), customer.getCity(), customer.getZip()); } }); - + List
addressList = new ArrayList<>(addressCol); assertTrue(addressList.size() == 3); assertTrue(addressList.get(0).getLocality().equals("locality1")); } - + @Test public void givenCustomerList_whenFiltered_thenCorrectSize() { boolean isModified = CollectionUtils.filter(linkedList1, new Predicate() { public boolean evaluate(Customer customer) { - return Arrays.asList("Daniel","Kyle").contains(customer.getName()); + return Arrays.asList("Daniel", "Kyle").contains(customer.getName()); } }); //filterInverse does the opposite. It removes the element from the list if the Predicate returns true //select and selectRejected work the same way except that they do not remove elements from the given collection and return a new collection - + assertTrue(isModified && linkedList1.size() == 2); } - + @Test public void givenNonEmptyList_whenCheckedIsNotEmpty_thenTrue() { List emptyList = new ArrayList<>(); List nullList = null; - + //Very handy at times where we want to check if a collection is not null and not empty too. //isNotEmpty does the opposite. Handy because using ! operator on isEmpty makes it missable while reading assertTrue(CollectionUtils.isNotEmpty(list1)); assertTrue(CollectionUtils.isEmpty(nullList)); assertTrue(CollectionUtils.isEmpty(emptyList)); } - + @Test public void givenCustomerListAndASubcollection_whenChecked_thenTrue() { assertTrue(CollectionUtils.isSubCollection(list3, list1)); } - + @Test public void givenTwoLists_whenIntersected_thenCheckSize() { Collection intersection = CollectionUtils.intersection(list1, list3); assertTrue(intersection.size() == 2); } - + @Test public void givenTwoLists_whenSubtracted_thenCheckElementNotPresentInA() { Collection result = CollectionUtils.subtract(list1, list3); assertFalse(result.contains(customer1)); } - + @Test public void givenTwoLists_whenUnioned_thenCheckElementPresentInResult() { Collection union = CollectionUtils.union(list1, list2); assertTrue(union.contains(customer1)); assertTrue(union.contains(customer4)); } - + } \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/commons/collections/MapUtilsTest.java b/libraries/src/test/java/com/baeldung/commons/collections/MapUtilsTest.java new file mode 100644 index 0000000000..4685d84781 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/commons/collections/MapUtilsTest.java @@ -0,0 +1,132 @@ +package com.baeldung.commons.collections; + +import org.apache.commons.collections4.MapIterator; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.collections4.PredicateUtils; +import org.apache.commons.collections4.TransformerUtils; +import org.assertj.core.api.Assertions; +import org.junit.Before; +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.collection.IsMapContaining.hasEntry; +import static org.hamcrest.collection.IsMapWithSize.aMapWithSize; +import static org.hamcrest.collection.IsMapWithSize.anEmptyMap; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + +public class MapUtilsTest { + + private String[][] color2DArray = new String[][]{ + {"RED", "#FF0000"}, + {"GREEN", "#00FF00"}, + {"BLUE", "#0000FF"} + }; + private String[] color1DArray = new String[]{ + "RED", "#FF0000", + "GREEN", "#00FF00", + "BLUE", "#0000FF" + }; + private Map colorMap; + + @Before + public void createMap() { + this.colorMap = MapUtils.putAll(new HashMap(), this.color2DArray); + } + + @Test + public void whenCreateMapFrom2DArray_theMapIsCreated() { + this.colorMap = MapUtils.putAll(new HashMap(), this.color2DArray); + + assertThat(this.colorMap, is(aMapWithSize(this.color2DArray.length))); + + assertThat(this.colorMap, hasEntry("RED", "#FF0000")); + assertThat(this.colorMap, hasEntry("GREEN", "#00FF00")); + assertThat(this.colorMap, hasEntry("BLUE", "#0000FF")); + } + + @Test + public void whenCreateMapFrom1DArray_theMapIsCreated() { + this.colorMap = MapUtils.putAll(new HashMap(), this.color1DArray); + + assertThat(this.colorMap, is(aMapWithSize(this.color1DArray.length / 2))); + + assertThat(this.colorMap, hasEntry("RED", "#FF0000")); + assertThat(this.colorMap, hasEntry("GREEN", "#00FF00")); + assertThat(this.colorMap, hasEntry("BLUE", "#0000FF")); + } + + @Test + public void whenVerbosePrintMap_thenMustPrintFormattedMap() { + MapUtils.verbosePrint(System.out, "Optional Label", this.colorMap); + } + + @Test + public void whenGetKeyNotPresent_thenMustReturnDefaultValue() { + String defaultColorStr = "COLOR_NOT_FOUND"; + String color = MapUtils.getString(this.colorMap, "BLACK", defaultColorStr); + + assertEquals(color, defaultColorStr); + } + + @Test + public void whenGetOnNullMap_thenMustReturnDefaultValue() { + String defaultColorStr = "COLOR_NOT_FOUND"; + String color = MapUtils.getString(null, "RED", defaultColorStr); + + assertEquals(color, defaultColorStr); + } + + @Test + public void whenInvertMap_thenMustReturnInvertedMap() { + Map invColorMap = MapUtils.invertMap(this.colorMap); + + int size = invColorMap.size(); + Assertions.assertThat(invColorMap) + .hasSameSizeAs(colorMap) + .containsKeys(this.colorMap.values().toArray(new String[size])) + .containsValues(this.colorMap.keySet().toArray(new String[size])); + } + + @Test(expected = IllegalArgumentException.class) + public void whenCreateFixedSizedMapAndAdd_thenMustThrowException() { + Map rgbMap = MapUtils.fixedSizeMap(MapUtils.putAll( + new HashMap(), + this.color1DArray)); + + rgbMap.put("ORANGE", "#FFA500"); + } + + @Test(expected = IllegalArgumentException.class) + public void whenAddDuplicateToUniqueValuesPredicateMap_thenMustThrowException() { + Map uniqValuesMap + = MapUtils.predicatedMap(this.colorMap, null, PredicateUtils.uniquePredicate()); + + uniqValuesMap.put("NEW_RED", "#FF0000"); + } + + @Test + public void whenCreateLazyMap_theMapIsCreated() { + Map intStrMap = MapUtils.lazyMap( + new HashMap(), + TransformerUtils.stringValueTransformer()); + + assertThat(intStrMap, is(anEmptyMap())); + + intStrMap.get(1); + intStrMap.get(2); + intStrMap.get(3); + + assertThat(intStrMap, is(aMapWithSize(3))); + } +} diff --git a/libraries/src/test/java/com/baeldung/commons/collections/SetUtilsUnitTest.java b/libraries/src/test/java/com/baeldung/commons/collections/SetUtilsUnitTest.java index 4d264e3aea..7d214bc5c5 100644 --- a/libraries/src/test/java/com/baeldung/commons/collections/SetUtilsUnitTest.java +++ b/libraries/src/test/java/com/baeldung/commons/collections/SetUtilsUnitTest.java @@ -11,9 +11,6 @@ import java.util.Set; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -/** - * Created by smatt on 21/06/2017. - */ public class SetUtilsUnitTest { @Test(expected = IllegalArgumentException.class) @@ -27,33 +24,33 @@ public class SetUtilsUnitTest { @Test public void givenTwoSets_whenDifference_thenSetView() { - Set a = new HashSet<>(Arrays.asList(1,2,5)); - Set b = new HashSet<>(Arrays.asList(1,2)); + Set a = new HashSet<>(Arrays.asList(1, 2, 5)); + Set b = new HashSet<>(Arrays.asList(1, 2)); SetUtils.SetView result = SetUtils.difference(a, b); assertTrue(result.size() == 1 && result.contains(5)); } @Test public void givenTwoSets_whenUnion_thenUnionResult() { - Set a = new HashSet<>(Arrays.asList(1,2,5)); - Set b = new HashSet<>(Arrays.asList(1,2)); - Set expected = new HashSet<>(Arrays.asList(1,2,5)); + Set a = new HashSet<>(Arrays.asList(1, 2, 5)); + Set b = new HashSet<>(Arrays.asList(1, 2)); + Set expected = new HashSet<>(Arrays.asList(1, 2, 5)); SetUtils.SetView union = SetUtils.union(a, b); assertTrue(SetUtils.isEqualSet(expected, union)); } @Test public void givenTwoSets_whenIntersection_thenIntersectionResult() { - Set a = new HashSet<>(Arrays.asList(1,2,5)); - Set b = new HashSet<>(Arrays.asList(1,2)); - Set expected = new HashSet<>(Arrays.asList(1,2)); + Set a = new HashSet<>(Arrays.asList(1, 2, 5)); + Set b = new HashSet<>(Arrays.asList(1, 2)); + Set expected = new HashSet<>(Arrays.asList(1, 2)); SetUtils.SetView intersect = SetUtils.intersection(a, b); assertTrue(SetUtils.isEqualSet(expected, intersect)); } @Test public void givenSet_whenTransformedSet_thenTransformedResult() { - Set a = SetUtils.transformedSet(new HashSet<>(), (e) -> e * 2 ); + Set a = SetUtils.transformedSet(new HashSet<>(), (e) -> e * 2); a.add(2); assertEquals(a.toArray()[0], 4); @@ -65,19 +62,19 @@ public class SetUtilsUnitTest { @Test public void givenTwoSet_whenDisjunction_thenDisjunctionSet() { - Set a = new HashSet<>(Arrays.asList(1,2,5)); - Set b = new HashSet<>(Arrays.asList(1,2,3)); + Set a = new HashSet<>(Arrays.asList(1, 2, 5)); + Set b = new HashSet<>(Arrays.asList(1, 2, 3)); SetUtils.SetView result = SetUtils.disjunction(a, b); assertTrue(result.toSet().contains(5) && result.toSet().contains(3)); } @Test public void givenSet_when_OrderedSet_thenMaintainElementOrder() { - Set set = new HashSet<>(Arrays.asList(10,1,5)); + Set set = new HashSet<>(Arrays.asList(10, 1, 5)); System.out.println("unordered set: " + set); Set orderedSet = SetUtils.orderedSet(new HashSet<>()); - orderedSet.addAll(Arrays.asList(10,1,5)); + orderedSet.addAll(Arrays.asList(10, 1, 5)); System.out.println("ordered set = " + orderedSet); } } \ No newline at end of file diff --git a/libraries/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java b/libraries/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java index 6b2777c289..7a05228e51 100644 --- a/libraries/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java +++ b/libraries/src/test/java/com/baeldung/commons/collections/orderedmap/OrderedMapUnitTest.java @@ -1,10 +1,5 @@ package com.baeldung.commons.collections.orderedmap; -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; - import org.apache.commons.collections4.OrderedMap; import org.apache.commons.collections4.OrderedMapIterator; import org.apache.commons.collections4.map.LinkedMap; @@ -12,6 +7,11 @@ import org.apache.commons.collections4.map.ListOrderedMap; import org.junit.Before; import org.junit.Test; +import java.util.ArrayList; +import java.util.List; + +import static org.junit.Assert.assertEquals; + public class OrderedMapUnitTest { private String[] names = {"Emily", "Mathew", "Rose", "John", "Anna"}; diff --git a/libraries/src/test/java/com/baeldung/commons/dbutils/DbUtilsUnitTest.java b/libraries/src/test/java/com/baeldung/commons/dbutils/DbUtilsUnitTest.java new file mode 100644 index 0000000000..bc7623589c --- /dev/null +++ b/libraries/src/test/java/com/baeldung/commons/dbutils/DbUtilsUnitTest.java @@ -0,0 +1,163 @@ +package com.baeldung.commons.dbutils; + +import org.apache.commons.dbutils.AsyncQueryRunner; +import org.apache.commons.dbutils.DbUtils; +import org.apache.commons.dbutils.QueryRunner; +import org.apache.commons.dbutils.handlers.BeanListHandler; +import org.apache.commons.dbutils.handlers.MapListHandler; +import org.apache.commons.dbutils.handlers.ScalarHandler; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +public class DbUtilsUnitTest { + + private Connection connection; + + @Before + public void setupDB() throws Exception { + Class.forName("org.h2.Driver"); + String db = "jdbc:h2:mem:;INIT=runscript from 'classpath:/employees.sql'"; + connection = DriverManager.getConnection(db); + } + + @After + public void closeBD() { + DbUtils.closeQuietly(connection); + } + + @Test + public void givenResultHandler_whenExecutingQuery_thenExpectedList() throws SQLException { + MapListHandler beanListHandler = new MapListHandler(); + + QueryRunner runner = new QueryRunner(); + List> list = runner.query(connection, "SELECT * FROM employee", beanListHandler); + + assertEquals(list.size(), 5); + assertEquals(list.get(0) + .get("firstname"), "John"); + assertEquals(list.get(4) + .get("firstname"), "Christian"); + } + + @Test + public void givenResultHandler_whenExecutingQuery_thenEmployeeList() throws SQLException { + BeanListHandler beanListHandler = new BeanListHandler<>(Employee.class); + + QueryRunner runner = new QueryRunner(); + List employeeList = runner.query(connection, "SELECT * FROM employee", beanListHandler); + + assertEquals(employeeList.size(), 5); + assertEquals(employeeList.get(0) + .getFirstName(), "John"); + assertEquals(employeeList.get(4) + .getFirstName(), "Christian"); + } + + @Test + public void givenResultHandler_whenExecutingQuery_thenExpectedScalar() throws SQLException { + ScalarHandler scalarHandler = new ScalarHandler<>(); + + QueryRunner runner = new QueryRunner(); + String query = "SELECT COUNT(*) FROM employee"; + long count = runner.query(connection, query, scalarHandler); + + assertEquals(count, 5); + } + + @Test + public void givenResultHandler_whenExecutingQuery_thenEmailsSetted() throws SQLException { + EmployeeHandler employeeHandler = new EmployeeHandler(connection); + + QueryRunner runner = new QueryRunner(); + List employees = runner.query(connection, "SELECT * FROM employee", employeeHandler); + + assertEquals(employees.get(0) + .getEmails() + .size(), 2); + assertEquals(employees.get(2) + .getEmails() + .size(), 3); + assertNotNull(employees.get(0).getEmails().get(0).getEmployeeId()); + } + + @Test + public void givenResultHandler_whenExecutingQuery_thenAllPropertiesSetted() throws SQLException { + EmployeeHandler employeeHandler = new EmployeeHandler(connection); + + QueryRunner runner = new QueryRunner(); + String query = "SELECT * FROM employee_legacy"; + List employees = runner.query(connection, query, employeeHandler); + + assertEquals((int) employees.get(0).getId(), 1); + assertEquals(employees.get(0).getFirstName(), "John"); + } + + @Test + public void whenInserting_thenInserted() throws SQLException { + QueryRunner runner = new QueryRunner(); + String insertSQL = "INSERT INTO employee (firstname,lastname,salary, hireddate) VALUES (?, ?, ?, ?)"; + + int numRowsInserted = runner.update(connection, insertSQL, "Leia", "Kane", 60000.60, new Date()); + + assertEquals(numRowsInserted, 1); + } + + @Test + public void givenHandler_whenInserting_thenExpectedId() throws SQLException { + ScalarHandler scalarHandler = new ScalarHandler<>(); + + QueryRunner runner = new QueryRunner(); + String insertSQL = "INSERT INTO employee (firstname,lastname,salary, hireddate) VALUES (?, ?, ?, ?)"; + + int newId = runner.insert(connection, insertSQL, scalarHandler, "Jenny", "Medici", 60000.60, new Date()); + + assertEquals(newId, 6); + } + + @Test + public void givenSalary_whenUpdating_thenUpdated() throws SQLException { + double salary = 35000; + + QueryRunner runner = new QueryRunner(); + String updateSQL = "UPDATE employee SET salary = salary * 1.1 WHERE salary <= ?"; + int numRowsUpdated = runner.update(connection, updateSQL, salary); + + assertEquals(numRowsUpdated, 3); + } + + @Test + public void whenDeletingRecord_thenDeleted() throws SQLException { + QueryRunner runner = new QueryRunner(); + String deleteSQL = "DELETE FROM employee WHERE id = ?"; + int numRowsDeleted = runner.update(connection, deleteSQL, 3); + + assertEquals(numRowsDeleted, 1); + } + + @Test + public void givenAsyncRunner_whenExecutingQuery_thenExpectedList() throws Exception { + AsyncQueryRunner runner = new AsyncQueryRunner(Executors.newCachedThreadPool()); + + EmployeeHandler employeeHandler = new EmployeeHandler(connection); + String query = "SELECT * FROM employee"; + Future> future = runner.query(connection, query, employeeHandler); + List employeeList = future.get(10, TimeUnit.SECONDS); + + assertEquals(employeeList.size(), 5); + } + +} diff --git a/libraries/src/test/java/com/baeldung/commons/lang3/StringUtilsUnitTest.java b/libraries/src/test/java/com/baeldung/commons/lang3/StringUtilsUnitTest.java index 15620455aa..191387d088 100644 --- a/libraries/src/test/java/com/baeldung/commons/lang3/StringUtilsUnitTest.java +++ b/libraries/src/test/java/com/baeldung/commons/lang3/StringUtilsUnitTest.java @@ -2,9 +2,10 @@ package com.baeldung.commons.lang3; import org.apache.commons.lang3.StringUtils; import org.junit.Test; + import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; public class StringUtilsUnitTest { @Test diff --git a/libraries/src/test/java/com/baeldung/hikaricp/HikariCPUnitTest.java b/libraries/src/test/java/com/baeldung/hikaricp/HikariCPIntegrationTest.java similarity index 88% rename from libraries/src/test/java/com/baeldung/hikaricp/HikariCPUnitTest.java rename to libraries/src/test/java/com/baeldung/hikaricp/HikariCPIntegrationTest.java index 1a1c5ef868..80588ecc03 100644 --- a/libraries/src/test/java/com/baeldung/hikaricp/HikariCPUnitTest.java +++ b/libraries/src/test/java/com/baeldung/hikaricp/HikariCPIntegrationTest.java @@ -6,7 +6,7 @@ import java.util.List; import static org.junit.Assert.assertEquals; -public class HikariCPUnitTest { +public class HikariCPIntegrationTest { @Test public void givenConnection_thenFetchDbData() { diff --git a/libraries/src/test/java/com/baeldung/hll/HLLUnitTest.java b/libraries/src/test/java/com/baeldung/hll/HLLUnitTest.java new file mode 100644 index 0000000000..8d09c99f0f --- /dev/null +++ b/libraries/src/test/java/com/baeldung/hll/HLLUnitTest.java @@ -0,0 +1,63 @@ +package com.baeldung.hll; + + +import com.google.common.hash.HashFunction; +import com.google.common.hash.Hashing; +import net.agkn.hll.HLL; +import org.assertj.core.data.Offset; +import org.junit.Test; + +import java.util.stream.LongStream; + +import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; + +public class HLLUnitTest { + + @Test + public void givenHLL_whenAddHugeAmountOfNumbers_thenShouldReturnEstimatedCardinality() { + //given + long numberOfElements = 100_000_000; + long toleratedDifference = 1_000_000; + HashFunction hashFunction = Hashing.murmur3_128(); + HLL hll = new HLL(14, 5); + + //when + LongStream.range(0, numberOfElements).forEach(element -> { + long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong(); + hll.addRaw(hashedValue); + } + ); + + //then + long cardinality = hll.cardinality(); + assertThat(cardinality).isCloseTo(numberOfElements, Offset.offset(toleratedDifference)); + } + + @Test + public void givenTwoHLLs_whenAddHugeAmountOfNumbers_thenShouldReturnEstimatedCardinalityForUnionOfHLLs() { + //given + long numberOfElements = 100_000_000; + long toleratedDifference = 1_000_000; + HashFunction hashFunction = Hashing.murmur3_128(); + HLL firstHll = new HLL(15, 5); + HLL secondHLL = new HLL(15, 5); + + //when + LongStream.range(0, numberOfElements).forEach(element -> { + long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong(); + firstHll.addRaw(hashedValue); + } + ); + + LongStream.range(numberOfElements, numberOfElements * 2).forEach(element -> { + long hashedValue = hashFunction.newHasher().putLong(element).hash().asLong(); + secondHLL.addRaw(hashedValue); + } + ); + + //then + firstHll.union(secondHLL); + long cardinality = firstHll.cardinality(); + assertThat(cardinality).isCloseTo(numberOfElements * 2, Offset.offset(toleratedDifference * 2)); + } +} diff --git a/libraries/src/test/java/com/baeldung/jasypt/JasyptUnitTest.java b/libraries/src/test/java/com/baeldung/jasypt/JasyptUnitTest.java index 39d54085e2..5e65c585aa 100644 --- a/libraries/src/test/java/com/baeldung/jasypt/JasyptUnitTest.java +++ b/libraries/src/test/java/com/baeldung/jasypt/JasyptUnitTest.java @@ -8,7 +8,9 @@ import org.jasypt.util.text.BasicTextEncryptor; import org.junit.Ignore; import org.junit.Test; -import static junit.framework.Assert.*; +import static junit.framework.Assert.assertFalse; +import static junit.framework.Assert.assertNotSame; +import static junit.framework.Assert.assertTrue; import static junit.framework.TestCase.assertEquals; public class JasyptUnitTest { @@ -30,7 +32,7 @@ public class JasyptUnitTest { } @Test - public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldBeSame(){ + public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldBeSame() { String password = "secret-pass"; BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor(); String encryptedPassword = passwordEncryptor.encryptPassword(password); @@ -43,7 +45,7 @@ public class JasyptUnitTest { } @Test - public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldNotBeSame(){ + public void givenTextPassword_whenOneWayEncryption_thenCompareEncryptedPasswordsShouldNotBeSame() { String password = "secret-pass"; BasicPasswordEncryptor passwordEncryptor = new BasicPasswordEncryptor(); String encryptedPassword = passwordEncryptor.encryptPassword(password); @@ -56,7 +58,6 @@ public class JasyptUnitTest { } - @Test @Ignore("should have installed local_policy.jar") public void givenTextPrivateData_whenDecrypt_thenCompareToEncryptedWithCustomAlgorithm() { @@ -77,7 +78,7 @@ public class JasyptUnitTest { @Test @Ignore("should have installed local_policy.jar") - public void givenTextPrivateData_whenDecryptOnHighPerformance_thenDecrypt(){ + public void givenTextPrivateData_whenDecryptOnHighPerformance_thenDecrypt() { //given String privateData = "secret-data"; PooledPBEStringEncryptor encryptor = new PooledPBEStringEncryptor(); diff --git a/libraries/src/test/java/com/baeldung/jdo/GuideToJDOIntegrationTest.java b/libraries/src/test/java/com/baeldung/jdo/GuideToJDOIntegrationTest.java index 578f9ff902..e916a229f7 100644 --- a/libraries/src/test/java/com/baeldung/jdo/GuideToJDOIntegrationTest.java +++ b/libraries/src/test/java/com/baeldung/jdo/GuideToJDOIntegrationTest.java @@ -8,7 +8,6 @@ import javax.jdo.PersistenceManager; import javax.jdo.PersistenceManagerFactory; import javax.jdo.Query; import javax.jdo.Transaction; -import java.util.Iterator; import java.util.List; import static org.junit.Assert.assertEquals; diff --git a/libraries/src/test/java/com/baeldung/neuroph/XORTest.java b/libraries/src/test/java/com/baeldung/neuroph/XORTest.java new file mode 100644 index 0000000000..063c57195b --- /dev/null +++ b/libraries/src/test/java/com/baeldung/neuroph/XORTest.java @@ -0,0 +1,50 @@ +package com.baeldung.neuroph; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.neuroph.core.NeuralNetwork; + +import static org.junit.Assert.*; + +public class XORTest { + private NeuralNetwork ann = null; + + @Before + public void annInit() { + ann = NeurophXOR.trainNeuralNetwork(NeurophXOR.assembleNeuralNetwork()); + } + + @Test + public void leftDisjunctTest() { + ann.setInput(0, 1); + ann.calculate(); + assertEquals(ann.getOutput()[0], 1.0,0.0); + } + + @Test + public void rightDisjunctTest() { + ann.setInput(1, 0); + ann.calculate(); + assertEquals(ann.getOutput()[0], 1.0,0.0); + } + + @Test + public void bothFalseConjunctTest() { + ann.setInput(0, 0); + ann.calculate(); + assertEquals(ann.getOutput()[0], 0.0,0.0); + } + + @Test + public void bothTrueConjunctTest() { + ann.setInput(1, 1); + ann.calculate(); + assertEquals(ann.getOutput()[0], 0.0,0.0); + } + + @After + public void annClose() { + ann = null; + } +} diff --git a/libraries/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java b/libraries/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java index 2952938cd9..b152b22964 100644 --- a/libraries/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java +++ b/libraries/src/test/java/com/baeldung/pact/PactConsumerDrivenContractUnitTest.java @@ -8,7 +8,11 @@ import au.com.dius.pact.consumer.dsl.PactDslWithProvider; import au.com.dius.pact.model.RequestResponsePact; import org.junit.Rule; import org.junit.Test; -import org.springframework.http.*; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; import java.util.HashMap; @@ -20,7 +24,7 @@ public class PactConsumerDrivenContractUnitTest { @Rule public PactProviderRuleMk2 mockProvider - = new PactProviderRuleMk2("test_provider", "localhost", 8080, this); + = new PactProviderRuleMk2("test_provider", "localhost", 8080, this); @Pact(consumer = "test_consumer") public RequestResponsePact createPact(PactDslWithProvider builder) { @@ -28,25 +32,25 @@ public class PactConsumerDrivenContractUnitTest { headers.put("Content-Type", "application/json"); return builder - .given("test GET ") - .uponReceiving("GET REQUEST") - .path("/") - .method("GET") - .willRespondWith() - .status(200) - .headers(headers) - .body("{\"condition\": true, \"name\": \"tom\"}") - .given("test POST") - .uponReceiving("POST REQUEST") - .method("POST") - .headers(headers) - .body("{\"name\": \"Michael\"}") - .path("/create") - .willRespondWith() - .status(201) - .headers(headers) - .body("") - .toPact(); + .given("test GET ") + .uponReceiving("GET REQUEST") + .path("/") + .method("GET") + .willRespondWith() + .status(200) + .headers(headers) + .body("{\"condition\": true, \"name\": \"tom\"}") + .given("test POST") + .uponReceiving("POST REQUEST") + .method("POST") + .headers(headers) + .body("{\"name\": \"Michael\"}") + .path("/create") + .willRespondWith() + .status(201) + .headers(headers) + .body("") + .toPact(); } @@ -55,7 +59,7 @@ public class PactConsumerDrivenContractUnitTest { public void givenGet_whenSendRequest_shouldReturn200WithProperHeaderAndBody() { //when ResponseEntity response - = new RestTemplate().getForEntity(mockProvider.getUrl(), String.class); + = new RestTemplate().getForEntity(mockProvider.getUrl(), String.class); //then assertThat(response.getStatusCode().value()).isEqualTo(200); @@ -69,10 +73,10 @@ public class PactConsumerDrivenContractUnitTest { //when ResponseEntity postResponse = new RestTemplate().exchange( - mockProvider.getUrl() + "/create", - HttpMethod.POST, - new HttpEntity<>(jsonBody, httpHeaders), - String.class + mockProvider.getUrl() + "/create", + HttpMethod.POST, + new HttpEntity<>(jsonBody, httpHeaders), + String.class ); //then diff --git a/libraries/src/test/java/com/baeldung/pcollections/PCollectionsUnitTest.java b/libraries/src/test/java/com/baeldung/pcollections/PCollectionsUnitTest.java new file mode 100644 index 0000000000..23f9abf2f3 --- /dev/null +++ b/libraries/src/test/java/com/baeldung/pcollections/PCollectionsUnitTest.java @@ -0,0 +1,90 @@ +package com.baeldung.pcollections; + +import org.junit.Test; +import org.pcollections.*; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class PCollectionsUnitTest { + + @Test + public void whenEmpty_thenCreateEmptyHashPMap() { + HashPMap pmap = HashTreePMap.empty(); + assertEquals(pmap.size(), 0); + } + + @Test + public void givenKeyValue_whenSingleton_thenCreateNonEmptyHashPMap() { + HashPMap pmap1 = HashTreePMap.singleton("key1", "value1"); + assertEquals(pmap1.size(), 1); + } + + @Test + public void givenExistingHashMap_whenFrom_thenCreateHashPMap() { + Map map = new HashMap(); + map.put("mkey1", "mval1"); + map.put("mkey2", "mval2"); + + HashPMap pmap2 = HashTreePMap.from(map); + assertEquals(pmap2.size(), 2); + } + + @Test + public void whenHashPMapMethods_thenPerformOperations() { + + HashPMap pmap = HashTreePMap.empty(); + HashPMap pmap0 = pmap.plus("key1", "value1"); + + Map map = new HashMap(); + map.put("key2", "val2"); + map.put("key3", "val3"); + + HashPMap pmap1 = pmap0.plusAll(map); + HashPMap pmap2 = pmap1.minus("key1"); + HashPMap pmap3 = pmap2.minusAll(map.keySet()); + + assertEquals(pmap0.size(), 1); + assertEquals(pmap1.size(), 3); + assertFalse(pmap2.containsKey("key1")); + assertEquals(pmap3.size(), 0); + } + + @Test + public void whenTreePVectorMethods_thenPerformOperations() { + TreePVector pVector = TreePVector.empty(); + + TreePVector pV1 = pVector.plus("e1"); + TreePVector pV2 = pV1.plusAll(Arrays.asList("e2", "e3", "e4")); + assertEquals(1, pV1.size()); + assertEquals(4, pV2.size()); + + TreePVector pV3 = pV2.minus("e1"); + TreePVector pV4 = pV3.minusAll(Arrays.asList("e2", "e3", "e4")); + assertEquals(pV3.size(), 3); + assertEquals(pV4.size(), 0); + + TreePVector pSub = pV2.subList(0, 2); + assertTrue(pSub.contains("e1") && pSub.contains("e2")); + + TreePVector pVW = (TreePVector) pV2.with(0, "e10"); + assertEquals(pVW.get(0), "e10"); + } + + @Test + public void whenMapPSetMethods_thenPerformOperations() { + + MapPSet pSet = HashTreePSet.empty() + .plusAll(Arrays.asList("e1","e2","e3","e4")); + assertEquals(pSet.size(), 4); + + MapPSet pSet1 = pSet.minus("e4"); + assertFalse(pSet1.contains("e4")); + } + +} diff --git a/libraries/src/test/java/com/baeldung/text/WordUtilsTest.java b/libraries/src/test/java/com/baeldung/text/WordUtilsTest.java index b9268d67b3..fafba2fbb5 100644 --- a/libraries/src/test/java/com/baeldung/text/WordUtilsTest.java +++ b/libraries/src/test/java/com/baeldung/text/WordUtilsTest.java @@ -13,11 +13,11 @@ public class WordUtilsTest { Assert.assertEquals("To Be Capitalized!", result); } - + @Test public void whenContainsWords_thenCorrect() { boolean containsWords = WordUtils.containsAllWords("String to search", "to", "search"); - + Assert.assertTrue(containsWords); } } diff --git a/libraries/src/test/resources/employees.sql b/libraries/src/test/resources/employees.sql new file mode 100644 index 0000000000..c6109724cf --- /dev/null +++ b/libraries/src/test/resources/employees.sql @@ -0,0 +1,43 @@ +CREATE TABLE employee( + id int NOT NULL PRIMARY KEY auto_increment, + firstname varchar(255), + lastname varchar(255), + salary double, + hireddate date +); + +CREATE TABLE email( + id int NOT NULL PRIMARY KEY auto_increment, + employeeid int, + address varchar(255) +); + +CREATE TABLE employee_legacy( + id int NOT NULL PRIMARY KEY auto_increment, + first_name varchar(255), + last_name varchar(255), + salary double, + hired_date date +); + + +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('John', 'Doe', 10000.10, to_date('01-01-2001','dd-mm-yyyy')); +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Kevin', 'Smith', 20000.20, to_date('02-02-2002','dd-mm-yyyy')); +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Kim', 'Smith', 30000.30, to_date('03-03-2003','dd-mm-yyyy')); +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Stephen', 'Torvalds', 40000.40, to_date('04-04-2004','dd-mm-yyyy')); +INSERT INTO employee (firstname,lastname,salary,hireddate) VALUES ('Christian', 'Reynolds', 50000.50, to_date('05-05-2005','dd-mm-yyyy')); + +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('John', 'Doe', 10000.10, to_date('01-01-2001','dd-mm-yyyy')); +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Kevin', 'Smith', 20000.20, to_date('02-02-2002','dd-mm-yyyy')); +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Kim', 'Smith', 30000.30, to_date('03-03-2003','dd-mm-yyyy')); +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Stephen', 'Torvalds', 40000.40, to_date('04-04-2004','dd-mm-yyyy')); +INSERT INTO employee_legacy (first_name,last_name,salary,hired_date) VALUES ('Christian', 'Reynolds', 50000.50, to_date('05-05-2005','dd-mm-yyyy')); + +INSERT INTO email (employeeid,address) VALUES (1, 'john@baeldung.com'); +INSERT INTO email (employeeid,address) VALUES (1, 'john@gmail.com'); +INSERT INTO email (employeeid,address) VALUES (2, 'kevin@baeldung.com'); +INSERT INTO email (employeeid,address) VALUES (3, 'kim@baeldung.com'); +INSERT INTO email (employeeid,address) VALUES (3, 'kim@gmail.com'); +INSERT INTO email (employeeid,address) VALUES (3, 'kim@outlook.com'); +INSERT INTO email (employeeid,address) VALUES (4, 'stephen@baeldung.com'); +INSERT INTO email (employeeid,address) VALUES (5, 'christian@gmail.com'); diff --git a/liquibase/README.md b/liquibase/README.md new file mode 100644 index 0000000000..0e5bfcb8a6 --- /dev/null +++ b/liquibase/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Introduction to Liquibase Rollback](http://www.baeldung.com/liquibase-rollback) diff --git a/log-mdc/README.md b/log-mdc/README.md index be0b2670c3..3841224824 100644 --- a/log-mdc/README.md +++ b/log-mdc/README.md @@ -2,6 +2,7 @@ - TBD - [Improved Java Logging with Mapped Diagnostic Context (MDC)](http://www.baeldung.com/mdc-in-log4j-2-logback) - [Java Logging with Nested Diagnostic Context (NDC)](http://www.baeldung.com/java-logging-ndc-log4j) +- [Drools Using Rules from Excel Files](http://www.baeldung.com/drools-excel) ### References diff --git a/metrics/README.md b/metrics/README.md index c98024c479..09fe925604 100644 --- a/metrics/README.md +++ b/metrics/README.md @@ -1,3 +1,4 @@ ## Relevant articles: - [Intro to Dropwizard Metrics](http://www.baeldung.com/dropwizard-metrics) +- [Introduction to Netflix Servo](http://www.baeldung.com/netflix-servo) diff --git a/metrics/pom.xml b/metrics/pom.xml index 794c53b157..574c1ac132 100644 --- a/metrics/pom.xml +++ b/metrics/pom.xml @@ -1,6 +1,6 @@ + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 @@ -15,7 +15,7 @@ 3.1.2 3.1.0 - 0.12.16 + 0.12.17 @@ -44,10 +44,24 @@ javax.servlet-api ${dep.ver.servlet} + com.netflix.servo servo-core ${netflix.servo.ver} + test + + + com.netflix.servo + servo-atlas + ${netflix.servo.ver} + test + + + com.fasterxml.jackson.dataformat + jackson-dataformat-smile + 2.8.9 + test diff --git a/metrics/src/test/java/com/baeldung/metrics/servo/AtlasObserverLiveTest.java b/metrics/src/test/java/com/baeldung/metrics/servo/AtlasObserverLiveTest.java new file mode 100644 index 0000000000..cc2d3aa393 --- /dev/null +++ b/metrics/src/test/java/com/baeldung/metrics/servo/AtlasObserverLiveTest.java @@ -0,0 +1,95 @@ +package com.baeldung.metrics.servo; + +import com.netflix.servo.DefaultMonitorRegistry; +import com.netflix.servo.monitor.BasicCounter; +import com.netflix.servo.monitor.Counter; +import com.netflix.servo.monitor.MonitorConfig; +import com.netflix.servo.publish.BasicMetricFilter; +import com.netflix.servo.publish.MonitorRegistryMetricPoller; +import com.netflix.servo.publish.PollRunnable; +import com.netflix.servo.publish.PollScheduler; +import com.netflix.servo.publish.atlas.AtlasMetricObserver; +import com.netflix.servo.publish.atlas.BasicAtlasConfig; +import com.netflix.servo.tag.BasicTagList; +import org.apache.commons.lang.math.RandomUtils; +import org.apache.http.HttpEntity; +import org.apache.http.impl.client.HttpClients; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.apache.http.client.methods.RequestBuilder.get; +import static org.hamcrest.CoreMatchers.containsString; +import static org.hamcrest.CoreMatchers.not; +import static org.junit.Assert.assertThat; + +/** + * @author aiet + */ +public class AtlasObserverLiveTest { + + private final String atlasUri = "http://localhost:7101/api/v1"; + + @Before + public void prepareScheduler() { + System.setProperty("servo.pollers", "1000"); + System.setProperty("servo.atlas.batchSize", "1"); + System.setProperty("servo.atlas.uri", atlasUri + "/publish"); + AtlasMetricObserver observer = new AtlasMetricObserver(new BasicAtlasConfig(), BasicTagList.of("servo", "counter")); + + PollRunnable task = new PollRunnable(new MonitorRegistryMetricPoller(), new BasicMetricFilter(true), observer); + PollScheduler + .getInstance() + .start(); + PollScheduler + .getInstance() + .addPoller(task, 1, SECONDS); + } + + @After + public void stopScheduler() { + if (PollScheduler + .getInstance() + .isStarted()) { + PollScheduler + .getInstance() + .stop(); + } + } + + private String atlasValuesOfTag(String tagname) throws Exception { + HttpEntity entity = HttpClients + .createDefault() + .execute(get() + .setUri(atlasUri + "/tags/" + tagname) + .build()) + .getEntity(); + return new BufferedReader(new InputStreamReader(entity.getContent())).readLine(); + } + + @Test + public void givenAtlasAndCounter_whenRegister_thenPublishedToAtlas() throws Exception { + Counter counter = new BasicCounter(MonitorConfig + .builder("test") + .withTag("servo", "counter") + .build()); + DefaultMonitorRegistry + .getInstance() + .register(counter); + assertThat(atlasValuesOfTag("servo"), not(containsString("counter"))); + + for (int i = 0; i < 3; i++) { + counter.increment(RandomUtils.nextInt(10)); + SECONDS.sleep(1); + counter.increment(-1 * RandomUtils.nextInt(10)); + SECONDS.sleep(1); + } + + assertThat(atlasValuesOfTag("servo"), containsString("counter")); + } + +} diff --git a/mockito/pom.xml b/mockito/pom.xml index c77d42f97d..19dd2f6468 100644 --- a/mockito/pom.xml +++ b/mockito/pom.xml @@ -41,7 +41,7 @@ org.powermock - powermock-api-mockito + powermock-api-mockito2 ${powermock.version} test @@ -65,7 +65,7 @@ 3.5 - 1.6.6 + 1.7.0 diff --git a/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorForPartialMocking.java b/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorForPartialMocking.java index 771444f13d..9a3bc8875b 100644 --- a/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorForPartialMocking.java +++ b/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorForPartialMocking.java @@ -1,12 +1,12 @@ package com.baeldung.powermockito.introduction; -public class CollaboratorForPartialMocking { +class CollaboratorForPartialMocking { - public static String staticMethod() { + static String staticMethod() { return "Hello Baeldung!"; } - public final String finalMethod() { + final String finalMethod() { return "Hello Baeldung!"; } @@ -14,7 +14,7 @@ public class CollaboratorForPartialMocking { return "Hello Baeldung!"; } - public String privateMethodCaller() { + String privateMethodCaller() { return privateMethod() + " Welcome to the Java world."; } } \ No newline at end of file diff --git a/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorWithFinalMethods.java b/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorWithFinalMethods.java index 8287454782..f748b6a6fc 100644 --- a/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorWithFinalMethods.java +++ b/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorWithFinalMethods.java @@ -1,8 +1,8 @@ package com.baeldung.powermockito.introduction; -public class CollaboratorWithFinalMethods { +class CollaboratorWithFinalMethods { - public final String helloMethod() { + final String helloMethod() { return "Hello World!"; } diff --git a/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorWithStaticMethods.java b/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorWithStaticMethods.java index 2795ae97f1..1f416aefa7 100644 --- a/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorWithStaticMethods.java +++ b/mockito/src/test/java/com/baeldung/powermockito/introduction/CollaboratorWithStaticMethods.java @@ -1,16 +1,16 @@ package com.baeldung.powermockito.introduction; -public class CollaboratorWithStaticMethods { +class CollaboratorWithStaticMethods { - public static String firstMethod(String name) { + static String firstMethod(String name) { return "Hello " + name + " !"; } - public static String secondMethod() { + static String secondMethod() { return "Hello no one!"; } - public static String thirdMethod() { + static String thirdMethod() { return "Hello no one again!"; } } \ No newline at end of file diff --git a/mockito/src/test/java/org/baeldung/mockito/MockitoAnnotationIntegrationTest.java b/mockito/src/test/java/org/baeldung/mockito/MockitoAnnotationIntegrationTest.java index 4e090e6652..5e083adbf5 100644 --- a/mockito/src/test/java/org/baeldung/mockito/MockitoAnnotationIntegrationTest.java +++ b/mockito/src/test/java/org/baeldung/mockito/MockitoAnnotationIntegrationTest.java @@ -17,7 +17,7 @@ public class MockitoAnnotationIntegrationTest { private List mockedList; @Spy - List spiedList = new ArrayList(); + private List spiedList = new ArrayList<>(); @Before public void init() { @@ -87,6 +87,7 @@ public class MockitoAnnotationIntegrationTest { } @Captor + private ArgumentCaptor argCaptor; @Test @@ -98,10 +99,10 @@ public class MockitoAnnotationIntegrationTest { } @Mock - Map wordMap; + private Map wordMap; @InjectMocks - MyDictionary dic = new MyDictionary(); + private MyDictionary dic = new MyDictionary(); @Test public void whenUseInjectMocksAnnotation_thenCorrect() { diff --git a/mockito/src/test/java/org/baeldung/mockito/MockitoMockIntegrationTest.java b/mockito/src/test/java/org/baeldung/mockito/MockitoMockIntegrationTest.java index 6ec3b34db5..f846907fd7 100644 --- a/mockito/src/test/java/org/baeldung/mockito/MockitoMockIntegrationTest.java +++ b/mockito/src/test/java/org/baeldung/mockito/MockitoMockIntegrationTest.java @@ -24,7 +24,7 @@ public class MockitoMockIntegrationTest { } @Rule - public ExpectedException thrown = ExpectedException.none(); + private ExpectedException thrown = ExpectedException.none(); @Test public void whenUsingSimpleMock_thenCorrect() { diff --git a/mockito/src/test/java/org/baeldung/mockito/MyDictionary.java b/mockito/src/test/java/org/baeldung/mockito/MyDictionary.java index a613b28f59..8a0ea92502 100644 --- a/mockito/src/test/java/org/baeldung/mockito/MyDictionary.java +++ b/mockito/src/test/java/org/baeldung/mockito/MyDictionary.java @@ -3,19 +3,19 @@ package org.baeldung.mockito; import java.util.HashMap; import java.util.Map; -public class MyDictionary { +class MyDictionary { - Map wordMap; + private Map wordMap; - public MyDictionary() { - wordMap = new HashMap(); + MyDictionary() { + wordMap = new HashMap<>(); } public void add(final String word, final String meaning) { wordMap.put(word, meaning); } - public String getMeaning(final String word) { + String getMeaning(final String word) { return wordMap.get(word); } } diff --git a/mockito/src/test/java/org/baeldung/mockito/MyList.java b/mockito/src/test/java/org/baeldung/mockito/MyList.java index 548596e6b6..be69ef8a8a 100644 --- a/mockito/src/test/java/org/baeldung/mockito/MyList.java +++ b/mockito/src/test/java/org/baeldung/mockito/MyList.java @@ -2,7 +2,7 @@ package org.baeldung.mockito; import java.util.AbstractList; -public class MyList extends AbstractList { +class MyList extends AbstractList { @Override public String get(final int index) { diff --git a/mockito2/pom.xml b/mockito2/pom.xml index 523cfa816d..a7c4683c30 100644 --- a/mockito2/pom.xml +++ b/mockito2/pom.xml @@ -53,6 +53,6 @@ UTF-8 - 2.7.5 + 2.8.9 diff --git a/mocks/mock-comparisons/pom.xml b/mocks/mock-comparisons/pom.xml index 2ab35651f1..e350457f54 100644 --- a/mocks/mock-comparisons/pom.xml +++ b/mocks/mock-comparisons/pom.xml @@ -13,7 +13,7 @@ mock-comparisons - 1.10.19 + 2.8.9 3.4 1.29 diff --git a/mocks/mock-comparisons/src/test/java/org/baeldung/mocks/mockito/LoginControllerIntegrationTest.java b/mocks/mock-comparisons/src/test/java/org/baeldung/mocks/mockito/LoginControllerIntegrationTest.java index 18bc2ae189..8f8918ab22 100644 --- a/mocks/mock-comparisons/src/test/java/org/baeldung/mocks/mockito/LoginControllerIntegrationTest.java +++ b/mocks/mock-comparisons/src/test/java/org/baeldung/mocks/mockito/LoginControllerIntegrationTest.java @@ -7,7 +7,12 @@ import org.baeldung.mocks.testCase.UserForm; import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import org.mockito.*; +import org.mockito.ArgumentMatcher; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; public class LoginControllerIntegrationTest { @@ -41,50 +46,63 @@ public class LoginControllerIntegrationTest { public void assertTwoMethodsHaveBeenCalled() { UserForm userForm = new UserForm(); userForm.username = "foo"; - Mockito.when(loginService.login(userForm)).thenReturn(true); + Mockito.when(loginService.login(userForm)) + .thenReturn(true); String login = loginController.login(userForm); Assert.assertEquals("OK", login); - Mockito.verify(loginService).login(userForm); - Mockito.verify(loginService).setCurrentUser("foo"); + Mockito.verify(loginService) + .login(userForm); + Mockito.verify(loginService) + .setCurrentUser("foo"); } @Test public void assertOnlyOneMethodHasBeenCalled() { UserForm userForm = new UserForm(); userForm.username = "foo"; - Mockito.when(loginService.login(userForm)).thenReturn(false); + Mockito.when(loginService.login(userForm)) + .thenReturn(false); String login = loginController.login(userForm); Assert.assertEquals("KO", login); - Mockito.verify(loginService).login(userForm); + Mockito.verify(loginService) + .login(userForm); Mockito.verifyNoMoreInteractions(loginService); } @Test public void mockExceptionThrowing() { UserForm userForm = new UserForm(); - Mockito.when(loginService.login(userForm)).thenThrow(IllegalArgumentException.class); + Mockito.when(loginService.login(userForm)) + .thenThrow(IllegalArgumentException.class); String login = loginController.login(userForm); Assert.assertEquals("ERROR", login); - Mockito.verify(loginService).login(userForm); + Mockito.verify(loginService) + .login(userForm); Mockito.verifyZeroInteractions(loginService); } @Test public void mockAnObjectToPassAround() { - UserForm userForm = Mockito.when(Mockito.mock(UserForm.class).getUsername()).thenReturn("foo").getMock(); - Mockito.when(loginService.login(userForm)).thenReturn(true); + UserForm userForm = Mockito.when(Mockito.mock(UserForm.class) + .getUsername()) + .thenReturn("foo") + .getMock(); + Mockito.when(loginService.login(userForm)) + .thenReturn(true); String login = loginController.login(userForm); Assert.assertEquals("OK", login); - Mockito.verify(loginService).login(userForm); - Mockito.verify(loginService).setCurrentUser("foo"); + Mockito.verify(loginService) + .login(userForm); + Mockito.verify(loginService) + .setCurrentUser("foo"); } @Test @@ -92,19 +110,22 @@ public class LoginControllerIntegrationTest { UserForm userForm = new UserForm(); userForm.username = "foo"; // default matcher - Mockito.when(loginService.login(Mockito.any(UserForm.class))).thenReturn(true); + Mockito.when(loginService.login(Mockito.any(UserForm.class))) + .thenReturn(true); String login = loginController.login(userForm); Assert.assertEquals("OK", login); - Mockito.verify(loginService).login(userForm); + Mockito.verify(loginService) + .login(userForm); // complex matcher - Mockito.verify(loginService).setCurrentUser(Mockito.argThat(new ArgumentMatcher() { - @Override - public boolean matches(Object argument) { - return argument instanceof String && ((String) argument).startsWith("foo"); - } - })); + Mockito.verify(loginService) + .setCurrentUser(Mockito.argThat(new ArgumentMatcher() { + @Override + public boolean matches(String argument) { + return argument.startsWith("foo"); + } + })); } @Test @@ -114,12 +135,14 @@ public class LoginControllerIntegrationTest { UserForm userForm = new UserForm(); userForm.username = "foo"; // let service's login use implementation so let's mock DAO call - Mockito.when(loginDao.login(userForm)).thenReturn(1); + Mockito.when(loginDao.login(userForm)) + .thenReturn(1); String login = loginController.login(userForm); Assert.assertEquals("OK", login); // verify mocked call - Mockito.verify(spiedLoginService).setCurrentUser("foo"); + Mockito.verify(spiedLoginService) + .setCurrentUser("foo"); } } diff --git a/mockserver/pom.xml b/mockserver/pom.xml new file mode 100644 index 0000000000..8d3e97f129 --- /dev/null +++ b/mockserver/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + + com.baeldung + mockserver + 1.0.0-SNAPSHOT + + 3.10.8 + 4.4.1 + + + + + org.mock-server + mockserver-netty + ${mock-sever-netty-version} + + + + org.mock-server + mockserver-client-java + ${mock-sever-netty-version} + + + + org.apache.httpcomponents + httpclient + ${apche-http-version} + + + org.apache.httpcomponents + httpcore + ${apche-http-version} + + + + + + + maven-surefire-plugin + 2.20 + + + **/**LiveTest.java + + + + + + + \ No newline at end of file diff --git a/mockserver/src/main/java/com/baeldung/mock/server/ExpectationCallbackHandler.java b/mockserver/src/main/java/com/baeldung/mock/server/ExpectationCallbackHandler.java new file mode 100644 index 0000000000..a74dca28da --- /dev/null +++ b/mockserver/src/main/java/com/baeldung/mock/server/ExpectationCallbackHandler.java @@ -0,0 +1,23 @@ +package com.baeldung.mock.server; + +import org.mockserver.mock.action.ExpectationCallback; +import org.mockserver.model.HttpRequest; +import org.mockserver.model.HttpResponse; + +import static org.mockserver.model.HttpResponse.notFoundResponse; +import static org.mockserver.model.HttpResponse.response; + + +public class ExpectationCallbackHandler implements ExpectationCallback { + + public HttpResponse handle(HttpRequest httpRequest) { + if (httpRequest.getPath().getValue().endsWith("/callback")) { + return httpResponse; + } else { + return notFoundResponse(); + } + } + + public static HttpResponse httpResponse = response() + .withStatusCode(200); +} diff --git a/mockserver/src/test/java/com/baeldung/mock/server/MockServerLiveTest.java b/mockserver/src/test/java/com/baeldung/mock/server/MockServerLiveTest.java new file mode 100644 index 0000000000..e7b972f6a4 --- /dev/null +++ b/mockserver/src/test/java/com/baeldung/mock/server/MockServerLiveTest.java @@ -0,0 +1,173 @@ +package com.baeldung.mock.server; + +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.junit.*; +import org.mockserver.client.server.MockServerClient; +import org.mockserver.integration.ClientAndProxy; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.model.Header; +import org.mockserver.model.HttpForward; +import org.mockserver.verify.VerificationTimes; + +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +import static junit.framework.Assert.assertEquals; +import static org.mockserver.integration.ClientAndProxy.startClientAndProxy; +import static org.mockserver.integration.ClientAndServer.startClientAndServer; +import static org.mockserver.matchers.Times.exactly; +import static org.mockserver.model.HttpClassCallback.callback; +import static org.mockserver.model.HttpForward.forward; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; +import static org.mockserver.model.StringBody.exact; + +public class MockServerLiveTest { + + private static ClientAndServer mockServer; + + @BeforeClass + public static void startServer() { + mockServer = startClientAndServer(1080); + } + + + @Test + public void whenPostRequestMockServer_thenServerReceived(){ + createExpectationForInvalidAuth(); + hitTheServerWithPostRequest(); + verifyPostRequest(); + } + + @Test + public void whenPostRequestForInvalidAuth_then401Received(){ + createExpectationForInvalidAuth(); + org.apache.http.HttpResponse response = hitTheServerWithPostRequest(); + assertEquals(401, response.getStatusLine().getStatusCode()); + } + + @Test + public void whenGetRequest_ThenForward(){ + createExpectationForForward(); + hitTheServerWithGetRequest("index.html"); + verifyGetRequest(); + + } + + @Test + public void whenCallbackRequest_ThenCallbackMethodCalled(){ + createExpectationForCallBack(); + org.apache.http.HttpResponse response= hitTheServerWithGetRequest("/callback"); + assertEquals(200,response.getStatusLine().getStatusCode()); + } + + private void verifyPostRequest() { + new MockServerClient("localhost", 1080).verify( + request() + .withMethod("POST") + .withPath("/validate") + .withBody(exact("{username: 'foo', password: 'bar'}")), + VerificationTimes.exactly(1) + ); + } + private void verifyGetRequest() { + new MockServerClient("localhost", 1080).verify( + request() + .withMethod("GET") + .withPath("/index.html"), + VerificationTimes.exactly(1) + ); + } + + private org.apache.http.HttpResponse hitTheServerWithPostRequest() { + String url = "http://127.0.0.1:1080/validate"; + HttpClient client = HttpClientBuilder.create().build(); + HttpPost post = new HttpPost(url); + post.setHeader("Content-type", "application/json"); + org.apache.http.HttpResponse response=null; + + try { + StringEntity stringEntity = new StringEntity("{username: 'foo', password: 'bar'}"); + post.getRequestLine(); + post.setEntity(stringEntity); + response=client.execute(post); + + } catch (Exception e) { + throw new RuntimeException(e); + } + return response; + } + + private org.apache.http.HttpResponse hitTheServerWithGetRequest(String page) { + String url = "http://127.0.0.1:1080/"+page; + HttpClient client = HttpClientBuilder.create().build(); + org.apache.http.HttpResponse response=null; + HttpGet get = new HttpGet(url); + try { + response=client.execute(get); + } catch (IOException e) { + throw new RuntimeException(e); + } + + return response; + } + + private void createExpectationForInvalidAuth() { + new MockServerClient("127.0.0.1", 1080) + .when( + request() + .withMethod("POST") + .withPath("/validate") + .withHeader("\"Content-type\", \"application/json\"") + .withBody(exact("{username: 'foo', password: 'bar'}")), + exactly(1) + ) + .respond( + response() + .withStatusCode(401) + .withHeaders( + new Header("Content-Type", "application/json; charset=utf-8"), + new Header("Cache-Control", "public, max-age=86400") + ) + .withBody("{ message: 'incorrect username and password combination' }") + .withDelay(TimeUnit.SECONDS,1) + ); + } + + private void createExpectationForForward(){ + new MockServerClient("127.0.0.1", 1080) + .when( + request() + .withMethod("GET") + .withPath("/index.html"), + exactly(1) + ) + .forward( + forward() + .withHost("www.mock-server.com") + .withPort(80) + .withScheme(HttpForward.Scheme.HTTP) + ); + } + + private void createExpectationForCallBack(){ + mockServer + .when( + request() + .withPath("/callback") + ) + .callback( + callback() + .withCallbackClass("com.baeldung.mock.server.ExpectationCallbackHandler") + ); + } + + @AfterClass + public static void stopServer() { + mockServer.stop(); + } +} diff --git a/pom.xml b/pom.xml index 818d131359..6641155044 100644 --- a/pom.xml +++ b/pom.xml @@ -12,10 +12,13 @@ UTF-8 refs/heads/master + true + false + false 4.12 1.3 - 1.10.19 + 2.8.9 1.7.21 1.1.7 @@ -25,6 +28,7 @@ + spring-activiti aws akka-streams algorithms @@ -57,6 +61,7 @@ guava guava18 guava19 + guava21 guice disruptor @@ -208,6 +213,7 @@ spring-zuul spring-reactor spring-vertx + testing testng @@ -228,6 +234,7 @@ drools liquibase spring-boot-property-exp + mockserver @@ -324,11 +331,11 @@ - + 3.4 + diff --git a/ratpack/pom.xml b/ratpack/pom.xml index 8681f5fc10..7a75ec50b7 100644 --- a/ratpack/pom.xml +++ b/ratpack/pom.xml @@ -1,55 +1,64 @@ - 4.0.0 - com.baeldung - ratpack - jar - 1.0-SNAPSHOT - ratpack - http://maven.apache.org + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + com.baeldung + ratpack + jar + 1.0-SNAPSHOT + ratpack + http://maven.apache.org - - UTF-8 - 1.8 - 1.8 - + + UTF-8 + 1.8 + 1.8 + 1.4.6 + com.baeldung parent-modules 1.0.0-SNAPSHOT - - - - - io.ratpack - ratpack-core - 1.4.5 - - - io.ratpack - ratpack-hikari - 1.4.5 - - - io.ratpack - ratpack-test - 1.4.5 - - - com.h2database - h2 - 1.4.193 - - + - - ${project.artifactId} - - - src/main/resources - - - + + + + io.ratpack + ratpack-spring-boot-starter + ${ratpack.version} + pom + + + + io.ratpack + ratpack-core + ${ratpack.version} + + + io.ratpack + ratpack-hikari + ${ratpack.version} + + + io.ratpack + ratpack-test + ${ratpack.version} + + + com.h2database + h2 + 1.4.193 + + + + + ${project.artifactId} + + + src/main/resources + + + diff --git a/ratpack/src/main/java/com/baeldung/spring/ArticleList.java b/ratpack/src/main/java/com/baeldung/spring/ArticleList.java new file mode 100644 index 0000000000..b4d50bb3d3 --- /dev/null +++ b/ratpack/src/main/java/com/baeldung/spring/ArticleList.java @@ -0,0 +1,11 @@ +package com.baeldung.spring; + +import java.util.List; + +/** + * @author aiet + */ +public interface ArticleList { + + List articles(); +} diff --git a/ratpack/src/main/java/com/baeldung/spring/Config.java b/ratpack/src/main/java/com/baeldung/spring/Config.java new file mode 100644 index 0000000000..ec0d1787e6 --- /dev/null +++ b/ratpack/src/main/java/com/baeldung/spring/Config.java @@ -0,0 +1,24 @@ +package com.baeldung.spring; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.util.Arrays; + +/** + * @author aiet + */ +@Configuration +public class Config { + + @Bean + public Content content() { + return () -> "hello baeldung!"; + } + + @Bean + public ArticleList articles() { + return () -> Arrays.asList("Introduction to Ratpack", "Ratpack Google Guice Integration", "Ratpack Spring Boot Integration"); + } + +} diff --git a/ratpack/src/main/java/com/baeldung/spring/Content.java b/ratpack/src/main/java/com/baeldung/spring/Content.java new file mode 100644 index 0000000000..4d01c70cb9 --- /dev/null +++ b/ratpack/src/main/java/com/baeldung/spring/Content.java @@ -0,0 +1,10 @@ +package com.baeldung.spring; + +/** + * @author aiet + */ +public interface Content { + + String body(); + +} diff --git a/ratpack/src/main/java/com/baeldung/spring/EmbedRatpackApp.java b/ratpack/src/main/java/com/baeldung/spring/EmbedRatpackApp.java new file mode 100644 index 0000000000..7f3483d676 --- /dev/null +++ b/ratpack/src/main/java/com/baeldung/spring/EmbedRatpackApp.java @@ -0,0 +1,46 @@ +package com.baeldung.spring; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import ratpack.func.Action; +import ratpack.handling.Chain; +import ratpack.server.ServerConfig; +import ratpack.spring.config.EnableRatpack; + +/** + * @author aiet + */ +@SpringBootApplication +@EnableRatpack +public class EmbedRatpackApp { + + @Autowired private Content content; + @Autowired private ArticleList list; + + @Bean + public Action hello() { + return chain -> chain.get("hello", ctx -> ctx.render(content.body())); + } + + @Bean + public Action list() { + return chain -> chain.get("list", ctx -> ctx.render(list + .articles() + .toString())); + } + + @Bean + public ServerConfig ratpackServerConfig() { + return ServerConfig + .builder() + .findBaseDir("public") + .build(); + } + + public static void main(String[] args) { + SpringApplication.run(EmbedRatpackApp.class, args); + } + +} diff --git a/ratpack/src/main/java/com/baeldung/spring/EmbedSpringBootApp.java b/ratpack/src/main/java/com/baeldung/spring/EmbedSpringBootApp.java new file mode 100644 index 0000000000..05ff00cbbd --- /dev/null +++ b/ratpack/src/main/java/com/baeldung/spring/EmbedSpringBootApp.java @@ -0,0 +1,19 @@ +package com.baeldung.spring; + +import ratpack.server.RatpackServer; + +import static ratpack.spring.Spring.spring; + +public class EmbedSpringBootApp { + + public static void main(String[] args) throws Exception { + RatpackServer.start(server -> server + .registry(spring(Config.class)) + .handlers(chain -> chain.get(ctx -> ctx.render(ctx + .get(Content.class) + .body())))); + } + +} + + diff --git a/ratpack/src/main/resources/public/index.html b/ratpack/src/main/resources/public/index.html new file mode 100644 index 0000000000..d6573bfb7f --- /dev/null +++ b/ratpack/src/main/resources/public/index.html @@ -0,0 +1,10 @@ + + + + + Special Static Resource + + +This page is static. + + \ No newline at end of file diff --git a/ratpack/src/test/java/com/baeldung/spring/EmbedRatpackAppIntegrationTest.java b/ratpack/src/test/java/com/baeldung/spring/EmbedRatpackAppIntegrationTest.java new file mode 100644 index 0000000000..802fe75d5c --- /dev/null +++ b/ratpack/src/test/java/com/baeldung/spring/EmbedRatpackAppIntegrationTest.java @@ -0,0 +1,41 @@ +package com.baeldung.spring; + +import org.junit.Test; +import ratpack.test.MainClassApplicationUnderTest; + +import java.io.IOException; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +/** + * @author aiet + */ +public class EmbedRatpackAppIntegrationTest { + + MainClassApplicationUnderTest appUnderTest = new MainClassApplicationUnderTest(EmbedRatpackApp.class); + + @Test + public void whenSayHello_thenGotWelcomeMessage() { + assertEquals("hello baeldung!", appUnderTest + .getHttpClient() + .getText("/hello")); + } + + @Test + public void whenRequestList_thenGotArticles() throws IOException { + assertEquals(3, appUnderTest + .getHttpClient() + .getText("/list") + .split(",").length); + } + + @Test + public void whenRequestStaticResource_thenGotStaticContent() { + assertThat(appUnderTest + .getHttpClient() + .getText("/"), containsString("page is static")); + } + +} diff --git a/selenium-junit-testng/README.md b/selenium-junit-testng/README.md index cc1b728287..29393b956b 100644 --- a/selenium-junit-testng/README.md +++ b/selenium-junit-testng/README.md @@ -1,3 +1,4 @@ ### Relevant Articles: - [Guide to Selenium with JUnit / TestNG](http://www.baeldung.com/java-selenium-with-junit-and-testng) - [Testing a Site with Selenium / Webdriver](http://www.baeldung.com) +- [Testing with Selenium/WebDriver and the Page Object Pattern](http://www.baeldung.com/selenium-webdriver-page-object) diff --git a/spring-5-mvc/README.md b/spring-5-mvc/README.md new file mode 100644 index 0000000000..c031a9d10e --- /dev/null +++ b/spring-5-mvc/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Spring Boot and Kotlin](http://www.baeldung.com/spring-boot-kotlin) diff --git a/spring-5/README.md b/spring-5/README.md index 510ee45f03..03b8121f90 100644 --- a/spring-5/README.md +++ b/spring-5/README.md @@ -7,4 +7,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Concurrent Test Execution in Spring 5](http://www.baeldung.com/spring-5-concurrent-tests) - [Introduction to the Functional Web Framework in Spring 5](http://www.baeldung.com/spring-5-functional-web) -- [Exploring the Spring MVC URL Matching Improvements](http://www.baeldung.com/spring-mvc-url-matching) +- [Exploring the Spring 5 MVC URL Matching Improvements](http://www.baeldung.com/spring-5-mvc-url-matching) + + diff --git a/spring-activiti/pom.xml b/spring-activiti/pom.xml new file mode 100644 index 0000000000..3d2f1386df --- /dev/null +++ b/spring-activiti/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + com.example + spring-activiti + 0.0.1-SNAPSHOT + jar + + spring-activiti + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 1.5.4.RELEASE + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.activiti + activiti-spring-boot-starter-basic + 6.0.0 + + + org.springframework.boot + spring-boot-starter-web + + + + com.h2database + h2 + runtime + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java b/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java new file mode 100644 index 0000000000..3924d31f68 --- /dev/null +++ b/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiController.java @@ -0,0 +1,60 @@ +package com.example.activitiwithspring; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.activiti.engine.RuntimeService; +import org.activiti.engine.TaskService; +import org.activiti.engine.task.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class ActivitiController { + private static final Logger logger = LoggerFactory.getLogger(ActivitiController.class); + @Autowired + private RuntimeService runtimeService; + + @Autowired + private TaskService taskService; + + @GetMapping("/start-process") + public String startProcess() { + runtimeService.startProcessInstanceByKey("my-process"); + return "Process started. Number of currently running process instances = " + runtimeService.createProcessInstanceQuery() + .count(); + } + + @GetMapping("/get-tasks/{processInstanceId}") + public List getTasks(@PathVariable String processInstanceId) { + List usertasks = taskService.createTaskQuery() + .processInstanceId(processInstanceId) + .list(); + + List tasks = usertasks.stream().map(task -> { + TaskRepresentation taskRepresentation = new TaskRepresentation(task.getId(), task.getName(), task.getProcessInstanceId()); + return taskRepresentation; + }).collect(Collectors.toList()); + return tasks; + } + + @GetMapping("/complete-task-A/{processInstanceId}") + public TaskRepresentation completeTaskA(@PathVariable String processInstanceId) { + Task task = taskService.createTaskQuery() + .processInstanceId(processInstanceId) + .singleResult(); + taskService.complete(task.getId()); + logger.info("Task completed"); + task = taskService.createTaskQuery() + .processInstanceId(processInstanceId) + .singleResult(); + + return new TaskRepresentation(task.getId(), task.getName(), task.getProcessInstanceId()); + } +} diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java b/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java new file mode 100644 index 0000000000..e98b8ad7ca --- /dev/null +++ b/spring-activiti/src/main/java/com/example/activitiwithspring/ActivitiWithSpringApplication.java @@ -0,0 +1,12 @@ +package com.example.activitiwithspring; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ActivitiWithSpringApplication { + + public static void main(String[] args) { + SpringApplication.run(ActivitiWithSpringApplication.class, args); + } +} diff --git a/spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java b/spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java new file mode 100644 index 0000000000..bb1412b057 --- /dev/null +++ b/spring-activiti/src/main/java/com/example/activitiwithspring/TaskRepresentation.java @@ -0,0 +1,43 @@ +package com.example.activitiwithspring; + +class TaskRepresentation { + + private String id; + private String name; + private String processInstanceId; + + public TaskRepresentation() { + super(); + } + + public TaskRepresentation(String id, String name, String processInstanceId) { + this.id = id; + this.name = name; + this.processInstanceId = processInstanceId; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getProcessInstanceId() { + return processInstanceId; + } + + public void setProcessInstanceId(String processInstanceId) { + this.processInstanceId = processInstanceId; + } + +} diff --git a/spring-activiti/src/main/resources/processes/my-process.bpmn20.xml b/spring-activiti/src/main/resources/processes/my-process.bpmn20.xml new file mode 100644 index 0000000000..3ced8d6b7c --- /dev/null +++ b/spring-activiti/src/main/resources/processes/my-process.bpmn20.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerTest.java b/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerTest.java new file mode 100644 index 0000000000..3176207664 --- /dev/null +++ b/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiControllerTest.java @@ -0,0 +1,120 @@ +package com.example.activitiwithspring; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.List; + +import org.activiti.engine.RuntimeService; +import org.activiti.engine.runtime.ProcessInstance; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@SpringBootTest +public class ActivitiControllerTest { + private static final Logger logger = LoggerFactory.getLogger(ActivitiControllerTest.class); + private MockMvc mockMvc; + + @Autowired + private WebApplicationContext wac; + + @Autowired + RuntimeService runtimeService; + + @Before + public void setUp() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac) + .build(); + + for (ProcessInstance instance : runtimeService.createProcessInstanceQuery() + .list()) { + runtimeService.deleteProcessInstance(instance.getId(), "Reset Processes"); + } + } + + @Test + public void givenProcess_whenStartProcess_thenIncreaseInProcessInstanceCount() throws Exception { + + String responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/start-process")) + .andReturn() + .getResponse() + .getContentAsString(); + assertEquals("Process started. Number of currently running process instances = 1", responseBody); + + responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/start-process")) + .andReturn() + .getResponse() + .getContentAsString(); + assertEquals("Process started. Number of currently running process instances = 2", responseBody); + + responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/start-process")) + .andReturn() + .getResponse() + .getContentAsString(); + assertEquals("Process started. Number of currently running process instances = 3", responseBody); + } + + @Test + public void givenProcess_whenProcessInstance_thenReceivedRunningTask() throws Exception { + + this.mockMvc.perform(MockMvcRequestBuilders.get("/start-process")) + .andReturn() + .getResponse(); + ProcessInstance pi = runtimeService.createProcessInstanceQuery() + .orderByProcessInstanceId() + .desc() + .list() + .get(0); + + logger.info("process instance = " + pi.getId()); + String responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/get-tasks/" + pi.getId())) + .andReturn() + .getResponse() + .getContentAsString(); + + ObjectMapper mapper = new ObjectMapper(); + List tasks = Arrays.asList(mapper.readValue(responseBody, TaskRepresentation[].class)); + assertEquals(1, tasks.size()); + assertEquals("A", tasks.get(0).getName()); + + } + + @Test + public void givenProcess_whenCompleteTaskA_thenReceivedNextTask() throws Exception { + + this.mockMvc.perform(MockMvcRequestBuilders.get("/start-process")) + .andReturn() + .getResponse(); + ProcessInstance pi = runtimeService.createProcessInstanceQuery() + .orderByProcessInstanceId() + .desc() + .list() + .get(0); + + logger.info("process instance = " + pi.getId()); + String responseBody = this.mockMvc.perform(MockMvcRequestBuilders.get("/complete-task-A/" + pi.getId())) + .andReturn() + .getResponse() + .getContentAsString(); + + ObjectMapper mapper = new ObjectMapper(); + TaskRepresentation task = mapper.readValue(responseBody, TaskRepresentation.class); + assertEquals("B", task.getName()); + + } +} diff --git a/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationTests.java b/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationTests.java new file mode 100644 index 0000000000..da22c6c7fa --- /dev/null +++ b/spring-activiti/src/test/java/com/example/activitiwithspring/ActivitiWithSpringApplicationTests.java @@ -0,0 +1,16 @@ +package com.example.activitiwithspring; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class ActivitiWithSpringApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-boot-bootstrap/README.md b/spring-boot-bootstrap/README.md new file mode 100644 index 0000000000..75a2b35be7 --- /dev/null +++ b/spring-boot-bootstrap/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Bootstrap a Simple Application using Spring Boot](http://www.baeldung.com/spring-boot-start) diff --git a/spring-boot/README.MD b/spring-boot/README.MD index 9a4a9f3686..e837c88804 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -23,4 +23,7 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Create a Custom Auto-Configuration with Spring Boot](http://www.baeldung.com/spring-boot-custom-auto-configuration) - [Testing in Spring Boot](http://www.baeldung.com/spring-boot-testing) - [Guide to @ConfigurationProperties in Spring Boot](http://www.baeldung.com/configuration-properties-in-spring-boot) +- [How to Get All Spring-Managed Beans?](http://www.baeldung.com/spring-show-all-beans) +- [A Java Client for a WebSockets API](http://www.baeldung.com/websockets-api-java-spring-client) - [Spring Boot and Togglz Aspect](http://www.baeldung.com/spring-togglz) + diff --git a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java index 8d5eb56bf4..660b461ab6 100644 --- a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithServletComponentIntegrationTest.java @@ -14,15 +14,18 @@ import org.springframework.test.context.junit4.SpringRunner; import javax.servlet.FilterRegistration; import javax.servlet.ServletContext; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootAnnotatedApp.class) @AutoConfigureMockMvc -@TestPropertySource(properties = { "security.basic.enabled=false" }) +@TestPropertySource(properties = {"security.basic.enabled=false"}) public class SpringBootWithServletComponentIntegrationTest { - @Autowired private ServletContext servletContext; + @Autowired + private ServletContext servletContext; @Test public void givenServletContext_whenAccessAttrs_thenFoundAttrsPutInServletListner() { @@ -42,7 +45,8 @@ public class SpringBootWithServletComponentIntegrationTest { .contains("echo servlet")); } - @Autowired private TestRestTemplate restTemplate; + @Autowired + private TestRestTemplate restTemplate; @Test public void givenServletFilter_whenGetHello_thenRequestFiltered() { @@ -59,7 +63,6 @@ public class SpringBootWithServletComponentIntegrationTest { } - } diff --git a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java index 64507ad02c..31bb2ab195 100644 --- a/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/annotation/servletcomponentscan/SpringBootWithoutServletComponentIntegrationTest.java @@ -14,17 +14,21 @@ import org.springframework.test.context.junit4.SpringRunner; import javax.servlet.FilterRegistration; import javax.servlet.ServletContext; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = SpringBootPlainApp.class) @AutoConfigureMockMvc -@TestPropertySource(properties = { "security.basic.enabled=false" }) +@TestPropertySource(properties = {"security.basic.enabled=false"}) public class SpringBootWithoutServletComponentIntegrationTest { - @Autowired private ServletContext servletContext; + @Autowired + private ServletContext servletContext; - @Autowired private TestRestTemplate restTemplate; + @Autowired + private TestRestTemplate restTemplate; @Test public void givenServletContext_whenAccessAttrs_thenNotFound() { diff --git a/spring-boot/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java index dda9d69edd..e886042c8d 100644 --- a/spring-boot/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/autoconfiguration/AutoconfigurationIntegrationTest.java @@ -1,5 +1,8 @@ package com.baeldung.autoconfiguration; +import com.baeldung.autoconfiguration.example.AutoconfigurationApplication; +import com.baeldung.autoconfiguration.example.MyUser; +import com.baeldung.autoconfiguration.example.MyUserRepository; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -7,13 +10,9 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import com.baeldung.autoconfiguration.example.AutoconfigurationApplication; -import com.baeldung.autoconfiguration.example.MyUser; -import com.baeldung.autoconfiguration.example.MyUserRepository; - @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = AutoconfigurationApplication.class) -@EnableJpaRepositories(basePackages = { "com.baeldung.autoconfiguration.example" }) +@EnableJpaRepositories(basePackages = {"com.baeldung.autoconfiguration.example"}) public class AutoconfigurationIntegrationTest { @Autowired diff --git a/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java index 530b8e9cb3..413f6980ce 100644 --- a/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/displayallbeans/DisplayBeanIntegrationTest.java @@ -1,15 +1,5 @@ package com.baeldung.displayallbeans; -import static org.assertj.core.api.BDDAssertions.then; -import static org.hamcrest.CoreMatchers.hasItem; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -23,7 +13,15 @@ import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.context.WebApplicationContext; -import com.baeldung.displayallbeans.Application; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.assertj.core.api.BDDAssertions.then; +import static org.hamcrest.CoreMatchers.hasItem; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @@ -46,10 +44,10 @@ public class DisplayBeanIntegrationTest { public void givenRestTemplate_whenAccessServerUrl_thenHttpStatusOK() throws Exception { ResponseEntity entity = this.testRestTemplate.getForEntity( "http://localhost:" + this.port + "/displayallbeans", String.class); - + then(entity.getStatusCode()).isEqualTo(HttpStatus.OK); } - + @Test public void givenRestTemplate_whenAccessEndpointUrl_thenHttpStatusOK() throws Exception { @SuppressWarnings("rawtypes") @@ -68,14 +66,14 @@ public class DisplayBeanIntegrationTest { List> allBeans = (List) ((Map) entity.getBody().get(0)).get("beans"); List beanNamesList = allBeans.stream().map(x -> (String) x.get("bean")).collect(Collectors.toList()); - assertThat( beanNamesList, hasItem("fooController")); - assertThat( beanNamesList, hasItem("fooService")); + assertThat(beanNamesList, hasItem("fooController")); + assertThat(beanNamesList, hasItem("fooService")); } - + @Test public void givenWebApplicationContext_whenAccessGetBeanDefinitionNames_thenReturnsBeanNames() throws Exception { String[] beanNames = context.getBeanDefinitionNames(); - + List beanNamesList = Arrays.asList(beanNames); assertTrue(beanNamesList.contains("fooController")); assertTrue(beanNamesList.contains("fooService")); diff --git a/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java b/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java index af46fe0423..fa05dbab66 100644 --- a/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java +++ b/spring-boot/src/test/java/com/baeldung/intro/AppLiveTest.java @@ -18,7 +18,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringRunner.class) @SpringBootTest @AutoConfigureMockMvc -@TestPropertySource(properties = { "security.basic.enabled=false" }) +@TestPropertySource(properties = {"security.basic.enabled=false"}) public class AppLiveTest { @Autowired @@ -27,15 +27,15 @@ public class AppLiveTest { @Test public void getIndex() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(equalTo("Index Page"))); + .andExpect(status().isOk()) + .andExpect(content().string(equalTo("Index Page"))); } @Test public void getLocal() throws Exception { mvc.perform(MockMvcRequestBuilders.get("/local").accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(content().string(equalTo("/local"))); + .andExpect(status().isOk()) + .andExpect(content().string(equalTo("/local"))); } } \ No newline at end of file diff --git a/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java index e40678603b..ca6230e8f5 100644 --- a/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/toggle/ToggleIntegrationTest.java @@ -1,9 +1,5 @@ package com.baeldung.toggle; -import static org.junit.Assert.*; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -16,6 +12,10 @@ import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; +import static org.junit.Assert.assertEquals; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = ToggleApplication.class) @AutoConfigureMockMvc diff --git a/spring-boot/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java index 829c0a6ac4..edb40e9a1f 100644 --- a/spring-boot/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/utils/UtilsControllerIntegrationTest.java @@ -1,5 +1,6 @@ package com.baeldung.utils; +import com.baeldung.utils.controller.UtilsController; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; @@ -10,32 +11,29 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import com.baeldung.utils.controller.UtilsController; - public class UtilsControllerIntegrationTest { - @InjectMocks + @InjectMocks private UtilsController utilsController; - + private MockMvc mockMvc; - + @Before public void setup() { MockitoAnnotations.initMocks(this); this.mockMvc = MockMvcBuilders.standaloneSetup(utilsController) - .build(); + .build(); } - + @Test public void givenParameter_setRequestParam_andSetSessionAttribute() throws Exception { - String param = "testparam"; - this.mockMvc.perform( - post("/setParam") - .param("param", param) - .sessionAttr("parameter", param)) - .andExpect(status().isOk()); + String param = "testparam"; + this.mockMvc.perform( + post("/setParam") + .param("param", param) + .sessionAttr("parameter", param)) + .andExpect(status().isOk()); } - + } diff --git a/spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java b/spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java index f30c8ee4e7..b52ab5b1d3 100644 --- a/spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java +++ b/spring-boot/src/test/java/com/baeldung/websocket/client/MyStompSessionHandlerIntegrationTest.java @@ -6,11 +6,6 @@ import org.mockito.Mockito; import org.springframework.messaging.simp.stomp.StompHeaders; import org.springframework.messaging.simp.stomp.StompSession; -/** - * Test class for MyStompSessionHandler - * @author Kalyan - * - */ public class MyStompSessionHandlerIntegrationTest { @Test diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeControllerIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeControllerIntegrationTest.java index 2146fc09bc..6623a6396f 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeControllerIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeControllerIntegrationTest.java @@ -45,9 +45,9 @@ public class EmployeeControllerIntegrationTest { given(service.save(Mockito.anyObject())).willReturn(alex); mvc.perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON) - .content(JsonUtil.toJson(alex))) - .andExpect(status().isCreated()) - .andExpect(jsonPath("$.name", is("alex"))); + .content(JsonUtil.toJson(alex))) + .andExpect(status().isCreated()) + .andExpect(jsonPath("$.name", is("alex"))); verify(service, VerificationModeFactory.times(1)).save(Mockito.anyObject()); reset(service); } @@ -63,11 +63,11 @@ public class EmployeeControllerIntegrationTest { given(service.getAllEmployees()).willReturn(allEmployees); mvc.perform(get("/api/employees").contentType(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(jsonPath("$", hasSize(3))) - .andExpect(jsonPath("$[0].name", is(alex.getName()))) - .andExpect(jsonPath("$[1].name", is(john.getName()))) - .andExpect(jsonPath("$[2].name", is(bob.getName()))); + .andExpect(status().isOk()) + .andExpect(jsonPath("$", hasSize(3))) + .andExpect(jsonPath("$[0].name", is(alex.getName()))) + .andExpect(jsonPath("$[1].name", is(john.getName()))) + .andExpect(jsonPath("$[2].name", is(bob.getName()))); verify(service, VerificationModeFactory.times(1)).getAllEmployees(); reset(service); } diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRepositoryIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRepositoryIntegrationTest.java index ec599beedf..952ff19707 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRepositoryIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRepositoryIntegrationTest.java @@ -1,9 +1,5 @@ package org.baeldung.boot.boottest; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; - import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -11,6 +7,10 @@ import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.test.context.junit4.SpringRunner; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + @RunWith(SpringRunner.class) @DataJpaTest public class EmployeeRepositoryIntegrationTest { @@ -65,7 +65,7 @@ public class EmployeeRepositoryIntegrationTest { List allEmployees = employeeRepository.findAll(); assertThat(allEmployees).hasSize(3) - .extracting(Employee::getName) - .containsOnly(alex.getName(), ron.getName(), bob.getName()); + .extracting(Employee::getName) + .containsOnly(alex.getName(), ron.getName(), bob.getName()); } } diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java index 4c3a50f933..c1d8c52eb9 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeRestControllerIntegrationTest.java @@ -1,19 +1,5 @@ package org.baeldung.boot.boottest; -import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.greaterThanOrEqualTo; -import static org.hamcrest.Matchers.hasSize; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -import java.io.IOException; -import java.util.List; - import org.baeldung.boot.DemoApplication; import org.junit.After; import org.junit.Test; @@ -27,6 +13,20 @@ import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; +import java.io.IOException; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.hamcrest.Matchers.hasSize; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, classes = DemoApplication.class) @AutoConfigureMockMvc @@ -49,11 +49,11 @@ public class EmployeeRestControllerIntegrationTest { public void whenValidInput_thenCreateEmployee() throws IOException, Exception { Employee bob = new Employee("bob"); mvc.perform(post("/api/employees").contentType(MediaType.APPLICATION_JSON) - .content(JsonUtil.toJson(bob))); + .content(JsonUtil.toJson(bob))); List found = repository.findAll(); assertThat(found).extracting(Employee::getName) - .containsOnly("bob"); + .containsOnly("bob"); } @Test @@ -63,12 +63,12 @@ public class EmployeeRestControllerIntegrationTest { createTestEmployee("alex"); mvc.perform(get("/api/employees").contentType(MediaType.APPLICATION_JSON)) - .andDo(print()) - .andExpect(status().isOk()) - .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(jsonPath("$", hasSize(greaterThanOrEqualTo(2)))) - .andExpect(jsonPath("$[0].name", is("bob"))) - .andExpect(jsonPath("$[1].name", is("alex"))); + .andDo(print()) + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(jsonPath("$", hasSize(greaterThanOrEqualTo(2)))) + .andExpect(jsonPath("$[0].name", is("bob"))) + .andExpect(jsonPath("$[1].name", is("alex"))); } private void createTestEmployee(String name) { diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeServiceImplIntegrationTest.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeServiceImplIntegrationTest.java index 8038ae4373..5bd6b34c40 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeServiceImplIntegrationTest.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/EmployeeServiceImplIntegrationTest.java @@ -1,10 +1,5 @@ package org.baeldung.boot.boottest; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Arrays; -import java.util.List; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -16,6 +11,11 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Bean; import org.springframework.test.context.junit4.SpringRunner; +import java.util.Arrays; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + @RunWith(SpringRunner.class) public class EmployeeServiceImplIntegrationTest { @@ -44,27 +44,27 @@ public class EmployeeServiceImplIntegrationTest { List allEmployees = Arrays.asList(john, bob, alex); Mockito.when(employeeRepository.findByName(john.getName())) - .thenReturn(john); + .thenReturn(john); Mockito.when(employeeRepository.findByName(alex.getName())) - .thenReturn(alex); + .thenReturn(alex); Mockito.when(employeeRepository.findByName("wrong_name")) - .thenReturn(null); + .thenReturn(null); Mockito.when(employeeRepository.findById(john.getId())) - .thenReturn(john); + .thenReturn(john); Mockito.when(employeeRepository.findAll()) - .thenReturn(allEmployees); + .thenReturn(allEmployees); Mockito.when(employeeRepository.findById(-99L)) - .thenReturn(null); + .thenReturn(null); } @Test public void whenValidName_thenEmployeeShouldBeFound() { String name = "alex"; Employee found = employeeService.getEmployeeByName(name); - - assertThat(found.getName()) + + assertThat(found.getName()) .isEqualTo(name); - } + } @Test public void whenInValidName_thenEmployeeShouldNotBeFound() { @@ -114,25 +114,25 @@ public class EmployeeServiceImplIntegrationTest { List allEmployees = employeeService.getAllEmployees(); verifyFindAllEmployeesIsCalledOnce(); assertThat(allEmployees).hasSize(3) - .extracting(Employee::getName) - .contains(alex.getName(), john.getName(), bob.getName()); + .extracting(Employee::getName) + .contains(alex.getName(), john.getName(), bob.getName()); } private void verifyFindByNameIsCalledOnce(String name) { Mockito.verify(employeeRepository, VerificationModeFactory.times(1)) - .findByName(name); + .findByName(name); Mockito.reset(employeeRepository); } private void verifyFindByIdIsCalledOnce() { Mockito.verify(employeeRepository, VerificationModeFactory.times(1)) - .findById(Mockito.anyLong()); + .findById(Mockito.anyLong()); Mockito.reset(employeeRepository); } private void verifyFindAllEmployeesIsCalledOnce() { Mockito.verify(employeeRepository, VerificationModeFactory.times(1)) - .findAll(); + .findAll(); Mockito.reset(employeeRepository); } } diff --git a/spring-boot/src/test/java/org/baeldung/boot/boottest/JsonUtil.java b/spring-boot/src/test/java/org/baeldung/boot/boottest/JsonUtil.java index 3d532ce54a..36d07164b2 100644 --- a/spring-boot/src/test/java/org/baeldung/boot/boottest/JsonUtil.java +++ b/spring-boot/src/test/java/org/baeldung/boot/boottest/JsonUtil.java @@ -1,12 +1,12 @@ package org.baeldung.boot.boottest; -import java.io.IOException; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; -public class JsonUtil { - public static byte[] toJson(Object object) throws IOException { +import java.io.IOException; + +class JsonUtil { + static byte[] toJson(Object object) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); return mapper.writeValueAsBytes(object); diff --git a/spring-cloud/spring-cloud-bootstrap/README.MD b/spring-cloud/spring-cloud-bootstrap/README.MD index a174fba3dd..164219c185 100644 --- a/spring-cloud/spring-cloud-bootstrap/README.MD +++ b/spring-cloud/spring-cloud-bootstrap/README.MD @@ -2,9 +2,9 @@ - [Spring Cloud – Bootstrapping](http://www.baeldung.com/spring-cloud-bootstrapping) - [Spring Cloud – Securing Services](http://www.baeldung.com/spring-cloud-securing-services) - [Spring Cloud – Tracing Services with Zipkin](http://www.baeldung.com/tracing-services-with-zipkin) +- [Spring Cloud Series – The Gateway Pattern](http://www.baeldung.com/spring-cloud-gateway-pattern) - [Spring Cloud – Adding Angular 4](http://www.baeldung.com/spring-cloud-angular) - - To run the project: - copy the appliction-config folder to c:\Users\{username}\ on Windows or /Users/{username}/ on *nix. Then open a git bash terminal in application-config and run: - git init diff --git a/spring-data-mongodb/pom.xml b/spring-data-mongodb/pom.xml index 84d49a3e35..7060ec5b36 100644 --- a/spring-data-mongodb/pom.xml +++ b/spring-data-mongodb/pom.xml @@ -115,7 +115,7 @@ 4.3.4.RELEASE - 1.9.6.RELEASE + 1.10.4.RELEASE 2.9.0 4.1.4 diff --git a/spring-data-mongodb/src/main/java/org/baeldung/annotation/CascadeSave.java b/spring-data-mongodb/src/main/java/org/baeldung/annotation/CascadeSave.java index 9fba40245b..aae0214d09 100644 --- a/spring-data-mongodb/src/main/java/org/baeldung/annotation/CascadeSave.java +++ b/spring-data-mongodb/src/main/java/org/baeldung/annotation/CascadeSave.java @@ -8,5 +8,4 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) public @interface CascadeSave { - } diff --git a/spring-data-mongodb/src/main/java/org/baeldung/config/MongoConfig.java b/spring-data-mongodb/src/main/java/org/baeldung/config/MongoConfig.java index 6910245b2b..80b177f4c9 100644 --- a/spring-data-mongodb/src/main/java/org/baeldung/config/MongoConfig.java +++ b/spring-data-mongodb/src/main/java/org/baeldung/config/MongoConfig.java @@ -1,8 +1,7 @@ package org.baeldung.config; -import java.util.ArrayList; -import java.util.List; - +import com.mongodb.Mongo; +import com.mongodb.MongoClient; import org.baeldung.converter.UserWriterConverter; import org.baeldung.event.CascadeSaveMongoEventListener; import org.baeldung.event.UserCascadeSaveMongoEventListener; @@ -14,8 +13,8 @@ import org.springframework.data.mongodb.core.convert.CustomConversions; import org.springframework.data.mongodb.gridfs.GridFsTemplate; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; -import com.mongodb.Mongo; -import com.mongodb.MongoClient; +import java.util.ArrayList; +import java.util.List; @Configuration @EnableMongoRepositories(basePackages = "org.baeldung.repository") diff --git a/spring-data-mongodb/src/main/java/org/baeldung/config/SimpleMongoConfig.java b/spring-data-mongodb/src/main/java/org/baeldung/config/SimpleMongoConfig.java index 6140382f82..9653796d8d 100644 --- a/spring-data-mongodb/src/main/java/org/baeldung/config/SimpleMongoConfig.java +++ b/spring-data-mongodb/src/main/java/org/baeldung/config/SimpleMongoConfig.java @@ -1,13 +1,12 @@ package org.baeldung.config; +import com.mongodb.Mongo; +import com.mongodb.MongoClient; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.repository.config.EnableMongoRepositories; -import com.mongodb.Mongo; -import com.mongodb.MongoClient; - @Configuration @EnableMongoRepositories(basePackages = "org.baeldung.repository") public class SimpleMongoConfig { diff --git a/spring-data-mongodb/src/main/java/org/baeldung/converter/UserWriterConverter.java b/spring-data-mongodb/src/main/java/org/baeldung/converter/UserWriterConverter.java index 2dedda46ec..4a6970489e 100644 --- a/spring-data-mongodb/src/main/java/org/baeldung/converter/UserWriterConverter.java +++ b/spring-data-mongodb/src/main/java/org/baeldung/converter/UserWriterConverter.java @@ -1,11 +1,10 @@ package org.baeldung.converter; -import org.baeldung.model.User; -import org.springframework.core.convert.converter.Converter; -import org.springframework.stereotype.Component; - import com.mongodb.BasicDBObject; import com.mongodb.DBObject; +import org.baeldung.model.User; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; @Component public class UserWriterConverter implements Converter { diff --git a/spring-data-mongodb/src/main/java/org/baeldung/event/CascadeCallback.java b/spring-data-mongodb/src/main/java/org/baeldung/event/CascadeCallback.java index e01a1bc8c0..94cad4566a 100644 --- a/spring-data-mongodb/src/main/java/org/baeldung/event/CascadeCallback.java +++ b/spring-data-mongodb/src/main/java/org/baeldung/event/CascadeCallback.java @@ -12,7 +12,7 @@ public class CascadeCallback implements ReflectionUtils.FieldCallback { private Object source; private MongoOperations mongoOperations; - public CascadeCallback(final Object source, final MongoOperations mongoOperations) { + CascadeCallback(final Object source, final MongoOperations mongoOperations) { this.source = source; this.setMongoOperations(mongoOperations); } @@ -35,7 +35,7 @@ public class CascadeCallback implements ReflectionUtils.FieldCallback { } - public Object getSource() { + private Object getSource() { return source; } @@ -43,11 +43,11 @@ public class CascadeCallback implements ReflectionUtils.FieldCallback { this.source = source; } - public MongoOperations getMongoOperations() { + private MongoOperations getMongoOperations() { return mongoOperations; } - public void setMongoOperations(final MongoOperations mongoOperations) { + private void setMongoOperations(final MongoOperations mongoOperations) { this.mongoOperations = mongoOperations; } } diff --git a/spring-data-mongodb/src/main/java/org/baeldung/event/CascadeSaveMongoEventListener.java b/spring-data-mongodb/src/main/java/org/baeldung/event/CascadeSaveMongoEventListener.java index 79840fb570..acc377011d 100644 --- a/spring-data-mongodb/src/main/java/org/baeldung/event/CascadeSaveMongoEventListener.java +++ b/spring-data-mongodb/src/main/java/org/baeldung/event/CascadeSaveMongoEventListener.java @@ -3,6 +3,7 @@ package org.baeldung.event; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener; +import org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent; import org.springframework.util.ReflectionUtils; public class CascadeSaveMongoEventListener extends AbstractMongoEventListener { @@ -11,7 +12,8 @@ public class CascadeSaveMongoEventListener extends AbstractMongoEventListener event) { + final Object source = event.getSource(); ReflectionUtils.doWithFields(source.getClass(), new CascadeCallback(source, mongoOperations)); } } \ No newline at end of file diff --git a/spring-data-mongodb/src/main/java/org/baeldung/event/UserCascadeSaveMongoEventListener.java b/spring-data-mongodb/src/main/java/org/baeldung/event/UserCascadeSaveMongoEventListener.java index 423df59b95..ade20bcc1d 100644 --- a/spring-data-mongodb/src/main/java/org/baeldung/event/UserCascadeSaveMongoEventListener.java +++ b/spring-data-mongodb/src/main/java/org/baeldung/event/UserCascadeSaveMongoEventListener.java @@ -4,14 +4,16 @@ import org.baeldung.model.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.MongoOperations; import org.springframework.data.mongodb.core.mapping.event.AbstractMongoEventListener; +import org.springframework.data.mongodb.core.mapping.event.BeforeConvertEvent; public class UserCascadeSaveMongoEventListener extends AbstractMongoEventListener { @Autowired private MongoOperations mongoOperations; @Override - public void onBeforeConvert(final Object source) { - if (source instanceof User && ((User) source).getEmailAddress() != null) { + public void onBeforeConvert(final BeforeConvertEvent event) { + final Object source = event.getSource(); + if ((source instanceof User) && (((User) source).getEmailAddress() != null)) { mongoOperations.save(((User) source).getEmailAddress()); } } diff --git a/spring-data-mongodb/src/main/java/org/baeldung/repository/UserRepository.java b/spring-data-mongodb/src/main/java/org/baeldung/repository/UserRepository.java index 7d51f7b6cc..8e442e8b7f 100644 --- a/spring-data-mongodb/src/main/java/org/baeldung/repository/UserRepository.java +++ b/spring-data-mongodb/src/main/java/org/baeldung/repository/UserRepository.java @@ -1,12 +1,12 @@ package org.baeldung.repository; -import java.util.List; - import org.baeldung.model.User; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.Query; import org.springframework.data.querydsl.QueryDslPredicateExecutor; +import java.util.List; + public interface UserRepository extends MongoRepository, QueryDslPredicateExecutor { @Query("{ 'name' : ?0 }") List findUsersByName(String name); @@ -26,10 +26,10 @@ public interface UserRepository extends MongoRepository, QueryDslP List findByNameStartingWith(String regexp); List findByNameEndingWith(String regexp); - - @Query(value="{}", fields="{name : 1}") + + @Query(value = "{}", fields = "{name : 1}") List findNameAndId(); - - @Query(value="{}", fields="{_id : 0}") + + @Query(value = "{}", fields = "{_id : 0}") List findNameAndAgeExcludeId(); } diff --git a/spring-data-mongodb/src/test/java/org/baeldung/aggregation/ZipsAggregationLiveTest.java b/spring-data-mongodb/src/test/java/org/baeldung/aggregation/ZipsAggregationLiveTest.java index a25a904758..5686465c19 100644 --- a/spring-data-mongodb/src/test/java/org/baeldung/aggregation/ZipsAggregationLiveTest.java +++ b/spring-data-mongodb/src/test/java/org/baeldung/aggregation/ZipsAggregationLiveTest.java @@ -1,17 +1,10 @@ package org.baeldung.aggregation; -import static org.junit.Assert.*; -import static org.springframework.data.mongodb.core.aggregation.Aggregation.*; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.StreamSupport; - +import com.mongodb.DB; +import com.mongodb.DBCollection; +import com.mongodb.DBObject; +import com.mongodb.MongoClient; +import com.mongodb.util.JSON; import org.baeldung.aggregation.model.StatePopulation; import org.baeldung.config.MongoConfig; import org.junit.AfterClass; @@ -33,18 +26,30 @@ import org.springframework.data.mongodb.core.query.Criteria; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import com.mongodb.DB; -import com.mongodb.DBCollection; -import com.mongodb.DBObject; -import com.mongodb.MongoClient; -import com.mongodb.util.JSON; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.StreamSupport; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.springframework.data.mongodb.core.aggregation.Aggregation.group; +import static org.springframework.data.mongodb.core.aggregation.Aggregation.limit; +import static org.springframework.data.mongodb.core.aggregation.Aggregation.match; +import static org.springframework.data.mongodb.core.aggregation.Aggregation.newAggregation; +import static org.springframework.data.mongodb.core.aggregation.Aggregation.project; +import static org.springframework.data.mongodb.core.aggregation.Aggregation.sort; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class ZipsAggregationLiveTest { private static MongoClient client; - + @Autowired private MongoTemplate mongoTemplate; @@ -58,7 +63,7 @@ public class ZipsAggregationLiveTest { InputStream zipsJsonStream = ZipsAggregationLiveTest.class.getResourceAsStream("/zips.json"); BufferedReader reader = new BufferedReader(new InputStreamReader(zipsJsonStream)); reader.lines() - .forEach(line -> zipsCollection.insert((DBObject) JSON.parse(line))); + .forEach(line -> zipsCollection.insert((DBObject) JSON.parse(line))); reader.close(); } @@ -95,7 +100,7 @@ public class ZipsAggregationLiveTest { * decreasing population */ List actualList = StreamSupport.stream(result.spliterator(), false) - .collect(Collectors.toList()); + .collect(Collectors.toList()); List expectedList = new ArrayList<>(actualList); Collections.sort(expectedList, (sp1, sp2) -> sp2.getStatePop() - sp1.getStatePop()); @@ -111,7 +116,7 @@ public class ZipsAggregationLiveTest { GroupOperation averageStatePop = group("_id.state").avg("cityPop").as("avgCityPop"); SortOperation sortByAvgPopAsc = sort(new Sort(Direction.ASC, "avgCityPop")); ProjectionOperation projectToMatchModel = project().andExpression("_id").as("state") - .andExpression("avgCityPop").as("statePop"); + .andExpression("avgCityPop").as("statePop"); LimitOperation limitToOnlyFirstDoc = limit(1); Aggregation aggregation = newAggregation(sumTotalCityPop, averageStatePop, sortByAvgPopAsc, limitToOnlyFirstDoc, projectToMatchModel); @@ -121,7 +126,7 @@ public class ZipsAggregationLiveTest { assertEquals("ND", smallestState.getState()); assertTrue(smallestState.getStatePop() - .equals(1645)); + .equals(1645)); } @Test @@ -130,8 +135,8 @@ public class ZipsAggregationLiveTest { GroupOperation sumZips = group("state").count().as("zipCount"); SortOperation sortByCount = sort(Direction.ASC, "zipCount"); GroupOperation groupFirstAndLast = group().first("_id").as("minZipState") - .first("zipCount").as("minZipCount").last("_id").as("maxZipState") - .last("zipCount").as("maxZipCount"); + .first("zipCount").as("minZipCount").last("_id").as("maxZipState") + .last("zipCount").as("maxZipCount"); Aggregation aggregation = newAggregation(sumZips, sortByCount, groupFirstAndLast); diff --git a/spring-data-mongodb/src/test/java/org/baeldung/gridfs/GridFSLiveTest.java b/spring-data-mongodb/src/test/java/org/baeldung/gridfs/GridFSLiveTest.java index 3853a406fb..88205ba7fd 100644 --- a/spring-data-mongodb/src/test/java/org/baeldung/gridfs/GridFSLiveTest.java +++ b/spring-data-mongodb/src/test/java/org/baeldung/gridfs/GridFSLiveTest.java @@ -1,19 +1,8 @@ package org.baeldung.gridfs; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.Matchers.nullValue; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThat; - -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -import org.baeldung.config.MongoConfig; +import com.mongodb.BasicDBObject; +import com.mongodb.DBObject; +import com.mongodb.gridfs.GridFSDBFile; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; @@ -27,9 +16,18 @@ import org.springframework.data.mongodb.gridfs.GridFsTemplate; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import com.mongodb.BasicDBObject; -import com.mongodb.DBObject; -import com.mongodb.gridfs.GridFSDBFile; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.nullValue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; @ContextConfiguration("file:src/main/resources/mongoConfig.xml") @RunWith(SpringJUnit4ClassRunner.class) diff --git a/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/DocumentQueryLiveTest.java b/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/DocumentQueryLiveTest.java index df3ebcb2d2..729b0f6dfa 100644 --- a/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/DocumentQueryLiveTest.java +++ b/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/DocumentQueryLiveTest.java @@ -1,11 +1,5 @@ package org.baeldung.mongotemplate; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; - -import java.util.Iterator; -import java.util.List; - import org.baeldung.config.MongoConfig; import org.baeldung.model.EmailAddress; import org.baeldung.model.User; @@ -23,6 +17,12 @@ import org.springframework.data.mongodb.core.query.Query; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import java.util.Iterator; +import java.util.List; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class DocumentQueryLiveTest { diff --git a/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java b/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java index 61115faede..2d2117afbb 100644 --- a/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java +++ b/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/MongoTemplateProjectionLiveTest.java @@ -1,9 +1,5 @@ package org.baeldung.mongotemplate; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - import org.baeldung.config.SimpleMongoConfig; import org.baeldung.model.User; import org.junit.After; @@ -16,6 +12,10 @@ import org.springframework.data.mongodb.core.query.Query; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = SimpleMongoConfig.class) public class MongoTemplateProjectionLiveTest { @@ -42,14 +42,14 @@ public class MongoTemplateProjectionLiveTest { final Query query = new Query(); query.fields() - .include("name"); + .include("name"); mongoTemplate.find(query, User.class) - .forEach(user -> { - assertNotNull(user.getName()); - assertTrue(user.getAge() - .equals(0)); - }); + .forEach(user -> { + assertNotNull(user.getName()); + assertTrue(user.getAge() + .equals(0)); + }); } @Test @@ -59,13 +59,13 @@ public class MongoTemplateProjectionLiveTest { final Query query = new Query(); query.fields() - .exclude("_id"); + .exclude("_id"); mongoTemplate.find(query, User.class) - .forEach(user -> { - assertNull(user.getId()); - assertNotNull(user.getAge()); - }); + .forEach(user -> { + assertNull(user.getId()); + assertNotNull(user.getAge()); + }); } diff --git a/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java b/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java index 76162c6096..b7ce0cafae 100644 --- a/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java +++ b/spring-data-mongodb/src/test/java/org/baeldung/mongotemplate/MongoTemplateQueryLiveTest.java @@ -1,11 +1,5 @@ package org.baeldung.mongotemplate; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; -import static org.hamcrest.Matchers.nullValue; - -import java.util.List; - import org.baeldung.config.MongoConfig; import org.baeldung.model.EmailAddress; import org.baeldung.model.User; @@ -26,6 +20,12 @@ import org.springframework.data.mongodb.core.query.Query; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import java.util.List; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.nullValue; +import static org.junit.Assert.assertThat; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = MongoConfig.class) public class MongoTemplateQueryLiveTest { diff --git a/spring-mustache/.gitignore b/spring-mustache/.gitignore new file mode 100644 index 0000000000..2af7cefb0a --- /dev/null +++ b/spring-mustache/.gitignore @@ -0,0 +1,24 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ \ No newline at end of file diff --git a/spring-mustache/pom.xml b/spring-mustache/pom.xml new file mode 100644 index 0000000000..45fee6b10e --- /dev/null +++ b/spring-mustache/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.baeldung + spring-mustache + 0.0.1-SNAPSHOT + jar + + spring-mustache + Demo project for Spring Boot + + + org.springframework.boot + spring-boot-starter-parent + 1.5.4.RELEASE + + + + + + UTF-8 + UTF-8 + 1.8 + + + + + org.springframework.boot + spring-boot-starter-mustache + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.webjars + bootstrap + 3.3.7 + + + org.fluttercode.datafactory + datafactory + 0.8 + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + diff --git a/spring-mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java b/spring-mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java new file mode 100644 index 0000000000..addd1fa088 --- /dev/null +++ b/spring-mustache/src/main/java/com/baeldung/springmustache/SpringMustacheApplication.java @@ -0,0 +1,34 @@ +package com.baeldung.springmustache; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.mustache.MustacheEnvironmentCollector; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.core.env.Environment; + +import com.samskivert.mustache.Mustache; + +@SpringBootApplication +@ComponentScan(basePackages = {"com.baeldung"}) +public class SpringMustacheApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringMustacheApplication.class, args); + } + + @Bean + public Mustache.Compiler mustacheCompiler(Mustache.TemplateLoader templateLoader, Environment environment) { + + MustacheEnvironmentCollector collector = new MustacheEnvironmentCollector(); + collector.setEnvironment(environment); + + Mustache.Compiler compiler = Mustache.compiler() + .defaultValue("Some Default Value") + .withLoader(templateLoader) + .withCollector(collector); + return compiler; + + } +} + diff --git a/spring-mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java b/spring-mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java new file mode 100644 index 0000000000..b24625e7d5 --- /dev/null +++ b/spring-mustache/src/main/java/com/baeldung/springmustache/controller/ArticleController.java @@ -0,0 +1,48 @@ +package com.baeldung.springmustache.controller; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; +import java.util.stream.IntStream; + +import org.fluttercode.datafactory.impl.DataFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +import com.baeldung.springmustache.model.Article; + +@Controller +public class ArticleController { + + @RequestMapping("/article") + public ModelAndView displayArticle(Map model) { + + List
articles = new LinkedList<>(); + IntStream.range(0, 10) + .forEach(count -> { + articles.add(generateArticle("Article Title " + count)); + }); + + Map modelMap = new HashMap<>(); + modelMap.put("articles", articles); + + return new ModelAndView("index", modelMap); + } + + private Article generateArticle(String title) { + Article article = new Article(); + DataFactory factory = new DataFactory(); + article.setTitle(title); + article.setBody( + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur faucibus tempor diam. In molestie arcu eget ante facilisis sodales. Maecenas porta tellus sapien, eget rutrum nisi blandit in. Mauris tempor auctor ante, ut blandit velit venenatis id. Ut varius, augue aliquet feugiat congue, arcu ipsum finibus purus, dapibus semper velit sapien venenatis magna. Nunc quam ex, aliquet at rutrum sed, vestibulum quis libero. In laoreet libero cursus maximus vulputate. Nullam in fermentum sem. Duis aliquam ullamcorper dui, et dictum justo placerat id. Aliquam pretium orci quis sapien convallis, non blandit est tempus."); + article.setPublishDate(factory.getBirthDate().toString()); + article.setAuthor(factory.getName()); + return article; + } +} + + diff --git a/spring-mustache/src/main/java/com/baeldung/springmustache/model/Article.java b/spring-mustache/src/main/java/com/baeldung/springmustache/model/Article.java new file mode 100644 index 0000000000..78b08f877f --- /dev/null +++ b/spring-mustache/src/main/java/com/baeldung/springmustache/model/Article.java @@ -0,0 +1,41 @@ +package com.baeldung.springmustache.model; + +public class Article { + private String title; + private String body; + private String author; + private String publishDate; + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBody() { + return body; + } + + public void setBody(String body) { + this.body = body; + } + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } + + public String getPublishDate() { + return publishDate; + } + + public void setPublishDate(String publishDate) { + this.publishDate = publishDate; + } + +} diff --git a/spring-mustache/src/main/resources/application.properties b/spring-mustache/src/main/resources/application.properties new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-mustache/src/main/resources/templates/error/error.html b/spring-mustache/src/main/resources/templates/error/error.html new file mode 100644 index 0000000000..fa29db41c4 --- /dev/null +++ b/spring-mustache/src/main/resources/templates/error/error.html @@ -0,0 +1,9 @@ + + + + + + Something went wrong: {{status}} {{error}} + + + \ No newline at end of file diff --git a/spring-mustache/src/main/resources/templates/index.html b/spring-mustache/src/main/resources/templates/index.html new file mode 100644 index 0000000000..bda60f9d8f --- /dev/null +++ b/spring-mustache/src/main/resources/templates/index.html @@ -0,0 +1,9 @@ +{{>layout/header}} + +
{{>layout/article}}
+ + + + +{{>layout/footer}} diff --git a/spring-mustache/src/main/resources/templates/layout/article.html b/spring-mustache/src/main/resources/templates/layout/article.html new file mode 100644 index 0000000000..9d573580d3 --- /dev/null +++ b/spring-mustache/src/main/resources/templates/layout/article.html @@ -0,0 +1,8 @@ +
+ {{#articles}} +

{{title}}

+

{{publishDate}}

+

{{author}}

+

{{body}}

+ {{/articles}} +
\ No newline at end of file diff --git a/spring-mustache/src/main/resources/templates/layout/footer.html b/spring-mustache/src/main/resources/templates/layout/footer.html new file mode 100644 index 0000000000..04f34cac54 --- /dev/null +++ b/spring-mustache/src/main/resources/templates/layout/footer.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/spring-mustache/src/main/resources/templates/layout/header.html b/spring-mustache/src/main/resources/templates/layout/header.html new file mode 100644 index 0000000000..d203ef800b --- /dev/null +++ b/spring-mustache/src/main/resources/templates/layout/header.html @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationTests.java b/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationTests.java new file mode 100644 index 0000000000..9138dfe92b --- /dev/null +++ b/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationTests.java @@ -0,0 +1,30 @@ +package com.baeldung.springmustache; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +public class SpringMustacheApplicationTests { + + @Autowired + private TestRestTemplate restTemplate; + + @Test + public void givenIndexPageWhenContainsArticleThenTrue() { + + ResponseEntity entity = this.restTemplate.getForEntity("/article", String.class); + + Assert.assertTrue(entity.getStatusCode().equals(HttpStatus.OK)); + Assert.assertTrue(entity.getBody().contains("Article Title 0")); + } + +} diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index 504cfcdcc7..d42efa7ff6 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -23,3 +23,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Uploading and Displaying Excel Files with Spring MVC](http://www.baeldung.com/spring-mvc-excel-files) - [Spring MVC Custom Validation](http://www.baeldung.com/spring-mvc-custom-validator) - [web.xml vs Initializer with Spring](http://www.baeldung.com/spring-xml-vs-java-config) +- [The HttpMediaTypeNotAcceptableException in Spring MVC](http://www.baeldung.com/spring-httpmediatypenotacceptable) diff --git a/spring-mvc-java/pom.xml b/spring-mvc-java/pom.xml index eb8e1455a7..b939f0496d 100644 --- a/spring-mvc-java/pom.xml +++ b/spring-mvc-java/pom.xml @@ -5,7 +5,6 @@ spring-mvc-java 0.1-SNAPSHOT spring-mvc-java - war com.baeldung diff --git a/spring-remoting/pom.xml b/spring-remoting/pom.xml index 0b751d1fc9..b40f77eb50 100644 --- a/spring-remoting/pom.xml +++ b/spring-remoting/pom.xml @@ -33,6 +33,7 @@ remoting-hessian-burlap remoting-amqp remoting-jms + spring-remoting-rmi \ No newline at end of file diff --git a/spring-remoting/spring-remoting-rmi/pom.xml b/spring-remoting/spring-remoting-rmi/pom.xml new file mode 100644 index 0000000000..723158775f --- /dev/null +++ b/spring-remoting/spring-remoting-rmi/pom.xml @@ -0,0 +1,19 @@ + + + + spring-remoting + com.baeldung + 1.0-SNAPSHOT + + 4.0.0 + pom + + remoting-rmi-server + remoting-rmi-client + + spring-remoting-rmi + + + \ No newline at end of file diff --git a/spring-remoting/spring-remoting-rmi/remoting-rmi-client/pom.xml b/spring-remoting/spring-remoting-rmi/remoting-rmi-client/pom.xml new file mode 100644 index 0000000000..003976dc7b --- /dev/null +++ b/spring-remoting/spring-remoting-rmi/remoting-rmi-client/pom.xml @@ -0,0 +1,30 @@ + + + + spring-remoting-rmi + com.baeldung + 1.0-SNAPSHOT + + 4.0.0 + + remoting-rmi-client + + + + org.springframework.boot + spring-boot-starter-activemq + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + com.baeldung + api + + + \ No newline at end of file diff --git a/spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/java/com/baeldung/client/RmiClient.java b/spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/java/com/baeldung/client/RmiClient.java new file mode 100644 index 0000000000..a568b749f9 --- /dev/null +++ b/spring-remoting/spring-remoting-rmi/remoting-rmi-client/src/main/java/com/baeldung/client/RmiClient.java @@ -0,0 +1,26 @@ +package com.baeldung.client; + +import com.baeldung.api.Booking; +import com.baeldung.api.BookingException; +import com.baeldung.api.CabBookingService; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.remoting.rmi.RmiProxyFactoryBean; + +@SpringBootApplication public class RmiClient { + + @Bean RmiProxyFactoryBean service() { + RmiProxyFactoryBean rmiProxyFactory = new RmiProxyFactoryBean(); + rmiProxyFactory.setServiceUrl("rmi://localhost:1099/CabBookingService"); + rmiProxyFactory.setServiceInterface(CabBookingService.class); + return rmiProxyFactory; + } + + public static void main(String[] args) throws BookingException { + CabBookingService service = SpringApplication.run(RmiClient.class, args).getBean(CabBookingService.class); + Booking bookingOutcome = service.bookRide("13 Seagate Blvd, Key Largo, FL 33037"); + System.out.println(bookingOutcome); + } + +} diff --git a/spring-remoting/spring-remoting-rmi/remoting-rmi-server/pom.xml b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/pom.xml new file mode 100644 index 0000000000..5ce3f7f949 --- /dev/null +++ b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/pom.xml @@ -0,0 +1,40 @@ + + + + spring-remoting-rmi + com.baeldung + 1.0-SNAPSHOT + + 4.0.0 + + remoting-rmi-server + + + UTF-8 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + com.baeldung + api + + + com.baeldung + api + ${project.version} + + + + \ No newline at end of file diff --git a/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/java/com/baeldung/server/CabBookingServiceImpl.java b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/java/com/baeldung/server/CabBookingServiceImpl.java new file mode 100644 index 0000000000..55ec9c5733 --- /dev/null +++ b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/java/com/baeldung/server/CabBookingServiceImpl.java @@ -0,0 +1,16 @@ +package com.baeldung.server; + +import com.baeldung.api.Booking; +import com.baeldung.api.BookingException; +import com.baeldung.api.CabBookingService; + +import static java.lang.Math.random; +import static java.util.UUID.randomUUID; + +public class CabBookingServiceImpl implements CabBookingService { + + @Override public Booking bookRide(String pickUpLocation) throws BookingException { + if (random() < 0.3) throw new BookingException("Cab unavailable"); + return new Booking(randomUUID().toString()); + } +} diff --git a/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/java/com/baeldung/server/RmiServer.java b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/java/com/baeldung/server/RmiServer.java new file mode 100644 index 0000000000..7778c65e85 --- /dev/null +++ b/spring-remoting/spring-remoting-rmi/remoting-rmi-server/src/main/java/com/baeldung/server/RmiServer.java @@ -0,0 +1,34 @@ +package com.baeldung.server; + +import com.baeldung.api.CabBookingService; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.remoting.rmi.RmiServiceExporter; + +@SpringBootApplication public class RmiServer { + + @Bean CabBookingService bookingService() { + return new CabBookingServiceImpl(); + } + + @Bean RmiServiceExporter exporter(CabBookingService implementation) { + + // Expose a service via RMI. Remote obect URL is: + // rmi://:/ + // 1099 is the default port + + Class serviceInterface = CabBookingService.class; + RmiServiceExporter exporter = new RmiServiceExporter(); + exporter.setServiceInterface(serviceInterface); + exporter.setService(implementation); + exporter.setServiceName(serviceInterface.getSimpleName()); + exporter.setRegistryPort(1099); + return exporter; + } + + public static void main(String[] args) { + SpringApplication.run(RmiServer.class, args); + } + +} diff --git a/spring-rest-docs/src/test/java/com/example/ApiDocumentationIntegrationTest.java b/spring-rest-docs/src/test/java/com/example/ApiDocumentationIntegrationTest.java index 0912023fb7..f2ac9d0f82 100644 --- a/spring-rest-docs/src/test/java/com/example/ApiDocumentationIntegrationTest.java +++ b/spring-rest-docs/src/test/java/com/example/ApiDocumentationIntegrationTest.java @@ -28,9 +28,17 @@ import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.li import static org.springframework.restdocs.hypermedia.HypermediaDocumentation.links; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*; -import static org.springframework.restdocs.operation.preprocess.Preprocessors.*; -import static org.springframework.restdocs.payload.PayloadDocumentation.*; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.patch; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put; +import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; +import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; +import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; +import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWithPath; +import static org.springframework.restdocs.payload.PayloadDocumentation.requestFields; +import static org.springframework.restdocs.payload.PayloadDocumentation.responseFields; import static org.springframework.restdocs.snippet.Attributes.key; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static org.springframework.util.StringUtils.collectionToDelimitedString; diff --git a/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentationIntegrationTest.java b/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentationIntegrationTest.java index 1af626d03b..c02c0c27f8 100644 --- a/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentationIntegrationTest.java +++ b/spring-rest-docs/src/test/java/com/example/GettingStartedDocumentationIntegrationTest.java @@ -1,8 +1,6 @@ package com.example; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.jayway.jsonpath.JsonPath; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -14,21 +12,19 @@ import org.springframework.restdocs.RestDocumentation; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import java.io.UnsupportedEncodingException; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.notNullValue; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration; -import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.*; -import static org.springframework.restdocs.operation.preprocess.Preprocessors.*; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; +import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; +import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessRequest; +import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse; +import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = SpringRestDocsApplication.class) diff --git a/spring-rest/difference-uri-url-rest/pom.xml b/spring-rest/difference-uri-url-rest/pom.xml deleted file mode 100644 index 5ab6e63240..0000000000 --- a/spring-rest/difference-uri-url-rest/pom.xml +++ /dev/null @@ -1,32 +0,0 @@ - - 4.0.0 - org.baeldung.springboot.rest - difference-uri-url-rest - 0.0.1-SNAPSHOT - war - - - 1.8 - - - - org.springframework.boot - spring-boot-starter-parent - 1.5.2.RELEASE - - - - - - org.springframework.boot - spring-boot-starter-web - compile - - - org.springframework.boot - spring-boot-starter-test - test - - - - \ No newline at end of file diff --git a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/Greeting.java b/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/Greeting.java deleted file mode 100644 index cc166587df..0000000000 --- a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/Greeting.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.springboot.rest; - -public class Greeting { - private static final long serialVersionUID = 1L; - - private Integer id = null; - private String content = null; - - public Greeting(Integer id) { - this.id = id; - this.content = "Hello World"; - } - - public Integer getId() { - return id; - } - - public String getContent() { - return content; - } -} \ No newline at end of file diff --git a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/GreetingController.java b/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/GreetingController.java deleted file mode 100644 index 3fca9a1a76..0000000000 --- a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/GreetingController.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.springboot.rest; - -import java.util.concurrent.atomic.AtomicLong; - -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -@RestController("/") -@Component -public class GreetingController { - - private final AtomicLong counter = new AtomicLong(); - - @RequestMapping(value = "/greetings", method = RequestMethod.GET) - public Greeting greeting() { - - return new Greeting(new Integer((int) counter.incrementAndGet())); - } -} \ No newline at end of file diff --git a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/SpringBootWebApplication.java b/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/SpringBootWebApplication.java deleted file mode 100644 index 08d4c2c65e..0000000000 --- a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/SpringBootWebApplication.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.springboot.rest; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.support.SpringBootServletInitializer; - -@EnableAutoConfiguration -@SpringBootApplication -public class SpringBootWebApplication extends SpringBootServletInitializer { - - // method for explicit deployment on Application Server - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { - return application.sources(SpringBootWebApplication.class); - } - - // run it as standalone JAVA application - public static void main(String[] args) throws Exception { - SpringApplication.run(SpringBootWebApplication.class, args); - } - - //Samples - // http://localhost:8080/greetings - // http://localhost:8989/difference-uri-url-rest/greetings -} \ No newline at end of file diff --git a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/client/ApplicationClient.java b/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/client/ApplicationClient.java deleted file mode 100644 index 2d92c890c5..0000000000 --- a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/client/ApplicationClient.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.baeldung.springboot.rest.client; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.web.client.RestTemplate; - -public class ApplicationClient { - //private static final Logger log = LoggerFactory.getLogger(ApplicationClient.class); - final static String URI_STRING = "http://localhost:8080/difference-uri-url-rest/greetings"; - - - public ApplicationClient() { - super(); - } - - public Greeting init() { - RestTemplate restTemplate = new RestTemplate(); - Greeting greeting = restTemplate.getForObject(ApplicationClient.URI_STRING, Greeting.class); - //log.info(greeting.toString()); - return greeting; - } - public static void main(String args[]) { - Greeting greeting = new ApplicationClient().init(); - System.out.println(greeting.toString()); - } - -} diff --git a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/client/Greeting.java b/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/client/Greeting.java deleted file mode 100644 index 7d1119d155..0000000000 --- a/spring-rest/difference-uri-url-rest/src/main/java/com/baeldung/springboot/rest/client/Greeting.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.springboot.rest.client; - -import java.io.Serializable; - -public class Greeting implements Serializable { - private static final long serialVersionUID = 1L; - - private Integer id = null; - private String content = null; - - /** Default constructor is mandatory for client */ - public Greeting() { - super(); - } - - public Greeting(Integer id) { - this.id = id; - this.content = "Hello World"; - } - - public Integer getId() { - return id; - } - - public String getContent() { - return content; - } - - @Override - public String toString() { - return "Id: " + getId().toString() + " Content: " + getContent(); - } -} \ No newline at end of file diff --git a/spring-rest/difference-uri-url-rest/src/test/java/com/baeldung/springboot/rest/test/DifferenceURIURLRESTTest.java b/spring-rest/difference-uri-url-rest/src/test/java/com/baeldung/springboot/rest/test/DifferenceURIURLRESTTest.java deleted file mode 100644 index 4397f8e088..0000000000 --- a/spring-rest/difference-uri-url-rest/src/test/java/com/baeldung/springboot/rest/test/DifferenceURIURLRESTTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.springboot.rest.test; - -import static org.junit.Assert.assertNotNull; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.springframework.web.client.RestTemplate; - -import com.baeldung.springboot.rest.client.Greeting; - -public class DifferenceURIURLRESTTest { - final static String URI_STRING = "http://localhost:8080/difference-uri-url-rest/greetings"; - static RestTemplate restTemplate; - Greeting greeting; - - @BeforeClass - public static void setupTest() { - restTemplate = new RestTemplate(); - } - - @Test - public void givenRestTenplate_whenIsNotNull_thenSuccess() { - assertNotNull("Rest Template not null", restTemplate); - } - - @Test - public void givenWiredConstructorParam_whenIsNotNull_thenSuccess() { - greeting = restTemplate.getForObject(URI_STRING, Greeting.class); - assertNotNull("Greeting class is not null", greeting); - } - -} diff --git a/spring-rest/pom.xml b/spring-rest/pom.xml index c12028149d..6065d7e529 100644 --- a/spring-rest/pom.xml +++ b/spring-rest/pom.xml @@ -1,321 +1,329 @@ - 4.0.0 - com.baeldung - spring-rest - 0.1-SNAPSHOT - spring-rest - war + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + com.baeldung + spring-rest + 0.1-SNAPSHOT + spring-rest + war - - parent-boot-4 - com.baeldung - 0.0.1-SNAPSHOT - ../parent-boot-4 - + + parent-boot-4 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-4 + - + - + - - org.springframework.boot - spring-boot-starter-thymeleaf - - - org.springframework.boot - spring-boot-starter-actuator - - - org.springframework.boot - spring-boot-devtools - - - org.springframework.boot - spring-boot-test - + + org.springframework.boot + spring-boot-starter-thymeleaf + + + org.springframework.boot + spring-boot-starter-actuator + + + org.springframework.boot + spring-boot-devtools + + + org.springframework.boot + spring-boot-test + - + - - org.springframework - spring-web - - - commons-logging - commons-logging - - - - - org.springframework - spring-webmvc - - - org.springframework - spring-oxm - + + org.springframework + spring-web + + + commons-logging + commons-logging + + + + + org.springframework + spring-webmvc + + + org.springframework + spring-oxm + - - commons-fileupload - commons-fileupload - ${commons-fileupload.version} - - + + commons-fileupload + commons-fileupload + ${commons-fileupload.version} + + - - javax.servlet - javax.servlet-api - provided - + + javax.servlet + javax.servlet-api + provided + - - javax.servlet - jstl - runtime - + + javax.servlet + jstl + runtime + - + - - com.fasterxml.jackson.core - jackson-databind - + + com.fasterxml.jackson.core + jackson-databind + - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + - - com.thoughtworks.xstream - xstream - ${xstream.version} - + + com.thoughtworks.xstream + xstream + ${xstream.version} + - + - - com.google.guava - guava - ${guava.version} - + + com.google.guava + guava + ${guava.version} + - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + - + - - com.squareup.okhttp3 - okhttp - ${com.squareup.okhttp3.version} - + + com.squareup.okhttp3 + okhttp + ${com.squareup.okhttp3.version} + - + - - org.hamcrest - hamcrest-core - test - - - org.hamcrest - hamcrest-library - test - + + org.hamcrest + hamcrest-core + test + + + org.hamcrest + hamcrest-library + test + - - org.mockito - mockito-core - test - + + org.mockito + mockito-core + test + - - org.springframework - spring-test - + + org.springframework + spring-test + - - - com.google.protobuf - protobuf-java - ${protobuf-java.version} - - - com.googlecode.protobuf-java-format - protobuf-java-format - ${protobuf-java-format.version} - + + + com.google.protobuf + protobuf-java + ${protobuf-java.version} + + + com.googlecode.protobuf-java-format + protobuf-java-format + ${protobuf-java-format.version} + - - com.esotericsoftware - kryo - ${kryo.version} - + + com.esotericsoftware + kryo + ${kryo.version} + - - com.jayway.jsonpath - json-path - + + com.jayway.jsonpath + json-path + - - - spring-rest - - - src/main/resources - true - - + + + commons-io + commons-io + 2.4 + - - - org.springframework.boot - spring-boot-maven-plugin - - true - - - - org.apache.maven.plugins - maven-war-plugin - + - - org.codehaus.cargo - cargo-maven2-plugin - ${cargo-maven2-plugin.version} - - true - - tomcat8x - embedded - - - - - - - 8082 - - - - + + spring-rest + + + src/main/resources + true + + - + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + org.apache.maven.plugins + maven-war-plugin + - + + org.codehaus.cargo + cargo-maven2-plugin + ${cargo-maven2-plugin.version} + + true + + tomcat8x + embedded + + + + + + + 8082 + + + + - + - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - none - - - **/*IntegrationTest.java - - - - - + - - - + - - live - - - - org.codehaus.cargo - cargo-maven2-plugin - - - start-server - pre-integration-test - - start - - - - stop-server - post-integration-test - - stop - - - - + + integration + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + none + + + **/*IntegrationTest.java + + + + + - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - none - - - **/*LiveTest.java - - - cargo - - - - - + + + - - - + + live + + + + org.codehaus.cargo + cargo-maven2-plugin + + + start-server + pre-integration-test + + start + + + + stop-server + post-integration-test + + stop + + + + - + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + none + + + **/*LiveTest.java + + + cargo + + + + + - - 1.3.2 - 4.0.0 - 1.4 - 3.1.0 - 3.5 - 1.4.9 + + + - - 20.0 + - - 1.6.0 - 3.0.4 + + 1.3.2 + 4.0.0 + 1.4 + 3.1.0 + 3.5 + 1.4.9 - - 3.4.1 + + 20.0 - 2.2.0 - + + 1.6.0 + 3.0.4 + + + 3.4.1 + + 2.2.0 + diff --git a/spring-rest/src/main/java/com/baeldung/produceimage/controller/DataProducerController.java b/spring-rest/src/main/java/com/baeldung/produceimage/controller/DataProducerController.java index 6f34bdb9ae..ab233a8b60 100644 --- a/spring-rest/src/main/java/com/baeldung/produceimage/controller/DataProducerController.java +++ b/spring-rest/src/main/java/com/baeldung/produceimage/controller/DataProducerController.java @@ -17,7 +17,7 @@ public class DataProducerController { return "Hello world"; } - @GetMapping(value = "/get-image") + @GetMapping("/get-image") public @ResponseBody byte[] getImage() throws IOException { final InputStream in = getClass().getResourceAsStream("/com/baeldung/produceimage/image.jpg"); return IOUtils.toByteArray(in); diff --git a/spring-rest/src/main/java/com/baeldung/web/log/app/Application.java b/spring-rest/src/main/java/com/baeldung/web/log/app/Application.java new file mode 100644 index 0000000000..41042008ef --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/web/log/app/Application.java @@ -0,0 +1,17 @@ +package com.baeldung.web.log.app; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.web.support.SpringBootServletInitializer; +import org.springframework.context.annotation.ComponentScan; + +@EnableAutoConfiguration +@ComponentScan("com.baeldung.web.log") +@SpringBootApplication +public class Application extends SpringBootServletInitializer { + + public static void main(final String[] args) { + SpringApplication.run(Application.class, args); + } +} \ No newline at end of file diff --git a/spring-rest/src/main/java/com/baeldung/web/log/app/TaxiFareRequestInterceptor.java b/spring-rest/src/main/java/com/baeldung/web/log/app/TaxiFareRequestInterceptor.java new file mode 100644 index 0000000000..b154f3665f --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/web/log/app/TaxiFareRequestInterceptor.java @@ -0,0 +1,44 @@ +package com.baeldung.web.log.app; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; +import org.springframework.web.util.ContentCachingRequestWrapper; + +import com.baeldung.web.log.util.RequestLoggingUtil; + +@Component +public class TaxiFareRequestInterceptor extends HandlerInterceptorAdapter { + + private final static Logger LOGGER = LoggerFactory.getLogger(TaxiFareRequestInterceptor.class); + + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + String postData; + HttpServletRequest requestCacheWrapperObject = null; + try { + // Uncomment to produce the stream closed issue + // postData = RequestLoggingUtil.getStringFromInputStream(request.getInputStream()); + + // To overcome request stream closed issue + requestCacheWrapperObject = new ContentCachingRequestWrapper(request); + requestCacheWrapperObject.getParameterMap(); + } catch (Exception exception) { + exception.printStackTrace(); + } finally { + postData = RequestLoggingUtil.readPayload(requestCacheWrapperObject); + LOGGER.info("REQUEST DATA: " + postData); + } + return true; + } + + @Override + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { + LOGGER.info("RESPONSE: " + response.getStatus()); + } + +} diff --git a/spring-rest/src/main/java/com/baeldung/web/log/config/RequestLoggingFilterConfig.java b/spring-rest/src/main/java/com/baeldung/web/log/config/RequestLoggingFilterConfig.java new file mode 100644 index 0000000000..bc9ad1cf84 --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/web/log/config/RequestLoggingFilterConfig.java @@ -0,0 +1,20 @@ +package com.baeldung.web.log.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.filter.CommonsRequestLoggingFilter; + +@Configuration +public class RequestLoggingFilterConfig { + + @Bean + public CommonsRequestLoggingFilter logFilter() { + CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter(); + filter.setIncludeQueryString(true); + filter.setIncludePayload(true); + filter.setMaxPayloadLength(10000); + filter.setIncludeHeaders(false); + filter.setAfterMessagePrefix("REQUEST DATA : "); + return filter; + } +} diff --git a/spring-rest/src/main/java/com/baeldung/web/log/config/TaxiFareMVCConfig.java b/spring-rest/src/main/java/com/baeldung/web/log/config/TaxiFareMVCConfig.java new file mode 100644 index 0000000000..f433b4f3c7 --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/web/log/config/TaxiFareMVCConfig.java @@ -0,0 +1,19 @@ +package com.baeldung.web.log.config; + +import com.baeldung.web.log.app.TaxiFareRequestInterceptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; + +@Configuration +public class TaxiFareMVCConfig extends WebMvcConfigurerAdapter { + + @Autowired + private TaxiFareRequestInterceptor taxiFareRequestInterceptor; + + @Override + public void addInterceptors(InterceptorRegistry registry) { + registry.addInterceptor(taxiFareRequestInterceptor).addPathPatterns("/**/taxifare/**/"); + } +} diff --git a/spring-rest/src/main/java/com/baeldung/web/log/controller/TaxiFareController.java b/spring-rest/src/main/java/com/baeldung/web/log/controller/TaxiFareController.java new file mode 100644 index 0000000000..7de88d44a8 --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/web/log/controller/TaxiFareController.java @@ -0,0 +1,42 @@ +package com.baeldung.web.log.controller; + +import javax.validation.Valid; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.baeldung.web.log.data.RateCard; +import com.baeldung.web.log.data.TaxiRide; +import com.baeldung.web.log.service.TaxiFareCalculatorService; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class TaxiFareController { + + @Autowired + private TaxiFareCalculatorService taxiFareCalculatorService; + + private static final Logger LOGGER = LoggerFactory.getLogger(TaxiFareController.class); + + @GetMapping("/taxifare/get/") + public RateCard getTaxiFare() { + LOGGER.debug("getTaxiFare() - START"); + return new RateCard(); + } + + @PostMapping("/taxifare/calculate/") + public String calculateTaxiFare(@RequestBody @Valid TaxiRide taxiRide) { + LOGGER.debug("calculateTaxiFare() - START"); + String totalFare = taxiFareCalculatorService.calculateFare(taxiRide); + LOGGER.debug("calculateTaxiFare() - Total Fare : {}",totalFare); + LOGGER.debug("calculateTaxiFare() - END"); + return totalFare; + } + +} diff --git a/spring-rest/src/main/java/com/baeldung/web/log/data/RateCard.java b/spring-rest/src/main/java/com/baeldung/web/log/data/RateCard.java new file mode 100644 index 0000000000..c7955b561b --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/web/log/data/RateCard.java @@ -0,0 +1,31 @@ +package com.baeldung.web.log.data; + +public class RateCard { + + private String nightSurcharge; + private String ratePerMile; + + public RateCard() { + nightSurcharge = "Extra $ 100"; + ratePerMile = "$ 10 Per Mile"; + } + + + public String getNightSurcharge() { + return nightSurcharge; + } + + public void setNightSurcharge(String nightSurcharge) { + this.nightSurcharge = nightSurcharge; + } + + public String getRatePerMile() { + return ratePerMile; + } + + public void setRatePerMile(String ratePerMile) { + this.ratePerMile = ratePerMile; + } + + +} diff --git a/spring-rest/src/main/java/com/baeldung/web/log/data/TaxiRide.java b/spring-rest/src/main/java/com/baeldung/web/log/data/TaxiRide.java new file mode 100644 index 0000000000..2e0f33f02b --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/web/log/data/TaxiRide.java @@ -0,0 +1,33 @@ +package com.baeldung.web.log.data; + +public class TaxiRide { + + private Boolean isNightSurcharge; + private Long distanceInMile; + + public TaxiRide() { + } + + public TaxiRide(Boolean isNightSurcharge, Long distanceInMile) { + this.isNightSurcharge = isNightSurcharge; + this.distanceInMile = distanceInMile; + } + + + public Boolean getIsNightSurcharge() { + return isNightSurcharge; + } + + public void setIsNightSurcharge(Boolean isNightSurcharge) { + this.isNightSurcharge = isNightSurcharge; + } + + public Long getDistanceInMile() { + return distanceInMile; + } + + public void setDistanceInMile(Long distanceInMile) { + this.distanceInMile = distanceInMile; + } + +} diff --git a/spring-rest/src/main/java/com/baeldung/web/log/service/TaxiFareCalculatorService.java b/spring-rest/src/main/java/com/baeldung/web/log/service/TaxiFareCalculatorService.java new file mode 100644 index 0000000000..1176b31e4c --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/web/log/service/TaxiFareCalculatorService.java @@ -0,0 +1,14 @@ +package com.baeldung.web.log.service; + +import com.baeldung.web.log.data.TaxiRide; +import org.springframework.stereotype.Service; + +@Service +public class TaxiFareCalculatorService { + + public String calculateFare(TaxiRide taxiRide) { + return String.valueOf((Long) (taxiRide.getIsNightSurcharge() + ? taxiRide.getDistanceInMile() * 10 + 100 + : taxiRide.getDistanceInMile() * 10)); + } +} diff --git a/spring-rest/src/main/java/com/baeldung/web/log/util/RequestLoggingUtil.java b/spring-rest/src/main/java/com/baeldung/web/log/util/RequestLoggingUtil.java new file mode 100644 index 0000000000..c13d35b55c --- /dev/null +++ b/spring-rest/src/main/java/com/baeldung/web/log/util/RequestLoggingUtil.java @@ -0,0 +1,38 @@ +package com.baeldung.web.log.util; + +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; + +import javax.servlet.http.HttpServletRequest; + +import org.apache.commons.io.IOUtils; +import org.springframework.web.util.ContentCachingRequestWrapper; +import org.springframework.web.util.WebUtils; + +public class RequestLoggingUtil { + + public static String getStringFromInputStream(InputStream is) { + StringWriter writer = new StringWriter(); + String encoding = "UTF-8"; + try { + IOUtils.copy(is, writer, encoding); + } catch (IOException e) { + e.printStackTrace(); + } + return writer.toString(); + } + + public static String readPayload(final HttpServletRequest request) throws IOException { + String payloadData = null; + ContentCachingRequestWrapper contentCachingRequestWrapper = WebUtils.getNativeRequest(request, ContentCachingRequestWrapper.class); + if (null != contentCachingRequestWrapper) { + byte[] buf = contentCachingRequestWrapper.getContentAsByteArray(); + if (buf.length > 0) { + payloadData = new String(buf, 0, buf.length, contentCachingRequestWrapper.getCharacterEncoding()); + } + } + return payloadData; + } + +} diff --git a/spring-rest/src/main/java/org/baeldung/config/MainApplication.java b/spring-rest/src/main/java/org/baeldung/config/MainApplication.java index e31fdfaaa9..36b021a537 100644 --- a/spring-rest/src/main/java/org/baeldung/config/MainApplication.java +++ b/spring-rest/src/main/java/org/baeldung/config/MainApplication.java @@ -12,5 +12,4 @@ public class MainApplication extends WebMvcConfigurerAdapter { public static void main(final String[] args) { SpringApplication.run(MainApplication.class, args); } - } \ No newline at end of file diff --git a/spring-rest/src/main/java/org/baeldung/repository/HeavyResourceRepository.java b/spring-rest/src/main/java/org/baeldung/repository/HeavyResourceRepository.java index 4ed5c21b83..e4eb6d8875 100644 --- a/spring-rest/src/main/java/org/baeldung/repository/HeavyResourceRepository.java +++ b/spring-rest/src/main/java/org/baeldung/repository/HeavyResourceRepository.java @@ -1,11 +1,11 @@ package org.baeldung.repository; -import java.util.Map; - import org.baeldung.web.dto.HeavyResource; import org.baeldung.web.dto.HeavyResourceAddressOnly; -public class HeavyResourceRepository { +import java.util.Map; + +public class HeavyResourceRepository { public void save(HeavyResource heavyResource) { } @@ -21,6 +21,7 @@ public class HeavyResourceRepository { public void save(HeavyResource heavyResource, String id) { } + public void save(HeavyResourceAddressOnly partialUpdate, String id) { } diff --git a/spring-rest/src/main/resources/logback.xml b/spring-rest/src/main/resources/logback.xml index ec0dc2469a..3496a4a03c 100644 --- a/spring-rest/src/main/resources/logback.xml +++ b/spring-rest/src/main/resources/logback.xml @@ -6,6 +6,10 @@ + + + + diff --git a/spring-rest/src/test/java/com/baeldung/web/log/test/TestTaxiFareController.java b/spring-rest/src/test/java/com/baeldung/web/log/test/TestTaxiFareController.java new file mode 100644 index 0000000000..398e3c04e9 --- /dev/null +++ b/spring-rest/src/test/java/com/baeldung/web/log/test/TestTaxiFareController.java @@ -0,0 +1,33 @@ +package com.baeldung.web.log.test; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; + +import org.junit.Test; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; + +import com.baeldung.web.log.data.TaxiRide; + +public class TestTaxiFareController { + + private static final String URL = "http://localhost:" + 8082 + "/spring-rest/taxifare/"; + + @Test + public void givenRequest_whenFetchTaxiFareRateCard_thanOK() { + TestRestTemplate testRestTemplate = new TestRestTemplate(); + ResponseEntity response = testRestTemplate.getForEntity(URL + "get/", String.class); + + assertThat(response.getStatusCode(), equalTo(HttpStatus.OK)); + } + + @Test + public void givenTaxiRide_whenCalculatedFare_thanStatus200() { + TestRestTemplate testRestTemplate = new TestRestTemplate(); + TaxiRide taxiRide = new TaxiRide(true, 10l); + String fare = testRestTemplate.postForObject(URL + "calculate/", taxiRide, String.class); + + assertThat(fare, equalTo("200")); + } +} diff --git a/spring-security-mvc-socket/README.md b/spring-security-mvc-socket/README.md index 2144765a04..5ae9d4f4cd 100644 --- a/spring-security-mvc-socket/README.md +++ b/spring-security-mvc-socket/README.md @@ -1,2 +1,2 @@ ### Relevant Articles: -- [Intro to Security and WebSockets](http://www.baeldung.com/intro-to-security-and-websockets) \ No newline at end of file +- [Intro to Security and WebSockets](http://www.baeldung.com/spring-security-websockets) diff --git a/spring-security-rest-full/src/test/java/org/baeldung/common/web/AbstractDiscoverabilityLiveTest.java b/spring-security-rest-full/src/test/java/org/baeldung/common/web/AbstractDiscoverabilityLiveTest.java index 2d3ad7b13f..e7456f1667 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/common/web/AbstractDiscoverabilityLiveTest.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/common/web/AbstractDiscoverabilityLiveTest.java @@ -37,7 +37,7 @@ public abstract class AbstractDiscoverabilityLiveTest ex // Then final String allowHeader = res.getHeader(HttpHeaders.ALLOW); - assertThat(allowHeader, AnyOf. anyOf(containsString("GET"), containsString("PUT"), containsString("DELETE"))); + assertThat(allowHeader, AnyOf.anyOf(containsString("GET"), containsString("PUT"), containsString("DELETE"))); } @Test diff --git a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java index be9b7cf27e..6e70f979c8 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java @@ -31,7 +31,7 @@ public abstract class CsrfAbstractIntegrationTest { @Autowired private Filter springSecurityFilterChain; - protected MockMvc mvc; + MockMvc mvc; // @@ -40,15 +40,15 @@ public abstract class CsrfAbstractIntegrationTest { mvc = MockMvcBuilders.webAppContextSetup(context).addFilters(springSecurityFilterChain).build(); } - protected RequestPostProcessor testUser() { + RequestPostProcessor testUser() { return user("user1").password("user1Pass").roles("USER"); } - protected RequestPostProcessor testAdmin() { + RequestPostProcessor testAdmin() { return user("admin").password("adminPass").roles("USER", "ADMIN"); } - protected String createFoo() throws JsonProcessingException { + String createFoo() throws JsonProcessingException { return new ObjectMapper().writeValueAsString(new Foo(randomAlphabetic(6))); } } diff --git a/spring-security-rest-full/src/test/java/org/baeldung/test/JacksonMarshaller.java b/spring-security-rest-full/src/test/java/org/baeldung/test/JacksonMarshaller.java index 392e101193..a899d387ab 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/test/JacksonMarshaller.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/test/JacksonMarshaller.java @@ -33,10 +33,6 @@ public final class JacksonMarshaller implements IMarshaller { String entityAsJSON = null; try { entityAsJSON = objectMapper.writeValueAsString(resource); - } catch (final JsonParseException parseEx) { - logger.error("", parseEx); - } catch (final JsonMappingException mappingEx) { - logger.error("", mappingEx); } catch (final IOException ioEx) { logger.error("", ioEx); } @@ -51,10 +47,6 @@ public final class JacksonMarshaller implements IMarshaller { T entity = null; try { entity = objectMapper.readValue(resourceAsString, clazz); - } catch (final JsonParseException parseEx) { - logger.error("", parseEx); - } catch (final JsonMappingException mappingEx) { - logger.error("", mappingEx); } catch (final IOException ioEx) { logger.error("", ioEx); } @@ -76,10 +68,6 @@ public final class JacksonMarshaller implements IMarshaller { } else { entities = objectMapper.readValue(resourcesAsString, List.class); } - } catch (final JsonParseException parseEx) { - logger.error("", parseEx); - } catch (final JsonMappingException mappingEx) { - logger.error("", mappingEx); } catch (final IOException ioEx) { logger.error("", ioEx); } diff --git a/spring-security-rest-full/src/test/java/org/baeldung/util/IDUtil.java b/spring-security-rest-full/src/test/java/org/baeldung/util/IDUtil.java index 84fb63a321..85ab623e5f 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/util/IDUtil.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/util/IDUtil.java @@ -10,21 +10,21 @@ public final class IDUtil { // API - public final static String randomPositiveLongAsString() { + public static String randomPositiveLongAsString() { return Long.toString(randomPositiveLong()); } - public final static String randomNegativeLongAsString() { + public static String randomNegativeLongAsString() { return Long.toString(randomNegativeLong()); } - public final static long randomPositiveLong() { + public static long randomPositiveLong() { long id = new Random().nextLong() * 10000; id = (id < 0) ? (-1 * id) : id; return id; } - public final static long randomNegativeLong() { + private static long randomNegativeLong() { long id = new Random().nextLong() * 10000; id = (id > 0) ? (-1 * id) : id; return id; diff --git a/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java b/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java index 7dcaec5a12..44dc860e62 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java @@ -27,6 +27,7 @@ public class LoggerInterceptorIntegrationTest { @Autowired WebApplicationContext wac; + @Autowired MockHttpSession session; diff --git a/spring-security-rest-full/src/test/java/org/baeldung/web/util/HTTPLinkHeaderUtil.java b/spring-security-rest-full/src/test/java/org/baeldung/web/util/HTTPLinkHeaderUtil.java index bb3919eacc..29f1c91ca3 100644 --- a/spring-security-rest-full/src/test/java/org/baeldung/web/util/HTTPLinkHeaderUtil.java +++ b/spring-security-rest-full/src/test/java/org/baeldung/web/util/HTTPLinkHeaderUtil.java @@ -1,10 +1,5 @@ package org.baeldung.web.util; -import java.util.List; - -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; - public final class HTTPLinkHeaderUtil { private HTTPLinkHeaderUtil() { @@ -13,23 +8,6 @@ public final class HTTPLinkHeaderUtil { // - /** - * ex.
- * https://api.github.com/users/steveklabnik/gists?page=2>; rel="next", ; rel="last" - */ - public static List extractAllURIs(final String linkHeader) { - Preconditions.checkNotNull(linkHeader); - - final List linkHeaders = Lists.newArrayList(); - final String[] links = linkHeader.split(", "); - for (final String link : links) { - final int positionOfSeparator = link.indexOf(';'); - linkHeaders.add(link.substring(1, positionOfSeparator - 1)); - } - - return linkHeaders; - } - public static String extractURIByRel(final String linkHeader, final String rel) { if (linkHeader == null) { return null; @@ -37,7 +15,7 @@ public final class HTTPLinkHeaderUtil { String uriWithSpecifiedRel = null; final String[] links = linkHeader.split(", "); - String linkRelation = null; + String linkRelation; for (final String link : links) { final int positionOfSeparator = link.indexOf(';'); linkRelation = link.substring(positionOfSeparator + 1, link.length()).trim(); @@ -50,20 +28,9 @@ public final class HTTPLinkHeaderUtil { return uriWithSpecifiedRel; } - static Object extractTypeOfRelation(final String linkRelation) { + private static Object extractTypeOfRelation(final String linkRelation) { final int positionOfEquals = linkRelation.indexOf('='); return linkRelation.substring(positionOfEquals + 2, linkRelation.length() - 1).trim(); } - /** - * ex.
- * https://api.github.com/users/steveklabnik/gists?page=2>; rel="next" - */ - public static String extractSingleURI(final String linkHeader) { - Preconditions.checkNotNull(linkHeader); - final int positionOfSeparator = linkHeader.indexOf(';'); - - return linkHeader.substring(1, positionOfSeparator - 1); - } - } diff --git a/spring-security-rest/pom.xml b/spring-security-rest/pom.xml index 64c0160e1f..13db431ae3 100644 --- a/spring-security-rest/pom.xml +++ b/spring-security-rest/pom.xml @@ -307,7 +307,7 @@ 2.9.0 - 2.6.1 + 2.7.0 4.4.5 4.5.2 diff --git a/spring-security-sso/README.md b/spring-security-sso/README.md new file mode 100644 index 0000000000..11b5f011d5 --- /dev/null +++ b/spring-security-sso/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Simple Single Sign On with Spring Security OAuth2](http://www.baeldung.com/sso-spring-security-oauth2) diff --git a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerIntegrationTest.java b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerIntegrationTest.java index 6c551b53b2..462e9e8c21 100644 --- a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerIntegrationTest.java +++ b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/ExpressionUtilityObjectsControllerIntegrationTest.java @@ -41,7 +41,7 @@ public class ExpressionUtilityObjectsControllerIntegrationTest { @Autowired private Filter springSecurityFilterChain; - protected RequestPostProcessor testUser() { + private RequestPostProcessor testUser() { return user("user1").password("user1Pass").roles("USER"); } diff --git a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerIntegrationTest.java b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerIntegrationTest.java index 62c364f864..9c5efdbfc2 100644 --- a/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerIntegrationTest.java +++ b/spring-thymeleaf/src/test/java/com/baeldung/thymeleaf/controller/LayoutDialectControllerIntegrationTest.java @@ -41,7 +41,7 @@ public class LayoutDialectControllerIntegrationTest { @Autowired private Filter springSecurityFilterChain; - protected RequestPostProcessor testUser() { + private RequestPostProcessor testUser() { return user("user1").password("user1Pass").roles("USER"); } diff --git a/spring-thymeleaf/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java b/spring-thymeleaf/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java index 3d8ddfdd5c..4f6480e3b2 100644 --- a/spring-thymeleaf/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java +++ b/spring-thymeleaf/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java @@ -41,7 +41,7 @@ public class CsrfEnabledIntegrationTest { @Autowired private Filter springSecurityFilterChain; - protected RequestPostProcessor testUser() { + private RequestPostProcessor testUser() { return user("user1").password("user1Pass").roles("USER"); } diff --git a/spring-vertx/README.md b/spring-vertx/README.md new file mode 100644 index 0000000000..05d059e1b2 --- /dev/null +++ b/spring-vertx/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Vert.x Spring Integration](http://www.baeldung.com/spring-vertx) diff --git a/static-analysis/src/test/java/com/baeldung/pmd/CntTest.java b/static-analysis/src/test/java/com/baeldung/pmd/CntTest.java new file mode 100644 index 0000000000..ed72602f99 --- /dev/null +++ b/static-analysis/src/test/java/com/baeldung/pmd/CntTest.java @@ -0,0 +1,17 @@ +package com.baeldung.pmd; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class CntTest { + + private Cnt service; + + @Test + public void whenSecondParamIsZeroShouldReturnIntMax(){ + service = new Cnt(); + int answer = service.d(100,0); + assertEquals(Integer.MAX_VALUE, answer); + } +} diff --git a/structurizr/README.md b/structurizr/README.md new file mode 100644 index 0000000000..e596dfa458 --- /dev/null +++ b/structurizr/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Intro to Structurizr](http://www.baeldung.com/structurizr) diff --git a/testing/pom.xml b/testing/pom.xml index aa10392aa8..bfd47dbc4a 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -45,6 +45,12 @@ test + + info.cukes + cucumber-java8 + ${cucumber.version} + test + org.pitest diff --git a/testing/src/test/java/com/baeldung/junitparams/SafeAdditionUtilTest.java b/testing/src/test/java/com/baeldung/junitparams/SafeAdditionUtilTest.java index 8ab49309cd..f1659437ec 100644 --- a/testing/src/test/java/com/baeldung/junitparams/SafeAdditionUtilTest.java +++ b/testing/src/test/java/com/baeldung/junitparams/SafeAdditionUtilTest.java @@ -1,20 +1,20 @@ package com.baeldung.junitparams; -import static org.junit.Assert.assertEquals; - import junitparams.FileParameters; import junitparams.JUnitParamsRunner; import junitparams.Parameters; import org.junit.Test; import org.junit.runner.RunWith; +import static org.junit.Assert.assertEquals; + @RunWith(JUnitParamsRunner.class) public class SafeAdditionUtilTest { private SafeAdditionUtil serviceUnderTest = new SafeAdditionUtil(); @Test - @Parameters({ "1, 2, 3", "-10, 30, 20", "15, -5, 10", "-5, -10, -15" }) + @Parameters({"1, 2, 3", "-10, 30, 20", "15, -5, 10", "-5, -10, -15"}) public void whenWithAnnotationProvidedParams_thenSafeAdd(int a, int b, int expectedValue) { assertEquals(expectedValue, serviceUnderTest.safeAdd(a, b)); } @@ -26,7 +26,7 @@ public class SafeAdditionUtilTest { } private Object[] parametersToTestAdd() { - return new Object[] { new Object[] { 1, 2, 3 }, new Object[] { -10, 30, 20 }, new Object[] { Integer.MAX_VALUE, 2, Integer.MAX_VALUE }, new Object[] { Integer.MIN_VALUE, -8, Integer.MIN_VALUE } }; + return new Object[]{new Object[]{1, 2, 3}, new Object[]{-10, 30, 20}, new Object[]{Integer.MAX_VALUE, 2, Integer.MAX_VALUE}, new Object[]{Integer.MIN_VALUE, -8, Integer.MIN_VALUE}}; } @Test @@ -36,7 +36,7 @@ public class SafeAdditionUtilTest { } private Object[] parametersForWhenWithnoParam_thenLoadByNameSafeAdd() { - return new Object[] { new Object[] { 1, 2, 3 }, new Object[] { -10, 30, 20 }, new Object[] { Integer.MAX_VALUE, 2, Integer.MAX_VALUE }, new Object[] { Integer.MIN_VALUE, -8, Integer.MIN_VALUE } }; + return new Object[]{new Object[]{1, 2, 3}, new Object[]{-10, 30, 20}, new Object[]{Integer.MAX_VALUE, 2, Integer.MAX_VALUE}, new Object[]{Integer.MIN_VALUE, -8, Integer.MIN_VALUE}}; } @Test diff --git a/testing/src/test/java/com/baeldung/junitparams/TestDataProvider.java b/testing/src/test/java/com/baeldung/junitparams/TestDataProvider.java index d318345a56..08a472502e 100644 --- a/testing/src/test/java/com/baeldung/junitparams/TestDataProvider.java +++ b/testing/src/test/java/com/baeldung/junitparams/TestDataProvider.java @@ -3,11 +3,11 @@ package com.baeldung.junitparams; public class TestDataProvider { public static Object[] provideBasicData() { - return new Object[] { new Object[] { 1, 2, 3 }, new Object[] { -10, 30, 20 }, new Object[] { 15, -5, 10 }, new Object[] { -5, -10, -15 } }; + return new Object[]{new Object[]{1, 2, 3}, new Object[]{-10, 30, 20}, new Object[]{15, -5, 10}, new Object[]{-5, -10, -15}}; } public static Object[] provideEdgeCaseData() { - return new Object[] { new Object[] { Integer.MAX_VALUE, 2, Integer.MAX_VALUE }, new Object[] { Integer.MIN_VALUE, -2, Integer.MIN_VALUE }, }; + return new Object[]{new Object[]{Integer.MAX_VALUE, 2, Integer.MAX_VALUE}, new Object[]{Integer.MIN_VALUE, -2, Integer.MIN_VALUE},}; } } diff --git a/testing/src/test/java/com/baeldung/testing/calculator/CalculatorIntegrationTest.java b/testing/src/test/java/com/baeldung/testing/calculator/CalculatorIntegrationTest.java index 1cdb92090a..20bd62396c 100644 --- a/testing/src/test/java/com/baeldung/testing/calculator/CalculatorIntegrationTest.java +++ b/testing/src/test/java/com/baeldung/testing/calculator/CalculatorIntegrationTest.java @@ -1,15 +1,14 @@ package com.baeldung.testing.calculator; -import org.junit.runner.RunWith; - import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; +import org.junit.runner.RunWith; @RunWith(Cucumber.class) @CucumberOptions( - features={"classpath:features/calculator.feature", "classpath:features/calculator-scenario-outline.feature"} - , plugin = { "pretty", "json:target/reports/json/calculator.json" } - , glue = {"com.baeldung.cucumber.calculator"} + features = {"classpath:features/calculator.feature", "classpath:features/calculator-scenario-outline.feature"} + , plugin = {"pretty", "json:target/reports/json/calculator.json"} + , glue = {"com.baeldung.cucumber.calculator"} ) public class CalculatorIntegrationTest { } diff --git a/testing/src/test/java/com/baeldung/testing/shopping/ShoppingIntegrationTest.java b/testing/src/test/java/com/baeldung/testing/shopping/ShoppingIntegrationTest.java new file mode 100644 index 0000000000..7bf8641ed6 --- /dev/null +++ b/testing/src/test/java/com/baeldung/testing/shopping/ShoppingIntegrationTest.java @@ -0,0 +1,12 @@ +package com.baeldung.testing.shopping; + +import org.junit.runner.RunWith; + +import cucumber.api.CucumberOptions; +import cucumber.api.junit.Cucumber; + +@RunWith(Cucumber.class) +@CucumberOptions(features = { "classpath:features/shopping.feature" }) +public class ShoppingIntegrationTest { + +} diff --git a/testing/src/test/java/com/baeldung/testing/shopping/ShoppingStepsDef.java b/testing/src/test/java/com/baeldung/testing/shopping/ShoppingStepsDef.java new file mode 100644 index 0000000000..2c4bf2eeae --- /dev/null +++ b/testing/src/test/java/com/baeldung/testing/shopping/ShoppingStepsDef.java @@ -0,0 +1,22 @@ +package com.baeldung.testing.shopping; + +import static org.junit.Assert.assertEquals; +import cucumber.api.java8.En; + +public class ShoppingStepsDef implements En { + + private int budget = 0; + + public ShoppingStepsDef() { + + Given("I have (\\d+) in my wallet", (Integer money) -> budget = money); + + When("I buy .* with (\\d+)", (Integer price) -> budget -= price); + + Then("I should have (\\d+) in my wallet", (Integer finalBudget) -> { + assertEquals(budget, finalBudget.intValue()); + }); + + } + +} \ No newline at end of file diff --git a/testing/src/test/resources/features/shopping.feature b/testing/src/test/resources/features/shopping.feature new file mode 100644 index 0000000000..d1ce43df75 --- /dev/null +++ b/testing/src/test/resources/features/shopping.feature @@ -0,0 +1,11 @@ +Feature: Shopping + + Scenario: Track my budget + Given I have 100 in my wallet + When I buy milk with 10 + Then I should have 90 in my wallet + + Scenario: Track my budget + Given I have 200 in my wallet + When I buy rice with 20 + Then I should have 180 in my wallet diff --git a/vaadin/pom.xml b/vaadin/pom.xml new file mode 100644 index 0000000000..6d3512ba2d --- /dev/null +++ b/vaadin/pom.xml @@ -0,0 +1,173 @@ + + + 4.0.0 + + org.test + vaadin-app + war + 1.0-SNAPSHOT + vaadin-app + + + 3 + + + + 7.7.10 + 8.0.6 + 9.3.9.v20160517 + UTF-8 + 1.8 + 1.8 + local + mytheme + + + + + vaadin-addons + http://maven.vaadin.com/vaadin-addons + + + + + + + com.vaadin + vaadin-bom + ${vaadin.version} + pom + import + + + + + + + javax.servlet + javax.servlet-api + 3.0.1 + provided + + + com.vaadin + vaadin-server + + + com.vaadin + vaadin-push + + + com.vaadin + vaadin-client-compiled + + + com.vaadin + vaadin-themes + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.0.0 + + false + + WEB-INF/classes/VAADIN/widgetsets/WEB-INF/** + + + + com.vaadin + vaadin-maven-plugin + ${vaadin.plugin.version} + + + + update-theme + update-widgetset + compile + + compile-theme + + + + + + org.apache.maven.plugins + maven-clean-plugin + 3.0.0 + + + + + src/main/webapp/VAADIN/themes + + **/styles.css + **/styles.scss.cache + + + + + + + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.plugin.version} + + 2 + + + + + + + + + vaadin-prerelease + + false + + + + + vaadin-prereleases + http://maven.vaadin.com/vaadin-prereleases + + + vaadin-snapshots + https://oss.sonatype.org/content/repositories/vaadin-snapshots/ + + false + + + true + + + + + + vaadin-prereleases + http://maven.vaadin.com/vaadin-prereleases + + + vaadin-snapshots + https://oss.sonatype.org/content/repositories/vaadin-snapshots/ + + false + + + true + + + + + + + diff --git a/vaadin/src/main/java/com/baeldung/introduction/BindData.java b/vaadin/src/main/java/com/baeldung/introduction/BindData.java new file mode 100644 index 0000000000..299554c039 --- /dev/null +++ b/vaadin/src/main/java/com/baeldung/introduction/BindData.java @@ -0,0 +1,20 @@ +package com.baeldung.introduction; + +public class BindData { + + private String bindName; + + public BindData(String bindName){ + this.bindName = bindName; + } + + public String getBindName() { + return bindName; + } + + public void setBindName(String bindName) { + this.bindName = bindName; + } + + +} diff --git a/vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java b/vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java new file mode 100644 index 0000000000..1b3733ad74 --- /dev/null +++ b/vaadin/src/main/java/com/baeldung/introduction/VaadinUI.java @@ -0,0 +1,281 @@ +package com.baeldung.introduction; + +import java.time.Instant; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import javax.servlet.annotation.WebServlet; + +import com.vaadin.annotations.Push; +import com.vaadin.annotations.Theme; +import com.vaadin.annotations.VaadinServletConfiguration; +import com.vaadin.data.Validator.InvalidValueException; +import com.vaadin.data.fieldgroup.BeanFieldGroup; +import com.vaadin.data.validator.StringLengthValidator; +import com.vaadin.server.ExternalResource; +import com.vaadin.server.FontAwesome; +import com.vaadin.server.VaadinRequest; +import com.vaadin.server.VaadinServlet; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.DateField; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.Grid; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.InlineDateField; +import com.vaadin.ui.Label; +import com.vaadin.ui.Link; +import com.vaadin.ui.ListSelect; +import com.vaadin.ui.NativeButton; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.Panel; +import com.vaadin.ui.PasswordField; +import com.vaadin.ui.RichTextArea; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; +import com.vaadin.ui.TwinColSelect; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; + +@SuppressWarnings("serial") +@Push +@Theme("mytheme") +public class VaadinUI extends UI { + + private Label currentTime; + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + protected void init(VaadinRequest vaadinRequest) { + final VerticalLayout verticalLayout = new VerticalLayout(); + verticalLayout.setSpacing(true); + verticalLayout.setMargin(true); + final GridLayout gridLayout = new GridLayout(3, 2); + gridLayout.setSpacing(true); + gridLayout.setMargin(true); + final HorizontalLayout horizontalLayout = new HorizontalLayout(); + horizontalLayout.setSpacing(true); + horizontalLayout.setMargin(true); + final FormLayout formLayout = new FormLayout(); + formLayout.setSpacing(true); + formLayout.setMargin(true); + final GridLayout buttonLayout = new GridLayout(3, 5); + buttonLayout.setMargin(true); + buttonLayout.setSpacing(true); + + final Label label = new Label(); + label.setId("Label"); + label.setValue("Label Value"); + label.setCaption("Label"); + gridLayout.addComponent(label); + + final Link link = new Link("Baeldung", new ExternalResource("http://www.baeldung.com/")); + link.setId("Link"); + link.setTargetName("_blank"); + gridLayout.addComponent(link); + + final TextField textField = new TextField(); + textField.setId("TextField"); + textField.setCaption("TextField:"); + textField.setValue("TextField Value"); + textField.setIcon(FontAwesome.USER); + gridLayout.addComponent(textField); + + final TextArea textArea = new TextArea(); + textArea.setCaption("TextArea"); + textArea.setId("TextArea"); + textArea.setValue("TextArea Value"); + gridLayout.addComponent(textArea); + + final DateField dateField = new DateField("DateField", new Date(0)); + dateField.setId("DateField"); + gridLayout.addComponent(dateField); + + final PasswordField passwordField = new PasswordField(); + passwordField.setId("PasswordField"); + passwordField.setCaption("PasswordField:"); + passwordField.setValue("password"); + gridLayout.addComponent(passwordField); + + final RichTextArea richTextArea = new RichTextArea(); + richTextArea.setCaption("Rich Text Area"); + richTextArea.setValue("

RichTextArea

"); + richTextArea.setSizeFull(); + + Panel richTextPanel = new Panel(); + richTextPanel.setContent(richTextArea); + + final InlineDateField inlineDateField = new InlineDateField(); + inlineDateField.setValue(new Date(0)); + inlineDateField.setCaption("Inline Date Field"); + horizontalLayout.addComponent(inlineDateField); + + Button normalButton = new Button("Normal Button"); + normalButton.setId("NormalButton"); + normalButton.addClickListener(e -> { + label.setValue("CLICK"); + }); + buttonLayout.addComponent(normalButton); + + Button tinyButton = new Button("Tiny Button"); + tinyButton.addStyleName("tiny"); + buttonLayout.addComponent(tinyButton); + + Button smallButton = new Button("Small Button"); + smallButton.addStyleName("small"); + buttonLayout.addComponent(smallButton); + + Button largeButton = new Button("Large Button"); + largeButton.addStyleName("large"); + buttonLayout.addComponent(largeButton); + + Button hugeButton = new Button("Huge Button"); + hugeButton.addStyleName("huge"); + buttonLayout.addComponent(hugeButton); + + Button disabledButton = new Button("Disabled Button"); + disabledButton.setDescription("This button cannot be clicked"); + disabledButton.setEnabled(false); + buttonLayout.addComponent(disabledButton); + + Button dangerButton = new Button("Danger Button"); + dangerButton.addStyleName("danger"); + buttonLayout.addComponent(dangerButton); + + Button friendlyButton = new Button("Friendly Button"); + friendlyButton.addStyleName("friendly"); + buttonLayout.addComponent(friendlyButton); + + Button primaryButton = new Button("Primary Button"); + primaryButton.addStyleName("primary"); + buttonLayout.addComponent(primaryButton); + + NativeButton nativeButton = new NativeButton("Native Button"); + buttonLayout.addComponent(nativeButton); + + Button iconButton = new Button("Icon Button"); + iconButton.setIcon(FontAwesome.ALIGN_LEFT); + buttonLayout.addComponent(iconButton); + + Button borderlessButton = new Button("BorderLess Button"); + borderlessButton.addStyleName("borderless"); + buttonLayout.addComponent(borderlessButton); + + Button linkButton = new Button("Link Button"); + linkButton.addStyleName("link"); + buttonLayout.addComponent(linkButton); + + Button quietButton = new Button("Quiet Button"); + quietButton.addStyleName("quiet"); + buttonLayout.addComponent(quietButton); + + horizontalLayout.addComponent(buttonLayout); + + final CheckBox checkbox = new CheckBox("CheckBox"); + checkbox.setValue(true); + checkbox.addValueChangeListener(e -> checkbox.setValue(!checkbox.getValue())); + formLayout.addComponent(checkbox); + + List numbers = new ArrayList(); + numbers.add("One"); + numbers.add("Ten"); + numbers.add("Eleven"); + ComboBox comboBox = new ComboBox("ComboBox"); + comboBox.addItems(numbers); + formLayout.addComponent(comboBox); + + ListSelect listSelect = new ListSelect("ListSelect"); + listSelect.addItems(numbers); + listSelect.setRows(2); + formLayout.addComponent(listSelect); + + NativeSelect nativeSelect = new NativeSelect("NativeSelect"); + nativeSelect.addItems(numbers); + formLayout.addComponent(nativeSelect); + + TwinColSelect twinColSelect = new TwinColSelect("TwinColSelect"); + twinColSelect.addItems(numbers); + + Grid grid = new Grid("Grid"); + grid.setColumns("Column1", "Column2", "Column3"); + grid.addRow("Item1", "Item2", "Item3"); + grid.addRow("Item4", "Item5", "Item6"); + + Panel panel = new Panel("Panel"); + panel.setContent(grid); + panel.setSizeUndefined(); + + Panel serverPushPanel = new Panel("Server Push"); + FormLayout timeLayout = new FormLayout(); + timeLayout.setSpacing(true); + timeLayout.setMargin(true); + currentTime = new Label("No TIME..."); + timeLayout.addComponent(currentTime); + serverPushPanel.setContent(timeLayout); + serverPushPanel.setSizeUndefined(); + ScheduledExecutorService scheduleExecutor = Executors.newScheduledThreadPool(1); + Runnable task = () -> { + currentTime.setValue("Current Time : " + Instant.now()); + }; + scheduleExecutor.scheduleWithFixedDelay(task, 0, 1, TimeUnit.SECONDS); + + FormLayout dataBindingLayout = new FormLayout(); + dataBindingLayout.setSpacing(true); + dataBindingLayout.setMargin(true); + + BindData bindData = new BindData("BindData"); + BeanFieldGroup beanFieldGroup = new BeanFieldGroup(BindData.class); + beanFieldGroup.setItemDataSource(bindData); + TextField bindedTextField = (TextField) beanFieldGroup.buildAndBind("BindName", "bindName"); + bindedTextField.setWidth("250px"); + dataBindingLayout.addComponent(bindedTextField); + + FormLayout validatorLayout = new FormLayout(); + validatorLayout.setSpacing(true); + validatorLayout.setMargin(true); + + HorizontalLayout textValidatorLayout = new HorizontalLayout(); + textValidatorLayout.setSpacing(true); + textValidatorLayout.setMargin(true); + + TextField stringValidator = new TextField(); + stringValidator.setNullSettingAllowed(true); + stringValidator.setNullRepresentation(""); + stringValidator.addValidator(new StringLengthValidator("String must have 2-5 characters lenght", 2, 5, true)); + stringValidator.setValidationVisible(false); + textValidatorLayout.addComponent(stringValidator); + Button buttonStringValidator = new Button("Validate String"); + buttonStringValidator.addClickListener(e -> { + try { + stringValidator.setValidationVisible(false); + stringValidator.validate(); + } catch (InvalidValueException err) { + stringValidator.setValidationVisible(true); + } + }); + textValidatorLayout.addComponent(buttonStringValidator); + + validatorLayout.addComponent(textValidatorLayout); + verticalLayout.addComponent(gridLayout); + verticalLayout.addComponent(richTextPanel); + verticalLayout.addComponent(horizontalLayout); + verticalLayout.addComponent(formLayout); + verticalLayout.addComponent(twinColSelect); + verticalLayout.addComponent(panel); + verticalLayout.addComponent(serverPushPanel); + verticalLayout.addComponent(dataBindingLayout); + verticalLayout.addComponent(validatorLayout); + setContent(verticalLayout); + } + + @WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true) + @VaadinServletConfiguration(ui = VaadinUI.class, productionMode = false) + public static class MyUIServlet extends VaadinServlet { + } +} diff --git a/vaadin/src/main/resources/README b/vaadin/src/main/resources/README new file mode 100644 index 0000000000..faabc74ad5 --- /dev/null +++ b/vaadin/src/main/resources/README @@ -0,0 +1 @@ +Please add your static resources here diff --git a/vaadin/src/main/webapp/VAADIN/themes/mytheme/addons.scss b/vaadin/src/main/webapp/VAADIN/themes/mytheme/addons.scss new file mode 100644 index 0000000000..a5670b70c7 --- /dev/null +++ b/vaadin/src/main/webapp/VAADIN/themes/mytheme/addons.scss @@ -0,0 +1,7 @@ +/* This file is automatically managed and will be overwritten from time to time. */ +/* Do not manually edit this file. */ + +/* Import and include this mixin into your project theme to include the addon themes */ +@mixin addons { +} + diff --git a/vaadin/src/main/webapp/VAADIN/themes/mytheme/favicon.ico b/vaadin/src/main/webapp/VAADIN/themes/mytheme/favicon.ico new file mode 100644 index 0000000000..ffb34a65c7 Binary files /dev/null and b/vaadin/src/main/webapp/VAADIN/themes/mytheme/favicon.ico differ diff --git a/vaadin/src/main/webapp/VAADIN/themes/mytheme/mytheme.scss b/vaadin/src/main/webapp/VAADIN/themes/mytheme/mytheme.scss new file mode 100644 index 0000000000..2c5fb8b944 --- /dev/null +++ b/vaadin/src/main/webapp/VAADIN/themes/mytheme/mytheme.scss @@ -0,0 +1,38 @@ +// If you edit this file you need to compile the theme. See README.md for details. + +// Global variable overrides. Must be declared before importing Valo. + +// Defines the plaintext font size, weight and family. Font size affects general component sizing. +//$v-font-size: 16px; +//$v-font-weight: 300; +//$v-font-family: "Open Sans", sans-serif; + +// Defines the border used by all components. +//$v-border: 1px solid (v-shade 0.7); +//$v-border-radius: 4px; + +// Affects the color of some component elements, e.g Button, Panel title, etc +//$v-background-color: hsl(210, 0%, 98%); +// Affects the color of content areas, e.g Panel and Window content, TextField input etc +//$v-app-background-color: $v-background-color; + +// Affects the visual appearance of all components +//$v-gradient: v-linear 8%; +//$v-bevel-depth: 30%; +//$v-shadow-opacity: 5%; + +// Defines colors for indicating status (focus, success, failure) +//$v-focus-color: valo-focus-color(); // Calculates a suitable color automatically +//$v-friendly-color: #2c9720; +//$v-error-indicator-color: #ed473b; + +// For more information, see: https://vaadin.com/book/-/page/themes.valo.html +// Example variants can be copy/pasted from https://vaadin.com/wiki/-/wiki/Main/Valo+Examples + +@import "../valo/valo.scss"; + +@mixin mytheme { + @include valo; + + // Insert your own theme rules here +} diff --git a/vaadin/src/main/webapp/VAADIN/themes/mytheme/styles.css b/vaadin/src/main/webapp/VAADIN/themes/mytheme/styles.css new file mode 100644 index 0000000000..75bf26f498 --- /dev/null +++ b/vaadin/src/main/webapp/VAADIN/themes/mytheme/styles.css @@ -0,0 +1,12986 @@ +/** + * Checks if a list contains a certain value. + * + * @param {list} $list - the list to check + * @param {value} $var - the value to search for + * @param {bool} $recursive (false) - should any contained lists be checked for the value + * + * @return {bool} true if the value is found from the list, false otherwise + * + * @group lists + */ + +/** + * Cross-browser opacity. + * + * @param {number} $value - opacity value from 0 to 1 + * @param {bool} $important (false) - should the property value be declared with !important + * + * @group util + */ + +@-webkit-keyframes valo-animate-in-fade { + 0% { + opacity: 0; + } + } + +@-moz-keyframes valo-animate-in-fade { + 0% { + opacity: 0; + } + } + +@keyframes valo-animate-in-fade { + 0% { + opacity: 0; + } + } + +@-webkit-keyframes valo-animate-out-fade { + 100% { + opacity: 0; + } + } + +@-moz-keyframes valo-animate-out-fade { + 100% { + opacity: 0; + } + } + +@keyframes valo-animate-out-fade { + 100% { + opacity: 0; + } + } + +@-webkit-keyframes valo-animate-in-slide-down { + 0% { + -webkit-transform: translateY(-100%); + } + } + +@-moz-keyframes valo-animate-in-slide-down { + 0% { + -moz-transform: translateY(-100%); + } + } + +@keyframes valo-animate-in-slide-down { + 0% { + -webkit-transform: translateY(-100%); + -moz-transform: translateY(-100%); + -ms-transform: translateY(-100%); + -o-transform: translateY(-100%); + transform: translateY(-100%); + } + } + +@-webkit-keyframes valo-animate-in-slide-up { + 0% { + -webkit-transform: translateY(100%); + } + } + +@-moz-keyframes valo-animate-in-slide-up { + 0% { + -moz-transform: translateY(100%); + } + } + +@keyframes valo-animate-in-slide-up { + 0% { + -webkit-transform: translateY(100%); + -moz-transform: translateY(100%); + -ms-transform: translateY(100%); + -o-transform: translateY(100%); + transform: translateY(100%); + } + } + +@-webkit-keyframes valo-animate-in-slide-left { + 0% { + -webkit-transform: translateX(100%); + } + } + +@-moz-keyframes valo-animate-in-slide-left { + 0% { + -moz-transform: translateX(100%); + } + } + +@keyframes valo-animate-in-slide-left { + 0% { + -webkit-transform: translateX(100%); + -moz-transform: translateX(100%); + -ms-transform: translateX(100%); + -o-transform: translateX(100%); + transform: translateX(100%); + } + } + +@-webkit-keyframes valo-animate-in-slide-right { + 0% { + -webkit-transform: translateX(-100%); + } + } + +@-moz-keyframes valo-animate-in-slide-right { + 0% { + -moz-transform: translateX(-100%); + } + } + +@keyframes valo-animate-in-slide-right { + 0% { + -webkit-transform: translateX(-100%); + -moz-transform: translateX(-100%); + -ms-transform: translateX(-100%); + -o-transform: translateX(-100%); + transform: translateX(-100%); + } + } + +@-webkit-keyframes valo-animate-out-slide-down { + 100% { + -webkit-transform: translateY(100%); + } + } + +@-moz-keyframes valo-animate-out-slide-down { + 100% { + -moz-transform: translateY(100%); + } + } + +@keyframes valo-animate-out-slide-down { + 100% { + -webkit-transform: translateY(100%); + -moz-transform: translateY(100%); + -ms-transform: translateY(100%); + -o-transform: translateY(100%); + transform: translateY(100%); + } + } + +@-webkit-keyframes valo-animate-out-slide-up { + 100% { + -webkit-transform: translateY(-100%); + } + } + +@-moz-keyframes valo-animate-out-slide-up { + 100% { + -moz-transform: translateY(-100%); + } + } + +@keyframes valo-animate-out-slide-up { + 100% { + -webkit-transform: translateY(-100%); + -moz-transform: translateY(-100%); + -ms-transform: translateY(-100%); + -o-transform: translateY(-100%); + transform: translateY(-100%); + } + } + +@-webkit-keyframes valo-animate-out-slide-left { + 100% { + -webkit-transform: translateX(-100%); + } + } + +@-moz-keyframes valo-animate-out-slide-left { + 100% { + -moz-transform: translateX(-100%); + } + } + +@keyframes valo-animate-out-slide-left { + 100% { + -webkit-transform: translateX(-100%); + -moz-transform: translateX(-100%); + -ms-transform: translateX(-100%); + -o-transform: translateX(-100%); + transform: translateX(-100%); + } + } + +@-webkit-keyframes valo-animate-out-slide-right { + 100% { + -webkit-transform: translateX(100%); + } + } + +@-moz-keyframes valo-animate-out-slide-right { + 100% { + -moz-transform: translateX(100%); + } + } + +@keyframes valo-animate-out-slide-right { + 100% { + -webkit-transform: translateX(100%); + -moz-transform: translateX(100%); + -ms-transform: translateX(100%); + -o-transform: translateX(100%); + transform: translateX(100%); + } + } + +@-webkit-keyframes valo-overlay-animate-in { + 0% { + -webkit-transform: translatey(-4px); + opacity: 0; + } + } + +@-moz-keyframes valo-overlay-animate-in { + 0% { + -moz-transform: translatey(-4px); + opacity: 0; + } + } + +@keyframes valo-overlay-animate-in { + 0% { + -webkit-transform: translatey(-4px); + -moz-transform: translatey(-4px); + -ms-transform: translatey(-4px); + -o-transform: translatey(-4px); + transform: translatey(-4px); + opacity: 0; + } + } + +@-webkit-keyframes valo-animate-out-slide-down-fade { + 100% { + opacity: 0; + -webkit-transform: translatey(30%); + } + } + +@-moz-keyframes valo-animate-out-slide-down-fade { + 100% { + opacity: 0; + -moz-transform: translatey(30%); + } + } + +@keyframes valo-animate-out-slide-down-fade { + 100% { + opacity: 0; + -webkit-transform: translatey(30%); + -moz-transform: translatey(30%); + -ms-transform: translatey(30%); + -o-transform: translatey(30%); + transform: translatey(30%); + } + } + +/** + * Outputs cross-browser Valo-specific linear gradient background-image declarations. + * + * @group style + * + * @param {color} $color ($v-background-color) - The base color for the gradient color stops + * @param {list} $gradient ($v-gradient) - Valo-specific gradient value. See the documentation for $v-gradient. + * @param {color} $fallback (null) - A fallback color for browser which do not support linear gradients (IE8 and IE9 in particular). If null, the base $color is used instead. + * @param {string} $direction (to bottom) - the direction of the linear gradient. The color stops are by default so that a lighter shade is at the start and a darker shade is at the end. + */ + +/** + * Computes a CSS border property value for the given base color. + * + * @group style + * + * @param {list} $border ($v-border) - CSS border value which can contain any of the color keywords + * @param {color} $color ($v-background-color) - the base color to which the color keywords are applied to + * @param {color} $context (null) - context/surrounding color where the border is expected to appear. The color of the final border is the darker of the two parameters passed to this function. + * @param {number} $strength (1) - adjustment for the border contrast + * + * @return {list} The input $border value with any color keyword replaced with the corresponding actual color + */ + +/** + * Ouput selectors and properties to vertically center elements inside their parent. + * + * @param {string} $to-align (()) - The selector to match the elements which you wish to align vertically. The targeted elements should be inline or inline-block elements. + * @param {string} $align (middle) - The vertical-align value, e.g. top, middle, bottom + * @param {string} $pseudo-element (after) - Which pseudo element to use for the vertical align guide + * + * @group util + */ + +@font-face { + font-family: ThemeIcons; + font-weight: normal; + font-style: normal; + src: url(../valo/util/bourbon/css3/../../../../base/fonts/themeicons-webfont.eot); + src: url(../valo/util/bourbon/css3/../../../../base/fonts/themeicons-webfont.eot?#iefix) format("embedded-opentype"), url(../valo/util/bourbon/css3/../../../../base/fonts/themeicons-webfont.woff) format("woff"), url(../valo/util/bourbon/css3/../../../../base/fonts/themeicons-webfont.ttf) format("truetype"), url(../valo/util/bourbon/css3/../../../../base/fonts/themeicons-webfont.svg#ThemeIcons) format("svg"); +} + +.ThemeIcons { + font-family: ThemeIcons; + font-style: normal; + font-weight: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + display: inline-block; + text-align: center; +} + +@font-face { + font-family: FontAwesome; + font-weight: normal; + font-style: normal; + src: url(../valo/util/bourbon/css3/../../../../base/fonts/fontawesome-webfont.eot); + src: url(../valo/util/bourbon/css3/../../../../base/fonts/fontawesome-webfont.eot?#iefix) format("embedded-opentype"), url(../valo/util/bourbon/css3/../../../../base/fonts/fontawesome-webfont.woff) format("woff"), url(../valo/util/bourbon/css3/../../../../base/fonts/fontawesome-webfont.ttf) format("truetype"), url(../valo/util/bourbon/css3/../../../../base/fonts/fontawesome-webfont.svg#FontAwesome) format("svg"); +} + +.FontAwesome { + font-family: FontAwesome; + font-style: normal; + font-weight: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + display: inline-block; + text-align: center; +} + +@font-face { + font-family: "Open Sans"; + src: url(../valo/fonts/open-sans/OpenSans-Light-webfont.eot); + src: url(../valo/fonts/open-sans/OpenSans-Light-webfont.eot?#iefix) format("embedded-opentype"), url(../valo/fonts/open-sans/OpenSans-Light-webfont.woff) format("woff"), url(../valo/fonts/open-sans/OpenSans-Light-webfont.ttf) format("truetype"); + font-weight: 300; + font-style: normal; +} + +@font-face { + font-family: "Open Sans"; + src: url(../valo/fonts/open-sans/OpenSans-Regular-webfont.eot); + src: url(../valo/fonts/open-sans/OpenSans-Regular-webfont.eot?#iefix) format("embedded-opentype"), url(../valo/fonts/open-sans/OpenSans-Regular-webfont.woff) format("woff"), url(../valo/fonts/open-sans/OpenSans-Regular-webfont.ttf) format("truetype"); + font-weight: 400; + font-style: normal; +} + +@font-face { + font-family: "Open Sans"; + src: url(../valo/fonts/open-sans/OpenSans-Semibold-webfont.eot); + src: url(../valo/fonts/open-sans/OpenSans-Semibold-webfont.eot?#iefix) format("embedded-opentype"), url(../valo/fonts/open-sans/OpenSans-Semibold-webfont.woff) format("woff"), url(../valo/fonts/open-sans/OpenSans-Semibold-webfont.ttf) format("truetype"); + font-weight: 600; + font-style: normal; +} + +@-webkit-keyframes v-rotate-360 { + to { + -webkit-transform: rotate(360deg); + } + } + +@-moz-keyframes v-rotate-360 { + to { + -moz-transform: rotate(360deg); + } + } + +@-o-keyframes v-rotate-360 { + to { + -o-transform: rotate(360deg); + } + } + +@keyframes v-rotate-360 { + to { + transform: rotate(360deg); + } + } + +@-webkit-keyframes v-progress-start { + 0% { + width: 0%; + } + 100% { + width: 50%; + } + } + +@-moz-keyframes v-progress-start { + 0% { + width: 0%; + } + 100% { + width: 50%; + } + } + +@keyframes v-progress-start { + 0% { + width: 0%; + } + 100% { + width: 50%; + } + } + +@-webkit-keyframes v-progress-delay { + 0% { + width: 50%; + } + 100% { + width: 90%; + } + } + +@-moz-keyframes v-progress-delay { + 0% { + width: 50%; + } + 100% { + width: 90%; + } + } + +@keyframes v-progress-delay { + 0% { + width: 50%; + } + 100% { + width: 90%; + } + } + +@-webkit-keyframes v-progress-wait { + 0% { + width: 90%; + height: 4px; + } + 3% { + width: 91%; + height: 7px; + } + 100% { + width: 96%; + height: 7px; + } + } + +@-moz-keyframes v-progress-wait { + 0% { + width: 90%; + height: 4px; + } + 3% { + width: 91%; + height: 7px; + } + 100% { + width: 96%; + height: 7px; + } + } + +@keyframes v-progress-wait { + 0% { + width: 90%; + height: 4px; + } + 3% { + width: 91%; + height: 7px; + } + 100% { + width: 96%; + height: 7px; + } + } + +@-webkit-keyframes v-progress-wait-pulse { + 0% { + opacity: 1; + } + 50% { + opacity: 0.1; + } + 100% { + opacity: 1; + } + } + +@-moz-keyframes v-progress-wait-pulse { + 0% { + opacity: 1; + } + 50% { + opacity: 0.1; + } + 100% { + opacity: 1; + } + } + +@keyframes v-progress-wait-pulse { + 0% { + opacity: 1; + } + 50% { + opacity: 0.1; + } + 100% { + opacity: 1; + } + } + +/** + * Outputs the context menu selectors and styles, which is used by Table and Tree for instance. + * + * @requires {mixin} valo-selection-item-style + * @requires {mixin} valo-selection-item-selected-style + */ + +/** + * The background color for overlay elements. + * + * @type color + * @group overlay + */ + +.v-shadow, .v-shadow-window { + display: none; +} + +.v-ie8 .v-shadow, .v-ie8 .v-shadow-window { + display: block; +} + +.v-ie8 .v-shadow .top, .v-ie8 .v-shadow-window .top { + position: absolute; + top: -6px; + right: 10px; + bottom: 6px; + left: -10px; + background: black; + filter: alpha(opacity=5) progid:DXImageTransform.Microsoft.blur(pixelradius=10, makeShadow=false); +} + +.v-ie8 .v-shadow .top-left, .v-ie8 .v-shadow-window .top-left { + position: absolute; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; + background: black; + filter: alpha(opacity=9) progid:DXImageTransform.Microsoft.blur(pixelradius=0, makeShadow=false); +} + +/** + * The backgound color for tooltips. + * + * @type color + * @group tooltip + */ + +/** + * + * + * @param {string} $primary-stylename (v-absolutelayout) - + * + * @group absolutelayout + */ + +/** + * Outputs the selectors and properties for the Accordion component. + * + * @param {string} $primary-stylename (v-accordion) - the primary style name for the selectors + * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component + * @group accordion + */ + +/** + * Outputs the selectors and properties for the Button component. + * + * @param {string} $primary-stylename (v-button) - the primary style name for the selectors + * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component + * + * @group button + */ + +/** + * A list of colors for custom event colors. Can be an empty list of you don't + * need any custom event colors. + * + * @example javascript + * // Java code + * // 'event' is an instance of EditableCalendarEvent + * event.setStyleName("color1"); // 1st color in the list + * event.setStyleName("color2"); // 2nd color in the list + * // etc. + * + * @group calendar + */ + +/** + * Outputs the selectors and properties for the CheckBox component. + * + * @param {string} $primary-stylename (v-checkbox) - the primary style name for the selectors + * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component + * + * @group checkbox + */ + +/** + * Outputs the global selectors and properties for the ColorPicker component - styles which are + * considered mandatory for the component to work properly. + * + * @param {string} $primary-stylename (v-colorpicker) - the primary style name for the selectors + * + * @group colorpicker + */ + +/** + * Outputs the selectors and properties for the ComboBox component. + * + * @param {string} $primary-stylename (v-filterselect) - the primary style name for the selectors + * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component + * + * @group combobox + */ + +/** + * The amount of spacing between different widgets in a component group. + * If null, a computed value is used ($v-border size * -1, or 1px if $v-border size is 0) + * + * @group csslayout + */ + +/** + * + * + * @param {string} $primary-stylename (v-customcomponent) - + * + * @group customcomponent + */ + +/** + * + * + * @param {string} $primary-stylename (v-customlayout) - + * + * @group customlayout + */ + +/** + * Outputs the selectors and properties for the DateField component. + * + * @param {string} $primary-stylename (v-datefield) - the primary style name for the selectors + * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component + * + * @group datefield + */ + +/** + * Outputs the styles and selectors for the DragAndDropWrapper component. + * + * @param {string} $primary-stylename (v-ddwrapper) - the primary style name for the selectors + * + * @group drag-n-drop + */ + +/** + * + * + * @param {string} $primary-stylename (v-form) - + * + * @group form + */ + +/** + * Outputs the selectors and properties for the FormLayout component. + * + * @param {string} $primary-stylename (v-formlayout) - the primary style name for the selectors + * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component + * + * @group formlayout + */ + +/** + * + * @group table + */ + +@-webkit-keyframes valo-grid-editor-footer-animate-in { + 0% { + margin-top: -37px; + } + } + +@-moz-keyframes valo-grid-editor-footer-animate-in { + 0% { + margin-top: -37px; + } + } + +@keyframes valo-grid-editor-footer-animate-in { + 0% { + margin-top: -37px; + } + } + +@-webkit-keyframes valo-grid-editor-footer-animate-in-alt { + 0% { + margin-bottom: -38px; + } + 100% { + margin-bottom: -1px; + } + } + +@-moz-keyframes valo-grid-editor-footer-animate-in-alt { + 0% { + margin-bottom: -38px; + } + 100% { + margin-bottom: -1px; + } + } + +@keyframes valo-grid-editor-footer-animate-in-alt { + 0% { + margin-bottom: -38px; + } + 100% { + margin-bottom: -1px; + } + } + +/** + * + * + * @param {string} $primary-stylename (v-gridlayout) - + * + * @group gridlayout + */ + +/** + * The font weight for headers. + * + * @group label + */ + +/** + * + * @group link + */ + +/** + * + * + * @param {string} $primary-stylename (v-loginform) - + * + * @group loginform + */ + +/** + * + * + * @param {string} $primary-stylename (v-menubar) - + * @param {bool} $include-additional-styles - + * + * @group menubar + */ + +/** + * + * + * @param {string} $primary-stylename (v-nativebutton) - + * + * @group nativebutton + */ + +/** + * + * + * @param {string} $primary-stylename (v-select) - + * + * @group nativeselect + */ + +/** + * + * @group notification + */ + +/** + * + * + * @param {string} $primary-stylename (v-select-optiongroup) - + * @param {bool} $include-additional-styles - + * + * @group optiongroup + */ + +/** + * + * + * + * @group orderedlayout + */ + +/** + * + * @group panel + */ + +@-webkit-keyframes v-popupview-animate-in { + 0% { + -webkit-transform: scale(0); + } + } + +@-moz-keyframes v-popupview-animate-in { + 0% { + -moz-transform: scale(0); + } + } + +@keyframes v-popupview-animate-in { + 0% { + -webkit-transform: scale(0); + -moz-transform: scale(0); + -ms-transform: scale(0); + -o-transform: scale(0); + transform: scale(0); + } + } + +/** + * + * @group progressbar + */ + +/** + * + * @group richtextarea + */ + +/** + * + * @group slider + */ + +/** + * + * + * @param {string} $primary-stylename (v-splitpanel) - + * @param {bool} $include-additional-styles - + * + * @group splitpanel + */ + +/** + * + * @group table + */ + +/** + * Should the tabsheet content changes be animated. + * + * @group tabsheet + */ + +/** + * The background color for text fields. + * @group textfield + */ + +/** + * Outputs the selectors and properties for the TextArea component. + * + * @param {string} $primary-stylename (v-textarea) - the primary style name for the selectors + * @param {bool} $include-additional-styles - should the mixin output all the different style variations of the component + * + * @group textarea + */ + +/** + * + * @group tree + */ + +/** + * + * + * @param {string} $primary-stylename (v-treetable) - + * + * @group treetable + */ + +/** + * + * + * @param {string} $primary-stylename (v-select-twincol) - + * + * @group twin-column-select + */ + +/** + * + * + * @param {string} $primary-stylename (v-upload) - + * + * @group upload + */ + +/** + * + */ + +/** + * @group window + */ + +@-webkit-keyframes valo-modal-window-indication { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } + } + +@-moz-keyframes valo-modal-window-indication { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } + } + +@keyframes valo-modal-window-indication { + 0% { + opacity: 0; + } + 100% { + opacity: 1; + } + } + +@-webkit-keyframes valo-animate-out-scale-down-fade { + 100% { + -webkit-transform: scale(0.8); + opacity: 0; + } + } + +@-moz-keyframes valo-animate-out-scale-down-fade { + 100% { + -moz-transform: scale(0.8); + opacity: 0; + } + } + +@keyframes valo-animate-out-scale-down-fade { + 100% { + -webkit-transform: scale(0.8); + -moz-transform: scale(0.8); + -ms-transform: scale(0.8); + -o-transform: scale(0.8); + transform: scale(0.8); + opacity: 0; + } + } + +/** + * @group valo-menu + */ + +.v-vaadin-version:after { + content: "7.7.10"; +} + +.v-widget { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + vertical-align: top; + text-align: left; + white-space: normal; +} + +.v-generated-body { + overflow: hidden; + margin: 0; + padding: 0; + border: 0; +} + +.v-app { + height: 100%; + -webkit-tap-highlight-color: transparent; + -webkit-text-size-adjust: 100%; + -ms-text-size-adjust: 100%; + -webkit-text-size-adjust: 100%; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.v-app input[type="text"], .v-app .v-slot > .v-caption, .v-app .v-gridlayout-slot > .v-caption, .v-app .v-has-caption > .v-caption, .v-app .v-formlayout-captioncell > .v-caption, .v-app .v-csslayout > .v-caption { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.v-app input::-ms-clear { + display: none; +} + +.v-ui { + position: relative; +} + +.v-ui.v-ui-embedded { + margin-top: -1px; + border-top: 1px solid transparent; +} + +.v-ui:focus { + outline: none; +} + +.v-overlay-container { + width: 0; + height: 0; +} + +.v-drag-element { + z-index: 60000; + position: absolute !important; + cursor: default; +} + +.v-clip { + overflow: hidden; +} + +.v-scrollable { + overflow: auto; +} + +.v-scrollable > .v-widget { + vertical-align: middle; + overflow: hidden; +} + +.v-ios.v-webkit .v-scrollable { + -webkit-overflow-scrolling: touch; +} + +.v-ios5.v-webkit .v-scrollable { + -webkit-overflow-scrolling: none; +} + +.v-webkit.v-ios .v-browserframe { + -webkit-overflow-scrolling: touch; + overflow: auto; +} + +.v-assistive-device-only { + position: absolute; + top: -2000px; + left: -2000px; + width: 10px; + overflow: hidden; +} + +.v-icon { + cursor: inherit; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.v-icon, .v-errorindicator, .v-required-field-indicator { + display: inline-block; + line-height: inherit; +} + +.v-caption { + display: inline-block; + white-space: nowrap; + line-height: 1.55; +} + +.v-captiontext { + display: inline-block; + line-height: inherit; +} + +div.v-layout.v-horizontal.v-widget { + white-space: nowrap; +} + +.v-layout.v-vertical > .v-expand, .v-layout.v-horizontal > .v-expand { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + height: 100%; +} + +.v-slot, .v-spacing { + display: inline-block; + white-space: nowrap; + vertical-align: top; +} + +.v-vertical > .v-slot:after { + display: inline-block; + clear: both; + width: 0; + height: 0; + overflow: hidden; +} + +.v-vertical > .v-slot, .v-vertical > .v-expand > .v-slot { + display: block; + clear: both; +} + +.v-horizontal > .v-slot, .v-horizontal > .v-expand > .v-slot { + height: 100%; +} + +.v-horizontal > .v-expand > .v-slot { + position: relative; +} + +.v-vertical > .v-spacing, .v-vertical > .v-expand > .v-spacing { + width: 0 !important; + display: block; + clear: both; +} + +.v-horizontal > .v-spacing, .v-horizontal > .v-expand > .v-spacing { + height: 0 !important; +} + +.v-align-middle:before, .v-align-bottom:before, .v-expand > .v-align-middle:before, .v-expand > .v-align-bottom:before { + content: ""; + display: inline-block; + height: 100%; + vertical-align: middle; + width: 0; +} + +.v-align-middle, .v-align-bottom { + white-space: nowrap; +} + +.v-align-middle > .v-widget, .v-align-bottom > .v-widget { + display: inline-block; +} + +.v-align-middle, .v-align-middle > .v-widget { + vertical-align: middle; +} + +.v-align-bottom, .v-align-bottom > .v-widget { + vertical-align: bottom; +} + +.v-align-center { + text-align: center; +} + +.v-align-center > .v-widget { + margin-left: auto; + margin-right: auto; +} + +.v-align-right { + text-align: right; +} + +.v-align-right > .v-widget { + margin-left: auto; +} + +.v-has-caption, .v-has-caption > .v-caption { + display: inline-block; +} + +.v-caption-on-left, .v-caption-on-right { + white-space: nowrap; +} + +.v-caption-on-top > .v-caption, .v-caption-on-bottom > .v-caption { + display: block; +} + +.v-caption-on-left > .v-caption { + padding-right: 0.5em; +} + +.v-caption-on-left > .v-widget, .v-caption-on-right > .v-widget { + display: inline-block; +} + +.v-has-caption.v-has-width > .v-widget { + width: 100% !important; +} + +.v-has-caption.v-has-height > .v-widget { + height: 100% !important; +} + +.v-gridlayout { + position: relative; +} + +.v-gridlayout-slot { + position: absolute; + line-height: 1.55; +} + +.v-gridlayout-spacing-on { + overflow: hidden; +} + +.v-gridlayout-spacing, .v-gridlayout-spacing-off { + padding-left: 0; + padding-top: 0; +} + +.v-gridlayout-spacing-off { + overflow: hidden; +} + +.v-calendar-month-day-scrollable { + overflow-y: scroll; +} + +.v-calendar-week-wrapper { + position: relative; + overflow: hidden; +} + +.v-calendar-current-time { + position: absolute; + left: 0; + width: 100%; + height: 1px; + background: red; + z-index: 2; +} + +.v-calendar-event-resizetop, .v-calendar-event-resizebottom { + position: absolute; + height: 5%; + min-height: 3px; + width: 100%; + z-index: 1; +} + +.v-calendar-event-resizetop { + cursor: row-resize; + top: 0; +} + +.v-calendar-event-resizebottom { + cursor: row-resize; + bottom: 0; +} + +.v-calendar-header-month td:first-child { + padding-left: 20px; +} + +.v-calendar-month-sizedheight .v-calendar-month-day { + height: 100px; +} + +.v-calendar-month-sizedwidth .v-calendar-month-day { + width: 100px; +} + +.v-calendar-header-month-Hsized .v-calendar-header-day { + width: 101px; +} + +.v-calendar-header-month-Hsized td:first-child { + padding-left: 21px; +} + +.v-calendar-header-day-Hsized { + width: 200px; +} + +.v-calendar-week-numbers-Vsized .v-calendar-week-number { + height: 100px; + line-height: 100px; +} + +.v-calendar-week-wrapper-Vsized { + height: 400px; + overflow-x: hidden !important; +} + +.v-calendar-times-Vsized .v-calendar-time { + height: 38px; +} + +.v-calendar-times-Hsized .v-calendar-time { + width: 42px; +} + +.v-calendar-day-times-Vsized .v-datecellslot, .v-calendar-day-times-Vsized .v-datecellslot-even { + height: 18px; +} + +.v-calendar-day-times-Hsized, .v-calendar-day-times-Hsized .v-datecellslot, .v-calendar-day-times-Hsized .v-datecellslot-even { + width: 200px; +} + +.v-colorpicker-popup.v-window { + min-width: 220px !important; +} + +.v-colorpicker-gradient-container { + overflow: visible !important; +} + +.v-colorpicker-gradient-clicklayer { + opacity: 0; + filter: alpha(opacity=0) ; +} + +.rgb-gradient .v-colorpicker-gradient-background { + background: url(../valo/components/img/colorpicker/gradient2.png); +} + +.hsv-gradient .v-colorpicker-gradient-foreground { + background: url(../valo/components/img/colorpicker/gradient.png); +} + +.v-colorpicker-gradient-higherbox:before { + content: ""; + width: 11px; + height: 11px; + border-radius: 7px; + border: 1px solid #fff; + -webkit-box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(0, 0, 0, 0.3); + box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(0, 0, 0, 0.3); + position: absolute; + bottom: -6px; + left: -6px; +} + +.v-colorpicker-popup .v-slider.v-slider-red:before { + background-color: red; +} + +.v-colorpicker-popup .v-slider.v-slider-green:before { + background-color: green; +} + +.v-colorpicker-popup .v-slider.v-slider-blue:before { + background-color: blue; +} + +.v-colorpicker-popup .v-slider.hue-slider:before { + background: url(../valo/components/img/colorpicker/slider_hue_bg.png); +} + +.v-colorpicker-popup input.v-textfield-dark { + color: #fff; +} + +.v-colorpicker-popup input.v-textfield-light { + color: #000; +} + +.v-colorpicker-grid { + height: 319px; +} + +.v-colorpicker-popup .colorselect td { + line-height: 15px; +} + +.v-table-header table, .v-table-footer table, .v-table-table { + border-spacing: 0; + border-collapse: separate; + margin: 0; + padding: 0; + border: 0; + line-height: 1.55; +} + +.v-table-resizer, .v-table-sort-indicator { + float: right; +} + +.v-table-caption-container-align-center { + text-align: center; +} + +.v-table-caption-container-align-right { + text-align: right; +} + +.v-table-header td, .v-table-footer td, .v-table-cell-content { + padding: 0; +} + +.v-table-sort-indicator { + width: 0; +} + +.v-tabsheet-hidetabs > .v-tabsheet-tabcontainer, .v-tabsheet-spacertd, .v-disabled .v-tabsheet-scroller, .v-tabsheet .v-disabled .v-tabsheet-caption-close { + display: none; +} + +.v-tabsheet { + overflow: visible !important; + position: relative; +} + +.v-tabsheet-tabcontainer table, .v-tabsheet-tabcontainer tbody, .v-tabsheet-tabcontainer tr { + display: inline-block; + border-spacing: 0; + border-collapse: collapse; + vertical-align: top; +} + +.v-tabsheet-tabcontainer td { + display: inline-block; + padding: 0; +} + +.v-tabsheet-tabs { + white-space: nowrap; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.v-tabsheet-content { + position: relative; +} + +.v-tabsheet-content > div > .v-scrollable > .v-margin-top { + padding-top: 12px; +} + +.v-tabsheet-content > div > .v-scrollable > .v-margin-right { + padding-right: 12px; +} + +.v-tabsheet-content > div > .v-scrollable > .v-margin-bottom { + padding-bottom: 12px; +} + +.v-tabsheet-content > div > .v-scrollable > .v-margin-left { + padding-left: 12px; +} + +.v-splitpanel-vertical, .v-splitpanel-horizontal { + overflow: hidden; + white-space: nowrap; +} + +.v-splitpanel-hsplitter { + z-index: 100; + cursor: e-resize; + cursor: col-resize; +} + +.v-splitpanel-vsplitter { + z-index: 100; + cursor: s-resize; + cursor: row-resize; +} + +.v-splitpanel-hsplitter:after, .v-splitpanel-vsplitter:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; +} + +.v-splitpanel-hsplitter div, .v-splitpanel-vsplitter div { + width: inherit; + height: inherit; + overflow: hidden; + position: relative; +} + +.v-splitpanel-hsplitter div:before, .v-splitpanel-vsplitter div:before { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; +} + +.v-disabled [class$="splitter"] div { + cursor: default; +} + +.v-disabled [class$="splitter"] div:before { + display: none; +} + +.v-splitpanel-horizontal > div > .v-splitpanel-second-container { + position: static !important; + display: inline-block; + vertical-align: top; +} + +.v-splitpanel-horizontal > div > .v-splitpanel-first-container { + display: inline-block; + vertical-align: top; +} + +.mytheme.v-app, .mytheme.v-app-loading { + font: 300 16px/1.55 "Open Sans", sans-serif; + color: #464646; + background-color: #fafafa; + cursor: default; +} + +.mytheme .v-app-loading { + width: 100%; + height: 100%; + background: #fafafa; +} + +.mytheme .v-app-loading:before { + content: ""; + position: fixed; + z-index: 100; + top: 45%; + left: 50%; + width: 28px; + height: 28px; + padding: 9px; + margin-top: -24px; + margin-left: -24px; + background: #fff url(../valo/shared/img/spinner.gif) no-repeat 50%; + border-radius: 4px; +} + +.mytheme .v-loading-indicator { + position: fixed !important; + z-index: 99999; + left: 0; + right: auto; + top: 0; + width: 50%; + opacity: 1; + height: 4px; + background-color: #197de1; + pointer-events: none; + -webkit-transition: none; + -moz-transition: none; + transition: none; + -webkit-animation: v-progress-start 1000ms 200ms both; + -moz-animation: v-progress-start 1000ms 200ms both; + animation: v-progress-start 1000ms 200ms both; +} + +.mytheme .v-loading-indicator[style*="none"] { + display: block !important; + width: 100% !important; + opacity: 0; + -webkit-animation: none; + -moz-animation: none; + animation: none; + -webkit-transition: opacity 500ms 300ms, width 300ms; + -moz-transition: opacity 500ms 300ms, width 300ms; + transition: opacity 500ms 300ms, width 300ms; +} + +.mytheme .v-loading-indicator-delay { + width: 90%; + -webkit-animation: v-progress-delay 3.8s forwards; + -moz-animation: v-progress-delay 3.8s forwards; + animation: v-progress-delay 3.8s forwards; +} + +.v-ff .mytheme .v-loading-indicator-delay { + width: 50%; +} + +.mytheme .v-loading-indicator-wait { + width: 96%; + -webkit-animation: v-progress-wait 5s forwards, v-progress-wait-pulse 1s 4s infinite backwards; + -moz-animation: v-progress-wait 5s forwards, v-progress-wait-pulse 1s 4s infinite backwards; + animation: v-progress-wait 5s forwards, v-progress-wait-pulse 1s 4s infinite backwards; +} + +.v-ff .mytheme .v-loading-indicator-wait { + width: 90%; +} + +.v-ie8 .mytheme .v-loading-indicator, .v-ie8 .mytheme .v-loading-indicator-delay, .v-ie8 .mytheme .v-loading-indicator-wait, .v-ie9 .mytheme .v-loading-indicator, .v-ie9 .mytheme .v-loading-indicator-delay, .v-ie9 .mytheme .v-loading-indicator-wait { + width: 28px !important; + height: 28px; + padding: 9px; + background: #fff url(../valo/shared/img/spinner.gif) no-repeat 50%; + border-radius: 4px; + top: 9px; + right: 9px; + left: auto; + filter: alpha(opacity=50); +} + +.v-ie8 .mytheme .v-loading-indicator[style*="none"], .v-ie8 .mytheme .v-loading-indicator-delay[style*="none"], .v-ie8 .mytheme .v-loading-indicator-wait[style*="none"], .v-ie9 .mytheme .v-loading-indicator[style*="none"], .v-ie9 .mytheme .v-loading-indicator-delay[style*="none"], .v-ie9 .mytheme .v-loading-indicator-wait[style*="none"] { + display: none !important; +} + +.v-ie8 .mytheme .v-loading-indicator-wait, .v-ie9 .mytheme .v-loading-indicator-wait { + filter: alpha(opacity=100); +} + +.mytheme .v-scrollable:focus { + outline: none; +} + +.mytheme img.v-icon { + vertical-align: middle; +} + +.mytheme .v-caption { + font-size: 14px; + font-weight: 400; + padding-bottom: 0.3em; + padding-left: 1px; +} + +.mytheme .v-caption-on-left .v-caption, .mytheme .v-caption-on-right .v-caption { + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-icon + .v-captiontext, .mytheme .v-icon + span { + margin-left: 7px; +} + +.mytheme .v-icon + .v-captiontext:empty, .mytheme .v-icon + span:empty { + margin-left: 0; +} + +.mytheme .v-errorindicator { + color: #ed473b; + font-weight: 600; + width: 19px; + text-align: center; +} + +.mytheme .v-errorindicator:before { + content: "!"; +} + +.mytheme .v-required-field-indicator { + color: #ed473b; + padding: 0 0.2em; +} + +.mytheme select { + font: inherit; + font-weight: 400; + line-height: inherit; + padding: 5px; + margin: 0; + border-radius: 4px; + border: 1px solid #c5c5c5; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + color: #464646; +} + +.mytheme select:focus { + outline: none; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme button { + font: inherit; + font-weight: 400; + line-height: 1.55; +} + +.mytheme a { + cursor: pointer; + color: #197de1; + text-decoration: underline; + font-weight: inherit; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme a:hover { + color: #4396ea; +} + +.mytheme a.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-disabled { + cursor: default !important; +} + +.mytheme .v-drag-element { + background: #fafafa; + color: #464646; + -webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); + border-radius: 4px; + overflow: hidden; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-tooltip { + background-color: #323232; + background-color: rgba(50, 50, 50, 0.9); + -webkit-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2); + color: white; + padding: 5px 9px; + border-radius: 3px; + max-width: 35em; + overflow: hidden !important; + font-size: 14px; +} + +.mytheme .v-tooltip div[style*="width"] { + width: auto !important; +} + +.mytheme .v-tooltip .v-errormessage { + background-color: white; + background-color: #fff; + color: #ed473b; + margin: -5px -9px; + padding: 5px 9px; + max-height: 10em; + overflow: auto; + font-weight: 400; +} + +.mytheme .v-tooltip .v-errormessage h2:only-child { + font: inherit; + line-height: inherit; +} + +.mytheme .v-tooltip .v-tooltip-text { + max-height: 10em; + overflow: auto; + margin-top: 10px; +} + +.mytheme .v-tooltip .v-errormessage[aria-hidden="true"] + .v-tooltip-text { + margin-top: 0; +} + +.mytheme .v-tooltip h1, .mytheme .v-tooltip h2, .mytheme .v-tooltip h3, .mytheme .v-tooltip h4 { + color: inherit; +} + +.mytheme .v-contextmenu { + padding: 4px 4px; + border-radius: 4px; + background-color: white; + color: #474747; + -webkit-box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -ms-backface-visibility: hidden; + backface-visibility: hidden; + padding: 4px 4px; +} + +.mytheme .v-contextmenu[class*="animate-in"] { + -webkit-animation: valo-overlay-animate-in 120ms; + -moz-animation: valo-overlay-animate-in 120ms; + animation: valo-overlay-animate-in 120ms; +} + +.mytheme .v-contextmenu[class*="animate-out"] { + -webkit-animation: valo-animate-out-fade 120ms; + -moz-animation: valo-animate-out-fade 120ms; + animation: valo-animate-out-fade 120ms; +} + +.mytheme .v-contextmenu table { + border-spacing: 0; +} + +.mytheme .v-contextmenu .gwt-MenuItem { + cursor: pointer; + line-height: 27px; + padding: 0 20px 0 10px; + border-radius: 3px; + font-weight: 400; + white-space: nowrap; + position: relative; + display: block; +} + +.mytheme .v-contextmenu .gwt-MenuItem:active:before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: #0957a6; + opacity: 0.15; + filter: alpha(opacity=15.0) ; + pointer-events: none; + border-radius: inherit; +} + +.mytheme .v-contextmenu .gwt-MenuItem .v-icon { + max-height: 27px; + margin-right: 5px; + min-width: 1em; +} + +.mytheme .v-contextmenu .gwt-MenuItem-selected { + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + color: #ecf2f8; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); +} + +.mytheme .v-reconnect-dialog { + color: white; + top: 12px; + right: 12px; + max-width: 100%; + border-radius: 0; + -webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.25); + box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.25); + padding: 12px 15px; + background-color: #444; + background-color: rgba(68, 68, 68, 0.9); + line-height: 22px; + text-align: center; +} + +.mytheme .v-reconnect-dialog .text { + display: inline-block; + padding-left: 10px; +} + +.mytheme .v-reconnect-dialog .spinner { + height: 24px !important; + width: 24px !important; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + border: 2px solid rgba(25, 125, 225, 0.2); + border-top-color: #197de1; + border-right-color: #197de1; + border-radius: 100%; + -webkit-animation: v-rotate-360 500ms infinite linear; + -moz-animation: v-rotate-360 500ms infinite linear; + animation: v-rotate-360 500ms infinite linear; + pointer-events: none; + display: none; + vertical-align: middle; +} + +.v-ie8 .mytheme .v-reconnect-dialog .spinner, .v-ie9 .mytheme .v-reconnect-dialog .spinner { + border: none; + border-radius: 4px; + background: #fff url(../valo/shared/img/spinner.gif) no-repeat 50% 50%; + background-size: 80%; +} + +.v-ie8 .mytheme .v-reconnect-dialog .spinner { + min-width: 30px; + min-height: 30px; +} + +.mytheme .v-reconnect-dialog.active .spinner { + display: inline-block; +} + +.mytheme .v-absolutelayout-wrapper { + position: absolute; +} + +.mytheme .v-absolutelayout-margin, .mytheme .v-absolutelayout-canvas { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.mytheme .v-absolutelayout.v-has-height > div, .mytheme .v-absolutelayout.v-has-height .v-absolutelayout-margin { + height: 100%; +} + +.mytheme .v-absolutelayout.v-has-height > div, .mytheme .v-absolutelayout.v-has-width .v-absolutelayout-margin { + width: 100%; +} + +.mytheme .v-margin-top { + padding-top: 37px; +} + +.mytheme .v-margin-right { + padding-right: 37px; +} + +.mytheme .v-margin-bottom { + padding-bottom: 37px; +} + +.mytheme .v-margin-left { + padding-left: 37px; +} + +.mytheme .v-spacing { + width: 12px; + height: 12px; +} + +.mytheme .v-verticallayout-well, .mytheme .v-horizontallayout-well { + background: #f5f5f5; + color: #454545; + -webkit-box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.05), inset 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.05), inset 0 2px 3px rgba(0, 0, 0, 0.05); + border-radius: 4px; + border: 1px solid #c5c5c5; +} + +.mytheme .v-verticallayout-well > div > [class*="-caption"], .mytheme .v-horizontallayout-well > div > [class*="-caption"] { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-verticallayout-well > .v-margin-top, .mytheme .v-horizontallayout-well > .v-margin-top { + padding-top: 12px; +} + +.mytheme .v-verticallayout-well > .v-margin-right, .mytheme .v-horizontallayout-well > .v-margin-right { + padding-right: 12px; +} + +.mytheme .v-verticallayout-well > .v-margin-bottom, .mytheme .v-horizontallayout-well > .v-margin-bottom { + padding-bottom: 12px; +} + +.mytheme .v-verticallayout-well > .v-margin-left, .mytheme .v-horizontallayout-well > .v-margin-left { + padding-left: 12px; +} + +.mytheme .v-verticallayout-card, .mytheme .v-horizontallayout-card { + background: white; + color: #474747; + border-radius: 4px; + border: 1px solid #d5d5d5; + -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); +} + +.mytheme .v-verticallayout-card > .v-margin-top, .mytheme .v-horizontallayout-card > .v-margin-top { + padding-top: 12px; +} + +.mytheme .v-verticallayout-card > .v-margin-right, .mytheme .v-horizontallayout-card > .v-margin-right { + padding-right: 12px; +} + +.mytheme .v-verticallayout-card > .v-margin-bottom, .mytheme .v-horizontallayout-card > .v-margin-bottom { + padding-bottom: 12px; +} + +.mytheme .v-verticallayout-card > .v-margin-left, .mytheme .v-horizontallayout-card > .v-margin-left { + padding-left: 12px; +} + +.mytheme .v-horizontallayout-wrapping { + white-space: normal !important; +} + +.mytheme .v-horizontallayout-wrapping > .v-spacing + .v-slot, .mytheme .v-horizontallayout-wrapping > .v-slot:first-child { + margin-bottom: 12px; +} + +.mytheme .v-horizontallayout-wrapping > .v-slot:first-child:last-child { + margin-bottom: 0; +} + +.mytheme .v-button { + position: relative; + text-align: center; + white-space: nowrap; + outline: none; + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + height: 37px; + padding: 0 16px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); +} + +.mytheme .v-button:before { + content: ""; + display: inline-block; + width: 0; + height: 100%; + vertical-align: middle; +} + +.mytheme .v-button > div { + vertical-align: middle; +} + +.v-sa .mytheme .v-button:before { + height: 110%; +} + +.v-ff .mytheme .v-button:before { + height: 107%; +} + +.v-ie .mytheme .v-button:before { + margin-top: 4px; +} + +.mytheme .v-button:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; +} + +.mytheme .v-button:focus:after { + -webkit-transition: none; + -moz-transition: none; + transition: none; +} + +.mytheme .v-button.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-button.v-disabled:after { + display: none; +} + +.mytheme .v-button:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-button:hover:after { + background-color: rgba(186, 186, 186, 0.1); +} + +.mytheme .v-button:focus:after { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-button:active:after { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-button-primary { + height: 37px; + padding: 0 16px; + color: #ecf2f8; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #1362b1; + border-top-color: #156ab3; + border-bottom-color: #1156a8; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + -webkit-box-shadow: inset 0 1px 0 #4d98e6, inset 0 -1px 0 #166bca, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 #4d98e6, inset 0 -1px 0 #166bca, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); + padding: 0 19px; + font-weight: bold; + min-width: 81px; +} + +.mytheme .v-button-primary:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-button-primary:hover:after { + background-color: rgba(90, 163, 237, 0.1); +} + +.mytheme .v-button-primary:focus:after { + border: inherit; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-button-primary:active:after { + background-color: rgba(2, 62, 122, 0.2); +} + +.v-ie8 .mytheme .v-button-primary { + min-width: 43px; +} + +.mytheme .v-button-friendly { + height: 37px; + padding: 0 16px; + color: #eaf4e9; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #227719; + border-top-color: #257d1a; + border-bottom-color: #1e6b15; + background-color: #2c9720; + background-image: -webkit-linear-gradient(top, #2f9f22 2%, #26881b 98%); + background-image: linear-gradient(to bottom,#2f9f22 2%, #26881b 98%); + -webkit-box-shadow: inset 0 1px 0 #46b33a, inset 0 -1px 0 #26811b, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 #46b33a, inset 0 -1px 0 #26811b, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); +} + +.mytheme .v-button-friendly:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-button-friendly:hover:after { + background-color: rgba(65, 211, 48, 0.1); +} + +.mytheme .v-button-friendly:focus:after { + border: inherit; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-button-friendly:active:after { + background-color: rgba(14, 86, 6, 0.2); +} + +.mytheme .v-button-danger { + height: 37px; + padding: 0 16px; + color: #f9f0ef; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #bb382e; + border-top-color: #bc3c31; + border-bottom-color: #b13028; + background-color: #ed473b; + background-image: -webkit-linear-gradient(top, #ee4c3f 2%, #e13e33 98%); + background-image: linear-gradient(to bottom,#ee4c3f 2%, #e13e33 98%); + -webkit-box-shadow: inset 0 1px 0 #ef786f, inset 0 -1px 0 #da3c31, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 #ef786f, inset 0 -1px 0 #da3c31, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); +} + +.mytheme .v-button-danger:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-button-danger:hover:after { + background-color: rgba(243, 137, 129, 0.1); +} + +.mytheme .v-button-danger:focus:after { + border: inherit; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-button-danger:active:after { + background-color: rgba(146, 12, 2, 0.2); +} + +.mytheme .v-button-borderless { + border: none; + -webkit-box-shadow: none; + box-shadow: none; + background: transparent; + color: inherit; +} + +.mytheme .v-button-borderless:hover:after { + background: transparent; +} + +.mytheme .v-button-borderless:active { + opacity: 0.7; + filter: alpha(opacity=70) ; +} + +.mytheme .v-button-borderless:active:after { + background: transparent; +} + +.mytheme .v-button-borderless-colored { + border: none; + -webkit-box-shadow: none; + box-shadow: none; + background: transparent; + color: #197de1; +} + +.mytheme .v-button-borderless-colored:hover { + color: #4396ea; +} + +.mytheme .v-button-borderless-colored:hover:after { + background: transparent; +} + +.mytheme .v-button-borderless-colored:active { + opacity: 0.7; + filter: alpha(opacity=70) ; +} + +.mytheme .v-button-borderless-colored:active:after { + background: transparent; +} + +.mytheme .v-button-quiet { + visibility: hidden; +} + +.mytheme .v-button-quiet:focus, .mytheme .v-button-quiet:hover { + visibility: visible; +} + +.mytheme .v-button-quiet [class*="wrap"] { + visibility: visible; +} + +.mytheme .v-button-quiet [class*="caption"] { + display: inline-block; +} + +.mytheme .v-button-link { + border: none; + -webkit-box-shadow: none; + box-shadow: none; + background: transparent; + color: inherit; + cursor: pointer; + color: #197de1; + text-decoration: underline; + font-weight: inherit; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-button-link:hover:after { + background: transparent; +} + +.mytheme .v-button-link:active { + opacity: 0.7; + filter: alpha(opacity=70) ; +} + +.mytheme .v-button-link:active:after { + background: transparent; +} + +.mytheme .v-button-link:hover { + color: #4396ea; +} + +.mytheme .v-button-link.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-button-tiny { + height: 28px; + padding: 0 13px; + + + font-size: 12px; + + border-radius: 4px; +} + +.mytheme .v-button-tiny:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-button-small { + height: 31px; + padding: 0 14px; + + + font-size: 14px; + + border-radius: 4px; +} + +.mytheme .v-button-small:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-button-large { + height: 44px; + padding: 0 19px; + + + font-size: 20px; + + border-radius: 4px; +} + +.mytheme .v-button-large:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-button-huge { + height: 59px; + padding: 0 26px; + + + font-size: 26px; + + border-radius: 4px; +} + +.mytheme .v-button-huge:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-button-icon-align-right [class*="wrap"] { + display: inline-block; +} + +.mytheme .v-button-icon-align-right .v-icon { + float: right; + margin-left: 13px; +} + +.mytheme .v-button-icon-align-right .v-icon + span:not(:empty) { + margin-left: 0; +} + +.mytheme .v-button-icon-align-top { + height: auto; + padding-top: 5px; + padding-bottom: 5px; +} + +.mytheme .v-button-icon-align-top [class*="wrap"] { + display: inline-block; +} + +.mytheme .v-button-icon-align-top .v-icon { + display: block; + margin-left: auto; + margin-right: auto; +} + +.mytheme .v-button-icon-align-top .v-icon + span:not(:empty) { + margin-top: 7px; + margin-left: 0; +} + +.mytheme .v-button-icon-only { + width: 37px; + padding: 0; +} + +.mytheme .v-button-icon-only.v-button-tiny { + width: 28px; +} + +.mytheme .v-button-icon-only.v-button-small { + width: 31px; +} + +.mytheme .v-button-icon-only.v-button-large { + width: 44px; +} + +.mytheme .v-button-icon-only.v-button-huge { + width: 59px; +} + +.mytheme .v-button-icon-only .v-button-caption { + display: none; +} + +.mytheme .v-checkbox { + position: relative; + line-height: 19px; + white-space: nowrap; +} + +.mytheme .v-checkbox.v-has-width label { + white-space: normal; +} + +:root .mytheme .v-checkbox { + padding-left: 25px; +} + +:root .mytheme .v-checkbox label { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + display: inline-block; +} + +:root .mytheme .v-checkbox > input { + position: absolute; + clip: rect(0, 0, 0, 0); + left: 0.2em; + top: 0.2em; + z-index: 0; + margin: 0; +} + +:root .mytheme .v-checkbox > input:focus ~ label:before { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); +} + +:root .mytheme .v-checkbox > input ~ label:before, :root .mytheme .v-checkbox > input ~ label:after { + content: ""; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 19px; + height: 19px; + position: absolute; + top: 0; + left: 0; + border-radius: 4px; + font-size: 13px; + text-align: center; +} + +:root .mytheme .v-checkbox > input ~ label:before { + height: 18.5px; + padding: 0 9px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + padding: 0; + height: 19px; +} + +:root .mytheme .v-checkbox > input ~ label:after { + content: "\f00c"; + font-family: ThemeIcons; + color: transparent; + -webkit-transition: color 100ms; + -moz-transition: color 100ms; + transition: color 100ms; +} + +:root .mytheme .v-checkbox > input:active ~ label:after { + background-color: rgba(125, 125, 125, 0.2); +} + +:root .mytheme .v-checkbox > input:checked ~ label:after { + color: #197de1; +} + +.mytheme .v-checkbox > .v-icon, .mytheme .v-checkbox > label .v-icon { + margin: 0 6px 0 3px; + min-width: 1em; + cursor: pointer; +} + +.mytheme .v-checkbox.v-disabled > label, .mytheme .v-checkbox.v-disabled > .v-icon { + cursor: default; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-checkbox.v-disabled > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-checkbox.v-disabled > input:active ~ label:after { + background: transparent; +} + +.mytheme .v-checkbox.v-readonly > label, .mytheme .v-checkbox.v-readonly > .v-icon { + cursor: default; +} + +.mytheme .v-checkbox.v-readonly > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-checkbox.v-readonly > input:active ~ label:after { + background: transparent; +} + +:root .mytheme .v-checkbox.v-readonly > input ~ label:after { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-checkbox-small { + position: relative; + line-height: 16px; + white-space: nowrap; + font-size: 14px; +} + +.mytheme .v-checkbox-small.v-has-width label { + white-space: normal; +} + +:root .mytheme .v-checkbox-small { + padding-left: 21px; +} + +:root .mytheme .v-checkbox-small label { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + display: inline-block; +} + +:root .mytheme .v-checkbox-small > input { + position: absolute; + clip: rect(0, 0, 0, 0); + left: 0.2em; + top: 0.2em; + z-index: 0; + margin: 0; +} + +:root .mytheme .v-checkbox-small > input:focus ~ label:before { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); +} + +:root .mytheme .v-checkbox-small > input ~ label:before, :root .mytheme .v-checkbox-small > input ~ label:after { + content: ""; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 16px; + height: 16px; + position: absolute; + top: 0; + left: 0; + border-radius: 4px; + font-size: 11px; + text-align: center; +} + +:root .mytheme .v-checkbox-small > input ~ label:before { + height: 15.5px; + padding: 0 7px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + padding: 0; + height: 16px; +} + +:root .mytheme .v-checkbox-small > input ~ label:after { + content: "\f00c"; + font-family: ThemeIcons; + color: transparent; + -webkit-transition: color 100ms; + -moz-transition: color 100ms; + transition: color 100ms; +} + +:root .mytheme .v-checkbox-small > input:active ~ label:after { + background-color: rgba(125, 125, 125, 0.2); +} + +:root .mytheme .v-checkbox-small > input:checked ~ label:after { + color: #197de1; +} + +.mytheme .v-checkbox-small > .v-icon, .mytheme .v-checkbox-small > label .v-icon { + margin: 0 5px 0 3px; + min-width: 1em; + cursor: pointer; +} + +.mytheme .v-checkbox-small.v-disabled > label, .mytheme .v-checkbox-small.v-disabled > .v-icon { + cursor: default; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-checkbox-small.v-disabled > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-checkbox-small.v-disabled > input:active ~ label:after { + background: transparent; +} + +.mytheme .v-checkbox-small.v-readonly > label, .mytheme .v-checkbox-small.v-readonly > .v-icon { + cursor: default; +} + +.mytheme .v-checkbox-small.v-readonly > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-checkbox-small.v-readonly > input:active ~ label:after { + background: transparent; +} + +:root .mytheme .v-checkbox-small.v-readonly > input ~ label:after { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-checkbox-large { + position: relative; + line-height: 22px; + white-space: nowrap; + font-size: 20px; +} + +.mytheme .v-checkbox-large.v-has-width label { + white-space: normal; +} + +:root .mytheme .v-checkbox-large { + padding-left: 29px; +} + +:root .mytheme .v-checkbox-large label { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + display: inline-block; +} + +:root .mytheme .v-checkbox-large > input { + position: absolute; + clip: rect(0, 0, 0, 0); + left: 0.2em; + top: 0.2em; + z-index: 0; + margin: 0; +} + +:root .mytheme .v-checkbox-large > input:focus ~ label:before { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); +} + +:root .mytheme .v-checkbox-large > input ~ label:before, :root .mytheme .v-checkbox-large > input ~ label:after { + content: ""; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 22px; + height: 22px; + position: absolute; + top: 0; + left: 0; + border-radius: 4px; + font-size: 15px; + text-align: center; +} + +:root .mytheme .v-checkbox-large > input ~ label:before { + height: 22px; + padding: 0 10px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + padding: 0; + height: 22px; +} + +:root .mytheme .v-checkbox-large > input ~ label:after { + content: "\f00c"; + font-family: ThemeIcons; + color: transparent; + -webkit-transition: color 100ms; + -moz-transition: color 100ms; + transition: color 100ms; +} + +:root .mytheme .v-checkbox-large > input:active ~ label:after { + background-color: rgba(125, 125, 125, 0.2); +} + +:root .mytheme .v-checkbox-large > input:checked ~ label:after { + color: #197de1; +} + +.mytheme .v-checkbox-large > .v-icon, .mytheme .v-checkbox-large > label .v-icon { + margin: 0 7px 0 4px; + min-width: 1em; + cursor: pointer; +} + +.mytheme .v-checkbox-large.v-disabled > label, .mytheme .v-checkbox-large.v-disabled > .v-icon { + cursor: default; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-checkbox-large.v-disabled > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-checkbox-large.v-disabled > input:active ~ label:after { + background: transparent; +} + +.mytheme .v-checkbox-large.v-readonly > label, .mytheme .v-checkbox-large.v-readonly > .v-icon { + cursor: default; +} + +.mytheme .v-checkbox-large.v-readonly > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-checkbox-large.v-readonly > input:active ~ label:after { + background: transparent; +} + +:root .mytheme .v-checkbox-large.v-readonly > input ~ label:after { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect { + position: relative; + width: 185px; + height: 37px; + border-radius: 4px; + white-space: nowrap; +} + +.mytheme .v-filterselect [class*="input"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 37px; + border-radius: 4px; + padding: 4px 9px; + border: 1px solid #c5c5c5; + background: white; + color: #474747; + -webkit-box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + width: 100% !important; + height: 100%; + padding-right: 38px; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-filterselect [class*="input"], .v-ie9 .mytheme .v-filterselect [class*="input"] { + line-height: 37px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-filterselect [class*="input"].v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect [class*="input"]:focus { + outline: none; + -webkit-transition: none; + -moz-transition: none; + transition: none; + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-filterselect [class*="input"][class*="prompt"] { + color: #a3a3a3; +} + +.mytheme .v-filterselect .v-icon + [class*="input"] { + padding-left: 37px; +} + +.mytheme .v-filterselect img.v-icon { + max-height: 37px; + margin-left: 9px; +} + +.mytheme .v-filterselect span.v-icon { + color: #474747; + width: 37px; + line-height: 1; + padding-top: 0.12em; +} + +.mytheme .v-filterselect[class*="prompt"] > [class*="input"] { + color: #a3a3a3; +} + +.mytheme .v-filterselect [class$="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + position: absolute; + width: 37px; + top: 1px; + right: 1px; + bottom: 1px; + border-left: 1px solid #e4e4e4; + color: #a3a3a3; + border-radius: 0 3px 3px 0; +} + +.v-ie8 .mytheme .v-filterselect [class$="button"] { + background-color: white; +} + +.mytheme .v-filterselect [class$="button"]:before { + font-family: ThemeIcons; + content: "\f078"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; + position: absolute; + width: 37px; + text-align: center; + top: 50%; + line-height: 1; + margin-top: -0.47em; +} + +.mytheme .v-filterselect [class$="button"]:hover:before { + color: #474747; +} + +.mytheme .v-filterselect [class$="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; + background-color: rgba(128, 128, 128, 0.2); +} + +.mytheme .v-filterselect.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect.v-disabled [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect.v-disabled [class$="button"]:active:after { + display: none; +} + +.mytheme .v-filterselect.v-readonly [class*="input"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-filterselect.v-readonly [class*="input"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-filterselect.v-readonly [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect.v-readonly [class$="button"]:active:after { + display: none; +} + +.mytheme .v-filterselect .v-icon { + position: absolute; + pointer-events: none; +} + +.mytheme .v-filterselect-error .v-filterselect-input { + border-color: #ed473b !important; + background: #fffbfb; + color: #6c2621; +} + +.mytheme .v-filterselect-error .v-filterselect-button { + color: #ed473b; + border-color: #ed473b; +} + +.mytheme .v-filterselect-suggestpopup { + margin-top: 5px !important; +} + +.mytheme .v-filterselect-suggestpopup[class*="animate-in"] { + -webkit-animation: valo-overlay-animate-in 120ms; + -moz-animation: valo-overlay-animate-in 120ms; + animation: valo-overlay-animate-in 120ms; +} + +.mytheme .v-filterselect-suggestpopup [class$="suggestmenu"] { + padding: 4px 4px; + border-radius: 4px; + background-color: white; + color: #474747; + -webkit-box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -ms-backface-visibility: hidden; + backface-visibility: hidden; + padding: 4px 4px; + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + position: relative; + z-index: 1; + display: block; +} + +.mytheme .v-filterselect-suggestpopup table, .mytheme .v-filterselect-suggestpopup tbody, .mytheme .v-filterselect-suggestpopup tr, .mytheme .v-filterselect-suggestpopup td { + display: block; + width: 100%; + overflow-y: hidden; + float: left; + clear: both; +} + +.mytheme .v-filterselect-suggestpopup .gwt-MenuItem { + cursor: pointer; + line-height: 27px; + padding: 0 20px 0 10px; + border-radius: 3px; + font-weight: 400; + white-space: nowrap; + position: relative; + height: 27px; + box-sizing: border-box; + text-overflow: ellipsis; + overflow-x: hidden; +} + +.mytheme .v-filterselect-suggestpopup .gwt-MenuItem:active:before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: #0957a6; + opacity: 0.15; + filter: alpha(opacity=15.0) ; + pointer-events: none; + border-radius: inherit; +} + +.mytheme .v-filterselect-suggestpopup .gwt-MenuItem .v-icon { + max-height: 27px; + margin-right: 5px; + min-width: 1em; +} + +.mytheme .v-filterselect-suggestpopup .gwt-MenuItem-selected { + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + color: #ecf2f8; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); +} + +.mytheme .v-filterselect-suggestpopup [class$="status"] { + position: absolute; + right: 4px; + background: rgba(212, 212, 212, 0.9); + color: #3b3b3b; + border-radius: 0 0 4px 4px; + height: 23px; + bottom: -23px; + font-size: 12px; + line-height: 23px; + padding: 0 6px; + cursor: default; + pointer-events: none; + -webkit-animation: valo-animate-in-slide-down 200ms 80ms backwards; + -moz-animation: valo-animate-in-slide-down 200ms 80ms backwards; + animation: valo-animate-in-slide-down 200ms 80ms backwards; +} + +.mytheme .v-filterselect-suggestpopup [class$="status"] > * { + color: #3b3b3b; + text-decoration: none; +} + +.mytheme .v-filterselect-suggestpopup div[class*="page"] { + position: absolute; + z-index: 3; + right: 0; + opacity: 0.2; + filter: alpha(opacity=20) ; + cursor: pointer; + -webkit-transition: all 200ms; + -moz-transition: all 200ms; + transition: all 200ms; + width: 25px; + height: 25px; + line-height: 25px; + text-align: center; + font-family: ThemeIcons; + -webkit-transform: scale(0.8); + -moz-transform: scale(0.8); + -ms-transform: scale(0.8); + -o-transform: scale(0.8); + transform: scale(0.8); + color: #464646; +} + +.mytheme .v-filterselect-suggestpopup div[class*="page"]:after { + content: ""; + position: absolute; + display: block; + border-radius: 50%; +} + +.mytheme .v-filterselect-suggestpopup div[class*="page"]:hover { + opacity: 1; + filter: none ; + background: rgba(250, 250, 250, 0.5); +} + +.mytheme .v-filterselect-suggestpopup div[class*="page"]:hover:after { + top: -10px; + bottom: -10px; + left: -20px; + right: -20px; +} + +.mytheme .v-filterselect-suggestpopup div[class*="page"] span { + display: none; +} + +.mytheme .v-filterselect-suggestpopup:hover div[class*="page"] { + -webkit-transform: scale(1); + -moz-transform: scale(1); + -ms-transform: scale(1); + -o-transform: scale(1); + transform: scale(1); +} + +.mytheme .v-filterselect-suggestpopup div[class*="prev"] { + top: 0; + -webkit-transform-origin: 100% 0%; + -moz-transform-origin: 100% 0%; + -ms-transform-origin: 100% 0%; + -o-transform-origin: 100% 0%; + transform-origin: 100% 0%; + border-radius: 0 4px 0 4px; +} + +.mytheme .v-filterselect-suggestpopup div[class*="prev"]:before { + content: "\f0d8"; +} + +.mytheme .v-filterselect-suggestpopup div[class*="next"] { + bottom: 0; + -webkit-transform-origin: 100% 100%; + -moz-transform-origin: 100% 100%; + -ms-transform-origin: 100% 100%; + -o-transform-origin: 100% 100%; + transform-origin: 100% 100%; + border-radius: 4px 0 4px 0; +} + +.mytheme .v-filterselect-suggestpopup div[class*="next"]:before { + content: "\f0d7"; +} + +.mytheme .v-filterselect-suggestpopup div[class*="-off"] { + display: none; +} + +.mytheme .v-filterselect-no-input { + cursor: pointer; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); +} + +.mytheme .v-filterselect-no-input [class*="input"] { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + cursor: inherit; + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + text-shadow: inherit; + text-overflow: ellipsis; + border-radius: inherit; +} + +.mytheme .v-filterselect-no-input [class*="input"]:focus { + outline: none; + -webkit-transition: none; + -moz-transition: none; + transition: none; + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-filterselect-no-input [class$="button"] { + border-left: none !important; +} + +.mytheme .v-filterselect-no-input:hover [class$="button"]:before { + color: inherit; +} + +.mytheme .v-filterselect-borderless .v-filterselect-input { + border: none; + border-radius: 0; + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + color: inherit; +} + +.mytheme .v-filterselect-borderless .v-filterselect-input:focus { + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-filterselect-borderless .v-filterselect-input[class*="prompt"] { + color: inherit; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect-borderless .v-filterselect-button { + border: none; + color: inherit; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect-borderless.v-filterselect-prompt .v-filterselect-input { + color: inherit; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect-align-right input { + text-align: right; +} + +.mytheme .v-filterselect-align-center input { + text-align: center; +} + +.mytheme .v-filterselect-tiny { + height: 28px; + + font-size: 12px; +} + +.mytheme .v-filterselect-tiny [class*="input"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 28px; + + padding: 3px 5px; + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + width: 100% !important; + height: 100%; + padding-right: 29px; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-filterselect-tiny [class*="input"], .v-ie9 .mytheme .v-filterselect-tiny [class*="input"] { + line-height: 28px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-filterselect-tiny .v-icon + [class*="input"] { + padding-left: 28px; +} + +.mytheme .v-filterselect-tiny img.v-icon { + max-height: 28px; + margin-left: 5px; +} + +.mytheme .v-filterselect-tiny span.v-icon { + + width: 28px; + line-height: 1; + padding-top: 0.12em; +} + +.mytheme .v-filterselect-tiny [class$="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + position: absolute; + width: 28px; + border-radius: 0 4px 4px 0; +} + +.mytheme .v-filterselect-tiny [class$="button"]:before { + font-family: ThemeIcons; + content: "\f078"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; + position: absolute; + width: 28px; + text-align: center; + top: 50%; + line-height: 1; + margin-top: -0.47em; +} + +.mytheme .v-filterselect-tiny [class$="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-filterselect-tiny.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect-tiny.v-disabled [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect-tiny.v-disabled [class$="button"]:active:after { + display: none; +} + +.mytheme .v-filterselect-tiny.v-readonly [class*="input"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-filterselect-tiny.v-readonly [class*="input"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-filterselect-tiny.v-readonly [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect-tiny.v-readonly [class$="button"]:active:after { + display: none; +} + +.mytheme .v-filterselect-compact, .mytheme .v-filterselect-small { + height: 31px; + +} + +.mytheme .v-filterselect-compact [class*="input"], .mytheme .v-filterselect-small [class*="input"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 31px; + + padding: 3px 6px; + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + width: 100% !important; + height: 100%; + padding-right: 32px; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-filterselect-compact [class*="input"], .v-ie9 .mytheme .v-filterselect-compact [class*="input"], .v-ie8 .mytheme .v-filterselect-small [class*="input"], .v-ie9 .mytheme .v-filterselect-small [class*="input"] { + line-height: 31px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-filterselect-compact .v-icon + [class*="input"], .mytheme .v-filterselect-small .v-icon + [class*="input"] { + padding-left: 31px; +} + +.mytheme .v-filterselect-compact img.v-icon, .mytheme .v-filterselect-small img.v-icon { + max-height: 31px; + margin-left: 6px; +} + +.mytheme .v-filterselect-compact span.v-icon, .mytheme .v-filterselect-small span.v-icon { + + width: 31px; + line-height: 1; + padding-top: 0.12em; +} + +.mytheme .v-filterselect-compact [class$="button"], .mytheme .v-filterselect-small [class$="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + position: absolute; + width: 31px; + border-radius: 0 4px 4px 0; +} + +.mytheme .v-filterselect-compact [class$="button"]:before, .mytheme .v-filterselect-small [class$="button"]:before { + font-family: ThemeIcons; + content: "\f078"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; + position: absolute; + width: 31px; + text-align: center; + top: 50%; + line-height: 1; + margin-top: -0.47em; +} + +.mytheme .v-filterselect-compact [class$="button"]:active:after, .mytheme .v-filterselect-small [class$="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-filterselect-compact.v-disabled, .mytheme .v-filterselect-small.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect-compact.v-disabled [class$="button"], .mytheme .v-filterselect-small.v-disabled [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect-compact.v-disabled [class$="button"]:active:after, .mytheme .v-filterselect-small.v-disabled [class$="button"]:active:after { + display: none; +} + +.mytheme .v-filterselect-compact.v-readonly [class*="input"], .mytheme .v-filterselect-small.v-readonly [class*="input"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-filterselect-compact.v-readonly [class*="input"]:focus, .mytheme .v-filterselect-small.v-readonly [class*="input"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-filterselect-compact.v-readonly [class$="button"], .mytheme .v-filterselect-small.v-readonly [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect-compact.v-readonly [class$="button"]:active:after, .mytheme .v-filterselect-small.v-readonly [class$="button"]:active:after { + display: none; +} + +.mytheme .v-filterselect-small { + font-size: 14px; +} + +.mytheme .v-filterselect-large { + height: 44px; + + font-size: 20px; +} + +.mytheme .v-filterselect-large [class*="input"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 44px; + + padding: 5px 8px; + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + width: 100% !important; + height: 100%; + padding-right: 45px; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-filterselect-large [class*="input"], .v-ie9 .mytheme .v-filterselect-large [class*="input"] { + line-height: 44px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-filterselect-large .v-icon + [class*="input"] { + padding-left: 44px; +} + +.mytheme .v-filterselect-large img.v-icon { + max-height: 44px; + margin-left: 8px; +} + +.mytheme .v-filterselect-large span.v-icon { + + width: 44px; + line-height: 1; + padding-top: 0.12em; +} + +.mytheme .v-filterselect-large [class$="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + position: absolute; + width: 44px; + border-radius: 0 4px 4px 0; +} + +.mytheme .v-filterselect-large [class$="button"]:before { + font-family: ThemeIcons; + content: "\f078"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; + position: absolute; + width: 44px; + text-align: center; + top: 50%; + line-height: 1; + margin-top: -0.47em; +} + +.mytheme .v-filterselect-large [class$="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-filterselect-large.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect-large.v-disabled [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect-large.v-disabled [class$="button"]:active:after { + display: none; +} + +.mytheme .v-filterselect-large.v-readonly [class*="input"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-filterselect-large.v-readonly [class*="input"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-filterselect-large.v-readonly [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect-large.v-readonly [class$="button"]:active:after { + display: none; +} + +.mytheme .v-filterselect-huge { + height: 59px; + + font-size: 26px; +} + +.mytheme .v-filterselect-huge [class*="input"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 59px; + + padding: 7px 10px; + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + width: 100% !important; + height: 100%; + padding-right: 60px; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-filterselect-huge [class*="input"], .v-ie9 .mytheme .v-filterselect-huge [class*="input"] { + line-height: 59px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-filterselect-huge .v-icon + [class*="input"] { + padding-left: 59px; +} + +.mytheme .v-filterselect-huge img.v-icon { + max-height: 59px; + margin-left: 10px; +} + +.mytheme .v-filterselect-huge span.v-icon { + + width: 59px; + line-height: 1; + padding-top: 0.12em; +} + +.mytheme .v-filterselect-huge [class$="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + position: absolute; + width: 59px; + border-radius: 0 4px 4px 0; +} + +.mytheme .v-filterselect-huge [class$="button"]:before { + font-family: ThemeIcons; + content: "\f078"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; + position: absolute; + width: 59px; + text-align: center; + top: 50%; + line-height: 1; + margin-top: -0.47em; +} + +.mytheme .v-filterselect-huge [class$="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-filterselect-huge.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-filterselect-huge.v-disabled [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect-huge.v-disabled [class$="button"]:active:after { + display: none; +} + +.mytheme .v-filterselect-huge.v-readonly [class*="input"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-filterselect-huge.v-readonly [class*="input"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-filterselect-huge.v-readonly [class$="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-filterselect-huge.v-readonly [class$="button"]:active:after { + display: none; +} + +.mytheme .v-csslayout-well { + background: #f5f5f5; + color: #454545; + -webkit-box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.05), inset 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.05), inset 0 2px 3px rgba(0, 0, 0, 0.05); + border-radius: 4px; + border: 1px solid #c5c5c5; +} + +.mytheme .v-csslayout-well > div > [class*="-caption"] { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-csslayout-well > .v-margin-top { + padding-top: 12px; +} + +.mytheme .v-csslayout-well > .v-margin-right { + padding-right: 12px; +} + +.mytheme .v-csslayout-well > .v-margin-bottom { + padding-bottom: 12px; +} + +.mytheme .v-csslayout-well > .v-margin-left { + padding-left: 12px; +} + +.mytheme .v-csslayout-card { + background: white; + color: #474747; + border-radius: 4px; + border: 1px solid #d5d5d5; + -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); +} + +.mytheme .v-csslayout-card > .v-margin-top { + padding-top: 12px; +} + +.mytheme .v-csslayout-card > .v-margin-right { + padding-right: 12px; +} + +.mytheme .v-csslayout-card > .v-margin-bottom { + padding-bottom: 12px; +} + +.mytheme .v-csslayout-card > .v-margin-left { + padding-left: 12px; +} + +.mytheme .v-csslayout-v-component-group { + white-space: nowrap; + position: relative; +} + +.mytheme .v-csslayout-v-component-group .v-widget ~ .v-widget:not(:last-child) { + border-radius: 0; +} + +.mytheme .v-csslayout-v-component-group .v-widget:last-child { + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} + +.mytheme .v-csslayout-v-component-group .v-widget:first-child, .mytheme .v-csslayout-v-component-group .v-caption:first-child + .v-widget { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} + +.mytheme .v-csslayout-v-component-group .v-widget ~ .v-widget.first.first { + border-radius: 4px 0 0 4px; +} + +.mytheme .v-csslayout-v-component-group .v-widget ~ .v-widget.last.last { + border-radius: 0 4px 4px 0; +} + +.mytheme .v-csslayout-v-component-group .v-widget { + vertical-align: middle; + margin-left: -1px; +} + +.mytheme .v-csslayout-v-component-group .v-widget:first-child { + margin-left: 0; +} + +.mytheme .v-csslayout-v-component-group .v-widget:focus, .mytheme .v-csslayout-v-component-group .v-widget[class*="focus"], .mytheme .v-csslayout-v-component-group .v-widget [class*="focus"] { + position: relative; + z-index: 5; +} + +.mytheme .v-form fieldset { + border: none; + padding: 0; + margin: 0; + height: 100%; +} + +.mytheme .v-form-content { + height: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.mytheme [class*="spacing"] > tbody > [class*="row"] > td { + padding-top: 12px; +} + +.mytheme [class*="spacing"] > tbody > [class*="firstrow"] > td { + padding-top: 0; +} + +.mytheme [class*="margin-top"] > tbody > [class*="firstrow"] > td { + padding-top: 37px; +} + +.mytheme [class*="margin-bottom"] > tbody > [class*="lastrow"] > td { + padding-bottom: 37px; +} + +.mytheme [class*="margin-left"] > tbody > [class*="row"] > [class*="captioncell"] { + padding-left: 37px; +} + +.mytheme [class*="margin-left"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h2, .mytheme [class*="margin-left"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h3, .mytheme [class*="margin-left"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h4 { + left: 37px; +} + +.mytheme [class*="margin-right"] > tbody > [class*="row"] > [class*="contentcell"] { + padding-right: 37px; +} + +.mytheme [class*="margin-right"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h2, .mytheme [class*="margin-right"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h3, .mytheme [class*="margin-right"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h4 { + right: 37px; +} + +.mytheme .v-formlayout > table { + border-spacing: 0; + position: relative; +} + +.mytheme .v-formlayout.v-has-width > table, .mytheme .v-formlayout.v-has-width .v-formlayout-contentcell { + width: 100%; +} + +.mytheme .v-formlayout-error-indicator { + width: 19px; +} + +.mytheme .v-formlayout-captioncell { + vertical-align: top; + line-height: 36px; +} + +.mytheme .v-formlayout-captioncell .v-caption { + padding-bottom: 0; +} + +.mytheme .v-formlayout-captioncell .v-caption-h2, .mytheme .v-formlayout-captioncell .v-caption-h3, .mytheme .v-formlayout-captioncell .v-caption-h4 { + height: 3em; +} + +.mytheme .v-formlayout-contentcell .v-checkbox, .mytheme .v-formlayout-contentcell .v-radiobutton { + font-weight: 400; +} + +.mytheme .v-formlayout-contentcell > .v-label-h2, .mytheme .v-formlayout-contentcell > .v-label-h3, .mytheme .v-formlayout-contentcell > .v-label-h4 { + position: absolute; + left: 0; + right: 0; + width: auto !important; + margin-top: -0.5em; + padding-bottom: 0.5em; + border-bottom: 1px solid #dfdfdf; +} + +.mytheme .v-formlayout.light > table { + padding: 0; +} + +.mytheme .v-formlayout.light > table > tbody > tr > td { + padding-top: 0; + height: 37px; + border-bottom: 1px solid #eaeaea; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="lastrow"] > td { + border-bottom: none; +} + +.mytheme .v-formlayout.light > table > tbody > tr > [class*="captioncell"] { + color: #7d7d7d; + text-align: right; + padding-left: 13px; + line-height: 37px; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] { + padding-right: 0; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textfield, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textarea, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-filterselect, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-datefield, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-filterselect-input, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-datefield-textfield { + width: 100%; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textfield, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textarea, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-filterselect input, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-datefield input, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-richtextarea { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 37px; + border-radius: 0; + padding: 4px 7px; + + -webkit-box-shadow: none; + box-shadow: none; + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + background: transparent; + border: none; + color: inherit; +} + +.v-ie8 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textfield, .v-ie9 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textfield, .v-ie8 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textarea, .v-ie9 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textarea, .v-ie8 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-filterselect input, .v-ie9 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-filterselect input, .v-ie8 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-datefield input, .v-ie9 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-datefield input, .v-ie8 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-richtextarea, .v-ie9 .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-richtextarea { + line-height: 37px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textfield.v-disabled, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textarea.v-disabled, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-filterselect input.v-disabled, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-datefield input.v-disabled, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-richtextarea.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textfield:focus, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textarea:focus, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-filterselect input:focus, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-datefield input:focus, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-richtextarea:focus { + outline: none; + -webkit-transition: none; + -moz-transition: none; + transition: none; + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), none; + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), none; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textfield:focus, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textarea:focus, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-filterselect input:focus, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-datefield input:focus, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-richtextarea:focus { + box-shadow: none; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textfield-prompt, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textarea-prompt, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-filterselect-prompt input, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-datefield-prompt input { + color: #a3a3a3; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-textarea, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-richtextarea { + height: auto; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h2, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h3, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h4 { + border-bottom: none; + left: 0; + right: 0; +} + +.mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h3, .mytheme .v-formlayout.light > table > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h4 { + margin-top: 0; +} + +.mytheme .v-formlayout.light .v-richtextarea { + margin: 5px 0; +} + +.mytheme .v-formlayout.light .v-filterselect-button, .mytheme .v-formlayout.light .v-datefield-button { + border: none; +} + +.mytheme .v-formlayout.light .v-filterselect-button:active:after, .mytheme .v-formlayout.light .v-datefield-button:active:after { + display: none; +} + +.mytheme .v-formlayout.light .v-datefield-button { + right: 0; + left: auto; +} + +.mytheme .v-formlayout.light .v-checkbox { + margin-left: 7px; +} + +.mytheme .v-grid { + position: relative; +} + +.mytheme .v-grid-scroller { + position: absolute; + z-index: 1; + outline: none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.mytheme .v-grid-scroller-horizontal { + left: 0; + right: 0; + bottom: 0; + overflow-y: hidden; + -ms-overflow-y: hidden; +} + +.mytheme .v-grid-scroller-vertical { + right: 0; + top: 0; + bottom: 0; + overflow-x: hidden; + -ms-overflow-x: hidden; +} + +.mytheme .v-grid-tablewrapper { + position: absolute; + overflow: hidden; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + z-index: 5; +} + +.mytheme .v-grid-tablewrapper > table { + border-spacing: 0; + table-layout: fixed; + width: inherit; +} + +.mytheme .v-grid-header-deco, .mytheme .v-grid-footer-deco { + position: absolute; + right: 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.mytheme .v-grid-horizontal-scrollbar-deco { + position: absolute; + bottom: 0; + left: 0; + right: 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.mytheme .v-grid-header, .mytheme .v-grid-body, .mytheme .v-grid-footer { + position: absolute; + left: 0; + width: inherit; + z-index: 10; +} + +.mytheme .v-grid-header, .mytheme .v-grid-header-deco { + top: 0; +} + +.mytheme .v-grid-footer, .mytheme .v-grid-footer-deco { + bottom: 0; +} + +.mytheme .v-grid-body { + -ms-touch-action: none; + touch-action: none; + z-index: 0; + top: 0; +} + +.mytheme .v-grid-body .v-grid-row { + position: absolute; + top: 0; + left: 0; +} + +.mytheme .v-grid-row { + display: block; +} + +.v-ie8 .mytheme .v-grid-row, .v-ie9 .mytheme .v-grid-row { + float: left; + clear: left; + margin-top: 0; +} + +.mytheme .v-grid-row > td, .mytheme .v-grid-row > th { + background-color: white; +} + +.mytheme .v-grid-row { + width: inherit; +} + +.mytheme .v-grid-cell { + display: block; + float: left; + padding: 2px; + white-space: nowrap; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + overflow: hidden; + font-size: 16px; +} + +.mytheme .v-grid-cell.frozen { + position: relative; + z-index: 1; +} + +.mytheme .v-grid-spacer { + position: absolute; + display: block; + background-color: white; +} + +.mytheme .v-grid-spacer > td { + width: 100%; + height: 100%; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.v-ie8 .mytheme .v-grid-spacer, .v-ie9 .mytheme .v-grid-spacer { + margin-top: 0; +} + +.mytheme .v-grid { + outline: none; +} + +.mytheme .v-grid-scroller-vertical, .mytheme .v-grid-scroller-horizontal { + border: 1px solid #d4d4d4; +} + +.mytheme .v-grid-scroller-vertical { + border-left: none; +} + +.mytheme .v-grid-scroller-horizontal { + border-top: none; +} + +.mytheme .v-grid-tablewrapper { + border: 1px solid #d4d4d4; +} + +.mytheme .v-grid .header-drag-table { + border-spacing: 0; + position: relative; + table-layout: fixed; + width: inherit; +} + +.mytheme .v-grid .header-drag-table .v-grid-header { + position: absolute; +} + +.mytheme .v-grid .header-drag-table .v-grid-header > .v-grid-cell { + border: 1px solid #d4d4d4; + margin-top: -10px; + opacity: 0.9; + filter: alpha(opacity=90); + z-index: 30000; +} + +.mytheme .v-grid .header-drag-table .v-grid-header > .v-grid-drop-marker { + background-color: #197de1; + position: absolute; + width: 3px; +} + +.mytheme .v-grid-sidebar.v-contextmenu { + -webkit-box-shadow: none; + box-shadow: none; + border-radius: 0; + position: absolute; + top: 0; + right: 0; + background-color: #fafafa; + border: 1px solid #d4d4d4; + padding: 0; + z-index: 5; +} + +.mytheme .v-grid-sidebar.v-contextmenu.v-grid-sidebar-popup { + right: auto; +} + +.mytheme .v-grid-sidebar.v-contextmenu .v-grid-sidebar-button { + background: transparent; + border: none; + color: inherit; + cursor: pointer; + outline: none; + padding: 0 4px; + text-align: right; + line-height: 1; +} + +.mytheme .v-grid-sidebar.v-contextmenu .v-grid-sidebar-button[disabled] { + cursor: default; +} + +.mytheme .v-grid-sidebar.v-contextmenu .v-grid-sidebar-button::-moz-focus-inner { + border: 0; +} + +.mytheme .v-grid-sidebar.v-contextmenu .v-grid-sidebar-button:after { + content: "\f0c9"; + display: block; + font-family: ThemeIcons, sans-serif; + font-size: 14px; +} + +.mytheme .v-grid-sidebar.v-contextmenu.closed { + border-radius: 0; +} + +.mytheme .v-grid-sidebar.v-contextmenu.open .v-grid-sidebar-button { + width: 100%; +} + +.mytheme .v-grid-sidebar.v-contextmenu.open .v-grid-sidebar-button:after { + content: "\f0c9"; + font-size: 14px; + line-height: 1; +} + +.v-ie .mytheme .v-grid-sidebar.v-contextmenu.open .v-grid-sidebar-button { + vertical-align: middle; +} + +.v-ie8 .mytheme .v-grid-sidebar.v-contextmenu.open .v-grid-sidebar-button:after { + vertical-align: middle; + text-align: center; + display: inline; +} + +.mytheme .v-grid-sidebar.v-contextmenu .v-grid-sidebar-content { + padding: 4px 0; + overflow-y: auto; + overflow-x: hidden; +} + +.mytheme .v-grid-sidebar.v-contextmenu .v-grid-sidebar-content .gwt-MenuBar .gwt-MenuItem .column-hiding-toggle { + text-shadow: none; +} + +.mytheme .v-grid-cell { + background-color: white; + padding: 0 18px; + line-height: 37px; + text-overflow: ellipsis; +} + +.mytheme .v-grid-cell > * { + line-height: 1.55; + vertical-align: middle; +} + +.mytheme .v-grid-cell > div { + display: inline-block; +} + +.mytheme .v-grid-cell.frozen { + -webkit-box-shadow: 1px 0 2px rgba(0, 0, 0, 0.1); + box-shadow: 1px 0 2px rgba(0, 0, 0, 0.1); + border-right: 1px solid #d4d4d4; +} + +.mytheme .v-grid-cell.frozen + th, .mytheme .v-grid-cell.frozen + td { + border-left: none; +} + +.mytheme .v-grid-row > td, .mytheme .v-grid-editor-cells > div { + border-left: 1px solid #d4d4d4; + border-bottom: 1px solid #d4d4d4; +} + +.mytheme .v-grid-row > td:first-child, .mytheme .v-grid-editor-cells > div:first-child { + border-left: none; +} + +.mytheme .v-grid-editor-cells.frozen > div { + -webkit-box-shadow: 1px 0 2px rgba(0, 0, 0, 0.1); + box-shadow: 1px 0 2px rgba(0, 0, 0, 0.1); + border-right: 1px solid #d4d4d4; + border-left: none; +} + +.mytheme .v-grid-row-stripe > td { + background-color: #f5f5f5; +} + +.mytheme .v-grid-row-selected > td { + background: #197de1; +} + +.mytheme .v-grid-row-focused > td { + +} + +.mytheme .v-grid-header th { + position: relative; + background-color: #fafafa; + font-size: 14px; + font-weight: inherit; + border-left: 1px solid #d4d4d4; + border-bottom: 1px solid #d4d4d4; + + text-align: left; +} + +.mytheme .v-grid-header th:first-child { + border-left: none; +} + +.mytheme .v-grid-header .sort-asc, .mytheme .v-grid-header .sort-desc { + padding-right: 35px; +} + +.mytheme .v-grid-header .sort-asc:after, .mytheme .v-grid-header .sort-desc:after { + font-family: ThemeIcons, sans-serif; + content: "\f0de" " " attr(sort-order); + position: absolute; + right: 18px; + font-size: 12px; +} + +.mytheme .v-grid-header .sort-desc:after { + content: "\f0dd" " " attr(sort-order); +} + +.mytheme .v-grid-column-resize-handle { + position: absolute; + width: 36px; + right: -18px; + top: 0px; + bottom: 0px; + cursor: col-resize; + z-index: 10; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.mytheme .v-grid-column-resize-simple-indicator { + position: absolute; + width: 3px; + top: 0px; + left: 18px; + z-index: 9001; + background: #fff; + box-shadow: 0px 0px 5px #000; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.mytheme .v-grid-footer td { + background-color: #fafafa; + font-size: 14px; + font-weight: inherit; + border-left: 1px solid #d4d4d4; + border-top: 1px solid #d4d4d4; + border-bottom: none; + +} + +.mytheme .v-grid-footer td:first-child { + border-left: none; +} + +.mytheme .v-grid-header .v-grid-cell, .mytheme .v-grid-footer .v-grid-cell { + overflow: visible; +} + +.mytheme .v-grid-column-header-content, .mytheme .v-grid-column-footer-content { + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + line-height: 37px; + vertical-align: baseline; +} + +.mytheme .v-grid-header-deco { + border-top: 1px solid #d4d4d4; + border-right: 1px solid #d4d4d4; + background-color: #fafafa; +} + +.mytheme .v-grid-footer-deco { + border-bottom: 1px solid #d4d4d4; + border-right: 1px solid #d4d4d4; + background-color: #fafafa; +} + +.mytheme .v-grid-horizontal-scrollbar-deco { + background-color: #fafafa; + border: 1px solid #d4d4d4; + border-top: none; +} + +.mytheme .v-grid-cell-focused { + position: relative; +} + +.mytheme .v-grid-cell-focused:before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border: 2px solid #197de1; + display: none; + pointer-events: none; +} + +.ie8 .mytheme .v-grid-cell-focused:before, .ie9 .mytheme .v-grid-cell-focused:before, .ie10 .mytheme .v-grid-cell-focused:before { + content: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==); +} + +.mytheme .v-grid:focus .v-grid-cell-focused:before { + display: block; +} + +.mytheme .v-grid.v-disabled:focus .v-grid-cell-focused:before { + display: none; +} + +.mytheme .v-grid-editor { + position: absolute; + z-index: 20; + overflow: hidden; + left: 0; + right: 0; + border: 1px solid #d4d4d4; + box-sizing: border-box; + -moz-box-sizing: border-box; + margin-top: -1px; + -webkit-box-shadow: 0 0 9px rgba(0, 0, 0, 0.2); + box-shadow: 0 0 9px rgba(0, 0, 0, 0.2); +} + +.mytheme .v-grid-editor.unbuffered .v-grid-editor-footer { + width: 100%; +} + +.mytheme .v-grid-editor-cells { + position: relative; + white-space: nowrap; +} + +.mytheme .v-grid-editor-cells.frozen { + z-index: 2; +} + +.mytheme .v-grid-editor-cells > div { + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + vertical-align: middle; + background: white; +} + +.mytheme .v-grid-editor-cells > div:first-child { + border-left: none; +} + +.mytheme .v-grid-editor-cells > div > * { + vertical-align: middle; + display: inline-block; +} + +.mytheme .v-grid-editor-cells > div .v-filterselect { + padding-left: 0; +} + +.mytheme .v-grid-editor-cells > div input[type="text"], .mytheme .v-grid-editor-cells > div input[type="text"].v-filterselect-input, .mytheme .v-grid-editor-cells > div input[type="password"] { + padding-left: 18px; +} + +.mytheme .v-grid-editor-cells > div input[type="text"]:not(.v-filterselect-input), .mytheme .v-grid-editor-cells > div input[type="password"] { + padding-right: 9px; +} + +.mytheme .v-grid-editor-cells > div input[type="checkbox"] { + margin-left: 18px; +} + +.mytheme .v-grid-editor-cells > div .v-textfield, .mytheme .v-grid-editor-cells > div .v-datefield, .mytheme .v-grid-editor-cells > div .v-filterselect { + min-width: 100%; + max-width: 100%; + min-height: 100%; + max-height: 100%; +} + +.v-ie8 .mytheme .v-grid-editor-cells > div .v-datefield-button { + margin-left: -37px; +} + +.v-ie8 .mytheme .v-grid-editor-cells > div .v-filterselect-button { + margin-left: -25px; +} + +.mytheme .v-grid-editor-cells > div .v-select, .mytheme .v-grid-editor-cells > div .v-select-select { + min-width: 100%; + max-width: 100%; +} + +.mytheme .v-grid-editor-cells > div.not-editable.v-grid-cell { + float: none; +} + +.mytheme .v-grid-editor-cells .error::before { + position: absolute; + display: block; + height: 0; + width: 0; + content: ""; + border-top: 5px solid red; + border-right: 5px solid transparent; +} + +.mytheme .v-grid-editor-cells .error, .mytheme .v-grid-editor-cells .error > input { + background-color: #fee; +} + +.mytheme .v-grid-editor-footer { + display: table; + height: 37px; + border-top: 1px solid #d4d4d4; + margin-top: -1px; + background: white; + padding: 0 5px; +} + +.mytheme .v-grid-editor-footer + .v-grid-editor-cells > div { + border-bottom: none; + border-top: 1px solid #d4d4d4; +} + +.mytheme .v-grid-editor-footer:first-child { + border-top: none; + margin-top: 0; + border-bottom: 1px solid #d4d4d4; + margin-bottom: -1px; +} + +.mytheme .v-grid-editor-message, .mytheme .v-grid-editor-buttons { + display: table-cell; + white-space: nowrap; + vertical-align: middle; +} + +.mytheme .v-grid-editor-message { + width: 100%; + position: relative; +} + +.mytheme .v-grid-editor-message > div { + position: absolute; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + line-height: 37px; + top: 0; +} + +.mytheme .v-grid-editor-save { + margin-right: 4px; +} + +.mytheme .v-grid-spacer { + padding-left: 1px; +} + +.mytheme .v-grid-spacer > td { + display: block; + padding: 0; + background-color: white; + border-top: 1px solid #eeeeee; + border-bottom: 1px solid #d4d4d4; +} + +.mytheme .v-grid-spacer.stripe > td { + background-color: #f5f5f5; + border-top: 1px solid #e5e5e5; + border-bottom: 1px solid #d4d4d4; +} + +.mytheme .v-grid-spacer-deco-container { + border-top: 1px solid transparent; + position: relative; + top: 0; + z-index: 5; +} + +.mytheme .v-grid-spacer-deco { + top: 0; + left: 0; + width: 2px; + background-color: #197de1; + position: absolute; + height: 100%; + pointer-events: none; +} + +.ie8 .mytheme .v-grid-spacer-deco:before, .ie9 .mytheme .v-grid-spacer-deco:before, .ie10 .mytheme .v-grid-spacer-deco:before { + content: url(data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==); +} + +.mytheme .v-grid-cell > .v-progressbar { + width: 100%; +} + +.mytheme .v-grid { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + background-color: #fafafa; +} + +.mytheme .v-grid.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-grid-header .v-grid-cell { + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); +} + +.mytheme .v-grid-header .v-grid-cell.dragged { + opacity: 0.5; + filter: alpha(opacity=50) ; + -webkit-transition: opacity 0.3s ease-in-out; + -moz-transition: opacity 0.3s ease-in-out; + transition: opacity 0.3s ease-in-out; +} + +.mytheme .v-grid-header .v-grid-cell.dragged-column-header { + margin-top: -19px; +} + +.mytheme .v-grid-footer .v-grid-cell { + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); +} + +.mytheme .v-grid-header-deco { + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); +} + +.mytheme .v-grid-footer-deco, .mytheme .v-grid-horizontal-scrollbar-deco { + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); +} + +.mytheme .v-grid-row-selected > .v-grid-cell { + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + color: #c8dbed; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); + border-color: #1d69b4; +} + +.mytheme .v-grid-row-selected > .v-grid-cell-focused:before { + border-color: #71b0ef; +} + +.mytheme .v-grid-editor { + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + border-color: #197de1; +} + +.mytheme .v-grid-editor-footer { + font-size: 14px; + padding: 0 6px; + background: #fafafa; + -webkit-animation: valo-grid-editor-footer-animate-in 200ms 120ms backwards; + -moz-animation: valo-grid-editor-footer-animate-in 200ms 120ms backwards; + animation: valo-grid-editor-footer-animate-in 200ms 120ms backwards; +} + +.mytheme .v-grid-editor-footer:first-child { + -webkit-animation: valo-grid-editor-footer-animate-in-alt 200ms 120ms backwards; + -moz-animation: valo-grid-editor-footer-animate-in-alt 200ms 120ms backwards; + animation: valo-grid-editor-footer-animate-in-alt 200ms 120ms backwards; +} + +.mytheme .v-grid-editor-cells { + z-index: 1; +} + +.mytheme .v-grid-editor-cells > div:before { + content: ""; + display: inline-block; + height: 100%; + vertical-align: middle; +} + +.mytheme .v-grid-editor-cells > div.not-editable.v-grid-cell { + float: none; +} + +.mytheme .v-grid-editor-cells > div .error::before { + border-top: 9px solid #ed473b; + border-right: 9px solid transparent; +} + +.mytheme .v-grid-editor-cells > div .error, .mytheme .v-grid-editor-cells > div .error > input { + background-color: #fffbfb; +} + +.mytheme .v-grid-editor-cells > div .v-textfield, .mytheme .v-grid-editor-cells > div .v-textfield-focus, .mytheme .v-grid-editor-cells > div .v-datefield, .mytheme .v-grid-editor-cells > div .v-datefield .v-textfield-focus, .mytheme .v-grid-editor-cells > div .v-filterselect-input, .mytheme .v-grid-editor-cells > div .v-filterselect-input:focus { + border: none; + border-radius: 0; + background: transparent; + -webkit-box-shadow: inset 0 1px 0 #f2f2f2; + box-shadow: inset 0 1px 0 #f2f2f2; +} + +.mytheme .v-grid-editor-cells > div input[type="text"].v-datefield-textfield { + padding-left: 44.4px; +} + +.v-ie8 .mytheme .v-grid-editor-cells > div .v-datefield-button { + margin-left: 0px; +} + +.v-ie8 .mytheme .v-grid-editor-cells > div .v-filterselect-button { + margin-left: 0px; +} + +.mytheme .v-grid-editor-cells > div .v-textfield-focus, .mytheme .v-grid-editor-cells > div .v-datefield .v-textfield-focus, .mytheme .v-grid-editor-cells > div .v-filterselect-input:focus { + position: relative; +} + +.mytheme .v-grid-editor-cells > div .v-select { + padding-left: 9px; + padding-right: 9px; +} + +.mytheme .v-grid-editor-cells > div .v-checkbox { + margin: 0 9px 0 18px; +} + +.mytheme .v-grid-editor-cells > div .v-checkbox > input[type="checkbox"] { + margin-left: 0; +} + +.mytheme .v-grid-editor-cells > div .v-checkbox > label { + white-space: nowrap; +} + +.mytheme .v-grid-editor-message > div:before { + display: inline-block; + color: #ed473b; + font-weight: 600; + width: 19px; + text-align: center; + content: "!"; +} + +.mytheme .v-grid-editor-save, .mytheme .v-grid-editor-cancel { + cursor: pointer; + color: #197de1; + text-decoration: underline; + font-weight: inherit; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; + font-weight: 400; + text-decoration: none; + border: none; + background: transparent; + padding: 6px 6px; + margin: 0; + outline: none; +} + +.mytheme .v-grid-editor-save:hover, .mytheme .v-grid-editor-cancel:hover { + color: #4396ea; +} + +.mytheme .v-grid-editor-save.v-disabled, .mytheme .v-grid-editor-cancel.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-grid-spacer { + margin-top: -1px; +} + +.mytheme .v-grid-sidebar.v-contextmenu.open .v-grid-sidebar-content { + margin: 0 0 2px; + padding: 4px 4px 2px; + overflow-y: auto; + overflow-x: hidden; +} + +.mytheme .v-grid-sidebar.v-contextmenu.closed { + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); +} + +.mytheme .v-grid-scroller::-webkit-scrollbar { + border: none; +} + +.mytheme .v-grid-scroller::-webkit-scrollbar-thumb { + border-radius: 10px; + border: 4px solid transparent; + background: rgba(0, 0, 0, 0.3); + -webkit-background-clip: content-box; + background-clip: content-box; +} + +.mytheme .v-grid-scroller-vertical::-webkit-scrollbar-thumb { + min-height: 30px; +} + +.mytheme .v-grid-scroller-horizontal::-webkit-scrollbar-thumb { + min-width: 30px; +} + +.mytheme .v-textfield { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 37px; + border-radius: 4px; + padding: 4px 9px; + border: 1px solid #c5c5c5; + background: white; + color: #474747; + -webkit-box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + width: 185px; +} + +.v-ie8 .mytheme .v-textfield, .v-ie9 .mytheme .v-textfield { + line-height: 37px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-textfield.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-textfield:focus { + outline: none; + -webkit-transition: none; + -moz-transition: none; + transition: none; + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-textfield[class*="prompt"] { + color: #a3a3a3; +} + +.mytheme .v-textfield-readonly { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-textfield-readonly:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-textfield-error { + border-color: #ed473b !important; + background: #fffbfb; + color: #6c2621; +} + +.mytheme .v-textfield-borderless { + border: none; + border-radius: 0; + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + color: inherit; +} + +.mytheme .v-textfield-borderless:focus { + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-textfield-borderless[class*="prompt"] { + color: inherit; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-textfield-tiny { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 28px; + border-radius: 4px; + padding: 3px 7px; + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + font-size: 12px; +} + +.v-ie8 .mytheme .v-textfield-tiny, .v-ie9 .mytheme .v-textfield-tiny { + line-height: 28px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-textfield-compact, .mytheme .v-textfield-small { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 31px; + border-radius: 4px; + padding: 3px 8px; + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; +} + +.v-ie8 .mytheme .v-textfield-compact, .v-ie9 .mytheme .v-textfield-compact, .v-ie8 .mytheme .v-textfield-small, .v-ie9 .mytheme .v-textfield-small { + line-height: 31px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-textfield-small { + font-size: 14px; +} + +.mytheme .v-textfield-large { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 44px; + border-radius: 4px; + padding: 5px 10px; + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + font-size: 20px; +} + +.v-ie8 .mytheme .v-textfield-large, .v-ie9 .mytheme .v-textfield-large { + line-height: 44px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-textfield-huge { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 59px; + border-radius: 4px; + padding: 7px 12px; + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + font-size: 26px; +} + +.v-ie8 .mytheme .v-textfield-huge, .v-ie9 .mytheme .v-textfield-huge { + line-height: 59px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-slot-inline-icon { + position: relative; +} + +.mytheme .v-caption-inline-icon { + padding: 0; +} + +.mytheme .v-caption-inline-icon .v-captiontext { + font-size: 14px; + font-weight: 400; + padding-bottom: 0.3em; + padding-left: 1px; + margin: 0; +} + +.mytheme .v-caption-inline-icon .v-icon { + position: absolute; + z-index: 10; +} + +.mytheme .v-caption-inline-icon span.v-icon { + left: 1px; + bottom: 1px; + width: 37px; + line-height: 35px; + text-align: center; + font-size: 16px; +} + +.mytheme .v-caption-inline-icon img.v-icon { + left: 11px; + bottom: 11px; +} + +.mytheme .v-textfield-inline-icon { + padding-left: 37px; +} + +.mytheme .v-slot-inline-icon.v-slot-tiny { + position: relative; +} + +.mytheme .v-caption-inline-icon.v-caption-tiny { + padding: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-tiny .v-captiontext { + font-size: 14px; + font-weight: 400; + padding-bottom: 0.3em; + padding-left: 1px; + margin: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-tiny .v-icon { + position: absolute; + z-index: 10; +} + +.mytheme .v-caption-inline-icon.v-caption-tiny span.v-icon { + left: 1px; + bottom: 1px; + width: 28px; + line-height: 26px; + text-align: center; + font-size: 12px; +} + +.mytheme .v-caption-inline-icon.v-caption-tiny img.v-icon { + left: 6px; + bottom: 6px; +} + +.mytheme .v-textfield-inline-icon.v-textfield-tiny { + padding-left: 28px; +} + +.mytheme .v-slot-inline-icon.v-slot-compact { + position: relative; +} + +.mytheme .v-caption-inline-icon.v-caption-compact { + padding: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-compact .v-captiontext { + font-size: 14px; + font-weight: 400; + padding-bottom: 0.3em; + padding-left: 1px; + margin: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-compact .v-icon { + position: absolute; + z-index: 10; +} + +.mytheme .v-caption-inline-icon.v-caption-compact span.v-icon { + left: 1px; + bottom: 1px; + width: 31px; + line-height: 29px; + text-align: center; + font-size: 16px; +} + +.mytheme .v-caption-inline-icon.v-caption-compact img.v-icon { + left: 8px; + bottom: 8px; +} + +.mytheme .v-textfield-inline-icon.v-textfield-compact { + padding-left: 31px; +} + +.mytheme .v-slot-inline-icon.v-slot-small { + position: relative; +} + +.mytheme .v-caption-inline-icon.v-caption-small { + padding: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-small .v-captiontext { + font-size: 14px; + font-weight: 400; + padding-bottom: 0.3em; + padding-left: 1px; + margin: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-small .v-icon { + position: absolute; + z-index: 10; +} + +.mytheme .v-caption-inline-icon.v-caption-small span.v-icon { + left: 1px; + bottom: 1px; + width: 31px; + line-height: 29px; + text-align: center; + font-size: 14px; +} + +.mytheme .v-caption-inline-icon.v-caption-small img.v-icon { + left: 8px; + bottom: 8px; +} + +.mytheme .v-textfield-inline-icon.v-textfield-small { + padding-left: 31px; +} + +.mytheme .v-slot-inline-icon.v-slot-large { + position: relative; +} + +.mytheme .v-caption-inline-icon.v-caption-large { + padding: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-large .v-captiontext { + font-size: 14px; + font-weight: 400; + padding-bottom: 0.3em; + padding-left: 1px; + margin: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-large .v-icon { + position: absolute; + z-index: 10; +} + +.mytheme .v-caption-inline-icon.v-caption-large span.v-icon { + left: 1px; + bottom: 1px; + width: 44px; + line-height: 42px; + text-align: center; + font-size: 20px; +} + +.mytheme .v-caption-inline-icon.v-caption-large img.v-icon { + left: 14px; + bottom: 14px; +} + +.mytheme .v-textfield-inline-icon.v-textfield-large { + padding-left: 44px; +} + +.mytheme .v-slot-inline-icon.v-slot-huge { + position: relative; +} + +.mytheme .v-caption-inline-icon.v-caption-huge { + padding: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-huge .v-captiontext { + font-size: 14px; + font-weight: 400; + padding-bottom: 0.3em; + padding-left: 1px; + margin: 0; +} + +.mytheme .v-caption-inline-icon.v-caption-huge .v-icon { + position: absolute; + z-index: 10; +} + +.mytheme .v-caption-inline-icon.v-caption-huge span.v-icon { + left: 1px; + bottom: 1px; + width: 59px; + line-height: 57px; + text-align: center; + font-size: 26px; +} + +.mytheme .v-caption-inline-icon.v-caption-huge img.v-icon { + left: 22px; + bottom: 22px; +} + +.mytheme .v-textfield-inline-icon.v-textfield-huge { + padding-left: 59px; +} + +.mytheme .v-textfield-align-right { + text-align: right; +} + +.mytheme .v-textfield-align-center { + text-align: center; +} + +.mytheme .v-textarea { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 37px; + border-radius: 4px; + padding: 6px; + border: 1px solid #c5c5c5; + background: white; + color: #474747; + -webkit-box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + height: auto; + resize: none; + white-space: pre-wrap; + width: 185px; +} + +.v-ie8 .mytheme .v-textarea, .v-ie9 .mytheme .v-textarea { + line-height: 37px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-textarea.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-textarea:focus { + outline: none; + -webkit-transition: none; + -moz-transition: none; + transition: none; + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-textarea[class*="prompt"] { + color: #a3a3a3; +} + +.v-ie8 .mytheme .v-textarea, .v-ie9 .mytheme .v-textarea { + line-height: inherit; + padding-top: 4px; + padding-bottom: 4px; +} + +.mytheme .v-textarea-readonly { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-textarea-readonly:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-textarea-error { + border-color: #ed473b !important; + background: #fffbfb; + color: #6c2621; +} + +.mytheme .v-textarea-borderless { + border: none; + border-radius: 0; + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + color: inherit; +} + +.mytheme .v-textarea-borderless:focus { + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-textarea-borderless[class*="prompt"] { + color: inherit; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-textarea-tiny { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 28px; + border-radius: 4px; + padding: 6px; + + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + height: auto; + resize: none; + white-space: pre-wrap; + font-size: 12px; +} + +.v-ie8 .mytheme .v-textarea-tiny, .v-ie9 .mytheme .v-textarea-tiny { + line-height: 28px; + padding-top: 0; + padding-bottom: 0; +} + +.v-ie8 .mytheme .v-textarea-tiny, .v-ie9 .mytheme .v-textarea-tiny { + line-height: inherit; + padding-top: 3px; + padding-bottom: 3px; +} + +.mytheme .v-textarea-small { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 31px; + border-radius: 4px; + padding: 6px; + + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + height: auto; + resize: none; + white-space: pre-wrap; + font-size: 14px; +} + +.v-ie8 .mytheme .v-textarea-small, .v-ie9 .mytheme .v-textarea-small { + line-height: 31px; + padding-top: 0; + padding-bottom: 0; +} + +.v-ie8 .mytheme .v-textarea-small, .v-ie9 .mytheme .v-textarea-small { + line-height: inherit; + padding-top: 3px; + padding-bottom: 3px; +} + +.mytheme .v-textarea-large { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 44px; + border-radius: 4px; + padding: 6px; + + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + height: auto; + resize: none; + white-space: pre-wrap; + font-size: 20px; +} + +.v-ie8 .mytheme .v-textarea-large, .v-ie9 .mytheme .v-textarea-large { + line-height: 44px; + padding-top: 0; + padding-bottom: 0; +} + +.v-ie8 .mytheme .v-textarea-large, .v-ie9 .mytheme .v-textarea-large { + line-height: inherit; + padding-top: 5px; + padding-bottom: 5px; +} + +.mytheme .v-textarea-huge { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 59px; + border-radius: 4px; + padding: 6px; + + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + height: auto; + resize: none; + white-space: pre-wrap; + font-size: 26px; +} + +.v-ie8 .mytheme .v-textarea-huge, .v-ie9 .mytheme .v-textarea-huge { + line-height: 59px; + padding-top: 0; + padding-bottom: 0; +} + +.v-ie8 .mytheme .v-textarea-huge, .v-ie9 .mytheme .v-textarea-huge { + line-height: inherit; + padding-top: 7px; + padding-bottom: 7px; +} + +.mytheme .v-textarea-align-right { + text-align: right; +} + +.mytheme .v-textarea-align-center { + text-align: center; +} + +.mytheme .v-datefield { + position: relative; + width: 185px; + height: 37px; + border-radius: 4px; +} + +.mytheme .v-datefield [class*="textfield"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 37px; + border-radius: 4px; + padding: 4px 9px; + border: 1px solid #c5c5c5; + background: white; + color: #474747; + -webkit-box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + padding-left: 44.4px; + width: 100%; + height: 100%; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-datefield [class*="textfield"], .v-ie9 .mytheme .v-datefield [class*="textfield"] { + line-height: 37px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-datefield [class*="textfield"].v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-datefield [class*="textfield"]:focus { + outline: none; + -webkit-transition: none; + -moz-transition: none; + transition: none; + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-datefield [class*="textfield"][class*="prompt"] { + color: #a3a3a3; +} + +.mytheme .v-datefield[class*="prompt"] > [class*="textfield"] { + color: #a3a3a3; +} + +.mytheme .v-datefield [class*="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + -webkit-appearance: none; + background: transparent; + padding: 0; + position: absolute; + z-index: 10; + width: 37px; + line-height: 35px; + text-align: center; + font: inherit; + outline: none; + margin: 0; + top: 1px; + bottom: 1px; + left: 1px; + border: none; + border-right: 1px solid #e4e4e4; + color: #a3a3a3; + border-radius: 3px 0 0 3px; +} + +.mytheme .v-datefield [class*="button"]:hover { + color: #474747; +} + +.mytheme .v-datefield [class*="button"]:before { + font-family: ThemeIcons; + content: "\f073"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-datefield [class*="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba(128, 128, 128, 0.2); + border-radius: inherit; +} + +.mytheme .v-datefield.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-datefield.v-disabled [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield.v-disabled [class*="button"]:active:after { + display: none; +} + +.mytheme .v-datefield.v-readonly [class*="textfield"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-datefield.v-readonly [class*="textfield"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-datefield.v-readonly [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield.v-readonly [class*="button"]:active:after { + display: none; +} + +.mytheme .v-datefield-error .v-datefield-textfield { + border-color: #ed473b !important; + background: #fffbfb; + color: #6c2621; +} + +.mytheme .v-datefield-error .v-datefield-button { + color: #ed473b; + border-color: #ed473b; +} + +.mytheme .v-datefield-full { + width: 240px; +} + +.mytheme .v-datefield-day { + width: 185px; +} + +.mytheme .v-datefield-month { + width: 120px; +} + +.mytheme .v-datefield-year { + width: 104px; +} + +.mytheme .v-datefield-popup { + padding: 4px 4px; + border-radius: 4px; + background-color: white; + color: #474747; + -webkit-box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -ms-backface-visibility: hidden; + backface-visibility: hidden; + margin-top: 5px !important; + margin-bottom: 5px !important; + margin-right: 5px !important; + cursor: default; + width: auto; +} + +.mytheme .v-datefield-popup[class*="animate-in"] { + -webkit-animation: valo-overlay-animate-in 120ms; + -moz-animation: valo-overlay-animate-in 120ms; + animation: valo-overlay-animate-in 120ms; +} + +.mytheme .v-datefield-popup[class*="animate-out"] { + -webkit-animation: valo-animate-out-fade 120ms; + -moz-animation: valo-animate-out-fade 120ms; + animation: valo-animate-out-fade 120ms; +} + +.mytheme .v-datefield-popup table { + border-collapse: collapse; + border-spacing: 0; + margin: 0 auto; +} + +.mytheme .v-datefield-popup td { + padding: 2px; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel { + font-size: 16px; + text-align: center; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel:focus { + outline: none; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-day { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 30px; + height: 26px; + border: 1px solid transparent; + line-height: 26px; + text-align: center; + font-size: 14px; + background: #fafafa; + border-radius: 2px; + -webkit-transition: color 200ms; + -moz-transition: color 200ms; + transition: color 200ms; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + cursor: pointer; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-day:hover { + color: #197de1; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-day-offmonth { + color: #a0a0a0; + background: transparent; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-day-today { + color: #191919; + font-weight: 600; + border-color: #afafaf; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-selected, .mytheme .v-datefield-popup .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-selected:hover { + color: #c8dbed; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + border: none; + font-weight: 600; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-focused { + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + position: relative; +} + +.v-ie8 .mytheme .v-datefield-popup .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-focused { + border-color: #197de1; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-outside-range, .mytheme .v-datefield-popup .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-outside-range:hover { + color: #a0a0a0; + cursor: not-allowed; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-weekdays { + height: 26px; + color: rgba(133, 133, 133, 0.85); +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-weekdays strong { + font: inherit; + font-size: 14px; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-header { + white-space: nowrap; +} + +.mytheme .v-datefield-popup td[class*="year"] button, .mytheme .v-datefield-popup td[class*="month"] button { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + border: none; + background: transparent; + padding: 0; + margin: 0; + cursor: pointer; + color: transparent; + font-size: 0; + width: 19px; + height: 25px; + outline: none; + position: relative; + vertical-align: middle; +} + +.mytheme .v-datefield-popup td[class*="year"] button:before, .mytheme .v-datefield-popup td[class*="month"] button:before { + color: #a0a0a0; + font-size: 21px; + line-height: 24px; + -webkit-transition: color 200ms; + -moz-transition: color 200ms; + transition: color 200ms; +} + +.mytheme .v-datefield-popup td[class*="year"] button:hover:before, .mytheme .v-datefield-popup td[class*="month"] button:hover:before { + color: #197de1; +} + +.mytheme .v-datefield-popup td[class*="year"] button.outside-range, .mytheme .v-datefield-popup td[class*="month"] button.outside-range { + cursor: default; + opacity: 0.3; + filter: alpha(opacity=30.0) ; +} + +.mytheme .v-datefield-popup td[class*="year"] button.outside-range:hover:before, .mytheme .v-datefield-popup td[class*="month"] button.outside-range:hover:before { + color: #a0a0a0; +} + +.mytheme .v-datefield-popup .v-button-prevyear:before { + font-family: ThemeIcons; + content: "\f100"; +} + +.mytheme .v-datefield-popup .v-button-prevmonth:before { + font-family: ThemeIcons; + content: "\f104"; +} + +.mytheme .v-datefield-popup .v-button-nextyear:before { + font-family: ThemeIcons; + content: "\f101"; +} + +.mytheme .v-datefield-popup .v-button-nextmonth:before { + font-family: ThemeIcons; + content: "\f105"; +} + +.mytheme .v-datefield-popup td.v-datefield-calendarpanel-month { + width: 148px; + color: #197de1; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-year td.v-datefield-calendarpanel-month { + width: 74px; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-weeknumber, .mytheme .v-datefield-popup .v-datefield-calendarpanel-weekdays.v-datefield-calendarpanel-weeknumbers td:first-child { + width: 30px; + color: rgba(133, 133, 133, 0.85); + font-size: 14px; + display: inline-block; + text-align: left; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-weeknumber { + position: relative; +} + +.mytheme .v-datefield-popup .v-datefield-calendarpanel-weeknumbers .v-first:before { + content: ""; + position: absolute; + top: 38px; + bottom: 0; + left: 0; + width: 34px; + border-top: 1px solid #eaeaea; + border-right: 1px solid #eaeaea; + border-top-right-radius: 4px; + border-bottom-left-radius: 4px; + background: #fafafa; +} + +.mytheme .v-datefield-popup td.v-datefield-calendarpanel-time { + width: 100%; + font-size: 14px; +} + +.mytheme .v-datefield-popup td.v-datefield-calendarpanel-time .v-label { + display: inline; + margin: 0 0.1em; + font-weight: 400; +} + +.mytheme .v-datefield-calendarpanel { + font-size: 16px; + text-align: center; +} + +.mytheme .v-datefield-calendarpanel:focus { + outline: none; +} + +.mytheme .v-datefield-calendarpanel-day { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 30px; + height: 26px; + border: 1px solid transparent; + line-height: 26px; + text-align: center; + font-size: 14px; + background: #fafafa; + border-radius: 2px; + -webkit-transition: color 200ms; + -moz-transition: color 200ms; + transition: color 200ms; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + cursor: pointer; +} + +.mytheme .v-datefield-calendarpanel-day:hover { + color: #197de1; +} + +.mytheme .v-datefield-calendarpanel-day-offmonth { + color: #a0a0a0; + background: transparent; +} + +.mytheme .v-datefield-calendarpanel-day-today { + color: #191919; + font-weight: 600; + border-color: #afafaf; +} + +.mytheme .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-selected, .mytheme .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-selected:hover { + color: #c8dbed; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + border: none; + font-weight: 600; +} + +.mytheme .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-focused { + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + position: relative; +} + +.v-ie8 .mytheme .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-focused { + border-color: #197de1; +} + +.mytheme .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-outside-range, .mytheme .v-datefield-calendarpanel-day.v-datefield-calendarpanel-day-outside-range:hover { + color: #a0a0a0; + cursor: not-allowed; +} + +.mytheme .v-datefield-calendarpanel-weekdays { + height: 26px; + color: rgba(133, 133, 133, 0.85); +} + +.mytheme .v-datefield-calendarpanel-weekdays strong { + font: inherit; + font-size: 14px; +} + +.mytheme .v-datefield-calendarpanel-header { + white-space: nowrap; +} + +.mytheme td[class*="year"] button, .mytheme td[class*="month"] button { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + border: none; + background: transparent; + padding: 0; + margin: 0; + cursor: pointer; + color: transparent; + font-size: 0; + width: 19px; + height: 25px; + outline: none; + position: relative; + vertical-align: middle; +} + +.mytheme td[class*="year"] button:before, .mytheme td[class*="month"] button:before { + color: #a0a0a0; + font-size: 21px; + line-height: 24px; + -webkit-transition: color 200ms; + -moz-transition: color 200ms; + transition: color 200ms; +} + +.mytheme td[class*="year"] button:hover:before, .mytheme td[class*="month"] button:hover:before { + color: #197de1; +} + +.mytheme td[class*="year"] button.outside-range, .mytheme td[class*="month"] button.outside-range { + cursor: default; + opacity: 0.3; + filter: alpha(opacity=30.0) ; +} + +.mytheme td[class*="year"] button.outside-range:hover:before, .mytheme td[class*="month"] button.outside-range:hover:before { + color: #a0a0a0; +} + +.mytheme .v-button-prevyear:before { + font-family: ThemeIcons; + content: "\f100"; +} + +.mytheme .v-button-prevmonth:before { + font-family: ThemeIcons; + content: "\f104"; +} + +.mytheme .v-button-nextyear:before { + font-family: ThemeIcons; + content: "\f101"; +} + +.mytheme .v-button-nextmonth:before { + font-family: ThemeIcons; + content: "\f105"; +} + +.mytheme td.v-datefield-calendarpanel-month { + width: 148px; + color: #197de1; +} + +.mytheme .v-datefield-calendarpanel-year td.v-datefield-calendarpanel-month { + width: 74px; +} + +.mytheme .v-datefield-calendarpanel-weeknumber, .mytheme .v-datefield-calendarpanel-weekdays.v-datefield-calendarpanel-weeknumbers td:first-child { + width: 30px; + color: rgba(133, 133, 133, 0.85); + font-size: 14px; + display: inline-block; + text-align: left; +} + +.mytheme .v-datefield-calendarpanel-weeknumber { + position: relative; +} + +.mytheme .v-datefield-calendarpanel-weeknumbers .v-first:before { + content: ""; + position: absolute; + top: 38px; + bottom: 0; + left: 0; + width: 34px; + border-top: 1px solid #eaeaea; + border-right: 1px solid #eaeaea; + border-top-right-radius: 4px; + border-bottom-left-radius: 4px; + background: #fafafa; +} + +.mytheme td.v-datefield-calendarpanel-time { + width: 100%; + font-size: 14px; +} + +.mytheme td.v-datefield-calendarpanel-time .v-label { + display: inline; + margin: 0 0.1em; + font-weight: 400; +} + +.mytheme .v-datefield-borderless .v-datefield-textfield { + border: none; + border-radius: 0; + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + color: inherit; +} + +.mytheme .v-datefield-borderless .v-datefield-textfield:focus { + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-datefield-borderless .v-datefield-textfield[class*="prompt"] { + color: inherit; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-datefield-borderless .v-datefield-button { + border: none; + color: inherit; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-datefield-align-right input { + text-align: right; +} + +.mytheme .v-datefield-align-center input { + text-align: center; +} + +.mytheme .v-datefield-tiny { + height: 28px; + border-radius: 4px; + font-size: 12px; +} + +.mytheme .v-datefield-tiny [class*="textfield"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 28px; + border-radius: 4px; + padding: 3px 7px; + + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + padding-left: 33.6px; + width: 100%; + height: 100%; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-datefield-tiny [class*="textfield"], .v-ie9 .mytheme .v-datefield-tiny [class*="textfield"] { + line-height: 28px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-datefield-tiny [class*="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + -webkit-appearance: none; + background: transparent; + padding: 0; + position: absolute; + z-index: 10; + width: 28px; + line-height: 28px; + text-align: center; + font: inherit; + outline: none; + margin: 0; + border-radius: 4px 0 0 4px; +} + +.mytheme .v-datefield-tiny [class*="button"]:before { + font-family: ThemeIcons; + content: "\f073"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-datefield-tiny [class*="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-datefield-tiny.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-datefield-tiny.v-disabled [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield-tiny.v-disabled [class*="button"]:active:after { + display: none; +} + +.mytheme .v-datefield-tiny.v-readonly [class*="textfield"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-datefield-tiny.v-readonly [class*="textfield"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-datefield-tiny.v-readonly [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield-tiny.v-readonly [class*="button"]:active:after { + display: none; +} + +.mytheme .v-datefield-compact, .mytheme .v-datefield-small { + height: 31px; + border-radius: 4px; +} + +.mytheme .v-datefield-compact [class*="textfield"], .mytheme .v-datefield-small [class*="textfield"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 31px; + border-radius: 4px; + padding: 3px 8px; + + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + padding-left: 37.2px; + width: 100%; + height: 100%; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-datefield-compact [class*="textfield"], .v-ie9 .mytheme .v-datefield-compact [class*="textfield"], .v-ie8 .mytheme .v-datefield-small [class*="textfield"], .v-ie9 .mytheme .v-datefield-small [class*="textfield"] { + line-height: 31px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-datefield-compact [class*="button"], .mytheme .v-datefield-small [class*="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + -webkit-appearance: none; + background: transparent; + padding: 0; + position: absolute; + z-index: 10; + width: 31px; + line-height: 31px; + text-align: center; + font: inherit; + outline: none; + margin: 0; + border-radius: 4px 0 0 4px; +} + +.mytheme .v-datefield-compact [class*="button"]:before, .mytheme .v-datefield-small [class*="button"]:before { + font-family: ThemeIcons; + content: "\f073"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-datefield-compact [class*="button"]:active:after, .mytheme .v-datefield-small [class*="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-datefield-compact.v-disabled, .mytheme .v-datefield-small.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-datefield-compact.v-disabled [class*="button"], .mytheme .v-datefield-small.v-disabled [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield-compact.v-disabled [class*="button"]:active:after, .mytheme .v-datefield-small.v-disabled [class*="button"]:active:after { + display: none; +} + +.mytheme .v-datefield-compact.v-readonly [class*="textfield"], .mytheme .v-datefield-small.v-readonly [class*="textfield"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-datefield-compact.v-readonly [class*="textfield"]:focus, .mytheme .v-datefield-small.v-readonly [class*="textfield"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-datefield-compact.v-readonly [class*="button"], .mytheme .v-datefield-small.v-readonly [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield-compact.v-readonly [class*="button"]:active:after, .mytheme .v-datefield-small.v-readonly [class*="button"]:active:after { + display: none; +} + +.mytheme .v-datefield-small { + font-size: 14px; +} + +.mytheme .v-datefield-large { + height: 44px; + border-radius: 4px; + font-size: 20px; +} + +.mytheme .v-datefield-large [class*="textfield"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 44px; + border-radius: 4px; + padding: 5px 10px; + + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + padding-left: 52.8px; + width: 100%; + height: 100%; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-datefield-large [class*="textfield"], .v-ie9 .mytheme .v-datefield-large [class*="textfield"] { + line-height: 44px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-datefield-large [class*="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + -webkit-appearance: none; + background: transparent; + padding: 0; + position: absolute; + z-index: 10; + width: 44px; + line-height: 44px; + text-align: center; + font: inherit; + outline: none; + margin: 0; + border-radius: 4px 0 0 4px; +} + +.mytheme .v-datefield-large [class*="button"]:before { + font-family: ThemeIcons; + content: "\f073"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-datefield-large [class*="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-datefield-large.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-datefield-large.v-disabled [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield-large.v-disabled [class*="button"]:active:after { + display: none; +} + +.mytheme .v-datefield-large.v-readonly [class*="textfield"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-datefield-large.v-readonly [class*="textfield"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-datefield-large.v-readonly [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield-large.v-readonly [class*="button"]:active:after { + display: none; +} + +.mytheme .v-datefield-huge { + height: 59px; + border-radius: 4px; + font-size: 26px; +} + +.mytheme .v-datefield-huge [class*="textfield"] { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 59px; + border-radius: 4px; + padding: 7px 12px; + + + + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + padding-left: 70.8px; + width: 100%; + height: 100%; + border-radius: inherit; +} + +.v-ie8 .mytheme .v-datefield-huge [class*="textfield"], .v-ie9 .mytheme .v-datefield-huge [class*="textfield"] { + line-height: 59px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-datefield-huge [class*="button"] { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + -webkit-appearance: none; + background: transparent; + padding: 0; + position: absolute; + z-index: 10; + width: 59px; + line-height: 59px; + text-align: center; + font: inherit; + outline: none; + margin: 0; + border-radius: 4px 0 0 4px; +} + +.mytheme .v-datefield-huge [class*="button"]:before { + font-family: ThemeIcons; + content: "\f073"; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-datefield-huge [class*="button"]:active:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-datefield-huge.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-datefield-huge.v-disabled [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield-huge.v-disabled [class*="button"]:active:after { + display: none; +} + +.mytheme .v-datefield-huge.v-readonly [class*="textfield"] { + background: #fafafa; + color: #464646; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-datefield-huge.v-readonly [class*="textfield"]:focus { + box-shadow: none; + border-color: #c5c5c5; +} + +.mytheme .v-datefield-huge.v-readonly [class*="button"] { + cursor: default; + pointer-events: none; +} + +.mytheme .v-datefield-huge.v-readonly [class*="button"]:active:after { + display: none; +} + +.mytheme .v-inline-datefield-calendarpanel { + font-size: 16px; + text-align: center; +} + +.mytheme .v-inline-datefield-calendarpanel:focus { + outline: none; +} + +.mytheme .v-inline-datefield-calendarpanel-day { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 30px; + height: 26px; + border: 1px solid transparent; + line-height: 26px; + text-align: center; + font-size: 14px; + background: #fafafa; + border-radius: 2px; + -webkit-transition: color 200ms; + -moz-transition: color 200ms; + transition: color 200ms; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + cursor: pointer; +} + +.mytheme .v-inline-datefield-calendarpanel-day:hover { + color: #197de1; +} + +.mytheme .v-inline-datefield-calendarpanel-day-offmonth { + color: #a0a0a0; + background: transparent; +} + +.mytheme .v-inline-datefield-calendarpanel-day-today { + color: #191919; + font-weight: 600; + border-color: #afafaf; +} + +.mytheme .v-inline-datefield-calendarpanel-day.v-inline-datefield-calendarpanel-day-selected, .mytheme .v-inline-datefield-calendarpanel-day.v-inline-datefield-calendarpanel-day-selected:hover { + color: #c8dbed; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + border: none; + font-weight: 600; +} + +.mytheme .v-inline-datefield-calendarpanel-day.v-inline-datefield-calendarpanel-day-focused { + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + position: relative; +} + +.v-ie8 .mytheme .v-inline-datefield-calendarpanel-day.v-inline-datefield-calendarpanel-day-focused { + border-color: #197de1; +} + +.mytheme .v-inline-datefield-calendarpanel-day.v-inline-datefield-calendarpanel-day-outside-range, .mytheme .v-inline-datefield-calendarpanel-day.v-inline-datefield-calendarpanel-day-outside-range:hover { + color: #a0a0a0; + cursor: not-allowed; +} + +.mytheme .v-inline-datefield-calendarpanel-weekdays { + height: 26px; + color: rgba(133, 133, 133, 0.85); +} + +.mytheme .v-inline-datefield-calendarpanel-weekdays strong { + font: inherit; + font-size: 14px; +} + +.mytheme .v-inline-datefield-calendarpanel-header { + white-space: nowrap; +} + +.mytheme td[class*="year"] button, .mytheme td[class*="month"] button { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + border: none; + background: transparent; + padding: 0; + margin: 0; + cursor: pointer; + color: transparent; + font-size: 0; + width: 19px; + height: 25px; + outline: none; + position: relative; + vertical-align: middle; +} + +.mytheme td[class*="year"] button:before, .mytheme td[class*="month"] button:before { + color: #a0a0a0; + font-size: 21px; + line-height: 24px; + -webkit-transition: color 200ms; + -moz-transition: color 200ms; + transition: color 200ms; +} + +.mytheme td[class*="year"] button:hover:before, .mytheme td[class*="month"] button:hover:before { + color: #197de1; +} + +.mytheme td[class*="year"] button.outside-range, .mytheme td[class*="month"] button.outside-range { + cursor: default; + opacity: 0.3; + filter: alpha(opacity=30.0) ; +} + +.mytheme td[class*="year"] button.outside-range:hover:before, .mytheme td[class*="month"] button.outside-range:hover:before { + color: #a0a0a0; +} + +.mytheme .v-button-prevyear:before { + font-family: ThemeIcons; + content: "\f100"; +} + +.mytheme .v-button-prevmonth:before { + font-family: ThemeIcons; + content: "\f104"; +} + +.mytheme .v-button-nextyear:before { + font-family: ThemeIcons; + content: "\f101"; +} + +.mytheme .v-button-nextmonth:before { + font-family: ThemeIcons; + content: "\f105"; +} + +.mytheme td.v-inline-datefield-calendarpanel-month { + width: 148px; + color: #197de1; +} + +.mytheme .v-inline-datefield-calendarpanel-year td.v-inline-datefield-calendarpanel-month { + width: 74px; +} + +.mytheme .v-inline-datefield-calendarpanel-weeknumber, .mytheme .v-inline-datefield-calendarpanel-weekdays.v-inline-datefield-calendarpanel-weeknumbers td:first-child { + width: 30px; + color: rgba(133, 133, 133, 0.85); + font-size: 14px; + display: inline-block; + text-align: left; +} + +.mytheme .v-inline-datefield-calendarpanel-weeknumber { + position: relative; +} + +.mytheme .v-inline-datefield-calendarpanel-weeknumbers .v-first:before { + content: ""; + position: absolute; + top: 38px; + bottom: 0; + left: 0; + width: 34px; + border-top: 1px solid #eaeaea; + border-right: 1px solid #eaeaea; + border-top-right-radius: 4px; + border-bottom-left-radius: 4px; + background: #fafafa; +} + +.mytheme td.v-inline-datefield-calendarpanel-time { + width: 100%; + font-size: 14px; +} + +.mytheme td.v-inline-datefield-calendarpanel-time .v-label { + display: inline; + margin: 0 0.1em; + font-weight: 400; +} + +.mytheme .v-inline-datefield-calendarpanel { + position: relative; + background: white; + padding: 6px; +} + +.mytheme .v-gridlayout-margin-top { + padding-top: 37px; +} + +.mytheme .v-gridlayout-margin-bottom { + padding-bottom: 37px; +} + +.mytheme .v-gridlayout-margin-left { + padding-left: 37px; +} + +.mytheme .v-gridlayout-margin-right { + padding-right: 37px; +} + +.mytheme .v-gridlayout-spacing-on { + padding-left: 12px; + padding-top: 12px; +} + +.mytheme .v-menubar { + position: relative; + text-align: center; + white-space: nowrap; + outline: none; + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + height: 37px; + padding: 0 16px; + color: #191919; + font-weight: 400; + + cursor: default; + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + padding: 0; + text-align: left; + line-height: 35px; +} + +.mytheme .v-menubar:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; +} + +.mytheme .v-menubar:focus:after { + -webkit-transition: none; + -moz-transition: none; + transition: none; +} + +.mytheme .v-menubar.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-menubar.v-disabled:after { + display: none; +} + +.mytheme .v-menubar:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-menubar:focus:after { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-menubar > .v-menubar-menuitem { + padding: 0 14px; +} + +.mytheme .v-menubar > .v-menubar-menuitem[class*="-icon-only"] { + width: 37px; +} + +.mytheme .v-menubar:active:after { + background: transparent; +} + +.mytheme .v-menubar > .v-menubar-menuitem { + position: relative; + z-index: 1; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + height: 37px; + padding: 0 15px; + color: inherit; + font-weight: 400; + + cursor: pointer; + border-radius: 0; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7; + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7; + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + border-width: 0 1px 0 0; + border-color: inherit; + height: 100%; + line-height: inherit; + vertical-align: top; + text-align: center; +} + +.mytheme .v-menubar > .v-menubar-menuitem:first-child { + border-left-width: 0; + border-radius: 3px 0 0 3px; +} + +.mytheme .v-menubar > .v-menubar-menuitem:last-child { + border-radius: 0 3px 3px 0; + border-right-width: 0; +} + +.mytheme .v-menubar > .v-menubar-menuitem:first-child:last-child { + border-radius: 3px; +} + +.mytheme .v-menubar > .v-menubar-menuitem:before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-menubar > .v-menubar-menuitem:hover { + zoom: 1; +} + +.mytheme .v-menubar > .v-menubar-menuitem:hover:before { + background-color: rgba(186, 186, 186, 0.1); + border: none; +} + +.mytheme .v-menubar > .v-menubar-menuitem:active:before { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-menubar > .v-menubar-menuitem .v-icon { + margin: 0 4px 0 -4px; + cursor: inherit; +} + +.mytheme .v-menubar > .v-menubar-menuitem[class*="-icon-only"] { + width: 37px; + padding: 0; +} + +.mytheme .v-menubar > .v-menubar-menuitem[class*="-icon-only"] .v-icon { + margin: 0; +} + +.mytheme .v-menubar > .v-menubar-menuitem-checked { + -webkit-box-shadow: none; + box-shadow: none; + background-color: #ededed; + background-image: -webkit-linear-gradient(bottom, #ededed 2%, #e9e9e9 98%); + background-image: linear-gradient(to top,#ededed 2%, #e9e9e9 98%); + color: #181818; +} + +.mytheme .v-disabled > .v-menubar-menuitem, .mytheme .v-menubar > .v-menubar-menuitem-disabled { + cursor: default; +} + +.mytheme .v-disabled > .v-menubar-menuitem:before, .mytheme .v-menubar > .v-menubar-menuitem-disabled:before { + display: none; +} + +.mytheme .v-menubar-menuitem-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-menubar > .v-menubar-menuitem-selected { + color: #ecf2f8; + + + + border-radius: 0; + border: 1px solid #1362b1; + border-top-color: #156ab3; + border-bottom-color: #1156a8; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + -webkit-box-shadow: inset 0 1px 0 #4d98e6, inset 0 -1px 0 #166bca; + box-shadow: inset 0 1px 0 #4d98e6, inset 0 -1px 0 #166bca; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); + border-top-width: 0; + border-left-width: 0; + border-bottom-width: 0; + z-index: 2; +} + +.mytheme .v-menubar > .v-menubar-menuitem-selected:hover:before { + background: none; +} + +.mytheme .v-menubar .v-menubar-submenu-indicator { + display: none; +} + +.mytheme .v-menubar .v-menubar-submenu-indicator + .v-menubar-menuitem-caption:after { + font-family: ThemeIcons; + content: "\f078"; + font-size: 0.7em; + vertical-align: 0.15em; + margin: 0 -0.2em 0 0.5em; + opacity: 0.5; +} + +.mytheme .v-menubar .v-menubar-submenu-indicator + .v-menubar-menuitem-caption:empty:after { + margin-left: -0.2em; +} + +.mytheme .v-menubar-popup { + padding: 4px 4px; + border-radius: 4px; + background-color: white; + color: #474747; + -webkit-box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -ms-backface-visibility: hidden; + backface-visibility: hidden; + padding: 4px 4px; + margin: 5px 0 0 1px !important; +} + +.mytheme .v-menubar-popup[class*="animate-in"] { + -webkit-animation: valo-overlay-animate-in 120ms; + -moz-animation: valo-overlay-animate-in 120ms; + animation: valo-overlay-animate-in 120ms; +} + +.mytheme .v-menubar-popup[class*="animate-out"] { + -webkit-animation: valo-animate-out-fade 120ms; + -moz-animation: valo-animate-out-fade 120ms; + animation: valo-animate-out-fade 120ms; +} + +.mytheme .v-menubar-popup .v-menubar-submenu { + outline: none; +} + +.mytheme .v-menubar-popup .v-menubar-menuitem { + display: block; + cursor: pointer; + line-height: 27px; + padding: 0 20px 0 10px; + border-radius: 3px; + font-weight: 400; + white-space: nowrap; + position: relative; + padding-left: 32px; + padding-right: 37px; + position: relative; +} + +.mytheme .v-menubar-popup .v-menubar-menuitem:active:before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + background: #0957a6; + opacity: 0.15; + filter: alpha(opacity=15.0) ; + pointer-events: none; + border-radius: inherit; +} + +.mytheme .v-menubar-popup .v-menubar-menuitem .v-icon { + max-height: 27px; + margin-right: 5px; + min-width: 1em; +} + +.mytheme .v-menubar-popup .v-menubar-submenu-indicator { + display: none; +} + +.mytheme .v-menubar-popup .v-menubar-submenu-indicator + .v-menubar-menuitem-caption:after { + position: absolute; + right: 10px; + font-family: ThemeIcons; + content: "\f054"; + line-height: 29px; +} + +.mytheme .v-menubar-popup .v-menubar-menuitem-selected { + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + color: #ecf2f8; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); +} + +.mytheme .v-menubar-popup .v-menubar-separator { + display: block; + margin: 4px 0; + height: 0; + overflow: hidden; + border-bottom: 1px solid #e4e4e4; +} + +.mytheme .v-menubar-popup [class*="checked"] .v-menubar-menuitem-caption:before { + content: "\f00c"; + font-family: ThemeIcons; + position: absolute; + left: 10px; +} + +.mytheme .v-menubar-popup [class*="unchecked"] .v-menubar-menuitem-caption:before { + content: ""; +} + +.mytheme .v-menubar-popup [class*="disabled"] { + cursor: default; +} + +.mytheme .v-menubar-small { + height: 31px; + padding: 0 14px; + + font-weight: 400; + + cursor: default; + border-radius: 4px; + padding: 0; + text-align: left; + line-height: 29px; + font-size: 14px; +} + +.mytheme .v-menubar-small:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-menubar-small > .v-menubar-menuitem { + padding: 0 12px; +} + +.mytheme .v-menubar-small > .v-menubar-menuitem[class*="-icon-only"] { + width: 31px; +} + +.mytheme .v-menubar-borderless { + border: none; + border-radius: 0; + padding: 1px; + -webkit-box-shadow: none; + box-shadow: none; + text-shadow: none; + background: transparent; + color: inherit; +} + +.mytheme .v-menubar-borderless:focus:after { + display: none; +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem { + -webkit-box-shadow: none; + box-shadow: none; + border: none; + margin-right: 1px; + border-radius: 4px; + color: #197de1; + padding: 0 12px; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem:first-child, .mytheme .v-menubar-borderless .v-menubar-menuitem:last-child, .mytheme .v-menubar-borderless .v-menubar-menuitem:first-child:last-child { + border-radius: 4px; +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem:before { + content: none; +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem:hover { + color: #4396ea; +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem:active { + color: inherit; +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem-checked, .mytheme .v-menubar-borderless .v-menubar-menuitem-checked:first-child { + border: 1px solid #c5c5c5; + color: #197de1; +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem-checked .v-menubar-menuitem-caption, .mytheme .v-menubar-borderless .v-menubar-menuitem-checked:first-child .v-menubar-menuitem-caption { + position: relative; + top: -1px; +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem-selected { + color: #ecf2f8; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem-selected:hover { + color: #ecf2f8; +} + +.mytheme .v-menubar-borderless .v-menubar-menuitem-disabled, .mytheme .v-menubar-borderless .v-menubar-menuitem-disabled:hover { + color: inherit; +} + +.mytheme .v-radiobutton { + position: relative; + line-height: 19px; + white-space: nowrap; +} + +.mytheme .v-radiobutton.v-has-width label { + white-space: normal; +} + +:root .mytheme .v-radiobutton { + padding-left: 25px; +} + +:root .mytheme .v-radiobutton label { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + display: inline-block; +} + +:root .mytheme .v-radiobutton > input { + position: absolute; + clip: rect(0, 0, 0, 0); + left: 0.2em; + top: 0.2em; + z-index: 0; + margin: 0; +} + +:root .mytheme .v-radiobutton > input:focus ~ label:before { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); +} + +:root .mytheme .v-radiobutton > input ~ label:before, :root .mytheme .v-radiobutton > input ~ label:after { + content: ""; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 19px; + height: 19px; + position: absolute; + top: 0; + left: 0; + border-radius: 4px; + font-size: 13px; + text-align: center; +} + +:root .mytheme .v-radiobutton > input ~ label:before { + height: 18.5px; + padding: 0 9px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + padding: 0; + height: 19px; +} + +:root .mytheme .v-radiobutton > input ~ label:after { + content: "\f00c"; + font-family: ThemeIcons; + color: transparent; + -webkit-transition: color 100ms; + -moz-transition: color 100ms; + transition: color 100ms; +} + +:root .mytheme .v-radiobutton > input:active ~ label:after { + background-color: rgba(125, 125, 125, 0.2); +} + +:root .mytheme .v-radiobutton > input:checked ~ label:after { + color: #197de1; +} + +.mytheme .v-radiobutton > .v-icon, .mytheme .v-radiobutton > label .v-icon { + margin: 0 6px 0 3px; + min-width: 1em; + cursor: pointer; +} + +.mytheme .v-radiobutton.v-disabled > label, .mytheme .v-radiobutton.v-disabled > .v-icon { + cursor: default; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-radiobutton.v-disabled > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-radiobutton.v-disabled > input:active ~ label:after { + background: transparent; +} + +.mytheme .v-radiobutton.v-readonly > label, .mytheme .v-radiobutton.v-readonly > .v-icon { + cursor: default; +} + +.mytheme .v-radiobutton.v-readonly > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-radiobutton.v-readonly > input:active ~ label:after { + background: transparent; +} + +:root .mytheme .v-radiobutton.v-readonly > input ~ label:after { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +:root .mytheme .v-radiobutton > input:checked ~ label:after { + width: 7px; + height: 7px; + top: 6px; + left: 6px; + background: #197de1; +} + +:root .mytheme .v-radiobutton > input ~ label:before, :root .mytheme .v-radiobutton > input ~ label:after { + border-radius: 50%; + content: ""; +} + +.mytheme .v-select-optiongroup .v-radiobutton, .mytheme .v-select-optiongroup .v-checkbox { + display: block; + margin: 9px 16px 0 0; +} + +.mytheme .v-select-optiongroup .v-radiobutton:first-child, .mytheme .v-select-optiongroup .v-checkbox:first-child { + margin-top: 6px; +} + +.mytheme .v-select-optiongroup .v-radiobutton:last-child, .mytheme .v-select-optiongroup .v-checkbox:last-child { + margin-bottom: 6px; +} + +.mytheme .v-select-optiongroup.v-has-width label { + white-space: normal; +} + +.mytheme .v-select-optiongroup-small { + font-size: 14px; +} + +.mytheme .v-select-optiongroup-small .v-checkbox { + position: relative; + line-height: 16px; + white-space: nowrap; +} + +.mytheme .v-select-optiongroup-small .v-checkbox.v-has-width label { + white-space: normal; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox { + padding-left: 21px; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox label { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + display: inline-block; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox > input { + position: absolute; + clip: rect(0, 0, 0, 0); + left: 0.2em; + top: 0.2em; + z-index: 0; + margin: 0; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox > input:focus ~ label:before { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox > input ~ label:before, :root .mytheme .v-select-optiongroup-small .v-checkbox > input ~ label:after { + content: ""; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 16px; + height: 16px; + position: absolute; + top: 0; + left: 0; + border-radius: 4px; + font-size: 11px; + text-align: center; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox > input ~ label:before { + height: 15.5px; + padding: 0 7px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + padding: 0; + height: 16px; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox > input ~ label:after { + content: "\f00c"; + font-family: ThemeIcons; + color: transparent; + -webkit-transition: color 100ms; + -moz-transition: color 100ms; + transition: color 100ms; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox > input:active ~ label:after { + background-color: rgba(125, 125, 125, 0.2); +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox > input:checked ~ label:after { + color: #197de1; +} + +.mytheme .v-select-optiongroup-small .v-checkbox > .v-icon, .mytheme .v-select-optiongroup-small .v-checkbox > label .v-icon { + margin: 0 5px 0 3px; + min-width: 1em; + cursor: pointer; +} + +.mytheme .v-select-optiongroup-small .v-checkbox.v-disabled > label, .mytheme .v-select-optiongroup-small .v-checkbox.v-disabled > .v-icon { + cursor: default; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-select-optiongroup-small .v-checkbox.v-disabled > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox.v-disabled > input:active ~ label:after { + background: transparent; +} + +.mytheme .v-select-optiongroup-small .v-checkbox.v-readonly > label, .mytheme .v-select-optiongroup-small .v-checkbox.v-readonly > .v-icon { + cursor: default; +} + +.mytheme .v-select-optiongroup-small .v-checkbox.v-readonly > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox.v-readonly > input:active ~ label:after { + background: transparent; +} + +:root .mytheme .v-select-optiongroup-small .v-checkbox.v-readonly > input ~ label:after { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton { + position: relative; + line-height: 16px; + white-space: nowrap; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton.v-has-width label { + white-space: normal; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton { + padding-left: 21px; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton label { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + display: inline-block; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton > input { + position: absolute; + clip: rect(0, 0, 0, 0); + left: 0.2em; + top: 0.2em; + z-index: 0; + margin: 0; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton > input:focus ~ label:before { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton > input ~ label:before, :root .mytheme .v-select-optiongroup-small .v-radiobutton > input ~ label:after { + content: ""; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 16px; + height: 16px; + position: absolute; + top: 0; + left: 0; + border-radius: 4px; + font-size: 11px; + text-align: center; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton > input ~ label:before { + height: 15.5px; + padding: 0 7px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + padding: 0; + height: 16px; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton > input ~ label:after { + content: "\f00c"; + font-family: ThemeIcons; + color: transparent; + -webkit-transition: color 100ms; + -moz-transition: color 100ms; + transition: color 100ms; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton > input:active ~ label:after { + background-color: rgba(125, 125, 125, 0.2); +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton > input:checked ~ label:after { + color: #197de1; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton > .v-icon, .mytheme .v-select-optiongroup-small .v-radiobutton > label .v-icon { + margin: 0 5px 0 3px; + min-width: 1em; + cursor: pointer; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton.v-disabled > label, .mytheme .v-select-optiongroup-small .v-radiobutton.v-disabled > .v-icon { + cursor: default; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton.v-disabled > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton.v-disabled > input:active ~ label:after { + background: transparent; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton.v-readonly > label, .mytheme .v-select-optiongroup-small .v-radiobutton.v-readonly > .v-icon { + cursor: default; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton.v-readonly > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton.v-readonly > input:active ~ label:after { + background: transparent; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton.v-readonly > input ~ label:after { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton > input:checked ~ label:after { + width: 6px; + height: 6px; + top: 5px; + left: 5px; + background: #197de1; +} + +:root .mytheme .v-select-optiongroup-small .v-radiobutton > input ~ label:before, :root .mytheme .v-select-optiongroup-small .v-radiobutton > input ~ label:after { + border-radius: 50%; + content: ""; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton, .mytheme .v-select-optiongroup-small .v-checkbox { + display: block; + margin: 8px 16px 0 0; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton:first-child, .mytheme .v-select-optiongroup-small .v-checkbox:first-child { + margin-top: 5px; +} + +.mytheme .v-select-optiongroup-small .v-radiobutton:last-child, .mytheme .v-select-optiongroup-small .v-checkbox:last-child { + margin-bottom: 5px; +} + +.mytheme .v-select-optiongroup-small.v-has-width label { + white-space: normal; +} + +.mytheme .v-select-optiongroup-large { + font-size: 20px; +} + +.mytheme .v-select-optiongroup-large .v-checkbox { + position: relative; + line-height: 22px; + white-space: nowrap; +} + +.mytheme .v-select-optiongroup-large .v-checkbox.v-has-width label { + white-space: normal; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox { + padding-left: 29px; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox label { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + display: inline-block; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox > input { + position: absolute; + clip: rect(0, 0, 0, 0); + left: 0.2em; + top: 0.2em; + z-index: 0; + margin: 0; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox > input:focus ~ label:before { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox > input ~ label:before, :root .mytheme .v-select-optiongroup-large .v-checkbox > input ~ label:after { + content: ""; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 22px; + height: 22px; + position: absolute; + top: 0; + left: 0; + border-radius: 4px; + font-size: 15px; + text-align: center; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox > input ~ label:before { + height: 22px; + padding: 0 10px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + padding: 0; + height: 22px; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox > input ~ label:after { + content: "\f00c"; + font-family: ThemeIcons; + color: transparent; + -webkit-transition: color 100ms; + -moz-transition: color 100ms; + transition: color 100ms; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox > input:active ~ label:after { + background-color: rgba(125, 125, 125, 0.2); +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox > input:checked ~ label:after { + color: #197de1; +} + +.mytheme .v-select-optiongroup-large .v-checkbox > .v-icon, .mytheme .v-select-optiongroup-large .v-checkbox > label .v-icon { + margin: 0 7px 0 4px; + min-width: 1em; + cursor: pointer; +} + +.mytheme .v-select-optiongroup-large .v-checkbox.v-disabled > label, .mytheme .v-select-optiongroup-large .v-checkbox.v-disabled > .v-icon { + cursor: default; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-select-optiongroup-large .v-checkbox.v-disabled > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox.v-disabled > input:active ~ label:after { + background: transparent; +} + +.mytheme .v-select-optiongroup-large .v-checkbox.v-readonly > label, .mytheme .v-select-optiongroup-large .v-checkbox.v-readonly > .v-icon { + cursor: default; +} + +.mytheme .v-select-optiongroup-large .v-checkbox.v-readonly > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox.v-readonly > input:active ~ label:after { + background: transparent; +} + +:root .mytheme .v-select-optiongroup-large .v-checkbox.v-readonly > input ~ label:after { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton { + position: relative; + line-height: 22px; + white-space: nowrap; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton.v-has-width label { + white-space: normal; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton { + padding-left: 29px; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton label { + -webkit-tap-highlight-color: transparent; + -webkit-touch-callout: none; + cursor: pointer; + display: inline-block; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton > input { + position: absolute; + clip: rect(0, 0, 0, 0); + left: 0.2em; + top: 0.2em; + z-index: 0; + margin: 0; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton > input:focus ~ label:before { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5), inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton > input ~ label:before, :root .mytheme .v-select-optiongroup-large .v-radiobutton > input ~ label:after { + content: ""; + display: inline-block; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 22px; + height: 22px; + position: absolute; + top: 0; + left: 0; + border-radius: 4px; + font-size: 15px; + text-align: center; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton > input ~ label:before { + height: 22px; + padding: 0 10px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + padding: 0; + height: 22px; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton > input ~ label:after { + content: "\f00c"; + font-family: ThemeIcons; + color: transparent; + -webkit-transition: color 100ms; + -moz-transition: color 100ms; + transition: color 100ms; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton > input:active ~ label:after { + background-color: rgba(125, 125, 125, 0.2); +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton > input:checked ~ label:after { + color: #197de1; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton > .v-icon, .mytheme .v-select-optiongroup-large .v-radiobutton > label .v-icon { + margin: 0 7px 0 4px; + min-width: 1em; + cursor: pointer; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton.v-disabled > label, .mytheme .v-select-optiongroup-large .v-radiobutton.v-disabled > .v-icon { + cursor: default; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton.v-disabled > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton.v-disabled > input:active ~ label:after { + background: transparent; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton.v-readonly > label, .mytheme .v-select-optiongroup-large .v-radiobutton.v-readonly > .v-icon { + cursor: default; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton.v-readonly > label > .v-icon { + cursor: default; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton.v-readonly > input:active ~ label:after { + background: transparent; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton.v-readonly > input ~ label:after { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton > input:checked ~ label:after { + width: 8px; + height: 8px; + top: 7px; + left: 7px; + background: #197de1; +} + +:root .mytheme .v-select-optiongroup-large .v-radiobutton > input ~ label:before, :root .mytheme .v-select-optiongroup-large .v-radiobutton > input ~ label:after { + border-radius: 50%; + content: ""; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton, .mytheme .v-select-optiongroup-large .v-checkbox { + display: block; + margin: 11px 16px 0 0; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton:first-child, .mytheme .v-select-optiongroup-large .v-checkbox:first-child { + margin-top: 7px; +} + +.mytheme .v-select-optiongroup-large .v-radiobutton:last-child, .mytheme .v-select-optiongroup-large .v-checkbox:last-child { + margin-bottom: 7px; +} + +.mytheme .v-select-optiongroup-large.v-has-width label { + white-space: normal; +} + +.mytheme .v-select-optiongroup-horizontal { + white-space: nowrap; +} + +.mytheme .v-select-optiongroup-horizontal .v-radiobutton, .mytheme .v-select-optiongroup-horizontal .v-checkbox { + display: inline-block; +} + +.mytheme .v-select-optiongroup-horizontal.v-has-width { + white-space: normal; +} + +.mytheme .v-select-optiongroup-horizontal.v-has-width label { + white-space: nowrap; +} + +.mytheme .v-link { + cursor: pointer; + color: #197de1; + text-decoration: underline; + font-weight: inherit; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-link:hover { + color: #4396ea; +} + +.mytheme .v-link.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-link a { + cursor: inherit; + color: inherit; + text-decoration: inherit; + -webkit-transition: inherit; + -moz-transition: inherit; + transition: inherit; +} + +.mytheme .v-link .v-icon { + cursor: inherit; +} + +.mytheme .v-link-small { + font-size: 14px; +} + +.mytheme .v-link-large { + font-size: 20px; +} + +.mytheme .v-window { + padding: 4px 4px; + border-radius: 4px; + background-color: white; + color: #474747; + -webkit-box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -ms-backface-visibility: hidden; + backface-visibility: hidden; + -webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1), 0 16px 80px -6px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.09098); + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1), 0 16px 80px -6px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.09098); + padding: 0; + min-width: 148px !important; + min-height: 37px !important; + white-space: nowrap; + overflow: hidden !important; + -webkit-transition: width 200ms, height 200ms, top 200ms, left 200ms; + -moz-transition: width 200ms, height 200ms, top 200ms, left 200ms; + transition: width 200ms, height 200ms, top 200ms, left 200ms; +} + +.mytheme .v-window[class*="animate-in"] { + -webkit-animation: valo-animate-in-fade 140ms; + -moz-animation: valo-animate-in-fade 140ms; + animation: valo-animate-in-fade 140ms; +} + +.mytheme .v-window[class*="animate-out"] { + -webkit-animation: valo-animate-out-scale-down-fade 100ms; + -moz-animation: valo-animate-out-scale-down-fade 100ms; + animation: valo-animate-out-scale-down-fade 100ms; +} + +.mytheme .v-window.v-window-animate-in { + -webkit-transition: none; + -moz-transition: none; + transition: none; +} + +.mytheme .v-window-modalitycurtain { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: #222; + background-image: -webkit-radial-gradient(50% 50%, circle, #222, #0e0e0e); + background-image: radial-gradient( circle at 50% 50%, #222, #0e0e0e); + opacity: 0.72; + filter: alpha(opacity=72) ; + -webkit-animation: valo-animate-in-fade 400ms 100ms backwards; + -moz-animation: valo-animate-in-fade 400ms 100ms backwards; + animation: valo-animate-in-fade 400ms 100ms backwards; +} + +.v-op12 .mytheme .v-window-modalitycurtain { + -webkit-animation: none; + -moz-animation: none; + animation: none; +} + +.mytheme .v-window-draggingCurtain { + position: fixed !important; +} + +.mytheme .v-window-resizingCurtain + .v-window, .mytheme .v-window-draggingCurtain + .v-window { + -webkit-transition: none; + -moz-transition: none; + transition: none; +} + +.mytheme .v-window-outerheader { + cursor: move; + position: absolute; + z-index: 2; + top: 0; + left: 0; + right: 0; + -webkit-transform: translatez(0); + -moz-transform: translatez(0); + -ms-transform: translatez(0); + -o-transform: translatez(0); + transform: translatez(0); +} + +.mytheme .v-window-outerheader:after { + content: ""; + position: absolute; + bottom: -1px; + right: 0; + left: 0; + height: 0; + border-top: 1px solid #dfdfdf; + border-color: rgba(197, 197, 197, 0.5); +} + +.mytheme .v-window-header { + line-height: 36px; + padding-left: 12px; + margin-right: 74px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + color: #7e7e7e; +} + +.mytheme .v-window-restorebox-disabled ~ .v-window-closebox ~ .v-window-header, .mytheme .v-window-maximizebox-disabled ~ .v-window-closebox ~ .v-window-header { + margin-right: 37px; +} + +.mytheme .v-window-restorebox-disabled ~ .v-window-closebox-disabled ~ .v-window-header, .mytheme .v-window-maximizebox-disabled ~ .v-window-closebox-disabled ~ .v-window-header { + margin-right: 12px; +} + +.mytheme .v-window-closebox, .mytheme .v-window-maximizebox, .mytheme .v-window-restorebox { + position: absolute; + z-index: 3; + top: 0; + right: 0; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 33px; + height: 36px; + background-color: white; + line-height: 34px; + text-align: center; + cursor: pointer; + font-size: 21px; + color: #999999; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-window-closebox:focus, .mytheme .v-window-maximizebox:focus, .mytheme .v-window-restorebox:focus { + outline: none; +} + +.mytheme .v-window-closebox:hover, .mytheme .v-window-maximizebox:hover, .mytheme .v-window-restorebox:hover { + opacity: 1; + filter: none ; + color: #197de1; +} + +.mytheme .v-window-closebox:active, .mytheme .v-window-maximizebox:active, .mytheme .v-window-restorebox:active { + color: inherit; +} + +.mytheme .v-window-closebox { + padding-right: 4px; + border-radius: 0 4px 0 4px; +} + +.mytheme .v-window-closebox:before { + content: "\00d7"; +} + +.mytheme .v-window-maximizebox, .mytheme .v-window-restorebox { + right: 33px; + padding-left: 4px; + border-radius: 0 0 0 4px; +} + +.mytheme .v-window-maximizebox + .v-window-closebox, .mytheme .v-window-restorebox + .v-window-closebox { + border-bottom-left-radius: 0; +} + +.mytheme .v-window-closebox-disabled, .mytheme .v-window-resizebox-disabled, .mytheme .v-window-restorebox-disabled, .mytheme .v-window-maximizebox-disabled { + display: none; +} + +.mytheme .v-window-closebox-disabled + .v-window-closebox, .mytheme .v-window-resizebox-disabled + .v-window-closebox, .mytheme .v-window-restorebox-disabled + .v-window-closebox, .mytheme .v-window-maximizebox-disabled + .v-window-closebox { + width: 37px; + padding-right: 0; + border-bottom-left-radius: 4px; +} + +.mytheme .v-window-maximizebox:before { + content: "+"; +} + +.mytheme .v-window-restorebox:before { + content: "\2013"; +} + +.mytheme .v-window > .popupContent, .mytheme .v-window-wrap, .mytheme .v-window-contents, .mytheme .v-window-contents > .v-scrollable { + height: 100%; +} + +.mytheme .v-window-contents { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + border-radius: 4px; + margin-top: 0 !important; +} + +.mytheme .v-window-contents > .v-scrollable { + position: relative; +} + +.mytheme .v-window-contents > .v-scrollable > .v-margin-top { + padding-top: 12px; +} + +.mytheme .v-window-contents > .v-scrollable > .v-margin-right { + padding-right: 12px; +} + +.mytheme .v-window-contents > .v-scrollable > .v-margin-bottom { + padding-bottom: 12px; +} + +.mytheme .v-window-contents > .v-scrollable > .v-margin-left { + padding-left: 12px; +} + +.mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-top"] > tbody > [class*="firstrow"] > td { + padding-top: 12px; +} + +.mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-bottom"] > tbody > [class*="lastrow"] > td { + padding-bottom: 12px; +} + +.mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-left"] > tbody > [class*="row"] > [class*="captioncell"] { + padding-left: 12px; +} + +.mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-left"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h2, .mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-left"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h3, .mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-left"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h4 { + left: 12px; +} + +.mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-right"] > tbody > [class*="row"] > [class*="contentcell"] { + padding-right: 12px; +} + +.mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-right"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h2, .mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-right"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h3, .mytheme .v-window-contents > .v-scrollable > .v-formlayout [class*="margin-right"] > tbody > [class*="row"] > [class*="contentcell"] > .v-label-h4 { + right: 12px; +} + +.mytheme .v-window-contents > .v-scrollable:focus { + outline: none; +} + +.mytheme .v-window-contents > .v-scrollable:before { + content: ""; + position: absolute; + z-index: 2; + top: 0; + height: 0; + border-top: 1px solid white; + left: 0; + right: 0; +} + +.mytheme .v-window-contents > .v-scrollable .v-panel-captionwrap:after { + border-color: #dfdfdf; +} + +.mytheme .v-window-contents > .v-scrollable .v-panel-content:before { + border-color: white; +} + +.mytheme .v-window-footer { + height: 0; +} + +.mytheme .v-window-resizebox { + position: absolute; + z-index: 1000; + right: 0; + bottom: 0; + width: 19px; + height: 19px; + cursor: nwse-resize; +} + +.v-ie8 .mytheme .v-window-resizebox { + background: #000; + filter: alpha(opacity=0.1); +} + +.v-ie8 .mytheme .v-window-resizebox, .v-ie9 .mytheme .v-window-resizebox { + cursor: se-resize; +} + +.mytheme .v-window-modalitycurtain:active ~ .v-window { + -webkit-animation: none; + -moz-animation: none; + animation: none; +} + +.mytheme .v-window-top-toolbar > .v-widget, .mytheme .v-window-bottom-toolbar > .v-widget { + vertical-align: top; +} + +.mytheme .v-window-top-toolbar .v-label, .mytheme .v-window-bottom-toolbar .v-label { + line-height: 36px; +} + +.mytheme .v-window-top-toolbar .v-spacing, .mytheme .v-window-bottom-toolbar .v-spacing { + width: 6px; +} + +.mytheme .v-window-top-toolbar.v-layout { + padding: 7px 12px; + position: relative; + z-index: 2; + border-top: 1px solid #dfdfdf; + border-bottom: 1px solid #dfdfdf; + background-color: #fafafa; +} + +.mytheme .v-window-top-toolbar.v-menubar { + margin: 12px 12px 6px; +} + +.mytheme .v-window-top-toolbar.v-menubar-borderless { + padding-left: 6px; + padding-right: 6px; + margin: 5px 0; +} + +.mytheme .v-window-bottom-toolbar.v-layout { + padding: 7px 12px; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #f0f0f0 0, #fafafa 4px); + background-image: linear-gradient(to bottom,#f0f0f0 0, #fafafa 4px); + border-top: 1px solid #dfdfdf; + border-radius: 0 0 4px 4px; +} + +.mytheme .v-margin-left.v-margin-right.v-margin-top .v-window-top-toolbar.v-layout { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + margin: -12px -12px 0; +} + +.mytheme .v-margin-left.v-margin-right.v-margin-top .v-window-top-toolbar.v-menubar { + margin: 0; +} + +.mytheme .v-margin-left.v-margin-right.v-margin-top .v-window-top-toolbar.v-menubar-borderless { + margin: -6px -6px 0; + padding: 0; +} + +.mytheme .v-margin-left.v-margin-right.v-margin-bottom .v-window-bottom-toolbar.v-layout { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + margin: 0 -12px -12px; +} + +.mytheme .v-tree { + position: relative; + white-space: nowrap; +} + +.mytheme .v-tree:focus { + outline: none; +} + +.mytheme .v-tree-node:before { + content: ""; + position: absolute; + display: inline-block; + z-index: 3; + width: 1.9em; + height: 28px; + cursor: pointer; + background: red; + opacity: 0; +} + +.v-ie8 .mytheme .v-tree-node:before { + position: static; + margin-left: -1.9em; + vertical-align: top; + content: "\f0da"; + font-family: ThemeIcons; + text-align: center; + background: transparent; +} + +.v-ie8 .mytheme .v-tree-node { + padding-left: 1.9em; +} + +.mytheme .v-tree-node-caption { + height: 28px; + line-height: 27px; + overflow: hidden; + white-space: nowrap; + vertical-align: top; +} + +.mytheme .v-tree-node-caption > div { + display: inline-block; + width: 100%; + position: relative; + z-index: 2; +} + +.mytheme .v-tree-node-caption > div:before { + content: "\f0da"; + font-family: ThemeIcons; + display: inline-block; + width: 0.5em; + text-align: center; + margin: 0 0.6em 0 0.8em; + -webkit-transition: all 100ms; + -moz-transition: all 100ms; + transition: all 100ms; +} + +.v-ie8 .mytheme .v-tree-node-caption > div:before { + display: none; +} + +.mytheme .v-tree-node-caption span { + padding-right: 28px; + cursor: pointer; + display: inline-block; + width: 100%; +} + +.v-ie .mytheme .v-tree-node-caption span { + width: auto; +} + +.mytheme .v-tree-node-caption .v-icon { + padding-right: 0; + width: auto; + min-width: 1em; +} + +.mytheme .v-tree-node-caption:after { + content: ""; + display: block; + vertical-align: top; + position: absolute; + z-index: 1; + left: 0; + margin-top: -28px; + width: 100%; + height: 28px; + border-radius: 4px; + opacity: 0; + -webkit-transition: opacity 120ms; + -moz-transition: opacity 120ms; + transition: opacity 120ms; +} + +.v-ie8 .mytheme .v-tree-node-caption:after { + content: none; +} + +.v-ie8 .mytheme .v-tree-node-caption { + display: inline-block; +} + +.mytheme .v-tree-node-expanded > .v-tree-node-caption > div:before { + -webkit-transform: rotate(90deg); + -moz-transform: rotate(90deg); + -ms-transform: rotate(90deg); + -o-transform: rotate(90deg); + transform: rotate(90deg); + content: "\f0da"; + font-family: ThemeIcons; +} + +.v-ie8 .mytheme .v-tree-node-expanded:before { + content: "\f0d7"; + font-family: ThemeIcons; +} + +.mytheme .v-tree-node-leaf:before, .mytheme .v-tree-node-leaf > .v-tree-node-caption > div:before { + visibility: hidden; +} + +.mytheme .v-tree-node-focused:after { + opacity: 1; + border: 1px solid #197de1; +} + +.v-ie8 .mytheme .v-tree-node-focused { + outline: 1px dotted #197de1; +} + +.mytheme .v-tree-node-selected { + color: #ecf2f8; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); +} + +.mytheme .v-tree-node-selected:after { + opacity: 1; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + border: none; +} + +.v-ie8 .mytheme .v-tree-node-selected { + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); +} + +.mytheme .v-tree-node-children { + padding-left: 19px; +} + +.v-ie8 .mytheme .v-tree-node-children { + padding-left: 0; +} + +.mytheme .v-tree-node-drag-top:before, .mytheme .v-tree-node-drag-bottom:after, .mytheme .v-tree-node-drag-bottom.v-tree-node-dragfolder.v-tree-node-expanded > .v-tree-node-children:before { + content: "\2022"; + display: block; + position: absolute; + height: 2px; + width: 100%; + background: #197de1; + font-size: 32px; + line-height: 2px; + color: #197de1; + text-indent: -4px; + text-shadow: 0 0 1px #fafafa, 0 0 1px #fafafa; + opacity: 1; + visibility: visible; +} + +.mytheme .v-tree-node-drag-bottom.v-tree-node-dragfolder.v-tree-node-expanded:after { + content: none; +} + +.mytheme .v-tree-node-caption-drag-center { + -webkit-box-shadow: 0 0 0 2px #197de1; + box-shadow: 0 0 0 2px #197de1; + position: relative; + border-radius: 4px; +} + +.v-ie8 .mytheme .v-tree-node-caption-drag-center { + outline: 2px solid #197de1; +} + +.v-ff .mytheme .v-tree-node-drag-top:before, .v-ff .mytheme .v-tree-node-drag-bottom:after { + line-height: 1px; +} + +.v-ie8 .mytheme .v-tree-node-drag-top:before, .v-ie8 .mytheme .v-tree-node-drag-bottom:after { + line-height: 0; +} + +.mytheme .v-table { + position: relative; + background: #fafafa; + color: #464646; + overflow: hidden; +} + +.mytheme .v-table-header table, .mytheme .v-table-footer table, .mytheme .v-table-table { + -webkit-box-shadow: 0 0 0 1px #d4d4d4; + box-shadow: 0 0 0 1px #d4d4d4; +} + +.v-ie8 .mytheme .v-table-header table, .v-ie8 .mytheme .v-table-footer table, .v-ie8 .mytheme .v-table-table { + outline: 1px solid #d4d4d4; +} + +.mytheme .v-table-header-wrap, .mytheme .v-table-footer-wrap, .mytheme .v-table-header-drag { + border: 1px solid #d4d4d4; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + white-space: nowrap; + font-size: 14px; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); +} + +.mytheme .v-table-header-wrap { + position: relative; + border-bottom: none; +} + +.mytheme .v-table-footer-wrap { + border-top: none; +} + +.mytheme .v-table-footer td { + border-left: 1px solid #d4d4d4; +} + +.mytheme .v-table-footer-container, .mytheme .v-table-caption-container { + overflow: hidden; + line-height: 1; + min-height: 37px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.v-ie8 .mytheme .v-table-footer-container, .v-ie8 .mytheme .v-table-caption-container { + min-height: 14px; +} + +.mytheme .v-table-footer-container { + padding: 11px 12px 12px; + float: right; +} + +.mytheme [class^="v-table-header-cell"] { + position: relative; +} + +.mytheme .v-table-caption-container, .mytheme .v-table-header-drag { + padding: 12px 12px 11px; + border-left: 1px solid #d4d4d4; +} + +.mytheme .v-table-caption-container-align-right { + padding-right: 4px; +} + +.mytheme .v-table-resizer { + height: 37px; + width: 8px; + cursor: e-resize; + cursor: col-resize; + position: relative; + right: -4px; + z-index: 1; + margin-left: -8px; +} + +.mytheme .v-table-cell-content { + border-left: 1px solid #d4d4d4; + overflow: hidden; + height: 37px; + vertical-align: middle; +} + +.mytheme .v-table-cell-content:first-child { + border-left: none; + padding-left: 1px; +} + +.mytheme .v-table-header td:first-child .v-table-caption-container, .mytheme .v-table-footer td:first-child { + border-left-color: transparent; +} + +.mytheme .v-table-cell-wrapper { + line-height: 1; + padding: 0 12px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin-right: 0 !important; +} + +.mytheme .v-table-cell-wrapper > .v-widget { + margin: 3px -6px; +} + +.mytheme .v-table-cell-wrapper > .v-widget.v-label, .mytheme .v-table-cell-wrapper > .v-widget.v-checkbox, .mytheme .v-table-cell-wrapper > .v-widget.v-select-optiongroup { + margin: 0; +} + +.mytheme .v-table-cell-wrapper > .v-widget.v-progressbar { + margin-left: 0; + margin-right: 0; +} + +.mytheme .v-table-body { + border: 1px solid #d4d4d4; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.mytheme .v-table-table { + background-color: white; + white-space: nowrap; +} + +.mytheme .v-table-table td { + border-top: 1px solid #d4d4d4; +} + +.mytheme .v-table-table tr:first-child > td { + border-top: none; +} + +.mytheme .v-table-row { + background-color: white; + cursor: pointer; +} + +.mytheme .v-table-row-odd { + background-color: #f5f5f5; + cursor: pointer; +} + +.mytheme .v-table-body-noselection .v-table-row, .mytheme .v-table-body-noselection .v-table-row-odd { + cursor: default; +} + +.mytheme .v-table [class*="-row"].v-selected { + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + background-origin: border-box; + color: #ecf2f8; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); +} + +.mytheme .v-table [class*="-row"].v-selected + .v-selected { + background: #166ed5; +} + +.mytheme .v-table [class*="-row"].v-selected + .v-selected td { + border-top-color: #166ed5; +} + +.mytheme .v-table [class*="-row"].v-selected .v-table-cell-content { + border-color: transparent; + border-left-color: #1d69b4; +} + +.mytheme .v-table [class*="-row"].v-selected .v-table-cell-content:first-child { + border-left-color: transparent; +} + +.mytheme .v-table-header-cell-asc .v-table-sort-indicator, .mytheme .v-table-header-cell-desc .v-table-sort-indicator { + background: transparent; + width: 19px; + height: 37px; + line-height: 37px; + margin-left: -19px; +} + +.mytheme .v-table-header-cell-asc .v-table-sort-indicator:before, .mytheme .v-table-header-cell-desc .v-table-sort-indicator:before { + font-style: normal; + font-weight: normal; + display: inline-block; +} + +.mytheme .v-table-header-cell-asc .v-table-sort-indicator:before { + content: "\f0de"; + font-family: ThemeIcons; +} + +.mytheme .v-table-header-cell-desc .v-table-sort-indicator:before { + content: "\f0dd"; + font-family: ThemeIcons; +} + +.mytheme [class*="rowheader"] span.v-icon { + min-width: 1em; +} + +.mytheme .v-table-focus { + outline: 1px solid #197de1; + outline-offset: -1px; +} + +.mytheme .v-drag-element.v-table-focus, .mytheme .v-drag-element .v-table-focus { + outline: none; +} + +.mytheme .v-table-header-drag { + position: absolute; + opacity: 0.9; + filter: alpha(opacity=90) ; + margin-top: -19px; + z-index: 30000; + line-height: 1; +} + +.mytheme .v-table-focus-slot-right { + border-right: 3px solid #197de1; + right: -2px; + margin-left: -11px !important; +} + +.mytheme .v-table-focus-slot-left { + float: left; + border-left: 3px solid #197de1; + left: -1px; + right: auto; + margin-left: 0 !important; + margin-right: -11px; +} + +.mytheme .v-table-column-selector { + height: 37px; + padding: 0 16px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7; + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + position: absolute; + z-index: 2; + top: 0; + right: 0; + width: 19px; + height: 19px; + line-height: 19px; + padding: 0; + border-top-width: 0; + border-right-width: 0; + border-radius: 0 0 0 4px; + cursor: pointer; + text-align: center; + opacity: 0; + filter: alpha(opacity=0) ; + -webkit-transition: opacity 200ms 2s; + -moz-transition: opacity 200ms 2s; + transition: opacity 200ms 2s; +} + +.mytheme .v-table-column-selector:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-table-column-selector:hover:after { + background-color: rgba(186, 186, 186, 0.1); +} + +.mytheme .v-table-column-selector:focus:after { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-table-column-selector:active:after { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-table-column-selector:after { + content: ""; + position: absolute; + border: none; + top: 0; + right: 0; + bottom: 0; + left: 0; +} + +.mytheme .v-table-column-selector:active:after { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-table-column-selector:before { + font-family: ThemeIcons; + content: "\f013"; +} + +.mytheme .v-table-header-wrap:hover .v-table-column-selector { + opacity: 1; + filter: none ; + -webkit-transition-delay: 200ms; + -moz-transition-delay: 200ms; + transition-delay: 200ms; +} + +.mytheme .v-on:before, .mytheme .v-off:before { + content: "\f00c"; + font-family: ThemeIcons; + font-size: 0.9em; + margin-right: 6px; +} + +.mytheme .v-on div, .mytheme .v-off div { + display: inline; +} + +.mytheme .v-on.v-disabled, .mytheme .v-off.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-off:before { + visibility: hidden; +} + +.mytheme tbody.v-drag-element { + display: block; + overflow: visible; + -webkit-box-shadow: none; + box-shadow: none; + background: transparent; + opacity: 1; + filter: none ; +} + +.mytheme tbody.v-drag-element tr { + display: block; + + + -webkit-box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); + border-radius: 4px; + overflow: hidden; + opacity: 0.5; + filter: alpha(opacity=50) ; + background: white; +} + +.mytheme .v-table-body { + position: relative; + z-index: 1; +} + +.mytheme .v-table-scrollposition { + position: absolute; + top: 50%; + width: 100%; + height: 37px; + line-height: 37px; + margin: -19px 0 0 !important; + text-align: center; +} + +.mytheme .v-table-drag { + overflow: visible; +} + +.mytheme .v-table-drag .v-table-body { + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + border-color: #197de1; +} + +.v-ie8 .mytheme .v-table-drag .v-table-body { + border-color: #197de1; +} + +.mytheme .v-table-drag .v-table-body .v-table-focus { + outline: none; +} + +.mytheme .v-table-row-drag-middle .v-table-cell-content { + background-color: #d1e5f9; + color: #214060; +} + +.mytheme .v-table-row-drag-bottom td.v-table-cell-content { + border-bottom: 2px solid #197de1; + height: 35px; +} + +.mytheme .v-table-row-drag-bottom .v-table-cell-wrapper { + margin-bottom: -2px; +} + +.mytheme .v-table-row-drag-top td.v-table-cell-content { + border-top: 2px solid #197de1; + height: 36px; +} + +.mytheme .v-table-row-drag-top .v-table-cell-wrapper { + margin-top: -1px; +} + +.mytheme .v-table-no-stripes .v-table-row, .mytheme .v-table-no-stripes .v-table-row-odd { + background: transparent; +} + +.mytheme .v-table-no-vertical-lines .v-table-cell-content { + border-left: none; + padding-left: 1px; +} + +.mytheme .v-table-no-vertical-lines.v-treetable .v-table-cell-content { + padding-left: 13px; +} + +.mytheme .v-table-no-horizontal-lines .v-table-cell-content { + border-top: none; + border-bottom: none; +} + +.mytheme .v-table-no-horizontal-lines .v-table-row-drag-top .v-table-cell-content, .mytheme .v-table-no-horizontal-lines .v-table-row-drag-bottom .v-table-cell-content { + height: 36px; +} + +.mytheme .v-table-no-header .v-table-header-wrap { + display: none; +} + +.mytheme .v-table-borderless .v-table-header-wrap, .mytheme .v-table-borderless .v-table-footer-wrap, .mytheme .v-table-borderless .v-table-header-drag, .mytheme .v-table-borderless .v-table-body { + border: none; +} + +.mytheme .v-table-borderless .v-table-header-wrap { + border-bottom: 1px solid #d9d9d9; +} + +.mytheme .v-table-borderless .v-table-footer-wrap { + border-top: 1px solid #d9d9d9; +} + +.mytheme .v-table-compact .v-table-header-wrap, .mytheme .v-table-compact .v-table-footer-wrap, .mytheme .v-table-compact .v-table-header-drag, .mytheme .v-table-small .v-table-header-wrap, .mytheme .v-table-small .v-table-footer-wrap, .mytheme .v-table-small .v-table-header-drag { + font-size: 14px; +} + +.mytheme .v-table-compact .v-table-footer-container, .mytheme .v-table-small .v-table-footer-container { + padding: 8px 7px 9px; +} + +.mytheme .v-table-compact .v-table-caption-container, .mytheme .v-table-compact .v-table-header-drag, .mytheme .v-table-small .v-table-caption-container, .mytheme .v-table-small .v-table-header-drag { + padding-top: 9px; + padding-bottom: 8px; + padding-left: 6px; + padding-right: 6px; +} + +.mytheme .v-table-compact .v-table-caption-container-align-right, .mytheme .v-table-small .v-table-caption-container-align-right { + padding-right: 0; +} + +.mytheme .v-table-compact .v-table-resizer, .mytheme .v-table-small .v-table-resizer { + height: 31px; +} + +.mytheme .v-table-compact .v-table-cell-content, .mytheme .v-table-small .v-table-cell-content { + height: 31px; +} + +.mytheme .v-table-compact .v-table-cell-wrapper, .mytheme .v-table-small .v-table-cell-wrapper { + padding-left: 6px; + padding-right: 6px; +} + +.mytheme .v-table-compact .v-table-cell-wrapper > .v-widget, .mytheme .v-table-small .v-table-cell-wrapper > .v-widget { + margin: 2px -3px; +} + +.mytheme .v-table-compact .v-table-cell-wrapper > .v-widget.v-label, .mytheme .v-table-compact .v-table-cell-wrapper > .v-widget.v-checkbox, .mytheme .v-table-compact .v-table-cell-wrapper > .v-widget.v-select-optiongroup, .mytheme .v-table-small .v-table-cell-wrapper > .v-widget.v-label, .mytheme .v-table-small .v-table-cell-wrapper > .v-widget.v-checkbox, .mytheme .v-table-small .v-table-cell-wrapper > .v-widget.v-select-optiongroup { + margin: 0; +} + +.mytheme .v-table-compact .v-table-cell-wrapper > .v-widget.v-progressbar, .mytheme .v-table-small .v-table-cell-wrapper > .v-widget.v-progressbar { + margin-left: 0; + margin-right: 0; +} + +.mytheme .v-table-compact .v-table-header-cell-asc .v-table-sort-indicator, .mytheme .v-table-compact .v-table-header-cell-desc .v-table-sort-indicator, .mytheme .v-table-small .v-table-header-cell-asc .v-table-sort-indicator, .mytheme .v-table-small .v-table-header-cell-desc .v-table-sort-indicator { + height: 31px; + line-height: 31px; +} + +.mytheme .v-table-compact .v-table-header-drag, .mytheme .v-table-small .v-table-header-drag { + margin-top: -16px; +} + +.mytheme .v-table-compact.v-treetable .v-table-cell-wrapper, .mytheme .v-table-small.v-treetable .v-table-cell-wrapper { + padding-left: 0; + padding-right: 0; + min-height: 16px; +} + +.mytheme .v-table-compact.v-treetable .v-table-cell-content, .mytheme .v-table-small.v-treetable .v-table-cell-content { + padding-left: 6px; + padding-right: 6px; +} + +.mytheme .v-table-compact.v-treetable .v-table-cell-content:first-child, .mytheme .v-table-small.v-treetable .v-table-cell-content:first-child { + padding-left: 7px; +} + +.mytheme .v-table-compact.v-treetable .v-table-footer-container, .mytheme .v-table-small.v-treetable .v-table-footer-container { + padding-left: 6px; + padding-right: 6px; +} + +.mytheme .v-table-compact .v-table-row-drag-top .v-table-cell-content, .mytheme .v-table-compact .v-table-row-drag-bottom .v-table-cell-content, .mytheme .v-table-small .v-table-row-drag-top .v-table-cell-content, .mytheme .v-table-small .v-table-row-drag-bottom .v-table-cell-content { + height: 30px; +} + +.mytheme .v-table-small { + font-size: 14px; +} + +.mytheme .v-table-small.v-treetable .v-table-cell-wrapper { + min-height: 14px; +} + +.mytheme .v-treetable [class*="caption-container"], .mytheme .v-treetable [class*="footer-container"], .mytheme .v-treetable [class*="cell-wrapper"] { + -webkit-box-sizing: content-box; + -moz-box-sizing: content-box; + box-sizing: content-box; + padding-left: 0; + padding-right: 0; +} + +.mytheme .v-treetable [class*="caption-container"], .mytheme .v-treetable [class*="footer-container"] { + min-height: 14px; +} + +.mytheme .v-treetable [class*="cell-wrapper"] { + min-height: 16px; +} + +.mytheme .v-treetable [class*="caption-container"] { + padding-left: 12px; +} + +.mytheme .v-treetable [class*="caption-container-align-right"] { + padding-left: 20px; +} + +.mytheme .v-treetable [class*="footer-container"] { + padding-right: 12px; +} + +.mytheme .v-treetable [class*="cell-content"] { + padding-left: 12px; + padding-right: 12px; +} + +.mytheme .v-treetable [class*="cell-content"]:first-child { + padding-left: 13px; +} + +.mytheme .v-treetable-treespacer { + display: inline-block; + position: absolute; + width: 19px !important; + margin-left: -25px; + text-align: center; + cursor: pointer; +} + +.mytheme .v-treetable-node-closed:before { + content: "\f0da"; + font-family: ThemeIcons; +} + +.mytheme .v-treetable-node-open:before { + content: "\f0d7"; + font-family: ThemeIcons; +} + +.mytheme .v-splitpanel-horizontal > div > .v-splitpanel-hsplitter { + width: 1px; +} + +.mytheme .v-splitpanel-horizontal > div > .v-splitpanel-hsplitter:after { + left: -6px; + right: -6px; +} + +.mytheme .v-splitpanel-horizontal > div > .v-splitpanel-hsplitter div:before { + height: 37px; + padding: 0 16px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, none; + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, none; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + height: auto; + padding: 0; + border-radius: 0; + background-color: #fafafa; + background-image: -webkit-linear-gradient(left, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to right,#fafafa 2%, #efefef 98%); +} + +.mytheme .v-splitpanel-horizontal > div > .v-splitpanel-hsplitter div:before:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-splitpanel-horizontal > div > .v-splitpanel-hsplitter div:before:hover:after { + background-color: rgba(186, 186, 186, 0.1); +} + +.mytheme .v-splitpanel-horizontal > div > .v-splitpanel-hsplitter div:before:focus:after { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-splitpanel-horizontal > div > .v-splitpanel-hsplitter div:before:active:after { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-splitpanel-horizontal > div > .v-splitpanel-second-container { + margin-left: 1px; +} + +.mytheme .v-splitpanel-vertical > div > .v-splitpanel-vsplitter { + height: 1px; +} + +.mytheme .v-splitpanel-vertical > div > .v-splitpanel-vsplitter:after { + top: -6px; + bottom: -6px; +} + +.mytheme .v-splitpanel-vertical > div > .v-splitpanel-vsplitter div:before { + height: 37px; + padding: 0 16px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, none; + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, none; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + height: auto; + padding: 0; + border-radius: 0; +} + +.mytheme .v-splitpanel-vertical > div > .v-splitpanel-vsplitter div:before:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-splitpanel-vertical > div > .v-splitpanel-vsplitter div:before:hover:after { + background-color: rgba(186, 186, 186, 0.1); +} + +.mytheme .v-splitpanel-vertical > div > .v-splitpanel-vsplitter div:before:focus:after { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-splitpanel-vertical > div > .v-splitpanel-vsplitter div:before:active:after { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-splitpanel-horizontal.large > div > .v-splitpanel-hsplitter { + width: 12px; +} + +.mytheme .v-splitpanel-horizontal.large > div > .v-splitpanel-hsplitter:after { + left: 0px; + right: 0px; +} + +.mytheme .v-splitpanel-horizontal.large > div > .v-splitpanel-hsplitter div:before { + height: 37px; + padding: 0 16px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, none; + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, none; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + height: auto; + padding: 0; + border-radius: 0; + background-color: #fafafa; + background-image: -webkit-linear-gradient(left, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to right,#fafafa 2%, #efefef 98%); +} + +.mytheme .v-splitpanel-horizontal.large > div > .v-splitpanel-hsplitter div:before:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-splitpanel-horizontal.large > div > .v-splitpanel-hsplitter div:before:hover:after { + background-color: rgba(186, 186, 186, 0.1); +} + +.mytheme .v-splitpanel-horizontal.large > div > .v-splitpanel-hsplitter div:before:focus:after { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-splitpanel-horizontal.large > div > .v-splitpanel-hsplitter div:before:active:after { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-splitpanel-horizontal.large > div > .v-splitpanel-hsplitter div:after { + content: ""; + border: 1px solid #dadada; + border-top-color: #bababa; + border-left-color: #bababa; + position: absolute; + top: 50%; + left: 50%; + width: 0; + height: 37px; + margin-left: -1px; + margin-top: -19px; +} + +.mytheme .v-splitpanel-horizontal.large > div > .v-splitpanel-second-container { + margin-left: 12px; +} + +.mytheme .v-splitpanel-vertical.large > div > .v-splitpanel-vsplitter { + height: 12px; +} + +.mytheme .v-splitpanel-vertical.large > div > .v-splitpanel-vsplitter:after { + top: 0px; + bottom: 0px; +} + +.mytheme .v-splitpanel-vertical.large > div > .v-splitpanel-vsplitter div:before { + height: 37px; + padding: 0 16px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, none; + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, none; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + height: auto; + padding: 0; + border-radius: 0; +} + +.mytheme .v-splitpanel-vertical.large > div > .v-splitpanel-vsplitter div:before:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-splitpanel-vertical.large > div > .v-splitpanel-vsplitter div:before:hover:after { + background-color: rgba(186, 186, 186, 0.1); +} + +.mytheme .v-splitpanel-vertical.large > div > .v-splitpanel-vsplitter div:before:focus:after { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-splitpanel-vertical.large > div > .v-splitpanel-vsplitter div:before:active:after { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-splitpanel-vertical.large > div > .v-splitpanel-vsplitter div:after { + content: ""; + border: 1px solid #dadada; + border-top-color: #bababa; + border-left-color: #bababa; + position: absolute; + top: 50%; + left: 50%; + width: 37px; + height: 0; + margin-left: -19px; + margin-top: -1px; +} + +.mytheme .v-progressbar-wrapper { + border-radius: 4px; + height: 9px; + background-color: #d4d4d4; + background-image: -webkit-linear-gradient(bottom, #d7d7d7 2%, #c7c7c7 98%); + background-image: linear-gradient(to top,#d7d7d7 2%, #c7c7c7 98%); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + min-width: 74px; +} + +.mytheme .v-progressbar-indicator { + border-radius: 4px; + height: inherit; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + + + border: 1px solid #1362b1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + max-width: 100%; + min-width: 8px; + -webkit-transition: width 160ms; + -moz-transition: width 160ms; + transition: width 160ms; +} + +.mytheme .v-progressbar-point .v-progressbar-indicator { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + border: none; + text-align: right; + overflow: hidden; +} + +.mytheme .v-progressbar-point .v-progressbar-indicator:before { + content: ""; + display: inline-block; + border-radius: 4px; + height: inherit; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + + + border: 1px solid #1362b1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + max-width: 100%; + width: 9px; + vertical-align: top; +} + +.mytheme .v-progressbar-indeterminate { + height: 24px !important; + width: 24px !important; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + border: 2px solid rgba(25, 125, 225, 0.2); + border-top-color: #197de1; + border-right-color: #197de1; + border-radius: 100%; + -webkit-animation: v-rotate-360 500ms infinite linear; + -moz-animation: v-rotate-360 500ms infinite linear; + animation: v-rotate-360 500ms infinite linear; + pointer-events: none; +} + +.v-ie8 .mytheme .v-progressbar-indeterminate, .v-ie9 .mytheme .v-progressbar-indeterminate { + border: none; + border-radius: 4px; + background: #fff url(../valo/shared/img/spinner.gif) no-repeat 50% 50%; + background-size: 80%; +} + +.v-ie8 .mytheme .v-progressbar-indeterminate { + min-width: 30px; + min-height: 30px; +} + +.mytheme .v-progressbar-indeterminate .v-progressbar-wrapper { + display: none; +} + +.mytheme .v-slider { + position: relative; +} + +.mytheme .v-slider:focus { + outline: none; +} + +.mytheme .v-slider:focus .v-slider-handle:after { + opacity: 1; +} + +.v-ie8 .mytheme .v-slider:focus .v-slider-handle:after { + visibility: visible; +} + +.mytheme .v-slider.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-slider-base { + border-radius: 4px; + height: 9px; + background-color: #d4d4d4; + background-image: -webkit-linear-gradient(bottom, #d7d7d7 2%, #c7c7c7 98%); + background-image: linear-gradient(to top,#d7d7d7 2%, #c7c7c7 98%); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + min-width: 74px; + height: 6px; + margin: 16px 11px; + white-space: nowrap; + overflow: hidden; + +} + +.mytheme .v-slider-base:before { + content: ""; + position: absolute; + top: 16px; + bottom: 16px; + left: 11px; + width: 8px; + border-radius: 4px; + border-left: 1px solid #1362b1; +} + +.mytheme .v-slider-base:after { + border-radius: 4px; + height: inherit; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + + + border: 1px solid #1362b1; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + max-width: 100%; + content: ""; + display: inline-block; + margin-left: -100%; + width: 100%; + vertical-align: top; +} + +.v-ie8 .mytheme .v-slider-base:after { + position: relative; + left: -11px; +} + +.mytheme .v-has-width > .v-slider-base { + min-width: 0; +} + +.mytheme .v-slider-handle { + margin-top: -16px; + width: 0.1px; + display: inline-block; + vertical-align: top; +} + +.mytheme .v-slider-handle:before { + height: 37px; + padding: 0 16px; + color: #191919; + font-weight: 400; + + + border-radius: 4px; + border: 1px solid #c5c5c5; + border-top-color: #c5c5c5; + border-bottom-color: #bcbcbc; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7, 0 2px 3px rgba(0, 0, 0, 0.05); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); +} + +.mytheme .v-slider-handle:before:after { + border: inherit; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; +} + +.mytheme .v-slider-handle:before:hover:after { + background-color: rgba(186, 186, 186, 0.1); +} + +.mytheme .v-slider-handle:before:focus:after { + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-slider-handle:before:active:after { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-slider-handle:after { + border: 1px solid #c5c5c5; + border-color: #197de1; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + opacity: 0; + -webkit-transition: opacity 200ms; + -moz-transition: opacity 200ms; + transition: opacity 200ms; +} + +.v-ie8 .mytheme .v-slider-handle:after { + visibility: hidden; +} + +.mytheme .v-slider-handle:before, .mytheme .v-slider-handle:after { + content: ""; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0; + width: 22px; + height: 22px; + border-radius: 11px; + position: absolute; + z-index: 1; + margin-top: 8px; + margin-left: -11px; +} + +.mytheme .v-slider-feedback { + background-color: #323232; + background-color: rgba(50, 50, 50, 0.9); + -webkit-box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2); + box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2); + color: white; + padding: 5px 9px; + border-radius: 3px; + max-width: 35em; + overflow: hidden !important; + font-size: 14px; +} + +.mytheme .v-slider-vertical { + padding: 11px 0; + height: 96px; +} + +.mytheme .v-slider-vertical .v-slider-base { + background-color: #d4d4d4; + background-image: -webkit-linear-gradient(right, #d7d7d7 2%, #c7c7c7 98%); + background-image: linear-gradient(to left,#d7d7d7 2%, #c7c7c7 98%); + width: 6px; + height: 100% !important; + min-width: 0; + margin: 0 16px; +} + +.mytheme .v-slider-vertical .v-slider-base:before { + top: auto; + bottom: 11px; + left: 16px; + right: 16px; + width: auto; + height: 8px; + border-left: none; + border-bottom: 1px solid #1362b1; +} + +.mytheme .v-slider-vertical .v-slider-base:after { + height: 101%; + margin-left: 0; + background-color: #197de1; + background-image: -webkit-linear-gradient(left, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to right,#1b87e3 2%, #166ed5 98%); +} + +.v-ie8 .mytheme .v-slider-vertical .v-slider-base:after { + top: 11px; + left: 0; + height: 130%; +} + +.mytheme .v-slider-vertical .v-slider-handle { + width: 0; + height: 0.1px; + width: 37px; + display: block; +} + +.mytheme .v-slider-vertical .v-slider-handle:before, .mytheme .v-slider-vertical .v-slider-handle:after { + width: 22px; + height: 22px; + margin-top: -11px; + margin-left: -8px; +} + +.mytheme .v-slider-no-indicator .v-slider-base:before, .mytheme .v-slider-no-indicator .v-slider-base:after { + display: none; +} + +.mytheme .v-tabsheet:not(.v-has-width) { + width: auto !important; +} + +.mytheme .v-tabsheet-spacertd { + display: none !important; +} + +.mytheme .v-tabsheet-tabcontainer { + position: relative; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.mytheme .v-tabsheet-tabcontainer:before { + content: ""; + position: absolute; + height: 0; + border-top: 1px solid #dfdfdf; + bottom: 0; + left: 0; + right: 0; +} + +.mytheme .v-tabsheet-tabcontainer .v-tabsheet-tabs { + position: relative; +} + +.mytheme .v-tabsheet-tabitemcell { + vertical-align: bottom; +} + +.mytheme .v-tabsheet-tabitemcell .v-tabsheet-tabitem { + line-height: 0; + overflow: hidden; +} + +.mytheme .v-tabsheet-tabitemcell .v-caption { + margin-left: 19px; + padding: 0 4px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + cursor: pointer; + text-align: center; + line-height: 37px; + font-size: 15px; + font-weight: 300; + color: #696969; + width: auto !important; + overflow: hidden; + text-overflow: ellipsis; + border-bottom: 2px solid transparent; + position: relative; + -webkit-transition: border-bottom 200ms, color 200ms; + -moz-transition: border-bottom 200ms, color 200ms; + transition: border-bottom 200ms, color 200ms; +} + +.mytheme .v-tabsheet-tabitemcell .v-caption .v-captiontext { + display: inline; +} + +.mytheme .v-tabsheet-tabitemcell .v-caption .v-icon + .v-captiontext { + margin-left: 9px; +} + +.mytheme .v-tabsheet-tabitemcell .v-caption:hover { + color: #197de1; +} + +.mytheme .v-tabsheet-tabitemcell .v-caption.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; + cursor: default; + color: inherit !important; +} + +.mytheme .v-tabsheet-tabitemcell:first-child .v-caption, .mytheme .v-tabsheet-tabitemcell[aria-hidden="true"] + td .v-caption { + margin-left: 0; +} + +.mytheme .v-tabsheet-tabitemcell:focus { + outline: none; +} + +.mytheme .v-tabsheet-tabitemcell:focus .v-caption { + color: #197de1; +} + +.mytheme .v-tabsheet-tabitemcell .v-tabsheet-tabitem-selected .v-caption.v-caption { + border-bottom-color: #197de1; + color: #197de1; +} + +.mytheme .v-tabsheet-tabitemcell .v-caption-closable { + padding-right: 22px; +} + +.mytheme .v-tabsheet-tabitemcell.icons-on-top .v-caption-closable { + padding-right: 4px; +} + +.mytheme .v-tabsheet-tabitemcell .v-tabsheet-caption-close { + position: absolute; + right: 0; + top: 50%; + margin: -8px 0 0; + font-size: 18px; + line-height: 18px; + width: 18px; + text-align: center; + border-radius: 2px; + color: #969696; +} + +.mytheme .v-tabsheet-tabitemcell .v-tabsheet-caption-close:hover { + background: rgba(0, 0, 0, 0.03); + color: #197de1; +} + +.mytheme .v-tabsheet-tabitemcell .v-tabsheet-caption-close:active { + background: #197de1; + color: #c8dbed; +} + +.mytheme .v-tabsheet-scroller { + position: absolute; + top: 0; + right: 0; + bottom: 0; + padding-left: 19px; + background-color: transparent; + background-image: -webkit-linear-gradient(right, #fafafa 70%, rgba(250, 250, 250, 0) 100%); + background-image: linear-gradient(to left,#fafafa 70%, rgba(250, 250, 250, 0) 100%); + pointer-events: none; +} + +.mytheme .v-tabsheet-scroller:after { + content: ""; + height: 1px; + position: absolute; + bottom: 0; + left: 0; + right: 0; + display: block; + background-color: transparent; + background-image: -webkit-linear-gradient(right, #dfdfdf 70%, rgba(223, 223, 223, 0) 100%); + background-image: linear-gradient(to left,#dfdfdf 70%, rgba(223, 223, 223, 0) 100%); +} + +.v-ie8 .mytheme .v-tabsheet-scroller, .v-ie9 .mytheme .v-tabsheet-scroller { + background-color: #fafafa; +} + +.v-ie8 .mytheme .v-tabsheet-scroller:after, .v-ie9 .mytheme .v-tabsheet-scroller:after { + background-color: #dfdfdf; +} + +.mytheme .v-tabsheet-scroller button { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + border: none; + background: transparent; + font: inherit; + color: inherit; + height: 100%; + margin: 0; + padding: 0 9px; + outline: none; + cursor: pointer; + pointer-events: auto; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-tabsheet-scroller button:hover { + opacity: 1; + filter: none ; + color: #197de1; +} + +.mytheme .v-tabsheet-scroller button:active { + opacity: 0.7; + filter: alpha(opacity=70) ; + color: #197de1; +} + +.mytheme .v-tabsheet-scroller button::-moz-focus-inner { + padding: 0; + border: 0; +} + +.mytheme .v-tabsheet-scroller [class*="Next"] { + padding-left: 5px; +} + +.mytheme .v-tabsheet-scroller [class*="Next"]:before { + font-family: ThemeIcons; + content: "\f054"; +} + +.mytheme .v-tabsheet-scroller [class*="Prev"] { + padding-right: 5px; +} + +.mytheme .v-tabsheet-scroller [class*="Prev"]:before { + font-family: ThemeIcons; + content: "\f053"; +} + +.mytheme .v-tabsheet-scroller [class*="disabled"] { + cursor: default; + color: inherit !important; + opacity: 0.1 !important; + filter: alpha(opacity=10) !important; +} + +.mytheme .v-tabsheet-tabsheetpanel > .v-scrollable > .v-widget { + -webkit-animation: valo-animate-in-fade 300ms backwards; + -moz-animation: valo-animate-in-fade 300ms backwards; + animation: valo-animate-in-fade 300ms backwards; +} + +.mytheme .v-tabsheet-deco { + height: 20px !important; + width: 20px !important; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + border: 2px solid rgba(25, 125, 225, 0.2); + border-top-color: #197de1; + border-right-color: #197de1; + border-radius: 100%; + -webkit-animation: v-rotate-360 500ms infinite linear; + -moz-animation: v-rotate-360 500ms infinite linear; + animation: v-rotate-360 500ms infinite linear; + pointer-events: none; + display: none; + position: absolute; + z-index: 1; + bottom: 50%; + margin-bottom: -29px; + left: 50%; + margin-left: -10px; +} + +.v-ie8 .mytheme .v-tabsheet-deco, .v-ie9 .mytheme .v-tabsheet-deco { + border: none; + border-radius: 4px; + background: #fff url(../valo/shared/img/spinner.gif) no-repeat 50% 50%; + background-size: 80%; +} + +.v-ie8 .mytheme .v-tabsheet-deco { + min-width: 30px; + min-height: 30px; +} + +.mytheme .v-tabsheet-loading .v-tabsheet-deco { + display: block; +} + +.mytheme .v-tabsheet-equal-width-tabs > .v-tabsheet-tabcontainer table, .mytheme .v-tabsheet-equal-width-tabs > .v-tabsheet-tabcontainer tbody, .mytheme .v-tabsheet-equal-width-tabs > .v-tabsheet-tabcontainer tr { + width: 100%; +} + +.mytheme .v-tabsheet-equal-width-tabs > .v-tabsheet-tabcontainer tr { + display: table; + table-layout: fixed; +} + +.mytheme .v-tabsheet-equal-width-tabs > .v-tabsheet-tabcontainer td { + display: table-cell; +} + +.mytheme .v-tabsheet-equal-width-tabs > .v-tabsheet-tabcontainer .v-caption { + margin: 0; + display: block; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-tabcontainer .v-caption { + margin-left: 4px; + padding: 0 12px; + background-color: #fafafa; + border: 1px solid transparent; + line-height: 36px; + border-radius: 4px 4px 0 0; + font-weight: 400; + -webkit-transition: background-color 160ms; + -moz-transition: background-color 160ms; + transition: background-color 160ms; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-tabcontainer .v-caption:hover { + background-color: #f2f2f2; + border-bottom-color: #dfdfdf; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-tabcontainer .v-caption.v-disabled:hover { + background-color: #fafafa; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-tabcontainer .v-caption-closable { + padding-right: 30px; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-tabcontainer .v-tabsheet-caption-close { + top: 4px; + right: 4px; + margin-top: 0; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-tabcontainer td:first-child .v-caption, .mytheme .v-tabsheet-framed > .v-tabsheet-tabcontainer [aria-hidden="true"] + td .v-caption { + margin-left: 0; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-tabcontainer .v-tabsheet-tabitem .v-caption { + border-color: #dfdfdf; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-tabcontainer .v-tabsheet-tabitem-selected .v-caption { + background: white; + border-color: #dfdfdf; + border-bottom: none; + padding-bottom: 1px; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-content { + border: 1px solid #dfdfdf; + border-top: none; +} + +.mytheme .v-tabsheet-framed > .v-tabsheet-content > div { + background: white; +} + +.mytheme .v-tabsheet-framed.padded-tabbar > .v-tabsheet-tabcontainer { + border: 1px solid #dfdfdf; + border-bottom: none; + background: #fafafa; + padding-top: 6px; +} + +.mytheme .v-tabsheet-framed.icons-on-top > .v-tabsheet-tabcontainer .v-tabsheet-tabitem-selected .v-caption { + padding-bottom: 7px; +} + +.mytheme .v-tabsheet-centered-tabs > .v-tabsheet-tabcontainer { + text-align: center; +} + +.mytheme .v-tabsheet-right-aligned-tabs > .v-tabsheet-tabcontainer { + text-align: right; +} + +.mytheme .v-tabsheet-padded-tabbar > .v-tabsheet-tabcontainer .v-tabsheet-tabs { + padding: 0 9px; +} + +.mytheme .v-tabsheet-icons-on-top > .v-tabsheet-tabcontainer .v-caption { + padding-top: 6px; + padding-bottom: 6px; + line-height: 1.2; +} + +.mytheme .v-tabsheet-icons-on-top > .v-tabsheet-tabcontainer .v-icon { + display: block; +} + +.mytheme .v-tabsheet-icons-on-top > .v-tabsheet-tabcontainer .v-icon + .v-captiontext.v-captiontext { + margin-left: 0; +} + +.mytheme .v-tabsheet-icons-on-top > .v-tabsheet-tabcontainer .v-caption-closable { + padding-right: 12px; +} + +.mytheme .v-tabsheet-icons-on-top > .v-tabsheet-tabcontainer .v-tabsheet-caption-close { + top: 4px; + margin-top: 0; +} + +.mytheme .v-tabsheet-compact-tabbar > .v-tabsheet-tabcontainer-compact-tabbar .v-caption { + line-height: 1.8; +} + +.mytheme .v-tabsheet-only-selected-closable > .v-tabsheet-tabcontainer .v-tabsheet-caption-close { + visibility: hidden; +} + +.mytheme .v-tabsheet-only-selected-closable > .v-tabsheet-tabcontainer .v-tabsheet-tabitem-selected .v-tabsheet-caption-close { + visibility: visible; +} + +.mytheme .v-colorpicker-popup.v-window { + min-width: 220px !important; +} + +.mytheme .v-colorpicker-popup .v-tabsheet-tabs { + padding: 0 9px; +} + +.mytheme .v-colorpicker-popup [class$="sliders"] { + padding: 12px; +} + +.mytheme .v-colorpicker-popup [class$="sliders"] .v-widget { + width: 100% !important; + vertical-align: middle; +} + +.mytheme .v-colorpicker-popup [class$="sliders"] .v-has-caption { + white-space: nowrap; + padding-left: 48px; +} + +.mytheme .v-colorpicker-popup [class$="sliders"] .v-caption { + display: inline-block; + margin-left: -48px; + width: 48px; +} + +.mytheme .v-colorpicker-popup [class$="sliders"] .v-slot-hue-slider + .v-slot .v-has-caption { + padding-left: 80px; +} + +.mytheme .v-colorpicker-popup [class$="sliders"] .v-slot-hue-slider + .v-slot .v-caption { + margin-left: -80px; + width: 80px; +} + +.mytheme .v-colorpicker-popup .v-slider-red .v-slider-base:after { + background: red; + border: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-colorpicker-popup .v-slider-green .v-slider-base:after { + background: green; + border: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-colorpicker-popup .v-slider-blue .v-slider-base:after { + background: blue; + border: none; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-colorpicker-popup .v-margin-bottom { + padding-bottom: 0; +} + +.mytheme .v-colorpicker-popup .resize-button { + width: 100% !important; + height: auto !important; + text-align: center; + outline: none; +} + +.mytheme .v-colorpicker-popup .resize-button:before { + font-family: ThemeIcons; + content: "\f141"; +} + +.mytheme .v-colorpicker-popup .resize-button-caption { + display: none; +} + +.mytheme .v-colorpicker-popup .v-horizontallayout { + height: auto !important; + padding: 9px 0; + background-color: #fafafa; + border-top: 1px solid #ededed; +} + +.mytheme .v-colorpicker-popup .v-horizontallayout .v-expand { + overflow: visible; +} + +.mytheme .v-colorpicker-popup .v-horizontallayout .v-button { + width: 80% !important; +} + +.mytheme .v-colorpicker-preview { + width: 100% !important; + height: auto !important; + padding: 9px; +} + +.mytheme .v-colorpicker-preview-textfield { + height: auto !important; + text-align: center; + border: none; +} + +.mytheme .v-colorpicker { + width: auto; +} + +.mytheme .v-colorpicker-button-color { + position: absolute; + top: 6px; + right: 6px; + bottom: 6px; + left: 6px; + border-radius: 3px; + border: 1px solid rgba(0, 0, 0, 0.5); + max-width: 23px; +} + +.mytheme .v-colorpicker-button-color + .v-button-caption:not(:empty) { + margin-left: 19px; +} + +.v-ie8 .mytheme .v-colorpicker-button-color { + position: relative; + top: auto; + right: auto; + bottom: auto; + left: auto; + width: 16px; + height: 16px; + display: inline-block; + vertical-align: middle; + margin: 0 -8px; +} + +.v-ie8 .mytheme .v-colorpicker-button-color + .v-button-caption { + margin-left: 19px; +} + +.mytheme .v-panel { + background: white; + color: #474747; + border-radius: 4px; + border: 1px solid #d5d5d5; + -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + overflow: visible !important; +} + +.mytheme .v-panel-caption { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0 12px; + line-height: 36px; + border-bottom: 1px solid #d5d5d5; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #f6f6f6 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #f6f6f6 98%); + color: #464646; + font-weight: 400; + font-size: 14px; + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #eeeeee; + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #eeeeee; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + border-radius: 3px 3px 0 0; +} + +.mytheme .v-panel-content { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + width: 100%; + height: 100%; +} + +.mytheme .v-panel-content > .v-margin-top { + padding-top: 12px; +} + +.mytheme .v-panel-content > .v-margin-right { + padding-right: 12px; +} + +.mytheme .v-panel-content > .v-margin-bottom { + padding-bottom: 12px; +} + +.mytheme .v-panel-content > .v-margin-left { + padding-left: 12px; +} + +.mytheme .v-panel-borderless { + background: transparent; + color: inherit; + border: none; + border-radius: 0; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-panel-borderless > div > [class*="-caption"] { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; + color: inherit; + padding: 0; + margin: 0 12px; + border-bottom: none; +} + +.mytheme .v-panel-well { + background: #f5f5f5; + color: #454545; + -webkit-box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.05), inset 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.05), inset 0 2px 3px rgba(0, 0, 0, 0.05); + border-radius: 4px; + border: 1px solid #c5c5c5; +} + +.mytheme .v-panel-well > div > [class*="-caption"] { + background: transparent; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-panel-scroll-divider > [class*="-captionwrap"] { + position: relative; + z-index: 2; +} + +.mytheme .v-panel-scroll-divider > [class*="-captionwrap"]:after { + content: ""; + position: absolute; + bottom: -1px; + right: 0; + left: 0; + height: 0; + border-top: 1px solid #dfdfdf; + border-color: rgba(197, 197, 197, 0.5); +} + +.mytheme .v-panel-scroll-divider > [class*="-content"]:before { + content: ""; + position: absolute; + z-index: 2; + top: 0; + height: 0; + border-top: 1px solid #fafafa; + left: 0; + right: 0; +} + +.mytheme .v-panel-caption.v-horizontallayout { + height: auto !important; + line-height: 0; +} + +.mytheme .v-panel-caption.v-horizontallayout .v-slot { + vertical-align: middle; +} + +.mytheme .v-panel-caption.v-horizontallayout .v-label { + line-height: 37px; +} + +.mytheme .v-accordion { + background: white; + color: #474747; + border-radius: 4px; + border: 1px solid #d5d5d5; + -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #f4f4f4 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #f4f4f4 98%); + overflow: hidden; +} + +.mytheme .v-accordion-item { + position: relative; +} + +.mytheme .v-accordion-item:first-child { + border-top-left-radius: 3px; + border-top-right-radius: 3px; +} + +.mytheme .v-accordion-item:last-child { + border-bottom-left-radius: 3px; + border-bottom-right-radius: 3px; +} + +.mytheme .v-accordion-item:last-child [class*="item-content"] { + border-radius: inherit; +} + +.mytheme .v-accordion-item[class*="item-open"]:last-child > div > .v-caption { + border-radius: 0; +} + +.mytheme .v-accordion-item:not([class*="item-open"]):last-child > div > .v-caption { + border-bottom: none; + margin-bottom: 0; +} + +.mytheme .v-accordion-item[class*="item-open"] + [class*="item"] { + border-top: 1px solid #d9d9d9; +} + +.mytheme .v-accordion-item-caption { + border-radius: inherit; +} + +.mytheme .v-accordion-item-caption > .v-caption { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + padding: 0 12px; + line-height: 36px; + border-bottom: 1px solid #d5d5d5; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #f6f6f6 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #f6f6f6 98%); + color: #464646; + font-weight: 400; + font-size: 14px; + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #eeeeee; + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #eeeeee; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.05); + display: block; + background: transparent; + border-bottom-color: #c9c9c9; + border-radius: inherit; + cursor: pointer; + position: relative; +} + +.mytheme .v-accordion-item-caption > .v-caption:hover:before, .mytheme .v-accordion-item-caption > .v-caption:active:before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border-radius: inherit; +} + +.mytheme .v-accordion-item-caption > .v-caption:hover:before { + background-color: rgba(186, 186, 186, 0.1); + border: none; +} + +.mytheme .v-accordion-item-caption > .v-caption:active:before { + background-color: rgba(125, 125, 125, 0.2); +} + +.mytheme .v-accordion-item-content { + -webkit-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.05); + background-color: white; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.mytheme .v-accordion-item-content > .v-margin-top { + padding-top: 12px; +} + +.mytheme .v-accordion-item-content > .v-margin-right { + padding-right: 12px; +} + +.mytheme .v-accordion-item-content > .v-margin-bottom { + padding-bottom: 12px; +} + +.mytheme .v-accordion-item-content > .v-margin-left { + padding-left: 12px; +} + +.mytheme .v-accordion-borderless { + border: none; + border-radius: 0; + -webkit-box-shadow: none; + box-shadow: none; +} + +.mytheme .v-accordion-borderless > .v-accordion-item, .mytheme .v-accordion-borderless > .v-accordion-item > div > .v-caption, .mytheme .v-accordion-borderless > .v-accordion-item > .v-accordion-item-content { + border-radius: 0; +} + +.mytheme .v-select-twincol { + white-space: normal; +} + +.mytheme .v-select-twincol select { + border: 1px solid #c5c5c5; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + color: #464646; +} + +.mytheme .v-select-twincol select:focus { + outline: none; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-select-twincol .v-textfield, .mytheme .v-select-twincol .v-nativebutton { + width: auto !important; + margin-top: 9px; +} + +.mytheme .v-select-twincol .v-nativebutton { + margin-left: 9px; +} + +.mytheme .v-select-twincol-caption-left, .mytheme .v-select-twincol-caption-right { + font-size: 14px; + font-weight: 400; + padding-bottom: 0.3em; + padding-left: 1px; +} + +.mytheme .v-select-twincol-buttons { + white-space: nowrap; + display: inline-block; + vertical-align: top; + position: relative; + min-width: 3.5em; +} + +.mytheme .v-select-twincol-buttons .v-button { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + vertical-align: top; + text-align: left; + white-space: normal; + position: absolute; + left: 9px; + right: 9px; + top: 36px; + padding: 0; + text-align: center; +} + +.mytheme .v-select-twincol-buttons .v-button:first-child { + top: 0; +} + +.mytheme .v-select-twincol-buttons .v-button-caption { + display: none; +} + +.mytheme .v-select-twincol-buttons .v-button:focus { + z-index: 1; +} + +.mytheme .v-select-twincol-buttons .v-button:first-child { + border-radius: 4px 4px 0 0; +} + +.mytheme .v-select-twincol-buttons .v-button:last-child { + border-radius: 0 0 4px 4px; +} + +.mytheme .v-select-twincol-buttons .v-button-wrap:before { + font-family: ThemeIcons; + content: "\f053"; +} + +.mytheme .v-select-twincol-buttons .v-button:first-child .v-button-wrap:before { + font-family: ThemeIcons; + content: "\f054"; +} + +.mytheme .v-select-twincol-error .v-select-twincol-options, .mytheme .v-select-twincol-error .v-select-twincol-selections { + border-color: #ed473b !important; + background: #fffbfb; + color: #6c2621; +} + +.mytheme .v-select select { + border: 1px solid #c5c5c5; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + color: #464646; +} + +.mytheme .v-select select:focus { + outline: none; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-select-select { + display: block; +} + +.mytheme .v-select-select + .v-textfield { + width: auto !important; + margin-top: 9px; +} + +.mytheme .v-select-select + .v-textfield + .v-nativebutton { + margin-top: 9px; + margin-left: 9px; +} + +.mytheme .v-select-error .v-select-select { + border-color: #ed473b !important; + background: #fffbfb; + color: #6c2621; +} + +.mytheme .v-calendar-header-day { + font-weight: 400; + text-align: center; + padding: 7px 0; +} + +.mytheme .v-calendar-header-week .v-calendar-back, .mytheme .v-calendar-header-week .v-calendar-next { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + background: transparent; + border: none; + padding: 0; + margin: 0; + cursor: pointer; + outline: none; + color: inherit; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-calendar-header-week .v-calendar-back:focus, .mytheme .v-calendar-header-week .v-calendar-next:focus { + outline: none; +} + +.mytheme .v-calendar-header-week .v-calendar-back:hover, .mytheme .v-calendar-header-week .v-calendar-next:hover { + opacity: 1; + filter: none ; +} + +.mytheme .v-calendar-header-week .v-calendar-back:active, .mytheme .v-calendar-header-week .v-calendar-next:active { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-calendar-header-week .v-calendar-back:before { + font-family: ThemeIcons; + content: "\f053"; +} + +.mytheme .v-calendar-header-week .v-calendar-next:before { + font-family: ThemeIcons; + content: "\f054"; +} + +.mytheme .v-calendar-month { + outline: none; + overflow: hidden; +} + +.mytheme .v-calendar-month td { + vertical-align: top; +} + +.mytheme .v-calendar-week-number { + cursor: pointer; + width: 20px; + text-align: center; + font-size: 0.8em; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-calendar-week-number:hover { + opacity: 1; + filter: none ; +} + +.mytheme .v-calendar-month-day { + outline: none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + line-height: 1.2; +} + +.mytheme .v-calendar-bottom-spacer, .mytheme .v-calendar-spacer, .mytheme .v-calendar-bottom-spacer-empty { + height: 19px; + margin-bottom: 3px; +} + +.mytheme .v-calendar-bottom-spacer { + font-size: 0.8em; + padding: 0 5px; + cursor: pointer; +} + +.mytheme .v-calendar-bottom-spacer:hover { + color: #197de1; +} + +.mytheme .v-calendar-day-number { + line-height: 25px; + font-size: 16px; + text-align: right; + margin: 0 5px; + white-space: nowrap; + border-top: 1px solid #f2f2f2; + cursor: pointer; +} + +.mytheme .v-calendar-day-number:hover { + color: #197de1; +} + +.mytheme .v-calendar-month-day-today { + background: #eef3f8; +} + +.mytheme .v-calendar-month-day-today .v-calendar-day-number { + font-weight: 400; + color: #197de1; + border-top: 2px solid #197de1; + line-height: 24px; + margin: 0; + padding: 0 5px; +} + +.mytheme .v-calendar-month-day-selected { + background-color: #e3edf7; +} + +.mytheme .v-calendar-month-day-dragemphasis { + background-color: #a8a8a8; +} + +.mytheme .v-calendar-month-day-scrollable { + overflow-y: scroll; +} + +.mytheme .v-calendar-weekly-longevents { + margin-left: 50px; + border-bottom: 3px solid #e0e0e0; +} + +.mytheme .v-calendar-weekly-longevents .v-calendar-event-all-day { + height: 22px; + line-height: 1.6; + margin-bottom: 3px; +} + +.mytheme .v-calendar-header-week td { + vertical-align: middle !important; +} + +.mytheme .v-calendar-header-week .v-calendar-header-day { + cursor: pointer; +} + +.mytheme .v-calendar-times { + width: 50px; + font-size: 0.77em; + line-height: 1; + white-space: nowrap; +} + +.mytheme .v-calendar-time { + text-align: right; + padding-right: 9px; + margin-top: -6px; + padding-bottom: 6px; +} + +.mytheme .v-calendar-day-times, .mytheme .v-calendar-day-times-today { + outline: none; + border-right: 1px solid transparent; +} + +.mytheme .v-calendar-day-times:focus, .mytheme .v-calendar-day-times-today:focus { + outline: none; +} + +.mytheme .v-calendar .v-datecellslot, .mytheme .v-calendar .v-datecellslot-even { + border-top: 1px solid #dfdfdf; +} + +.mytheme .v-calendar .v-datecellslot:first-child, .mytheme .v-calendar .v-datecellslot-even:first-child { + border-top-color: transparent; +} + +.mytheme .v-calendar .v-datecellslot { + border-top-style: dotted; +} + +.mytheme .v-calendar .v-datecellslot, .mytheme .v-calendar .v-datecellslot-even { + margin-right: 5px; +} + +.mytheme .v-calendar-current-time { + background: #197de1; + line-height: 1px; + pointer-events: none; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-calendar-current-time:before { + content: "\2022"; + color: #197de1; + font-size: 22px; + margin-left: -0.07em; +} + +.mytheme .v-calendar .v-daterange { + position: relative; +} + +.mytheme .v-calendar .v-daterange:before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: -1px; + left: 0; + background: #197de1; + opacity: 0.5; + filter: alpha(opacity=50) ; + border-radius: 4px 4px 0 0; +} + +.mytheme .v-calendar .v-daterange + .v-daterange { + border-color: transparent; +} + +.mytheme .v-calendar .v-daterange + .v-daterange:before { + border-radius: 0; +} + +.mytheme .v-calendar-event { + font-size: 0.85em; + overflow: hidden; + cursor: pointer; + outline: none; + border-radius: 4px; +} + +.mytheme .v-calendar-event:focus { + outline: none; +} + +.mytheme .v-calendar-event-month { + padding: 0 5px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin-bottom: 3px; + white-space: nowrap; + text-overflow: ellipsis; + height: 19px; + line-height: 19px; +} + +.mytheme .v-calendar-event-month .v-calendar-event-time { + float: right; + font-size: 0.9em; + line-height: 19px; + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-calendar-event-month:before { + content: "\25cf"; + margin-right: 0.2em; +} + +.mytheme .v-calendar-event-all-day { + padding: 0 5px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + height: 19px; + line-height: 19px; + border-radius: 0; + margin-left: -1px; + white-space: nowrap; +} + +.mytheme .v-calendar-event-all-day:before { + content: ""; +} + +.mytheme .v-calendar-event-start { + overflow: visible; + margin-left: 0; +} + +.mytheme .v-calendar-event-start.v-calendar-event-continued-to, .mytheme .v-calendar-event-start.v-calendar-event-end { + overflow: hidden; + text-overflow: ellipsis; +} + +.mytheme .v-calendar-event-start { + border-top-left-radius: 4px; + border-bottom-left-radius: 4px; + margin-left: 5px; +} + +.mytheme .v-calendar-event-end { + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + margin-right: 5px; +} + +.mytheme .v-calendar-event-caption { + font-weight: 500; + line-height: 1.2; + padding: 5px 0; + position: absolute; + overflow: hidden; + right: 9px; + left: 5px; + bottom: 0; + top: 0; +} + +.mytheme .v-calendar-event-caption span { + font-weight: 300; + white-space: nowrap; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event { + overflow: visible; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event-content { + margin-top: -1px; + border-radius: 5px; + border: 1px solid #fafafa; + padding-top: 3px; + margin-right: 5px; +} + +.mytheme .v-calendar-event-month:before { + color: #00ace0; +} + +.mytheme .v-calendar-event-all-day { + background-color: #c8eaf4; + background-color: rgba(200, 234, 244, 0.8); + color: #00ace0; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event { + color: #00ace0; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event .v-calendar-event-content { + background-color: #c8eaf4; + background-color: rgba(200, 234, 244, 0.8); +} + +.mytheme .v-calendar-event-month[class*="color2"]:before { + color: #2d9f19; +} + +.mytheme .v-calendar-event-all-day[class*="color2"] { + background-color: #d1e7cd; + background-color: rgba(209, 231, 205, 0.8); + color: #2d9f19; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event[class*="color2"] { + color: #2d9f19; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event[class*="color2"] .v-calendar-event-content { + background-color: #d1e7cd; + background-color: rgba(209, 231, 205, 0.8); +} + +.mytheme .v-calendar-event-month[class*="color3"]:before { + color: #d18100; +} + +.mytheme .v-calendar-event-all-day[class*="color3"] { + background-color: #f1e1c8; + background-color: rgba(241, 225, 200, 0.8); + color: #d18100; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event[class*="color3"] { + color: #d18100; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event[class*="color3"] .v-calendar-event-content { + background-color: #f1e1c8; + background-color: rgba(241, 225, 200, 0.8); +} + +.mytheme .v-calendar-event-month[class*="color4"]:before { + color: #ce3812; +} + +.mytheme .v-calendar-event-all-day[class*="color4"] { + background-color: #f1d3cb; + background-color: rgba(241, 211, 203, 0.8); + color: #ce3812; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event[class*="color4"] { + color: #ce3812; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event[class*="color4"] .v-calendar-event-content { + background-color: #f1d3cb; + background-color: rgba(241, 211, 203, 0.8); +} + +.mytheme .v-calendar-event-month[class*="color5"]:before { + color: #2d55cd; +} + +.mytheme .v-calendar-event-all-day[class*="color5"] { + background-color: #d1d9f1; + background-color: rgba(209, 217, 241, 0.8); + color: #2d55cd; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event[class*="color5"] { + color: #2d55cd; +} + +.mytheme .v-calendar-week-wrapper .v-calendar-event[class*="color5"] .v-calendar-event-content { + background-color: #d1d9f1; + background-color: rgba(209, 217, 241, 0.8); +} + +.mytheme .v-calendar.v-disabled * { + cursor: default; +} + +.mytheme .v-label { + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.mytheme .v-label.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-label-undef-w { + white-space: nowrap; +} + +.mytheme h1, .mytheme .v-label-h1, .mytheme h2, .mytheme .v-label-h2, .mytheme h3, .mytheme .v-label-h3 { + line-height: 1.1; + font-weight: 200; + color: #141414; +} + +.mytheme h1, .mytheme .v-label-h1 { + font-size: 2.4em; + margin-top: 1.4em; + margin-bottom: 1em; + + letter-spacing: -0.03em; +} + +.mytheme h2, .mytheme .v-label-h2 { + font-size: 1.6em; + + margin-top: 1.6em; + margin-bottom: 0.77em; + letter-spacing: -0.02em; +} + +.mytheme h3, .mytheme .v-label-h3 { + font-size: 1.2em; + + margin-top: 1.8em; + margin-bottom: 0.77em; + letter-spacing: 0; +} + +.mytheme h4, .mytheme .v-label-h4 { + line-height: 1.1; + font-weight: 500; + font-size: 14px; + color: #414141; + text-transform: uppercase; + letter-spacing: 0; + margin-top: 2.4em; + margin-bottom: 0.8em; +} + +.mytheme .v-csslayout > h1:first-child, .mytheme .v-csslayout > h2:first-child, .mytheme .v-csslayout > h3:first-child, .mytheme .v-csslayout > h4 > .v-label-h1:first-child, .mytheme .v-csslayout > .v-label-h2:first-child, .mytheme .v-csslayout > .v-label-h3:first-child, .mytheme .v-csslayout > .v-label-h4:first-child { + margin-top: 16px; +} + +.mytheme .v-verticallayout > .v-slot:first-child h1, .mytheme .v-verticallayout > .v-slot:first-child .v-label-h1, .mytheme .v-verticallayout > .v-slot:first-child h2, .mytheme .v-verticallayout > .v-slot:first-child .v-label-h2, .mytheme .v-verticallayout > .v-slot:first-child h3, .mytheme .v-verticallayout > .v-slot:first-child .v-label-h3, .mytheme .v-verticallayout > .v-slot:first-child h4, .mytheme .v-verticallayout > .v-slot:first-child .v-label-h4, .mytheme .v-verticallayout > div > .v-slot:first-child h1, .mytheme .v-verticallayout > div > .v-slot:first-child .v-label-h1, .mytheme .v-verticallayout > div > .v-slot:first-child h2, .mytheme .v-verticallayout > div > .v-slot:first-child .v-label-h2, .mytheme .v-verticallayout > div > .v-slot:first-child h3, .mytheme .v-verticallayout > div > .v-slot:first-child .v-label-h3, .mytheme .v-verticallayout > div > .v-slot:first-child h4, .mytheme .v-verticallayout > div > .v-slot:first-child .v-label-h4 { + margin-top: 16px; +} + +.mytheme .v-verticallayout > .v-slot:first-child .v-formlayout-contentcell h1, .mytheme .v-verticallayout > .v-slot:first-child .v-formlayout-contentcell .v-label-h1, .mytheme .v-verticallayout > .v-slot:first-child .v-formlayout-contentcell h2, .mytheme .v-verticallayout > .v-slot:first-child .v-formlayout-contentcell .v-label-h2, .mytheme .v-verticallayout > .v-slot:first-child .v-formlayout-contentcell h3, .mytheme .v-verticallayout > .v-slot:first-child .v-formlayout-contentcell .v-label-h3, .mytheme .v-verticallayout > .v-slot:first-child .v-formlayout-contentcell h4, .mytheme .v-verticallayout > .v-slot:first-child .v-formlayout-contentcell .v-label-h4, .mytheme .v-verticallayout > div > .v-slot:first-child .v-formlayout-contentcell h1, .mytheme .v-verticallayout > div > .v-slot:first-child .v-formlayout-contentcell .v-label-h1, .mytheme .v-verticallayout > div > .v-slot:first-child .v-formlayout-contentcell h2, .mytheme .v-verticallayout > div > .v-slot:first-child .v-formlayout-contentcell .v-label-h2, .mytheme .v-verticallayout > div > .v-slot:first-child .v-formlayout-contentcell h3, .mytheme .v-verticallayout > div > .v-slot:first-child .v-formlayout-contentcell .v-label-h3, .mytheme .v-verticallayout > div > .v-slot:first-child .v-formlayout-contentcell h4, .mytheme .v-verticallayout > div > .v-slot:first-child .v-formlayout-contentcell .v-label-h4 { + margin-top: -0.5em; +} + +.mytheme h1.no-margin, .mytheme .v-label-h1.no-margin, .mytheme h2.no-margin, .mytheme .v-label-h2.no-margin, .mytheme h3.no-margin, .mytheme .v-label-h3.no-margin, .mytheme h4.no-margin, .mytheme .v-label-h4.no-margin { + margin: 0 !important; +} + +.mytheme .v-label-colored { + color: #197de1; +} + +.mytheme .v-label-large { + font-size: 20px; +} + +.mytheme .v-label-small { + font-size: 14px; +} + +.mytheme .v-label-tiny { + font-size: 12px; +} + +.mytheme .v-label-huge { + font-size: 26px; +} + +.mytheme .v-label-bold { + font-weight: 500; +} + +.mytheme .v-label-light { + font-weight: 200; + color: #7d7d7d; +} + +.mytheme .v-label-align-right { + text-align: right; +} + +.mytheme .v-label-align-center { + text-align: center; +} + +.mytheme .v-label-spinner { + height: 24px !important; + width: 24px !important; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + border: 2px solid rgba(25, 125, 225, 0.2); + border-top-color: #197de1; + border-right-color: #197de1; + border-radius: 100%; + -webkit-animation: v-rotate-360 500ms infinite linear; + -moz-animation: v-rotate-360 500ms infinite linear; + animation: v-rotate-360 500ms infinite linear; + pointer-events: none; +} + +.v-ie8 .mytheme .v-label-spinner, .v-ie9 .mytheme .v-label-spinner { + border: none; + border-radius: 4px; + background: #fff url(../valo/shared/img/spinner.gif) no-repeat 50% 50%; + background-size: 80%; +} + +.v-ie8 .mytheme .v-label-spinner { + min-width: 30px; + min-height: 30px; +} + +.mytheme .v-label-success, .mytheme .v-label-failure { + background: white; + color: #474747; + border: 2px solid #2c9720; + border-radius: 4px; + padding: 7px 19px 7px 37px; + font-weight: 400; + font-size: 15px; +} + +.mytheme .v-label-success:before, .mytheme .v-label-failure:before { + font-family: ThemeIcons; + content: "\f00c"; + margin-right: 0.5em; + margin-left: -19px; + color: #2c9720; +} + +.mytheme .v-label-failure { + border-color: #ed473b; +} + +.mytheme .v-label-failure:before { + content: "\f05e"; + color: #ed473b; +} + +.mytheme [draggable=true] { + -khtml-user-drag: element; + -webkit-user-drag: element; +} + +.mytheme .v-ddwrapper { + position: relative; +} + +.mytheme .v-ddwrapper-over:before, .mytheme .v-ddwrapper-over:after { + content: ""; + position: absolute; + z-index: 10; + top: -1px; + right: -1px; + bottom: -1px; + left: -1px; + border: 0 solid #197de1; +} + +.mytheme .v-ddwrapper-over-top:before { + border-top-width: 2px; +} + +.mytheme .v-ddwrapper-over-right:before { + border-right-width: 2px; +} + +.mytheme .v-ddwrapper-over-bottom:before { + border-bottom-width: 2px; +} + +.mytheme .v-ddwrapper-over-left:before { + border-left-width: 2px; +} + +.mytheme .no-vertical-drag-hints .v-ddwrapper-over-top:before, .mytheme .no-vertical-drag-hints.v-ddwrapper-over-top:before { + border-top-width: 0; +} + +.mytheme .no-vertical-drag-hints .v-ddwrapper-over-top:after, .mytheme .no-vertical-drag-hints.v-ddwrapper-over-top:after { + border-width: 2px; + border-radius: 4px; + opacity: 0.3; + filter: alpha(opacity=30.0) ; + background: #8abef2; +} + +.mytheme .no-vertical-drag-hints .v-ddwrapper-over-bottom:before, .mytheme .no-vertical-drag-hints.v-ddwrapper-over-bottom:before { + border-bottom-width: 0; +} + +.mytheme .no-vertical-drag-hints .v-ddwrapper-over-bottom:after, .mytheme .no-vertical-drag-hints.v-ddwrapper-over-bottom:after { + border-width: 2px; + border-radius: 4px; + opacity: 0.3; + filter: alpha(opacity=30.0) ; + background: #8abef2; +} + +.mytheme .no-horizontal-drag-hints.v-ddwrapper-over-left:before, .mytheme .no-horizontal-drag-hints .v-ddwrapper-over-left:before { + border-left-width: 0; +} + +.mytheme .no-horizontal-drag-hints.v-ddwrapper-over-left:after, .mytheme .no-horizontal-drag-hints .v-ddwrapper-over-left:after { + border-width: 2px; + border-radius: 4px; + opacity: 0.3; + filter: alpha(opacity=30.0) ; + background: #8abef2; +} + +.mytheme .no-horizontal-drag-hints.v-ddwrapper-over-right:before, .mytheme .no-horizontal-drag-hints .v-ddwrapper-over-right:before { + border-right-width: 0; +} + +.mytheme .no-horizontal-drag-hints.v-ddwrapper-over-right:after, .mytheme .no-horizontal-drag-hints .v-ddwrapper-over-right:after { + border-width: 2px; + border-radius: 4px; + opacity: 0.3; + filter: alpha(opacity=30.0) ; + background: #8abef2; +} + +.mytheme .v-ddwrapper-over-middle:after, .mytheme .v-ddwrapper-over-center:after { + border-width: 2px; + border-radius: 4px; + opacity: 0.3; + filter: alpha(opacity=30.0) ; + background: #8abef2; +} + +.mytheme .no-box-drag-hints.v-ddwrapper:after, .mytheme .no-box-drag-hints .v-ddwrapper:after { + display: none !important; + content: none; +} + +.mytheme .v-nativebutton { + -webkit-touch-callout: none; +} + +.mytheme .v-select select { + border: 1px solid #c5c5c5; + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + color: #464646; +} + +.mytheme .v-select select:focus { + outline: none; + -webkit-box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); + box-shadow: 0 0 0 2px rgba(25, 125, 225, 0.5); +} + +.mytheme .v-select-select { + display: block; +} + +.mytheme .v-select-select + .v-textfield { + width: auto !important; + margin-top: 9px; +} + +.mytheme .v-select-select + .v-textfield + .v-nativebutton { + margin-top: 9px; + margin-left: 9px; +} + +.mytheme .v-select-error .v-select-select { + border-color: #ed473b !important; + background: #fffbfb; + color: #6c2621; +} + +.mytheme .v-popupview { + cursor: pointer; + color: #197de1; + text-decoration: underline; + font-weight: inherit; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-popupview:hover { + color: #4396ea; +} + +.mytheme .v-popupview.v-disabled { + opacity: 0.5; + filter: alpha(opacity=50) ; +} + +.mytheme .v-popupview-popup { + padding: 4px 4px; + border-radius: 4px; + background-color: white; + color: #474747; + -webkit-box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + box-shadow: 0 4px 10px 0 rgba(0, 0, 0, 0.1), 0 3px 5px 0 rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.09098); + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -ms-backface-visibility: hidden; + backface-visibility: hidden; +} + +.mytheme .v-popupview-popup[class*="animate-in"] { + -webkit-animation: v-popupview-animate-in 120ms; + -moz-animation: v-popupview-animate-in 120ms; + animation: v-popupview-animate-in 120ms; +} + +.mytheme .v-popupview-popup[class*="animate-out"] { + -webkit-animation: valo-animate-out-fade 120ms; + -moz-animation: valo-animate-out-fade 120ms; + animation: valo-animate-out-fade 120ms; +} + +.mytheme .v-popupview-popup .popupContent > .v-margin-top { + padding-top: 12px; +} + +.mytheme .v-popupview-popup .popupContent > .v-margin-right { + padding-right: 12px; +} + +.mytheme .v-popupview-popup .popupContent > .v-margin-bottom { + padding-bottom: 12px; +} + +.mytheme .v-popupview-popup .popupContent > .v-margin-left { + padding-left: 12px; +} + +.mytheme .v-popupview-loading { + margin: 12px 12px; + height: 24px !important; + width: 24px !important; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + border: 2px solid rgba(25, 125, 225, 0.2); + border-top-color: #197de1; + border-right-color: #197de1; + border-radius: 100%; + -webkit-animation: v-rotate-360 500ms infinite linear; + -moz-animation: v-rotate-360 500ms infinite linear; + animation: v-rotate-360 500ms infinite linear; + pointer-events: none; +} + +.v-ie8 .mytheme .v-popupview-loading, .v-ie9 .mytheme .v-popupview-loading { + border: none; + border-radius: 4px; + background: #fff url(../valo/shared/img/spinner.gif) no-repeat 50% 50%; + background-size: 80%; +} + +.v-ie8 .mytheme .v-popupview-loading { + min-width: 30px; + min-height: 30px; +} + +.mytheme .v-richtextarea { + -webkit-appearance: none; + -moz-appearance: none; + -ms-appearance: none; + -o-appearance: none; + appearance: none; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + margin: 0; + font: inherit; + + font-weight: 400; + line-height: normal; + height: 37px; + border-radius: 4px; + padding: 0; + border: 1px solid #c5c5c5; + background: white; + color: #474747; + -webkit-box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + box-shadow: inset 0 1px 0 #f7f7f7, 0 1px 0 rgba(255, 255, 255, 0.1); + -webkit-transition: box-shadow 180ms, border 180ms; + -moz-transition: box-shadow 180ms, border 180ms; + transition: box-shadow 180ms, border 180ms; + height: auto; + overflow: hidden; +} + +.v-ie8 .mytheme .v-richtextarea, .v-ie9 .mytheme .v-richtextarea { + line-height: 37px; + padding-top: 0; + padding-bottom: 0; +} + +.mytheme .v-richtextarea[class*="prompt"] { + color: #a3a3a3; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar { + background-color: #fafafa; + background-image: -webkit-linear-gradient(top, #fafafa 2%, #efefef 98%); + background-image: linear-gradient(to bottom,#fafafa 2%, #efefef 98%); + -webkit-box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7; + box-shadow: inset 0 1px 0 white, inset 0 -1px 0 #e7e7e7; + border-bottom: 1px solid #c5c5c5; + color: #464646; +} + +.mytheme .v-richtextarea .gwt-ToggleButton, .mytheme .v-richtextarea .gwt-PushButton { + display: inline-block; + line-height: 37px; + width: 37px; + text-align: center; + outline: none; +} + +.mytheme .v-richtextarea .gwt-ToggleButton:hover, .mytheme .v-richtextarea .gwt-PushButton:hover { + color: black; +} + +.mytheme .v-richtextarea .gwt-ToggleButton-down, .mytheme .v-richtextarea .gwt-ToggleButton-down-hovering { + background-color: #e0e0e0; + background-image: -webkit-linear-gradient(bottom, #e0e0e0 2%, #dcdcdc 98%); + background-image: linear-gradient(to top,#e0e0e0 2%, #dcdcdc 98%); +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top img { + display: none; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div:before { + font-family: ThemeIcons; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Toggle Bold"]:before { + content: "\f032"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Toggle Italic"]:before { + content: "\f033"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Toggle Underline"]:before { + content: "\f0cd"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Toggle Subscript"]:before { + content: "\f12c"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Toggle Superscript"]:before { + content: "\f12b"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Left Justify"]:before { + content: "\f036"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Center"]:before { + content: "\f037"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Right Justify"]:before { + content: "\f038"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Toggle Strikethrough"]:before { + content: "\f0cc"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Indent Right"]:before { + content: "\f03c"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Indent Left"]:before { + content: "\f03b"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Insert Horizontal Rule"]:before { + content: "\2014"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Insert Ordered List"]:before { + content: "\f0cb"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Insert Unordered List"]:before { + content: "\f0ca"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Insert Image"]:before { + content: "\f03e"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Create Link"]:before { + content: "\f0c1"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Remove Link"]:before { + content: "\f127"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-top div[title="Remove Formatting"]:before { + content: "\f12d"; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-bottom { + font-size: 13px; + padding: 0 9px 9px 0; +} + +.mytheme .v-richtextarea .gwt-RichTextToolbar-bottom select { + margin: 9px 0 0 9px; +} + +.mytheme .v-richtextarea .gwt-RichTextArea { + background: #fff; + border: none; + display: block; +} + +.mytheme .v-richtextarea-readonly { + padding: 5px 7px; + background: transparent; +} + +.mytheme .v-upload .v-button { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + display: inline-block; + vertical-align: top; + text-align: left; + white-space: normal; +} + +.mytheme .v-upload-immediate .v-button { + width: 100%; +} + +.mytheme .v-upload-immediate input[type="file"] { + opacity: 0; + filter: alpha(opacity=0) ; + z-index: -1; + position: absolute; + right: 0; + height: 37px; + text-align: right; + border: none; + background: transparent; +} + +.mytheme .v-Notification.v-position-top { + top: 12px; +} + +.mytheme .v-Notification.v-position-right { + right: 12px; +} + +.mytheme .v-Notification.v-position-bottom { + bottom: 12px; +} + +.mytheme .v-Notification.v-position-left { + left: 12px; +} + +.mytheme .v-Notification.v-position-assistive { + top: -9999px; + left: -9999px; +} + +.mytheme .v-Notification-animate-in { + -webkit-animation: valo-animate-in-fade 180ms 10ms backwards; + -moz-animation: valo-animate-in-fade 180ms 10ms backwards; + animation: valo-animate-in-fade 180ms 10ms backwards; +} + +.mytheme .v-Notification-animate-in.v-position-top { + -webkit-animation: valo-animate-in-slide-down 400ms 10ms backwards; + -moz-animation: valo-animate-in-slide-down 400ms 10ms backwards; + animation: valo-animate-in-slide-down 400ms 10ms backwards; +} + +.mytheme .v-Notification-animate-in.v-position-bottom { + -webkit-animation: valo-animate-in-slide-up 400ms 10ms backwards; + -moz-animation: valo-animate-in-slide-up 400ms 10ms backwards; + animation: valo-animate-in-slide-up 400ms 10ms backwards; +} + +.mytheme .v-Notification-animate-out { + -webkit-animation: valo-animate-out-fade 150ms; + -moz-animation: valo-animate-out-fade 150ms; + animation: valo-animate-out-fade 150ms; +} + +.mytheme .v-Notification-animate-out.v-position-top, .mytheme .v-Notification-animate-out.v-position-bottom { + -webkit-animation: valo-animate-out-slide-down-fade 200ms; + -moz-animation: valo-animate-out-slide-down-fade 200ms; + animation: valo-animate-out-slide-down-fade 200ms; +} + +.mytheme .v-Notification { + border-radius: 4px; + text-align: center; + position: fixed !important; + -webkit-backface-visibility: hidden; + -moz-backface-visibility: hidden; + -ms-backface-visibility: hidden; + backface-visibility: hidden; + background: white; + -webkit-box-shadow: 0px 5px 15px 0px rgba(0, 0, 0, 0.15); + box-shadow: 0px 5px 15px 0px rgba(0, 0, 0, 0.15); + padding: 19px 22px; +} + +.mytheme .v-Notification .v-Notification-caption { + color: #197de1; + font-size: 19px; + line-height: 1; +} + +.mytheme .v-Notification .v-Notification-description { + line-height: 1.4; +} + +.mytheme .v-Notification-caption { + margin: 0; + display: inline-block; + text-align: left; + font-weight: inherit; + line-height: inherit; + white-space: nowrap; + letter-spacing: 0; +} + +.mytheme .v-Notification-description, .mytheme .v-Notification-details { + margin: 0; + display: inline-block; + vertical-align: middle; + max-width: 30em; + text-align: left; + max-height: 20em; + overflow: auto; +} + +.mytheme .v-Notification-caption ~ .v-Notification-description, .mytheme .v-Notification-caption ~ .v-Notification-details { + margin-left: 24px; +} + +.mytheme .v-icon + .v-Notification-caption { + margin-left: 16px; +} + +.mytheme .v-Notification-system { + left: 0 !important; + right: 0; + max-width: 100%; + margin: 0 !important; + border-radius: 0; + -webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.25); + box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.25); + padding: 12px 15px; + background-color: #444; + background-color: rgba(68, 68, 68, 0.9); + font-weight: 400; + line-height: 22px; +} + +.mytheme .v-Notification-system .v-Notification-description, .mytheme .v-Notification-system .v-Notification-details { + max-width: 50em; +} + +.mytheme .v-Notification-system.v-position-top { + top: 0; +} + +.mytheme .v-Notification-system.v-position-top[class*="animate-in"] { + -webkit-animation: valo-animate-in-slide-down 300ms 10ms backwards; + -moz-animation: valo-animate-in-slide-down 300ms 10ms backwards; + animation: valo-animate-in-slide-down 300ms 10ms backwards; +} + +.mytheme .v-Notification-system.v-position-top[class*="animate-out"] { + -webkit-animation: valo-animate-out-slide-up 200ms; + -moz-animation: valo-animate-out-slide-up 200ms; + animation: valo-animate-out-slide-up 200ms; +} + +.mytheme .v-Notification-system.v-position-bottom { + bottom: 0; +} + +.mytheme .v-Notification-system.v-position-bottom[class*="animate-in"] { + -webkit-animation: valo-animate-in-slide-up 300ms 10ms backwards; + -moz-animation: valo-animate-in-slide-up 300ms 10ms backwards; + animation: valo-animate-in-slide-up 300ms 10ms backwards; +} + +.mytheme .v-Notification-system.v-position-bottom[class*="animate-out"] { + -webkit-animation: valo-animate-out-slide-down 200ms; + -moz-animation: valo-animate-out-slide-down 200ms; + animation: valo-animate-out-slide-down 200ms; +} + +.mytheme .v-Notification-system .v-Notification-caption { + color: #fff; + vertical-align: middle; +} + +.mytheme .v-Notification-system .v-Notification-description, .mytheme .v-Notification-system .v-Notification-details { + color: #e6e6e6; +} + +.mytheme .v-Notification-system u { + text-decoration: none; +} + +.mytheme .v-Notification.tray { + text-align: left; +} + +.mytheme .v-Notification.tray .v-Notification-caption + .v-Notification-description { + display: block; + margin: 0.5em 0 0; +} + +.mytheme .v-Notification.warning { + background: #FFF3D2; +} + +.mytheme .v-Notification.warning .v-Notification-caption { + color: #AC7C00; +} + +.mytheme .v-Notification.warning .v-Notification-description { + color: #9D874D; +} + +.mytheme .v-Notification.error { + background: #ed473b; + font-weight: 400; + -webkit-box-shadow: 0px 5px 15px 0px rgba(0, 0, 0, 0.25); + box-shadow: 0px 5px 15px 0px rgba(0, 0, 0, 0.25); +} + +.mytheme .v-Notification.error .v-Notification-caption { + color: white; +} + +.mytheme .v-Notification.error .v-Notification-description { + color: #f4e0df; +} + +.mytheme .v-Notification.dark { + background-color: #444; + background-color: rgba(68, 68, 68, 0.9); + font-weight: 400; + line-height: 22px; +} + +.mytheme .v-Notification.dark .v-Notification-caption { + color: #fff; + vertical-align: middle; +} + +.mytheme .v-Notification.dark .v-Notification-description, .mytheme .v-Notification.dark .v-Notification-details { + color: #e6e6e6; +} + +.mytheme .v-Notification.bar { + left: 0 !important; + right: 0; + max-width: 100%; + margin: 0 !important; + border-radius: 0; + -webkit-box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.25); + box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.25); + padding: 12px 15px; +} + +.mytheme .v-Notification.bar .v-Notification-description, .mytheme .v-Notification.bar .v-Notification-details { + max-width: 50em; +} + +.mytheme .v-Notification.bar.v-position-top { + top: 0; +} + +.mytheme .v-Notification.bar.v-position-top[class*="animate-in"] { + -webkit-animation: valo-animate-in-slide-down 300ms 10ms backwards; + -moz-animation: valo-animate-in-slide-down 300ms 10ms backwards; + animation: valo-animate-in-slide-down 300ms 10ms backwards; +} + +.mytheme .v-Notification.bar.v-position-top[class*="animate-out"] { + -webkit-animation: valo-animate-out-slide-up 200ms; + -moz-animation: valo-animate-out-slide-up 200ms; + animation: valo-animate-out-slide-up 200ms; +} + +.mytheme .v-Notification.bar.v-position-bottom { + bottom: 0; +} + +.mytheme .v-Notification.bar.v-position-bottom[class*="animate-in"] { + -webkit-animation: valo-animate-in-slide-up 300ms 10ms backwards; + -moz-animation: valo-animate-in-slide-up 300ms 10ms backwards; + animation: valo-animate-in-slide-up 300ms 10ms backwards; +} + +.mytheme .v-Notification.bar.v-position-bottom[class*="animate-out"] { + -webkit-animation: valo-animate-out-slide-down 200ms; + -moz-animation: valo-animate-out-slide-down 200ms; + animation: valo-animate-out-slide-down 200ms; +} + +.mytheme .v-Notification.small { + padding: 11px 13px; +} + +.mytheme .v-Notification.small .v-Notification-caption { + font-size: 16px; +} + +.mytheme .v-Notification.small .v-Notification-description { + font-size: 14px; +} + +.mytheme .v-Notification.closable { + padding-right: 59px; + overflow: hidden !important; + cursor: pointer; +} + +.mytheme .v-Notification.closable:after { + content: "\00d7"; + font-size: 1.5em; + position: absolute; + top: 50%; + margin-top: -12px; + right: 12px; + width: 25px; + height: 25px; + line-height: 24px; + cursor: pointer; + color: #000; + opacity: 0.5; + filter: alpha(opacity=50) ; + text-align: center; + border: 1px solid #000; + border-color: rgba(0, 0, 0, 0.3); + border-radius: 50%; + -webkit-transition: opacity 200ms; + -moz-transition: opacity 200ms; + transition: opacity 200ms; +} + +.mytheme .v-Notification.closable:hover:after { + opacity: 1; + filter: none ; +} + +.mytheme .v-Notification.closable:active:after { + background-color: #000; + color: #fff; + opacity: 0.3; + filter: alpha(opacity=30.0) ; + -webkit-transition: none 200ms; + -moz-transition: none 200ms; + transition: none 200ms; +} + +.mytheme .v-Notification.closable.dark:after, .mytheme .v-Notification.closable.error:after, .mytheme .v-Notification.closable.system:after { + color: #fff; + border-color: #fff; + border-color: rgba(255, 255, 255, 0.3); +} + +.mytheme .v-Notification.closable.dark:active:after, .mytheme .v-Notification.closable.error:active:after, .mytheme .v-Notification.closable.system:active:after { + background-color: #fff; + color: #000; +} + +.mytheme .v-Notification.closable.tray:after { + top: 16px; + margin-top: 0; +} + +.mytheme .v-Notification.success, .mytheme .v-Notification.failure { + background: #fff; + color: #555; + border: 2px solid #2c9720; +} + +.mytheme .v-Notification.success .v-Notification-caption, .mytheme .v-Notification.failure .v-Notification-caption { + color: #2c9720; + font-weight: 400; +} + +.mytheme .v-Notification.success .v-Notification-caption:before, .mytheme .v-Notification.failure .v-Notification-caption:before { + font-family: ThemeIcons; + content: "\f00c"; + margin-right: 0.5em; +} + +.mytheme .v-Notification.success.bar, .mytheme .v-Notification.failure.bar { + margin: -2px !important; +} + +.mytheme .v-Notification.failure { + border-color: #ed473b; +} + +.mytheme .v-Notification.failure .v-Notification-caption { + color: #ed473b; +} + +.mytheme .v-Notification.failure .v-Notification-caption:before { + content: "\f05e"; +} + +.mytheme .valo-menu { + height: 100%; + background-color: #4b4b4b; + background-image: -webkit-linear-gradient(right, #414141 0%, #4b4b4b 9px); + background-image: linear-gradient(to left,#414141 0%, #4b4b4b 9px); + color: #a5a5a5; + font-size: 14px; + line-height: 30px; + border-right: 1px solid #3b3b3b; + white-space: nowrap; +} + +.mytheme .valo-menu-toggle { + display: none; + position: fixed; + z-index: 200; + top: 3px; + left: 3px; + min-width: 0; +} + +.mytheme .valo-menu-part { + border-left: 1px solid #414141; + height: 100%; + padding-bottom: 37px; + overflow: auto; +} + +.mytheme .valo-menu-part:first-child { + border-left: none; +} + +.mytheme .valo-menu-title, .mytheme .valo-menu-subtitle, .mytheme .valo-menu-item { + display: block; + line-height: inherit; + white-space: nowrap; + position: relative; +} + +.mytheme .valo-menu-title .valo-menu-badge, .mytheme .valo-menu-subtitle .valo-menu-badge, .mytheme .valo-menu-item .valo-menu-badge { + position: absolute; + right: 19px; +} + +.mytheme .valo-menu-title { + line-height: 1.2; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + color: white; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); + padding: 12px 19px; + font-size: 14px; + border-bottom: 1px solid #1362b1; + -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + text-align: center; +} + +.mytheme .valo-menu-title .v-menubar.v-menubar { + background: transparent; + border-color: #1362b1; + color: inherit; + -webkit-box-shadow: none; + box-shadow: none; + text-shadow: inherit; +} + +.mytheme .valo-menu-title .v-menubar-menuitem { + background: transparent; + -webkit-box-shadow: inset 0 1px 0 #4d98e6, inset 0 -1px 0 #166bca; + box-shadow: inset 0 1px 0 #4d98e6, inset 0 -1px 0 #166bca; + text-shadow: inherit; + font-size: 16px; + border-color: inherit; +} + +.mytheme .valo-menu-title h1, .mytheme .valo-menu-title .v-label-h1, .mytheme .valo-menu-title h2, .mytheme .valo-menu-title .v-label-h2, .mytheme .valo-menu-title h3, .mytheme .valo-menu-title .v-label-h3, .mytheme .valo-menu-title h4, .mytheme .valo-menu-title .v-label-h4 { + margin-top: 0; + margin-bottom: 0; + color: inherit; +} + +.mytheme .v-menubar-user-menu { + border: none; + border-radius: 0; + padding: 1px; + -webkit-box-shadow: none; + box-shadow: none; + text-shadow: none; + background: transparent; + color: inherit; + margin: 19px 7px; + display: block; + overflow: hidden; + text-align: center; + height: auto; + color: inherit; +} + +.mytheme .v-menubar-user-menu:focus:after { + display: none; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem { + -webkit-box-shadow: none; + box-shadow: none; + border: none; + margin-right: 1px; + border-radius: 4px; + color: #197de1; + padding: 0 12px; + -webkit-transition: color 140ms; + -moz-transition: color 140ms; + transition: color 140ms; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem:first-child, .mytheme .v-menubar-user-menu .v-menubar-menuitem:last-child, .mytheme .v-menubar-user-menu .v-menubar-menuitem:first-child:last-child { + border-radius: 4px; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem:before { + content: none; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem:hover { + color: #4396ea; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem:active { + color: inherit; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem-checked, .mytheme .v-menubar-user-menu .v-menubar-menuitem-checked:first-child { + border: 1px solid #c5c5c5; + color: #197de1; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem-checked .v-menubar-menuitem-caption, .mytheme .v-menubar-user-menu .v-menubar-menuitem-checked:first-child .v-menubar-menuitem-caption { + position: relative; + top: -1px; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem-selected { + color: #ecf2f8; + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05); +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem-selected:hover { + color: #ecf2f8; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem-disabled, .mytheme .v-menubar-user-menu .v-menubar-menuitem-disabled:hover { + color: inherit; +} + +.mytheme .v-menubar-user-menu > .v-menubar-menuitem { + color: inherit; + white-space: normal; + line-height: 1.4; + margin: 0; +} + +.mytheme .v-menubar-user-menu > .v-menubar-menuitem img.v-icon { + width: 56px; + height: 56px; + border-radius: 29px; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + display: block; + margin: 0 auto 0.3em; + border: 1px solid #c5c5c5; +} + +.mytheme .v-menubar-user-menu > .v-menubar-menuitem:after { + top: 0; + right: 0; + bottom: 0; + left: 0; +} + +.mytheme .v-menubar-user-menu .v-menubar-menuitem-selected { + background: transparent; +} + +.mytheme .valo-menu-subtitle { + color: #868686; + margin: 7px 0 7px 19px; + border-bottom: 1px solid #666666; +} + +.mytheme .valo-menu-subtitle [class*="badge"] { + color: #73a5d7; +} + +.mytheme .valo-menuitems { + display: block; +} + +.mytheme .valo-menu-item { + outline: none; + font-weight: 400; + padding: 0 37px 0 19px; + cursor: pointer; + position: relative; + overflow: hidden; + text-shadow: 0 2px 0 rgba(0, 0, 0, 0.05); + -webkit-transition: background-color 300ms, color 60ms; + -moz-transition: background-color 300ms, color 60ms; + transition: background-color 300ms, color 60ms; +} + +.mytheme .valo-menu-item [class*="caption"] { + vertical-align: middle; + display: inline-block; + width: 90%; + max-width: 15em; + padding-right: 19px; + text-overflow: ellipsis; + overflow: hidden; +} + +.mytheme .valo-menu-item [class*="badge"] { + color: #73a5d7; +} + +.mytheme .valo-menu-item.selected { + background: #434343; +} + +.mytheme .valo-menu-item.selected .v-icon { + color: #197de1; +} + +.mytheme .valo-menu-item.selected [class*="badge"] { + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + color: #c8dbed; +} + +.mytheme .valo-menu-item:focus, .mytheme .valo-menu-item:hover, .mytheme .valo-menu-item.selected { + color: white; +} + +.mytheme .valo-menu-item span.v-icon { + min-width: 1em; + margin-right: 19px; + text-align: center; + vertical-align: middle; + -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(black), to(rgba(0, 0, 0, 0.75))); +} + +.mytheme .valo-menu-item span.v-icon + span { + margin-left: 0; +} + +.mytheme .valo-menu-item [class*="badge"] { + background-color: #585858; + -webkit-transition: background-color 300ms; + -moz-transition: background-color 300ms; + transition: background-color 300ms; + line-height: 1; + padding: 4px 6px; + min-width: 11px; + text-align: center; + top: 4px; + border-radius: 4px; +} + +.mytheme .valo-menu-part.large-icons { + background-color: #4b4b4b; + min-width: 74px; + max-width: 111px; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-title { + font-size: 12px; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-title .v-label-undef-w { + white-space: normal; +} + +.mytheme .valo-menu-part.large-icons .v-menubar-user-menu { + margin-left: 0; + margin-right: 0; + font-size: 11px; +} + +.mytheme .valo-menu-part.large-icons .v-menubar-user-menu img.v-icon { + width: 28px; + height: 28px; +} + +.mytheme .valo-menu-part.large-icons [class*="subtitle"] { + margin: 9px 0 0; + padding: 7px 25px 7px 9px; + line-height: 1; + border: none; + text-overflow: ellipsis; + overflow: hidden; + background: #3c3c3c; + font-size: 13px; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); +} + +.mytheme .valo-menu-part.large-icons [class*="subtitle"] [class*="badge"] { + right: 9px; +} + +.mytheme .valo-menu-part.large-icons [class*="subtitle"] + .valo-menu-item { + border-top: none; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-item { + display: block; + font-size: 26px; + line-height: 1; + padding: 12px; + text-align: center; + border-top: 1px solid #555555; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-item:first-child { + border-top: none; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-item [class*="caption"] { + display: block; + width: auto; + margin: 0.3em 0 0; + padding: 0; + font-size: 11px; + line-height: 1.3; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-item .v-icon { + margin: 0; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-item span.v-icon { + opacity: 0.8; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-item.selected { + background: #434343; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-item.selected .v-icon { + opacity: 1; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-item.selected [class*="badge"] { + border-color: #434343; +} + +.mytheme .valo-menu-part.large-icons .valo-menu-item [class*="badge"] { + padding-left: 4px; + padding-right: 4px; + top: 7px; + right: 7px; + border: 2px solid #4b4b4b; +} + +.mytheme .valo-menu-logo { + display: block; + overflow: hidden; + width: 44px !important; + height: 44px; + border-radius: 4px; + text-align: center; + background-color: #197de1; + background-image: -webkit-linear-gradient(top, #1b87e3 2%, #166ed5 98%); + background-image: linear-gradient(to bottom,#1b87e3 2%, #166ed5 98%); + color: white; + font-size: 25px; + line-height: 44px; + margin: 19px auto; + -webkit-box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); +} + +.mytheme .valo-menu-logo:focus { + outline: none; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part { + background-color: #4b4b4b; + min-width: 74px; + max-width: 111px; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-title { + font-size: 12px; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-title .v-label-undef-w { + white-space: normal; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .v-menubar-user-menu { + margin-left: 0; + margin-right: 0; + font-size: 11px; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .v-menubar-user-menu img.v-icon { + width: 28px; + height: 28px; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part [class*="subtitle"] { + margin: 9px 0 0; + padding: 7px 25px 7px 9px; + line-height: 1; + border: none; + text-overflow: ellipsis; + overflow: hidden; + background: #3c3c3c; + font-size: 13px; + box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05); +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part [class*="subtitle"] [class*="badge"] { + right: 9px; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part [class*="subtitle"] + .valo-menu-item { + border-top: none; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-item { + display: block; + font-size: 26px; + line-height: 1; + padding: 12px; + text-align: center; + border-top: 1px solid #555555; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-item:first-child { + border-top: none; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-item [class*="caption"] { + display: block; + width: auto; + margin: 0.3em 0 0; + padding: 0; + font-size: 11px; + line-height: 1.3; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-item .v-icon { + margin: 0; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-item span.v-icon { + opacity: 0.8; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-item.selected { + background: #434343; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-item.selected .v-icon { + opacity: 1; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-item.selected [class*="badge"] { + border-color: #434343; +} + +.mytheme .valo-menu-responsive[width-range~="801px-1100px"] .valo-menu-part .valo-menu-item [class*="badge"] { + padding-left: 4px; + padding-right: 4px; + top: 7px; + right: 7px; + border: 2px solid #4b4b4b; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] { + padding-top: 37px; + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .v-loading-indicator { + top: 37px; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] > .v-widget { + position: relative !important; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menu { + border-right: none; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menu-part { + overflow: visible; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menu-toggle { + display: inline-block; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menu-title { + position: fixed; + z-index: 100; + top: 0; + left: 0; + right: 0; + height: 37px !important; + padding-top: 0; + padding-bottom: 0; + -webkit-backface-visibility: hidden; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menu .v-menubar-user-menu { + position: fixed; + z-index: 100; + top: 0; + right: 0; + margin: 0; + padding: 0; + height: 37px; + color: #97bee5; + max-width: 30%; + -webkit-backface-visibility: hidden; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menu .v-menubar-user-menu .v-menubar-menuitem { + line-height: 36px; + white-space: nowrap; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menu .v-menubar-user-menu img.v-icon { + display: inline-block; + margin: 0 6px 0 0; + width: 19px; + height: 19px; + border-radius: 10px; + border: none; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menuitems { + height: 100%; + background-color: #4b4b4b; + background-image: -webkit-linear-gradient(right, #414141 0%, #4b4b4b 9px); + background-image: linear-gradient(to left,#414141 0%, #4b4b4b 9px); + color: #a5a5a5; + font-size: 14px; + line-height: 30px; + border-right: 1px solid #3b3b3b; + white-space: nowrap; + position: fixed; + z-index: 9000; + top: 37px; + bottom: 0; + height: auto; + max-width: 100%; + overflow: auto; + padding: 19px 0; + -webkit-transform: translatex(-100%); + -moz-transform: translatex(-100%); + -ms-transform: translatex(-100%); + -o-transform: translatex(-100%); + transform: translatex(-100%); + -webkit-transition: all 300ms; + -moz-transition: all 300ms; + transition: all 300ms; +} + +.mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menu-visible .valo-menuitems, .mytheme .valo-menu-responsive[width-range~="0-800px"] .valo-menu-hover:hover .valo-menuitems { + -webkit-transform: translatex(0%); + -moz-transform: translatex(0%); + -ms-transform: translatex(0%); + -o-transform: translatex(0%); + transform: translatex(0%); +} + +.mytheme .valo-menu-responsive[width-range~="0-500px"] .valo-menu-toggle .v-button-caption { + display: none; +} + +.mytheme .valo-menu-responsive[width-range~="0-500px"] .valo-menu .v-menubar-user-menu .v-menubar-menuitem-caption { + display: inline-block; + width: 19px; + overflow: hidden; +} \ No newline at end of file diff --git a/vaadin/src/main/webapp/VAADIN/themes/mytheme/styles.scss b/vaadin/src/main/webapp/VAADIN/themes/mytheme/styles.scss new file mode 100644 index 0000000000..bba1d493c0 --- /dev/null +++ b/vaadin/src/main/webapp/VAADIN/themes/mytheme/styles.scss @@ -0,0 +1,11 @@ +@import "mytheme.scss"; +@import "addons.scss"; + +// This file prefixes all rules with the theme name to avoid causing conflicts with other themes. +// The actual styles should be defined in mytheme.scss + +.mytheme { + @include addons; + @include mytheme; + +} diff --git a/vavr/README.md b/vavr/README.md index e79e3269d5..c4155c2680 100644 --- a/vavr/README.md +++ b/vavr/README.md @@ -3,3 +3,5 @@ - [Guide to Try in Vavr](http://www.baeldung.com/javaslang-try) - [Guide to Pattern Matching in Vavr](http://www.baeldung.com/javaslang-pattern-matching) - [Property Testing Example With Vavr](http://www.baeldung.com/javaslang-property-testing) +- [Exceptions in Lambda Expression Using Vavr](http://www.baeldung.com/exceptions-using-vavr) +- [Vavr (ex-Javaslang) Support in Spring Data](http://www.baeldung.com/spring-vavr) diff --git a/vavr/pom.xml b/vavr/pom.xml index 5356417b3e..d35a408389 100644 --- a/vavr/pom.xml +++ b/vavr/pom.xml @@ -6,10 +6,11 @@ 1.0 vavr - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT + + org.springframework.boot + spring-boot-starter-parent + 2.0.0.BUILD-SNAPSHOT + @@ -24,9 +25,48 @@ junit ${junit.version}
- + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + + + + org.springframework.boot + spring-boot-starter-test + + + + + + spring-snapshot + Spring Snapshot Repository + https://repo.spring.io/snapshot + + true + + + + snapshots + libs-snapshot + https://repo.spring.io/libs-snapshot + + + + + + spring-snapshots + http://repo.spring.io/snapshot + + + + 1.8 0.9.0 4.12 diff --git a/vavr/src/main/java/com/baeldung/Application.java b/vavr/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..d58049fb35 --- /dev/null +++ b/vavr/src/main/java/com/baeldung/Application.java @@ -0,0 +1,11 @@ +package com.baeldung; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/vavr/src/main/java/com/baeldung/repositories/VavrUserRepository.java b/vavr/src/main/java/com/baeldung/repositories/VavrUserRepository.java new file mode 100644 index 0000000000..a3dd7937f7 --- /dev/null +++ b/vavr/src/main/java/com/baeldung/repositories/VavrUserRepository.java @@ -0,0 +1,18 @@ +package com.baeldung.repositories; + +import org.springframework.data.repository.Repository; + +import com.baeldung.vavr.User; + +import io.vavr.collection.Seq; +import io.vavr.control.Option; + +public interface VavrUserRepository extends Repository { + + Option findById(long id); + + Seq findByName(String name); + + User save(User user); + +} diff --git a/vavr/src/main/java/com/baeldung/vavr/User.java b/vavr/src/main/java/com/baeldung/vavr/User.java new file mode 100644 index 0000000000..69dd9aea24 --- /dev/null +++ b/vavr/src/main/java/com/baeldung/vavr/User.java @@ -0,0 +1,32 @@ +package com.baeldung.vavr; + +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; + +@Entity +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + + private String name; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/vavr/src/main/java/com/baeldung/vavr/either/EitherDemo.java b/vavr/src/main/java/com/baeldung/vavr/either/EitherDemo.java new file mode 100644 index 0000000000..95f8191342 --- /dev/null +++ b/vavr/src/main/java/com/baeldung/vavr/either/EitherDemo.java @@ -0,0 +1,37 @@ +package com.baeldung.vavr.either; + +import java.util.HashMap; +import java.util.Map; + +import io.vavr.control.Either; + +public class EitherDemo { + + public static Object[] computeWithoutEitherUsingArray(int marks) { + Object[] results = new Object[2]; + if (marks < 85) { + results[0] = "Marks not acceptable"; + } else { + results[1] = marks; + } + return results; + } + + public static Map computeWithoutEitherUsingMap(int marks) { + Map results = new HashMap<>(); + if (marks < 85) { + results.put("FAILURE", "Marks not acceptable"); + } else { + results.put("SUCCESS", marks); + } + return results; + } + + static Either computeWithEither(int marks) { + if (marks < 85) { + return Either.left("Marks not acceptable"); + } else { + return Either.right(marks); + } + } +} diff --git a/vavr/src/test/java/com/baeldung/vavr/PatternMatchingUnitTest.java b/vavr/src/test/java/com/baeldung/vavr/PatternMatchingUnitTest.java index ef5afe0e29..1adff2e845 100644 --- a/vavr/src/test/java/com/baeldung/vavr/PatternMatchingUnitTest.java +++ b/vavr/src/test/java/com/baeldung/vavr/PatternMatchingUnitTest.java @@ -100,13 +100,11 @@ public class PatternMatchingUnitTest { }))); } - - - public void displayEven() { + private void displayEven() { System.out.println("Input is even"); } - public void displayOdd() { + private void displayOdd() { System.out.println("Input is odd"); } } diff --git a/vavr/src/test/java/com/baeldung/vavr/collections/CollectionAPIUnitTest.java b/vavr/src/test/java/com/baeldung/vavr/collections/CollectionAPIUnitTest.java new file mode 100644 index 0000000000..9f0c48e3ee --- /dev/null +++ b/vavr/src/test/java/com/baeldung/vavr/collections/CollectionAPIUnitTest.java @@ -0,0 +1,274 @@ +package com.baeldung.vavr.collections; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; +import static org.junit.Assert.assertTrue; + +import java.util.Comparator; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import org.junit.Test; + +import io.vavr.Tuple; +import io.vavr.Tuple2; +import io.vavr.collection.Array; +import io.vavr.collection.CharSeq; +import io.vavr.collection.HashSet; +import io.vavr.collection.Iterator; +import io.vavr.collection.List; +import io.vavr.collection.Map; +import io.vavr.collection.Queue; +import io.vavr.collection.Set; +import io.vavr.collection.SortedMap; +import io.vavr.collection.SortedSet; +import io.vavr.collection.Stream; +import io.vavr.collection.TreeMap; +import io.vavr.collection.TreeSet; +import io.vavr.collection.Vector; + +public class CollectionAPIUnitTest { + + @Test + public void givenEmptyList_whenStacked_thenCorrect() { + List intList = List.empty(); + + List anotherList = intList.push(4) + .push(0); + Iterator iterator = anotherList.iterator(); + + assertEquals(new Integer(0), iterator.next()); + assertEquals(new Integer(4), iterator.next()); + } + + @Test + public void givenList_whenPrependTail_thenCorrect() { + List intList = List.of(1, 2, 3); + + List newList = intList.tail() + .prepend(0); + + assertEquals(new Integer(1), intList.get(0)); + assertEquals(new Integer(2), intList.get(1)); + assertEquals(new Integer(3), intList.get(2)); + + assertNotSame(intList.get(0), newList.get(0)); + assertEquals(new Integer(0), newList.get(0)); + assertSame(intList.get(1), newList.get(1)); + assertSame(intList.get(2), newList.get(2)); + } + + @Test + public void givenQueue_whenEnqueued_thenCorrect() { + Queue queue = Queue.of(1, 2, 3); + Queue secondQueue = queue.enqueue(4) + .enqueue(5); + + assertEquals(3, queue.size()); + assertEquals(5, secondQueue.size()); + + Tuple2> result = secondQueue.dequeue(); + Integer headValue = result.apply((head, tail) -> head); + assertEquals(new Integer(1), headValue); + + Iterator iterator = result.apply((head, tail) -> tail.iterator()); + + assertEquals(new Integer(2), iterator.next()); + assertEquals(new Integer(3), iterator.next()); + assertEquals(new Integer(4), iterator.next()); + assertEquals(new Integer(5), iterator.next()); + } + + @Test + public void givenStream_whenProcessed_thenCorrect() { + Stream intStream = Stream.iterate(0, i -> i + 1) + .take(10); + + assertEquals(10, intStream.size()); + + long evenSum = intStream.filter(i -> i % 2 == 0) + .sum() + .longValue(); + + assertEquals(20, evenSum); + assertEquals(new Integer(5), intStream.get(5)); + } + + @Test + public void givenArray_whenQueried_thenCorrect() { + Array intArray = Array.of(1, 2, 3); + Array newArray = intArray.removeAt(1); + + assertEquals(3, intArray.size()); + assertEquals(2, newArray.size()); + + assertEquals(new Integer(1), intArray.get(0)); + assertEquals(new Integer(2), intArray.get(1)); + assertEquals(new Integer(3), intArray.get(2)); + assertEquals(new Integer(3), newArray.get(1)); + } + + @Test + public void givenVector_whenQueried_thenCorrect() { + Vector intVector = Vector.range(1, 5); + Vector newVector = intVector.replace(2, 6); + + assertEquals(4, intVector.size()); + assertEquals(4, newVector.size()); + + assertEquals(new Integer(1), intVector.get(0)); + assertEquals(new Integer(2), intVector.get(1)); + assertEquals(new Integer(3), intVector.get(2)); + assertEquals(new Integer(6), newVector.get(1)); + } + + @Test + public void givenCharSeq_whenProcessed_thenCorrect() { + CharSeq chars = CharSeq.of("vavr"); + CharSeq newChars = chars.replace('v', 'V'); + + assertEquals(4, chars.size()); + assertEquals(4, newChars.size()); + + assertEquals('v', chars.charAt(0)); + assertEquals('V', newChars.charAt(0)); + assertEquals("Vavr", newChars.mkString()); + } + + @Test + public void givenHashSet_whenModified_thenCorrect() { + HashSet set = HashSet.of("Red", "Green", "Blue"); + HashSet newSet = set.add("Yellow"); + + assertEquals(3, set.size()); + assertEquals(4, newSet.size()); + assertFalse(set.contains("Yellow")); + assertTrue(newSet.contains("Yellow")); + } + + @Test + public void givenSortedSet_whenIterated_thenCorrect() { + SortedSet set = TreeSet.of("Red", "Green", "Blue"); + + Iterator iterator = set.iterator(); + assertEquals("Blue", iterator.next()); + assertEquals("Green", iterator.next()); + assertEquals("Red", iterator.next()); + } + + @Test + public void givenSortedSet_whenReversed_thenCorrect() { + SortedSet set = TreeSet.of(Comparator.reverseOrder(), "Green", "Red", "Blue"); + + Iterator iterator = set.iterator(); + assertEquals("Red", iterator.next()); + assertEquals("Green", iterator.next()); + assertEquals("Blue", iterator.next()); + } + + @Test + public void givenMap_whenIterated_thenCorrect() { + Map> map = List.rangeClosed(0, 10) + .groupBy(i -> i % 2); + + assertEquals(2, map.size()); + + Iterator>> iterator = map.iterator(); + assertEquals(6, iterator.next() + ._2() + .size()); + assertEquals(5, iterator.next() + ._2() + .size()); + } + + @Test + public void givenTreeMap_whenIterated_thenCorrect() { + SortedMap map = TreeMap.of(3, "Three", 2, "Two", 4, "Four", 1, "One"); + + Iterator> iterator = map.iterator(); + assertEquals(new Integer(1), iterator.next() + ._1()); + assertEquals(new Integer(2), iterator.next() + ._1()); + assertEquals(new Integer(3), iterator.next() + ._1()); + } + + @Test + public void givenJavaList_whenConverted_thenCorrect() { + java.util.List javaList = java.util.Arrays.asList(1, 2, 3, 4); + List vavrList = List.ofAll(javaList); + + assertEquals(4, vavrList.size()); + assertEquals(new Integer(1), vavrList.head()); + + java.util.stream.Stream javaStream = javaList.stream(); + Set vavrSet = HashSet.ofAll(javaStream); + + assertEquals(4, vavrSet.size()); + assertEquals(new Integer(2), vavrSet.tail() + .head()); + } + + @Test + public void givenJavaStream_whenCollected_thenCorrect() { + List vavrList = IntStream.range(1, 10) + .boxed() + .filter(i -> i % 2 == 0) + .collect(List.collector()); + + assertEquals(4, vavrList.size()); + assertEquals(new Integer(2), vavrList.head()); + } + + @Test + public void givenVavrList_whenConverted_thenCorrect() { + Integer[] array = List.of(1, 2, 3) + .toJavaArray(Integer.class); + assertEquals(3, array.length); + + java.util.Map map = List.of("1", "2", "3") + .toJavaMap(i -> Tuple.of(i, Integer.valueOf(i))); + assertEquals(new Integer(2), map.get("2")); + } + + @Test + public void givenVavrList_whenCollected_thenCorrect() { + java.util.Set javaSet = List.of(1, 2, 3) + .collect(Collectors.toSet()); + + assertEquals(3, javaSet.size()); + assertEquals(new Integer(1), javaSet.iterator() + .next()); + } + + @Test + public void givenVavrList_whenConvertedView_thenCorrect() { + java.util.List javaList = List.of(1, 2, 3) + .asJavaMutable(); + javaList.add(4); + + assertEquals(new Integer(4), javaList.get(3)); + } + + @Test(expected = UnsupportedOperationException.class) + public void givenVavrList_whenConvertedView_thenException() { + java.util.List javaList = List.of(1, 2, 3) + .asJava(); + + assertEquals(new Integer(3), javaList.get(2)); + javaList.add(4); + } + + @Test + public void givenList_whenSquared_thenCorrect() { + List vavrList = List.of(1, 2, 3); + Number sum = vavrList.map(i -> i * i) + .sum(); + + assertEquals(14L, sum); + } +} diff --git a/vavr/src/test/java/com/baeldung/vavr/either/EitherUnitTest.java b/vavr/src/test/java/com/baeldung/vavr/either/EitherUnitTest.java new file mode 100644 index 0000000000..6b0a34f9e4 --- /dev/null +++ b/vavr/src/test/java/com/baeldung/vavr/either/EitherUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.vavr.either; + +import io.vavr.control.Either; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class EitherUnitTest { + + @Test + public void givenMarks_whenPassNumber_thenExpectNumber() { + Either result = EitherDemo.computeWithEither(100); + int marks = result.right() + .getOrElseThrow(x -> new IllegalStateException()); + + assertEquals(100, marks); + } + + @Test + public void givenMarks_whenFailNumber_thenExpectErrorMesssage() { + Either result = EitherDemo.computeWithEither(50); + String error = result.left() + .getOrNull(); + + assertEquals("Marks not acceptable", error); + } + + @Test + public void givenPassMarks_whenModified_thenExpectNumber() { + Either result = EitherDemo.computeWithEither(90); + int marks = result.right() + .map(x -> x * 2) + .get(); + + assertEquals(180, marks); + } + +} diff --git a/vavr/src/test/java/com/baeldung/vavr/repositories/VavrRepositoryIntegrationTest.java b/vavr/src/test/java/com/baeldung/vavr/repositories/VavrRepositoryIntegrationTest.java new file mode 100644 index 0000000000..c2e9f377dd --- /dev/null +++ b/vavr/src/test/java/com/baeldung/vavr/repositories/VavrRepositoryIntegrationTest.java @@ -0,0 +1,47 @@ +package com.baeldung.vavr.repositories; + +import com.baeldung.Application; +import com.baeldung.repositories.VavrUserRepository; +import com.baeldung.vavr.User; + +import io.vavr.collection.Seq; +import io.vavr.control.Option; + +import org.junit.Test; +import org.junit.Before; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import static org.junit.Assert.*; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class VavrRepositoryIntegrationTest { + + @Autowired + private VavrUserRepository userRepository; + + @Before + public void setup() { + User user1 = new User(); + user1.setName("John"); + User user2 = new User(); + user2.setName("John"); + + userRepository.save(user1); + userRepository.save(user2); + } + + @Test + public void whenAddUsers_thenGetUsers() { + Option user = userRepository.findById(1L); + assertFalse(user.isEmpty()); + assertTrue(user.get().getName().equals("John")); + + Seq users = userRepository.findByName("John"); + assertEquals(2, users.size()); + } + +} diff --git a/video-tutorials/jackson-annotations/pom.xml b/video-tutorials/jackson-annotations/pom.xml index 853c84a1b8..e44611fab0 100644 --- a/video-tutorials/jackson-annotations/pom.xml +++ b/video-tutorials/jackson-annotations/pom.xml @@ -164,7 +164,7 @@ 2.5 - 2.2.26 + 2.8.9 4.4.1 4.5 diff --git a/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/deserialization/jsoncreator/JsonCreatorUnitTest.java b/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/deserialization/jsoncreator/JsonCreatorUnitTest.java index 1b1986417d..33c96acf52 100644 --- a/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/deserialization/jsoncreator/JsonCreatorUnitTest.java +++ b/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/deserialization/jsoncreator/JsonCreatorUnitTest.java @@ -21,10 +21,10 @@ public class JsonCreatorUnitTest { // arrange String authorJson = - "{" + - " \"christianName\": \"Alex\"," + - " \"surname\": \"Theedom\"" + - "}"; + "{" + + " \"christianName\": \"Alex\"," + + " \"surname\": \"Theedom\"" + + "}"; // act final Author author = new ObjectMapper().readerFor(Author.class).readValue(authorJson); diff --git a/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonfilter/JsonFilterUnitTest.java b/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonfilter/JsonFilterUnitTest.java index 133f8b1f21..5491168f9b 100644 --- a/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonfilter/JsonFilterUnitTest.java +++ b/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonfilter/JsonFilterUnitTest.java @@ -24,7 +24,7 @@ public class JsonFilterUnitTest { // arrange Author author = new Author("Alex", "Theedom"); FilterProvider filters = new SimpleFilterProvider() - .addFilter("authorFilter", SimpleBeanPropertyFilter.filterOutAllExcept("lastName")); + .addFilter("authorFilter", SimpleBeanPropertyFilter.filterOutAllExcept("lastName")); // act String result = new ObjectMapper().writer(filters).writeValueAsString(author); diff --git a/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonformat/JsonFormatUnitTest.java b/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonformat/JsonFormatUnitTest.java index 373e8d716a..6801516dfd 100644 --- a/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonformat/JsonFormatUnitTest.java +++ b/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonformat/JsonFormatUnitTest.java @@ -32,8 +32,8 @@ public class JsonFormatUnitTest { Date date = df.parse(toParse); Book book = new Book( - "Design Patterns: Elements of Reusable Object-oriented Software", - new Author("The", "GoF") + "Design Patterns: Elements of Reusable Object-oriented Software", + new Author("The", "GoF") ); book.setPublished(date); diff --git a/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonproperty/JsonPropertyUnitTest.java b/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonproperty/JsonPropertyUnitTest.java index 191330be86..62f9b498ac 100644 --- a/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonproperty/JsonPropertyUnitTest.java +++ b/video-tutorials/jackson-annotations/src/test/java/com/baeldung/jacksonannotation/general/jsonproperty/JsonPropertyUnitTest.java @@ -22,8 +22,8 @@ public class JsonPropertyUnitTest { // arrange Book book = new Book( - "Design Patterns: Elements of Reusable Object-oriented Software", - new Author("The", "GoF") + "Design Patterns: Elements of Reusable Object-oriented Software", + new Author("The", "GoF") ); book.configureBinding("Hardback");