Beispiel #1
0
		logger = log.New(buffer, "", 0)
		queue = mocks.NewQueue()

		transaction = mocks.NewTransaction()
		conn = mocks.NewConnection()
		conn.TransactionCall.Returns.Transaction = transaction

		guidGenerator = mocks.NewGUIDGenerator()
		guid1 := uuid.UUID([16]byte{0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55})
		guid2 := uuid.UUID([16]byte{0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x56})
		guid3 := uuid.UUID([16]byte{0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x57})
		guid4 := uuid.UUID([16]byte{0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x58})
		guidGenerator.GenerateCall.Returns.GUIDs = []*uuid.UUID{&guid1, &guid2, &guid3, &guid4}

		messagesRepo = mocks.NewMessagesRepo()
		enqueuer = services.NewEnqueuer(queue, guidGenerator.Generate, messagesRepo)
		space = cf.CloudControllerSpace{Name: "the-space"}
		org = cf.CloudControllerOrganization{Name: "the-org"}
		reqReceived, _ = time.Parse(time.RFC3339Nano, "2015-06-08T14:40:12.207187819-07:00")
	})

	Describe("Enqueue", func() {
		It("returns the correct types of responses for users", func() {
			users := []services.User{{GUID: "user-1"}, {Email: "*****@*****.**"}, {GUID: "user-3"}, {GUID: "user-4"}}
			responses := enqueuer.Enqueue(conn, users, services.Options{KindID: "the-kind"}, space, org, "the-client", "my-uaa-host", "my.scope", "some-request-id", reqReceived)

			Expect(responses).To(HaveLen(4))
			Expect(responses).To(ConsistOf([]services.Response{
				{
					Status:         "queued",
					Recipient:      "user-1",
Beispiel #2
0
func (m *Mother) Enqueuer() services.Enqueuer {
	return services.NewEnqueuer(m.Queue(), uuid.NewV4, m.MessagesRepo())
}