Skip to content

Commit

Permalink
Merge pull request #198 from guardian/refactor-contacts-to-common
Browse files Browse the repository at this point in the history
Refactor specific items to anghammarad-common project so we can use them to test anghammarad-config changes.
  • Loading branch information
sookburt authored Jul 26, 2024
2 parents 8e3adf7 + feceaac commit fceac7a
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.gu.anghammarad

import com.gu.anghammarad.common.Contacts
import com.gu.anghammarad.models.{Configuration, Contact, Message, Notification}
import com.gu.anghammarad.messages.{Messages, SendMessages}

Expand Down
2 changes: 1 addition & 1 deletion anghammarad/src/main/scala/com/gu/anghammarad/Config.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.amazonaws.auth.profile.ProfileCredentialsProvider
import com.amazonaws.regions.Regions
import com.amazonaws.services.s3.AmazonS3Client
import com.amazonaws.services.s3.model.{GetObjectRequest, S3ObjectInputStream}
import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.common.AnghammaradException.Fail

import scala.io.Source
import scala.util.{Success, Try}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gu.anghammarad.messages

import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.models.HangoutMessage
import sttp.client3.{HttpURLConnectionBackend, Response, UriContext, basicRequest}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.gu.anghammarad.messages

import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.Enrichments._
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.models._

import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.gu.anghammarad.serialization

import cats.syntax.either._
import com.amazonaws.services.lambda.runtime.events.SNSEvent
import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.Enrichments._
import com.gu.anghammarad.models._
import io.circe._
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import com.gu.anghammarad.Contacts._
import com.gu.anghammarad.common.Contacts._
import com.gu.anghammarad.models._
import com.gu.anghammarad.serialization.Serialization
import com.gu.anghammarad.testutils.TryValues
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

import scala.io.Source
import scala.util.Try


class ContactsTest extends AnyFreeSpec with Matchers with TryValues {
Expand Down
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ lazy val root = project
lazy val common = project
.settings(
name := "anghammarad-common",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % scalaTestVersion % Test
)
)

lazy val client = project
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import scala.util.{Failure, Try}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.models.{Channel, Contact, Email, EmailAddress, HangoutsChat, HangoutsRoom, Mapping, Message, _}
import com.gu.anghammarad.Targets._
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.common.Targets.{appMatches, awsAccountMatches, githubTeamSlugMatches, includesApp, includesAwsAccount, includesGithubTeamSlug, includesStack, sortMappingsByTargets, stackMatches}
import com.gu.anghammarad.models._

import scala.util.{Success, Try}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import com.gu.anghammarad.models._

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.gu.anghammarad
package com.gu.anghammarad.common

import com.gu.anghammarad.models._
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers


class TargetsTest extends AnyFreeSpec with Matchers {
import com.gu.anghammarad.Targets._
import com.gu.anghammarad.common.Targets._

"includesAwsAccount" - {
"returns false if AwsAccount is enquired about and not present" in {
Expand Down
2 changes: 1 addition & 1 deletion dev/src/main/scala/com/gu/anghammarad/Main.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.gu.anghammarad

import com.gu.anghammarad.AnghammaradException.Fail
import com.gu.anghammarad.common.AnghammaradException.Fail
import com.gu.anghammarad.ArgParser.argParser
import com.gu.anghammarad.models.{EmailAddress, HangoutsRoom, Notification}
import com.gu.anghammarad.serialization.Serialization
Expand Down

0 comments on commit fceac7a

Please sign in to comment.