Removed references to SMS support

Change-Id: Icaea565638a61eeb65db8113d5471559ed48d310
This commit is contained in:
Joe Keen 2015-02-12 17:15:35 -07:00
parent 4c54a95d54
commit 6e7ef66a58
12 changed files with 32 additions and 32 deletions

View File

@ -16,7 +16,7 @@ package monasca.api.domain.model.notificationmethod;
import com.fasterxml.jackson.annotation.JsonCreator;
public enum NotificationMethodType {
EMAIL, SMS, WEBHOOK, PAGERDUTY;
EMAIL, WEBHOOK, PAGERDUTY;
@JsonCreator
public static NotificationMethodType fromJson(String text) {

View File

@ -31,7 +31,7 @@ import monasca.api.domain.model.notificationmethod.NotificationMethodType;
public class CreateNotificationMethodTest extends AbstractModelTest {
public void shouldDeserializeFromJson() throws Exception {
CreateNotificationMethodCommand newNotificationMethod =
new CreateNotificationMethodCommand("MySMS", NotificationMethodType.SMS, "9228675309");
new CreateNotificationMethodCommand("MyEmail", NotificationMethodType.EMAIL, "a@b");
String json = jsonFixture("fixtures/newNotificationMethod.json");
CreateNotificationMethodCommand other = fromJson(json, CreateNotificationMethodCommand.class);
@ -40,7 +40,7 @@ public class CreateNotificationMethodTest extends AbstractModelTest {
public void shouldDeserializeFromJsonLowerCaseEnum() throws Exception {
CreateNotificationMethodCommand newNotificationMethod =
new CreateNotificationMethodCommand("MySMS", NotificationMethodType.SMS, "9228675309");
new CreateNotificationMethodCommand("MyEmail", NotificationMethodType.EMAIL, "a@b");
String json = jsonFixture("fixtures/newNotificationMethodWithLowercaseEnum.json");
CreateNotificationMethodCommand other = fromJson(json, CreateNotificationMethodCommand.class);
@ -50,7 +50,7 @@ public class CreateNotificationMethodTest extends AbstractModelTest {
@Test(expectedExceptions = JsonMappingException.class)
public void shouldDeserializeFromJsonEnumError() throws Exception {
CreateNotificationMethodCommand newNotificationMethod =
new CreateNotificationMethodCommand("MySMS", NotificationMethodType.SMS, "9228675309");
new CreateNotificationMethodCommand("MyEmail", NotificationMethodType.EMAIL, "a@b");
String json = jsonFixture("fixtures/newNotificationMethodWithInvalidEnum.json");
CreateNotificationMethodCommand other = fromJson(json, CreateNotificationMethodCommand.class);

View File

@ -31,7 +31,7 @@ public class NotificationMethodTest extends AbstractModelTest {
public NotificationMethodTest() {
notificationMethod =
new NotificationMethod("123", "MySMS", NotificationMethodType.SMS, "9228675309");
new NotificationMethod("123", "MyEmail", NotificationMethodType.EMAIL, "a@b");
notificationMethod.setLinks(Arrays.asList(new Link("self",
"https://cloudsvc.example.com/v1.0")));
}

View File

@ -60,11 +60,11 @@ public class NotificationMethodMySqlRepositoryImplTest {
protected void beforeMethod() {
handle.execute("truncate table notification_method");
handle
.execute("insert into notification_method (id, tenant_id, name, type, address, created_at, updated_at) values ('123', '444', 'MySMS', 'SMS', '8675309', NOW(), NOW())");
.execute("insert into notification_method (id, tenant_id, name, type, address, created_at, updated_at) values ('123', '444', 'MyEmail', 'EMAIL', 'a@b', NOW(), NOW())");
}
public void shouldCreate() {
NotificationMethod nmA = repo.create("555", "MySMS", NotificationMethodType.SMS, "5555555");
NotificationMethod nmA = repo.create("555", "MyEmail", NotificationMethodType.EMAIL, "a@b");
NotificationMethod nmB = repo.findById("555", nmA.getId());
assertEquals(nmA, nmB);
@ -80,15 +80,15 @@ public class NotificationMethodMySqlRepositoryImplTest {
NotificationMethod nm = repo.findById("444", "123");
assertEquals(nm.getId(), "123");
assertEquals(nm.getType(), NotificationMethodType.SMS);
assertEquals(nm.getAddress(), "8675309");
assertEquals(nm.getType(), NotificationMethodType.EMAIL);
assertEquals(nm.getAddress(), "a@b");
}
public void shouldFind() {
List<NotificationMethod> nms = repo.find("444", null);
assertEquals(nms, Arrays.asList(new NotificationMethod("123", "MySMS",
NotificationMethodType.SMS, "8675309")));
assertEquals(nms, Arrays.asList(new NotificationMethod("123", "MyEmail",
NotificationMethodType.EMAIL, "a@b")));
}
public void shouldUpdate() {

View File

@ -78,9 +78,9 @@ public class AlarmIntegrationTest extends AbstractMonApiResourceTest {
handle.execute("truncate table alarm");
handle.execute("truncate table notification_method");
handle
.execute("insert into notification_method (id, tenant_id, name, type, address, created_at, updated_at) values ('29387234', 'alarm-test', 'MySMS', 'SMS', '8675309', NOW(), NOW())");
.execute("insert into notification_method (id, tenant_id, name, type, address, created_at, updated_at) values ('29387234', 'alarm-test', 'MyEmail', 'EMAIL', 'a@b', NOW(), NOW())");
handle
.execute("insert into notification_method (id, tenant_id, name, type, address, created_at, updated_at) values ('77778687', 'alarm-test', 'MySMS', 'SMS', '8675309', NOW(), NOW())");
.execute("insert into notification_method (id, tenant_id, name, type, address, created_at, updated_at) values ('77778687', 'alarm-test', 'MyEmail', 'EMAIL', 'a@b', NOW(), NOW())");
mysqlDb.close(handle);
repo = new AlarmDefinitionMySqlRepositoryImpl(mysqlDb);

View File

@ -56,7 +56,7 @@ public class NotificationMethodIntegrationTest extends AbstractMonApiResourceTes
Handle handle = db.open();
handle.execute("truncate table notification_method");
handle
.execute("insert into notification_method (id, tenant_id, name, type, address, created_at, updated_at) values ('29387234', 'notification-method-test', 'MySMS', 'SMS', '8675309', NOW(), NOW())");
.execute("insert into notification_method (id, tenant_id, name, type, address, created_at, updated_at) values ('29387234', 'notification-method-test', 'MyEmaila', 'EMAIL', 'a@b', NOW(), NOW())");
db.close(handle);
repo = new NotificationMethodMySqlRepositoryImpl(db);
@ -76,7 +76,7 @@ public class NotificationMethodIntegrationTest extends AbstractMonApiResourceTes
// Fixtures
notificationMethod =
new NotificationMethod("123", "Joe's SMS", NotificationMethodType.SMS, "8675309");
new NotificationMethod("123", "Joe's Email", NotificationMethodType.EMAIL, "a@b");
}
public void shouldCreate() throws Exception {
@ -106,7 +106,7 @@ public class NotificationMethodIntegrationTest extends AbstractMonApiResourceTes
.header("X-Tenant-Id", TENANT_ID)
.type(MediaType.APPLICATION_JSON)
.post(ClientResponse.class,
new CreateNotificationMethodCommand("MySMS", NotificationMethodType.SMS, "8675309"));
new CreateNotificationMethodCommand("MyEmail", NotificationMethodType.EMAIL, "a@b"));
assertEquals(response.getStatus(), 409);
}

View File

@ -43,14 +43,14 @@ public class NotificationMethodResourceTest extends AbstractMonApiResourceTest {
protected void setupResources() throws Exception {
super.setupResources();
notificationMethod =
new NotificationMethod("123", "Joe's SMS", NotificationMethodType.SMS, "8675309");
new NotificationMethod("123", "Joe's Email", NotificationMethodType.EMAIL, "a@b");
notificationMethodWebhook =
new NotificationMethod("1234", "MyWh", NotificationMethodType.WEBHOOK, "http://localhost");
notificationMethodPagerduty =
new NotificationMethod("12345", "MyPd", NotificationMethodType.PAGERDUTY, "nzH2LVRdMzun11HNC2oD");
repo = mock(NotificationMethodRepository.class);
when(repo.create(eq("abc"), eq("MySMS"), eq(NotificationMethodType.SMS), anyString()))
when(repo.create(eq("abc"), eq("MyEmail"), eq(NotificationMethodType.EMAIL), anyString()))
.thenReturn(notificationMethod);
when(repo.create(eq("abc"), eq("MyWh"), eq(NotificationMethodType.WEBHOOK), anyString()))
.thenReturn(notificationMethodWebhook);
@ -69,14 +69,14 @@ public class NotificationMethodResourceTest extends AbstractMonApiResourceTest {
.header("X-Tenant-Id", "abc")
.header("Content-Type", MediaType.APPLICATION_JSON)
.post(ClientResponse.class,
new CreateNotificationMethodCommand("MySMS", NotificationMethodType.SMS, "8675309"));
new CreateNotificationMethodCommand("MyEmail", NotificationMethodType.EMAIL, "a@a.com"));
NotificationMethod newNotificationMethod = response.getEntity(NotificationMethod.class);
String location = response.getHeaders().get("Location").get(0);
assertEquals(response.getStatus(), 201);
assertEquals(location, "/v2.0/notification-methods/" + newNotificationMethod.getId());
assertEquals(newNotificationMethod, notificationMethod);
verify(repo).create(eq("abc"), eq("MySMS"), eq(NotificationMethodType.SMS), anyString());
verify(repo).create(eq("abc"), eq("MyEmail"), eq(NotificationMethodType.EMAIL), anyString());
}
public void shouldUpdate() {
@ -103,7 +103,7 @@ public class NotificationMethodResourceTest extends AbstractMonApiResourceTest {
.header("X-Tenant-Id", "abc")
.header("Content-Type", MediaType.APPLICATION_JSON)
.post(ClientResponse.class,
new CreateNotificationMethodCommand("MySMS", null, "8675309"));
new CreateNotificationMethodCommand("MyEmail", null, "a@b"));
String e = response.getEntity(String.class);
ErrorMessages.assertThat(e).matches("unprocessable_entity", 422,
@ -117,7 +117,7 @@ public class NotificationMethodResourceTest extends AbstractMonApiResourceTest {
.header("X-Tenant-Id", "abc")
.header("Content-Type", MediaType.APPLICATION_JSON)
.post(ClientResponse.class,
new CreateNotificationMethodCommand("MySMS", NotificationMethodType.EMAIL, "a@"));
new CreateNotificationMethodCommand("MyEmail", NotificationMethodType.EMAIL, "a@"));
ErrorMessages.assertThat(response.getEntity(String.class)).matches("unprocessable_entity", 422,
"Address a@ is not of correct format");
@ -130,7 +130,7 @@ public class NotificationMethodResourceTest extends AbstractMonApiResourceTest {
.header("X-Tenant-Id", "abc")
.header("Content-Type", MediaType.APPLICATION_JSON)
.post(ClientResponse.class,
new CreateNotificationMethodCommand("MySMS", NotificationMethodType.EMAIL, "a@f ,"));
new CreateNotificationMethodCommand("MyEmail", NotificationMethodType.EMAIL, "a@f ,"));
ErrorMessages.assertThat(response.getEntity(String.class)).matches("unprocessable_entity", 422,
"Address a@f , is not of correct format");
@ -143,7 +143,7 @@ public class NotificationMethodResourceTest extends AbstractMonApiResourceTest {
.header("X-Tenant-Id", "abc")
.header("Content-Type", MediaType.APPLICATION_JSON)
.post(ClientResponse.class,
new CreateNotificationMethodCommand("MySMS", NotificationMethodType.SMS, ""));
new CreateNotificationMethodCommand("MyEmail", NotificationMethodType.EMAIL, ""));
ErrorMessages.assertThat(response.getEntity(String.class)).matches("unprocessable_entity", 422,
"[address may not be empty (was )");
@ -161,7 +161,7 @@ public class NotificationMethodResourceTest extends AbstractMonApiResourceTest {
"01234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889"
+ "01234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889"
+ "01234567889012345678890123456788901234567889012345678890123456788901234567889012345678890123456788901234567889",
NotificationMethodType.SMS, "a@b"));
NotificationMethodType.EMAIL, "a@b"));
ErrorMessages.assertThat(response.getEntity(String.class)).matches("unprocessable_entity", 422,
"[name size must be between 1 and 250");
@ -176,8 +176,8 @@ public class NotificationMethodResourceTest extends AbstractMonApiResourceTest {
.post(
ClientResponse.class,
new CreateNotificationMethodCommand(
"MySMS",
NotificationMethodType.SMS,
"MyEmail",
NotificationMethodType.EMAIL,
"abcdefghi@0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"));
String e = response.getEntity(String.class);

View File

@ -1 +1 @@
{"name":"MySMS","type":"SMS","address":"9228675309"}
{"name":"MyEmail","type":"EMAIL","address":"a@b"}

View File

@ -1 +1 @@
{"name":"MySMS","type":"smsy","address":"9228675309"}
{"name":"MyEmail","type":"invalid_enum","address":"a@b"}

View File

@ -1 +1 @@
{"name":"MySMS","type":"sms","address":"9228675309"}
{"name":"MyEmail","type":"email","address":"a@b"}

View File

@ -1 +1 @@
{"id":"123","links":[{"rel":"self","href":"https://cloudsvc.example.com/v1.0"}],"name":"MySMS","type":"SMS","address":"9228675309"}
{"id":"123","links":[{"rel":"self","href":"https://cloudsvc.example.com/v1.0"}],"name":"MyEmail","type":"EMAIL","address":"a@b"}

View File

@ -2,7 +2,7 @@ CREATE TABLE `notification_method` (
`id` varchar(36) NOT NULL,
`tenant_id` varchar(36) NOT NULL DEFAULT '',
`name` varchar(250) NOT NULL DEFAULT '',
`type` varchar(10) NOT NULL DEFAULT 'EMAIL' check type in ('EMAIL','SMS', 'WEBHOOK', 'PAGERDUTY'),
`type` varchar(10) NOT NULL DEFAULT 'EMAIL' check type in ('EMAIL', 'WEBHOOK', 'PAGERDUTY'),
`address` varchar(100) NOT NULL DEFAULT '',
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,