Skip to content

Commit

Permalink
Fixed swagger check
Browse files Browse the repository at this point in the history
  • Loading branch information
soffokl committed Mar 29, 2019
1 parent a1b5668 commit 3d7b563
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions bin/check_swagger
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ source bin/helpers/output.sh
bin/swagger_generate
if [ $? -ne 0 ]; then
print_error "Swagger generation failed"
exit 1
fi

# validate
Expand Down
2 changes: 1 addition & 1 deletion session/create_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (consumer *createConsumer) Consume(requestPtr interface{}) (response interf
case nil:
if destroyCallback != nil {
go func() {
<-sessionInstance.Done
<-sessionInstance.done
destroyCallback()
}()
}
Expand Down
2 changes: 1 addition & 1 deletion session/dto.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ type BalanceTracker interface {
type Session struct {
ID ID
ConsumerID identity.Identity
Done chan struct{}
Config ServiceConfiguration
CreatedAt time.Time
Last bool
done chan struct{}
}

// ServiceConfiguration defines service configuration from underlying transport mechanism to be passed to remote party
Expand Down
6 changes: 3 additions & 3 deletions session/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (manager *Manager) Create(consumerID identity.Identity, issuerID identity.I
return
}
sessionInstance.ConsumerID = consumerID
sessionInstance.Done = make(chan struct{})
sessionInstance.done = make(chan struct{})
sessionInstance.Config = config
sessionInstance.CreatedAt = time.Now().UTC()

Expand All @@ -140,7 +140,7 @@ func (manager *Manager) Create(consumerID identity.Identity, issuerID identity.I

// stop the balance tracker once the session is finished
go func() {
<-sessionInstance.Done
<-sessionInstance.done
balanceTracker.Stop()
}()

Expand Down Expand Up @@ -193,7 +193,7 @@ func (manager *Manager) Destroy(consumerID identity.Identity, sessionID string)
}

manager.sessionStorage.Remove(ID(sessionID))
close(sessionInstance.Done)
close(sessionInstance.done)

return nil
}
4 changes: 2 additions & 2 deletions session/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ func TestManager_Create_StoresSession(t *testing.T) {

requestConfig := json.RawMessage{}
sessionInstance, err := manager.Create(consumerID, consumerID, currentProposalID, nil, requestConfig)
expectedResult.Done = sessionInstance.Done
expectedResult.done = sessionInstance.done
assert.NoError(t, err)

assert.Equal(t, expectedResult.Config, sessionInstance.Config)
assert.Equal(t, expectedResult.Last, sessionInstance.Last)
assert.Equal(t, expectedResult.Done, sessionInstance.Done)
assert.Equal(t, expectedResult.done, sessionInstance.done)
assert.Equal(t, expectedResult.ConsumerID, sessionInstance.ConsumerID)
assert.Equal(t, expectedResult.ID, sessionInstance.ID)
assert.False(t, sessionInstance.CreatedAt.IsZero())
Expand Down

0 comments on commit 3d7b563

Please sign in to comment.