> On Jan. 18, 2017, 1:43 p.m., Laszlo Puskas wrote: > > ambari-server/src/main/java/org/apache/ambari/server/utils/DefaultTimeSource.java, > > line 29 > > <https://reviews.apache.org/r/55643/diff/1/?file=1606956#file1606956line29> > > > > Why is this abstarction needed? Couldn't we simply use Calendar instead? > > Attila Doroszlai wrote: > If the abstraction is necessary you could use > `com.google.common.base.Ticker` instead.
I wouldn't use j.u.Calendar as it is a horrible monster. The SettingsEntity is given a long time stamp (representing milliseconds, so Google's ticker is not appropriate) each time it is saved. The abstraction is needed to support testing. There are objects that produce timestamped entities. In a test I need to predict what timestamp will be given to the next entity, which is not possible when System.currentTimeMillis() is wired into the code. For this reason I abstracted away System.currentTimeMillis() into an interface that has a default implementation as well as test/mock implementations that produce predictable timestamps. - Balázs Bence ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/55643/#review162065 ----------------------------------------------------------- On Jan. 17, 2017, 9:30 p.m., Balázs Bence Sári wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/55643/ > ----------------------------------------------------------- > > (Updated Jan. 17, 2017, 9:30 p.m.) > > > Review request for Ambari, Attila Doroszlai, Laszlo Puskas, Oliver Szabo, > Robert Nettleton, Sandor Magyari, Sumit Mohanty, and Sebastian Toader. > > > Bugs: AMBARI-19597 > https://issues.apache.org/jira/browse/AMBARI-19597 > > > Repository: ambari > > > Description > ------- > > Specifying the quick links profile should be supported in blueprint based > cluster installation. First implementation will address the possibility of > adding the profile to the cluster creation template. > > > Diffs > ----- > > > ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java > 5e8c803 > > ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java > b7c9e85 > > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterResourceProvider.java > cb30f2d > > ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequest.java > a35da86 > > ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/AcceptAllFilter.java > d784a22 > > ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/Component.java > a1267df > > ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/Filter.java > c551830 > > ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfile.java > c9ac6b4 > > ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilder.java > PRE-CREATION > > ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileEvaluationException.java > 26819e1 > > ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileParser.java > a3ae677 > > ambari-server/src/main/java/org/apache/ambari/server/state/quicklinksprofile/Service.java > 7724852 > > ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java > 7db07a0 > > ambari-server/src/main/java/org/apache/ambari/server/utils/DefaultTimeSource.java > PRE-CREATION > ambari-server/src/main/java/org/apache/ambari/server/utils/TimeSource.java > PRE-CREATION > > ambari-server/src/test/java/org/apache/ambari/server/agent/AgentResourceTest.java > 17b1e27 > > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ProvisionClusterRequestTest.java > 2cf478a > > ambari-server/src/test/java/org/apache/ambari/server/controller/internal/QuickLinkArtifactResourceProviderTest.java > 8c723c9 > > ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinksProfileBuilderTest.java > PRE-CREATION > > ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java > 7e6e5a3 > > ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java > 5c77831 > > Diff: https://reviews.apache.org/r/55643/diff/ > > > Testing > ------- > > - Wrote new unit tests > - Run the unit test suite for ambari-server. No failures. > - Covered the following cases by manual testing: > -- Installing a cluster via blueprint, quick links profile in the cluster > creation template, profile saved the first time > -- Installing a cluster via blueprint, quick links profile in the cluster > creation template, there was an existing quick links profile which was > overwritten during cluster installation > -- Installing a cluster via blueprint, no quick links profile in the > cluster creation template > > > Thanks, > > Balázs Bence Sári > >
