This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.knoldus.blogs.controller; | |
import com.knoldus.blogs.models.Blogs; | |
import com.knoldus.blogs.models.BlogsUpdateRequest; | |
import com.knoldus.blogs.repository.BlogRepository; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.web.bind.annotation.DeleteMapping; | |
import org.springframework.web.bind.annotation.GetMapping; | |
import org.springframework.web.bind.annotation.PathVariable; | |
import org.springframework.web.bind.annotation.PostMapping; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.knoldus.blogs.models; | |
import com.couchbase.client.java.repository.annotation.Field; | |
import com.couchbase.client.java.repository.annotation.Id; | |
import lombok.AllArgsConstructor; | |
import lombok.Builder; | |
import lombok.Data; | |
import org.springframework.data.couchbase.core.mapping.Document; | |
import javax.validation.constraints.NotNull; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.knoldus.blogs; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration; | |
import java.util.Collections; | |
import java.util.List; | |
@Configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<parent> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-parent</artifactId> | |
<version>2.1.3.RELEASE</version> | |
</parent> | |
<dependencies> | |
<dependency> | |
<groupId>org.springframework.boot</groupId> | |
<artifactId>spring-boot-starter-web</artifactId> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.Done; | |
import akka.NotUsed; | |
import com.lightbend.lagom.javadsl.api.ServiceCall; | |
import com.lightbend.lagom.javadsl.api.broker.Topic; | |
import com.lightbend.lagom.javadsl.testkit.ProducerStub; | |
import com.lightbend.lagom.javadsl.testkit.ProducerStubFactory; | |
import com.lightbend.lagom.javadsl.testkit.ServiceTest; | |
import org.junit.BeforeClass; | |
import org.junit.Test; | |
import org.knoldus.hello.api.GreetingMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.Done; | |
import akka.NotUsed; | |
import com.lightbend.lagom.javadsl.api.ServiceCall; | |
import com.lightbend.lagom.javadsl.api.broker.Topic; | |
import com.lightbend.lagom.javadsl.testkit.ProducerStub; | |
import com.lightbend.lagom.javadsl.testkit.ProducerStubFactory; | |
import com.lightbend.lagom.javadsl.testkit.ServiceTest; | |
import org.junit.BeforeClass; | |
import org.junit.Test; | |
import org.knoldus.hello.api.GreetingMessage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface HelloService extends Service { | |
ServiceCall<NotUsed, String> hello(String id); | |
ServiceCall<GreetingMessage, Done> useGreeting(String id); | |
Topic<HelloEvent> helloEvents(); | |
@Override default Descriptor descriptor() { | |
return named("hello") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.stream.javadsl.Source; | |
import akka.stream.testkit.TestSubscriber; | |
import akka.stream.testkit.javadsl.TestSink; | |
import com.lightbend.lagom.javadsl.persistence.PersistentEntityRegistry; | |
import com.lightbend.lagom.javadsl.testkit.ServiceTest; | |
import org.junit.BeforeClass; | |
import org.junit.Test; | |
import org.knoldus.hello.api.GreetingMessage; | |
import org.knoldus.hello.api.HelloEvent; | |
import org.knoldus.hello.api.HelloService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static class HelloServiceStub implements HelloService { | |
//1.Receives a ProducerStubFactory that factors ProducerStubs | |
@Inject | |
HelloServiceStub(ProducerStubFactory producerFactory) { | |
//2.Create a stub to request a producer for a specific topic | |
helloProducer = producerFactory.producer(GREETINGS_TOPIC); | |
} | |
@Override | |
public Topic<GreetingMessage> greetingsTopic() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scala> def printAnimals[T <: Animal](animal: ArrayList[T]) = { | |
| for(i <- 0 to animal.size - 1) { | |
| println(animal.get(i)) | |
| }} | |
printAnimals: [T <: Animal](animal: java.util.ArrayList[T])Unit |
NewerOlder