Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@FrankGasparovic
Copy link

Signed-off-by: Irina [email protected]

@FrankGasparovic
Copy link
Author

@Column(name = "adapter_endpoint", nullable = false)
private String adapterEndpoint;

@Column(name = "adapter_token_url", nullable = false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly see if you can move annotations as applicable from fields to getters

Copy link
Author

@FrankGasparovic FrankGasparovic Mar 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See other related comment,

this.adapterClientSecret = uaaClientSecret;
}

public AttributeAdapterConnectionEntity() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? if needed can we make it private since we dont have setters?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be public if we have the @entity annotation

@Table(name = "attribute_connector")
public class AttributeConnectorEntity {
@Id
@Column(name = "id")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is possible to move annotations on getters which I believe is a better practice read stackoverflow or google for more details?

Copy link
Author

@FrankGasparovic FrankGasparovic Mar 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like unit tests are not passing when we make this move.

private long id;

@Column(name = "refresh_interval_hours", nullable = true)
private int refreshIntervalHours;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do it in seconds?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanjeevchopra discussed with me he wanted the field in the ACS API to be in hours so that the minimum time they can pass is 1 hour. Sanjeev, what do you think? We could:

  1. Change customer field in the public API to be in seconds
  2. Convert from hours to seconds when we store in the DB
  3. Keep it the way it is

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets discuss

  • I suggested this to force a minimum cache time of 1 hour as a design pre-req.
  • To provide flexibility, we can use minutes and enforce a minimum of 60 mins. In case someone doesn't care about latency. Default should be probably 8 hours.
  • on a side not maxCacheIntervalMintues maybe more clear as a name

@JoinColumn(name = "connector_id", referencedColumnName = "id", nullable = false, updatable = false)
private AttributeConnectorEntity connector;

@Column(name = "adapter_endpoint", nullable = false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we have not specified length for the endpoint, please check other fields as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added length of 128

adapter_client_id varchar(128) NOT NULL
);

ALTER TABLE authorization_zone ADD COLUMN resource_attribute_connector integer NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this column should be same type as the one it links to - attribute_connector(id)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that foreign keys must have the same type of the referenced column's type. However, for postgres attribute_connector(id) is defined as bigserial. We can't use this type when defining a nullable foreign key for zone entity as bigserial does not support nullability. Since bigserial is just a wrapper for bigint to support auto-generating sequencing, decided to use bigint for foreign key definition.


ALTER TABLE authorization_zone ADD COLUMN resource_attribute_connector integer NULL;
ALTER TABLE authorization_zone ADD FOREIGN KEY (resource_attribute_connector) REFERENCES attribute_connector(id) ON DELETE CASCADE;
ALTER TABLE authorization_zone ADD COLUMN subject_attribute_connector integer NULL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

private long id;

@Column(name = "refresh_interval_hours", nullable = true)
private int refreshIntervalHours;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets discuss

  • I suggested this to force a minimum cache time of 1 hour as a design pre-req.
  • To provide flexibility, we can use minutes and enforce a minimum of 60 mins. In case someone doesn't care about latency. Default should be probably 8 hours.
  • on a side not maxCacheIntervalMintues maybe more clear as a name

return this.refreshIntervalHours;
}

public Set<AttributeAdapterConnectionEntity> getAttributeAdapters() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAttributeAdapterConnections ?

@JoinColumn(name = "connector_id", referencedColumnName = "id", nullable = false, updatable = false)
private AttributeConnectorEntity connector;

@Column(name = "adapter_endpoint", nullable = false, length = 128)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

128 seems small - please double check other urls we store in acs/uaa. 256 ?

return adapterClientId;
}

public String getUaaClientSecret() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls add a note here that this is temporary until encryption is implemented.

@EnableAutoConfiguration
@ContextConfiguration(classes = { InMemoryDataSourceConfig.class })
@ActiveProfiles(resolver = TestActiveProfilesResolver.class)
public class ZoneRepositoryTest extends AbstractTransactionalTestNGSpringContextTests {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider any negative tests - missing required fields in adapter, field too long etc. Some may belong at the controller layer to assert the correct response codes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were thinking that this would be enforced at the controller level. In the rest api story we already have one test for this, and will add more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, once you squash the commits I can merge

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok it's good to go. Integration tests are passing locally (Jenkins tests won't pass because of connections issues). Please merge so that we can continue with Rest API story.

@sanjeevchopra sanjeevchopra merged commit 61fa6ed into develop Mar 3, 2017
@sanjeevchopra sanjeevchopra deleted the US87141 branch March 3, 2017 21:10
@sanjeevchopra sanjeevchopra self-assigned this Mar 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants