Merge pull request #4276 from eugenp/remove-extra-files
remove eval code, move sms code to package
This commit is contained in:
commit
358f409404
1
pom.xml
1
pom.xml
|
@ -259,6 +259,7 @@
|
|||
<module>jersey</module>
|
||||
<module>java-spi</module>
|
||||
<module>performance-tests</module>
|
||||
<module>twilio</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
package com.baeldung.demo.eventstreamwebfluxdemo;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class EventStreamServer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(EventStreamServer.class, args);
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package com.baeldung.demo.eventstreamwebfluxdemo.client;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
public class EventStreamClient {
|
||||
public static void main(String[] args)
|
||||
{
|
||||
WebClient.create("http://127.0.0.1:8080")
|
||||
.get()
|
||||
.uri("/events")
|
||||
.accept(MediaType.APPLICATION_STREAM_JSON)
|
||||
.retrieve()
|
||||
.bodyToFlux(Long.class)
|
||||
.toStream()
|
||||
.forEach(item -> System.out.println("New event : " + item));
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.baeldung.demo.eventstreamwebfluxdemo.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
@RestController
|
||||
public class EventStreamController
|
||||
{
|
||||
@RequestMapping("/events")
|
||||
public Flux<Long> getServerEvents()
|
||||
{
|
||||
return Flux.interval(Duration.ofMillis(1000));
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package com.baeldung.demo.eventstreamwebfluxdemo;
|
||||
|
||||
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 EventStreamServerTests {
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.baeldung.sms</groupId>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>twilio</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.baeldung.twilio</groupId>
|
||||
<artifactId>sms</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.twilio.sdk</groupId>
|
||||
<artifactId>twilio</artifactId>
|
||||
<version>7.20.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,22 +0,0 @@
|
|||
import com.twilio.Twilio;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
||||
import com.twilio.type.PhoneNumber;
|
||||
|
||||
public class TwilioSmsExample {
|
||||
// Find your Account Sid and Token at twilio.com/console
|
||||
public static final String ACCOUNT_SID = "YOUR_ACCOUNT_SID";
|
||||
public static final String AUTH_TOKEN = "YOUR_ACCOUNT_TOKEN";
|
||||
|
||||
// Create a phone number in the Twilio console
|
||||
public static final String TWILIO_NUMBER = "+13334445555";
|
||||
|
||||
public static void main(String[] args) {
|
||||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
|
||||
Message message = Message.creator(
|
||||
new PhoneNumber("+12227779999"),
|
||||
new PhoneNumber(TWILIO_NUMBER),
|
||||
"Sample Twilio SMS using Java")
|
||||
.create();
|
||||
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
import com.twilio.Twilio;
|
||||
import com.twilio.converter.Promoter;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
||||
import com.twilio.type.PhoneNumber;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
public class TwilioSmsMediaExample {
|
||||
// Find your Account Sid and Token at twilio.com/console
|
||||
public static final String ACCOUNT_SID = "YOUR_ACCOUNT_SID";
|
||||
public static final String AUTH_TOKEN = "YOUR_ACCOUNT_TOKEN";
|
||||
|
||||
// Create a phone number in the Twilio console
|
||||
public static final String TWILIO_NUMBER = "+13334445555";
|
||||
|
||||
public static void main(String[] args) {
|
||||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
|
||||
Message message = Message.creator(
|
||||
new PhoneNumber("+12227779999"),
|
||||
new PhoneNumber(TWILIO_NUMBER),
|
||||
"Sample Twilio MMS using Java")
|
||||
.setMediaUrl(
|
||||
Promoter.listOfOne(
|
||||
URI.create("http://www.baeldung.com/wp-content/uploads/2017/10/icon-javaseries-home.png")))
|
||||
.create();
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import com.twilio.Twilio;
|
||||
import com.twilio.base.ResourceSet;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
||||
|
||||
public class TwilioSmsStatusAsyncExample {
|
||||
// Find your Account Sid and Token at twilio.com/console
|
||||
public static final String ACCOUNT_SID = "YOUR_ACCOUNT_SID";
|
||||
public static final String AUTH_TOKEN = "YOUR_AUTH_TOKEN";
|
||||
|
||||
// Create a phone number in the Twilio console
|
||||
public static final String TWILIO_NUMBER = "+13334445555";
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
|
||||
ListenableFuture<ResourceSet<Message>> future = Message.reader().readAsync();
|
||||
Futures.addCallback(
|
||||
future,
|
||||
new FutureCallback<ResourceSet<Message>>() {
|
||||
public void onSuccess(ResourceSet<Message> messages) {
|
||||
for (Message message : messages) {
|
||||
System.out.println(message.getSid() + " : " + message.getStatus());
|
||||
}
|
||||
}
|
||||
|
||||
public void onFailure(Throwable t) {
|
||||
System.out.println("Failed to get message status: " + t.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
import com.twilio.Twilio;
|
||||
import com.twilio.base.ResourceSet;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
||||
import com.twilio.type.PhoneNumber;
|
||||
|
||||
public class TwilioSmsStatusExample {
|
||||
// Find your Account Sid and Token at twilio.com/console
|
||||
public static final String ACCOUNT_SID = "YOUR_ACCOUNT_SID";
|
||||
public static final String AUTH_TOKEN = "YOUR_ACCOUNT_TOKEN";
|
||||
|
||||
// Create a phone number in the Twilio console
|
||||
public static final String TWILIO_NUMBER = "+13334445555";
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
|
||||
ResourceSet<Message> messages = Message.reader().read();
|
||||
for (Message message : messages) {
|
||||
System.out.println(message.getSid() + " : " + message.getStatus());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
package com.baeldung.twilio.sms;
|
||||
import com.twilio.Twilio;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
||||
import com.twilio.type.PhoneNumber;
|
|
@ -1,3 +1,4 @@
|
|||
package com.baeldung.twilio.sms;
|
||||
import com.twilio.Twilio;
|
||||
import com.twilio.converter.Promoter;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
|
@ -1,3 +1,4 @@
|
|||
package com.baeldung.twilio.sms;
|
||||
import com.google.common.util.concurrent.FutureCallback;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
|
@ -1,3 +1,4 @@
|
|||
package com.baeldung.twilio.sms;
|
||||
import com.twilio.Twilio;
|
||||
import com.twilio.base.ResourceSet;
|
||||
import com.twilio.rest.api.v2010.account.Message;
|
Loading…
Reference in New Issue