forked from spinnaker/echo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,476 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2015 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the 'License'); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an 'AS IS' BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
apply from: "$rootDir/gradle/groovy-module.gradle" | ||
|
||
dependencies { | ||
spinnaker.group("test") | ||
spinnaker.group("bootWeb") | ||
spinnaker.group("retrofitDefault") | ||
compile spinnaker.dependency("groovy") | ||
compile spinnaker.dependency("kork") | ||
compile spinnaker.dependency("rxJava") | ||
compile "javax.mail:mail:1.4.1" | ||
compile "org.springframework:spring-context-support:4.0.8.RELEASE" | ||
compile "org.apache.velocity:velocity:1.7" | ||
compile "org.jsoup:jsoup:1.8.2" | ||
testCompile "com.icegreen:greenmail:1.4.0" | ||
} |
62 changes: 62 additions & 0 deletions
62
echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/Application.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2015 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.echo | ||
|
||
import org.springframework.boot.SpringApplication | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration | ||
import org.springframework.boot.builder.SpringApplicationBuilder | ||
import org.springframework.boot.context.web.SpringBootServletInitializer | ||
import org.springframework.context.annotation.ComponentScan | ||
import org.springframework.context.annotation.Configuration | ||
|
||
/** | ||
* Application entry point. | ||
*/ | ||
@Configuration | ||
@EnableAutoConfiguration | ||
@ComponentScan('com.netflix.spinnaker.echo.config') | ||
class Application extends SpringBootServletInitializer { | ||
|
||
static final Map<String, String> DEFAULT_PROPS = [ | ||
'netflix.environment' : 'test', | ||
'netflix.account' : System.getProperty('netflix.environment', 'test'), | ||
'netflix.stack' : 'test', | ||
'spring.config.location': "${System.properties['user.home']}/.spinnaker/", | ||
'spring.config.name' : 'post', | ||
'spring.profiles.active': "${System.getProperty('netflix.environment', 'test')},local" | ||
] | ||
|
||
static { | ||
applyDefaults() | ||
} | ||
|
||
static void applyDefaults() { | ||
DEFAULT_PROPS.each { k, v -> | ||
System.setProperty(k, System.getProperty(k, v)) | ||
} | ||
} | ||
|
||
@Override | ||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { | ||
builder.sources(Application) | ||
} | ||
|
||
static void main(_) { | ||
SpringApplication.run this, [] as String[] | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/api/Notification.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package com.netflix.spinnaker.echo.api | ||
|
||
class Notification { | ||
Type notificationType | ||
Collection<String> to | ||
String templateGroup | ||
Severity severity | ||
|
||
Source source | ||
Map<String, Object> additionalContext = [:] | ||
|
||
static class Source { | ||
String executionType | ||
String executionId | ||
String application | ||
} | ||
|
||
static enum Type { | ||
HIPCHAT, | ||
EMAIL, | ||
SMS | ||
} | ||
|
||
static enum Severity { | ||
NORMAL, | ||
HIGH | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/config/ComponentConfig.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2015 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.echo.config | ||
|
||
import com.netflix.appinfo.InstanceInfo | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.ComponentScan | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.context.annotation.FilterType | ||
|
||
/** | ||
* Finds spring beans (@Component, @Resource, @Controller, etc.) on your classpath. | ||
* If you don't like classpath scanning, don't use it, you'll always have the choice. | ||
* I generally exclude @Configuration's from this scan, as picking those up can affect your tests. | ||
*/ | ||
@Configuration | ||
@ComponentScan( | ||
basePackages = ['com.netflix.spinnaker.echo'], | ||
excludeFilters = @ComponentScan.Filter(value = Configuration, type = FilterType.ANNOTATION) | ||
) | ||
class ComponentConfig { | ||
@Bean | ||
InstanceInfo.InstanceStatus instanceStatus() { | ||
InstanceInfo.InstanceStatus.UNKNOWN | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/config/EchoConfig.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2015 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.echo.config | ||
|
||
import static retrofit.Endpoints.newFixedEndpoint | ||
|
||
import com.netflix.spinnaker.echo.echo.EchoService | ||
import groovy.transform.CompileStatic | ||
import groovy.util.logging.Slf4j | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import retrofit.Endpoint | ||
import retrofit.RestAdapter | ||
import retrofit.RestAdapter.LogLevel | ||
import retrofit.client.Client | ||
|
||
@Configuration | ||
@Slf4j | ||
@CompileStatic | ||
class EchoConfig { | ||
|
||
@Bean | ||
Endpoint echoEndpoint(@Value('${echo.baseUrl}') String echoBaseUrl) { | ||
newFixedEndpoint(echoBaseUrl) | ||
} | ||
|
||
@Bean | ||
EchoService echoService(Endpoint echoEndpoint, Client retrofitClient, LogLevel retrofitLogLevel) { | ||
|
||
log.info('echo service loaded') | ||
|
||
new RestAdapter.Builder() | ||
.setEndpoint(echoEndpoint) | ||
.setClient(retrofitClient) | ||
.setLogLevel(retrofitLogLevel) | ||
.build() | ||
.create(EchoService) | ||
} | ||
|
||
} |
38 changes: 38 additions & 0 deletions
38
echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/config/EmailConfig.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2015 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.echo.config | ||
|
||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.mail.javamail.JavaMailSender | ||
import org.springframework.mail.javamail.JavaMailSenderImpl | ||
|
||
/** | ||
* Configuration for the mail service | ||
*/ | ||
@Configuration | ||
class EmailConfig { | ||
|
||
@Bean | ||
JavaMailSender mailSender(@Value('${mail.host}') String host) { | ||
JavaMailSenderImpl sender = new JavaMailSenderImpl() | ||
sender.setHost(host) | ||
sender | ||
} | ||
|
||
} |
54 changes: 54 additions & 0 deletions
54
echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/config/HipchatConfig.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright 2015 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.echo.config | ||
|
||
import static retrofit.Endpoints.newFixedEndpoint | ||
|
||
import com.netflix.spinnaker.echo.hipchat.HipchatService | ||
import groovy.transform.CompileStatic | ||
import groovy.util.logging.Slf4j | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import retrofit.Endpoint | ||
import retrofit.RestAdapter | ||
import retrofit.client.Client | ||
|
||
@Configuration | ||
@Slf4j | ||
@CompileStatic | ||
class HipchatConfig { | ||
|
||
@Bean | ||
Endpoint hipchatEndpoint(@Value('${hipchat.baseUrl}') String hipchatBaseUrl) { | ||
newFixedEndpoint(hipchatBaseUrl) | ||
} | ||
|
||
@Bean | ||
HipchatService hipchatService(Endpoint hipchatEndpoint, Client retrofitClient, RestAdapter.LogLevel retrofitLogLevel) { | ||
|
||
log.info('hipchat service loaded') | ||
|
||
new RestAdapter.Builder() | ||
.setEndpoint(hipchatEndpoint) | ||
.setClient(retrofitClient) | ||
.setLogLevel(retrofitLogLevel) | ||
.build() | ||
.create(HipchatService) | ||
} | ||
|
||
} |
64 changes: 64 additions & 0 deletions
64
echo-notifications/src/main/groovy/com/netflix/spinnaker/echo/config/MayoConfig.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright 2015 Netflix, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.netflix.spinnaker.echo.config | ||
|
||
import static retrofit.Endpoints.newFixedEndpoint | ||
|
||
import com.netflix.spinnaker.echo.mayo.MayoService | ||
import groovy.transform.CompileStatic | ||
import groovy.util.logging.Slf4j | ||
import org.springframework.beans.factory.annotation.Value | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import retrofit.Endpoint | ||
import retrofit.RestAdapter | ||
import retrofit.RestAdapter.LogLevel | ||
import retrofit.client.Client | ||
import retrofit.client.OkClient | ||
|
||
@Configuration | ||
@Slf4j | ||
@CompileStatic | ||
class MayoConfig { | ||
|
||
@Bean | ||
Client retrofitClient() { | ||
new OkClient() | ||
} | ||
|
||
@Bean | ||
LogLevel retrofitLogLevel() { | ||
LogLevel.NONE | ||
} | ||
|
||
@Bean | ||
Endpoint mayoEndpoint(@Value('${mayo.baseUrl}') String mayoBaseUrl) { | ||
newFixedEndpoint(mayoBaseUrl) | ||
} | ||
|
||
@Bean | ||
MayoService mayoService(Endpoint mayoEndpoint, Client retrofitClient, LogLevel retrofitLogLevel) { | ||
log.info('mayo service loaded') | ||
new RestAdapter.Builder() | ||
.setEndpoint(mayoEndpoint) | ||
.setClient(retrofitClient) | ||
.setLogLevel(retrofitLogLevel) | ||
.build() | ||
.create(MayoService) | ||
} | ||
|
||
} |
Oops, something went wrong.