Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 03fa5ea67 -> 5287ab113


Revert "AMBARI-18966. Add check to ensure we do not have @Transactional 
annotations on private methods. (Attila Doroszlai via stoader)"

This reverts commit 03fa5ea67a49b898997663cf62cee721715380d4.


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5287ab11
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5287ab11
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5287ab11

Branch: refs/heads/branch-2.5
Commit: 5287ab11310cd3e5a54d39d7192399fff8fe55fc
Parents: 03fa5ea
Author: Toader, Sebastian <stoa...@hortonworks.com>
Authored: Wed Dec 7 11:37:22 2016 +0100
Committer: Toader, Sebastian <stoa...@hortonworks.com>
Committed: Wed Dec 7 11:37:22 2016 +0100

----------------------------------------------------------------------
 ambari-project/pom.xml                          | 41 ---------------
 ambari-server/checkstyle.xml                    | 17 ------
 ambari-server/pom.xml                           |  4 --
 .../internal/AlertTargetResourceProvider.java   |  2 +-
 .../ClusterStackVersionResourceProvider.java    |  4 +-
 .../internal/UpgradeResourceProvider.java       |  2 +-
 .../apache/ambari/server/orm/dao/AlertsDAO.java |  6 +--
 .../apache/ambari/server/state/ServiceImpl.java |  2 +-
 .../server/state/cluster/ClustersImpl.java      |  2 +-
 .../ambari/server/state/host/HostImpl.java      |  2 +-
 .../services/RetryUpgradeActionService.java     |  2 +-
 .../svccomphost/ServiceComponentHostImpl.java   |  2 +-
 .../server/upgrade/UpgradeCatalog240.java       |  4 +-
 pom.xml                                         |  1 -
 utility/pom.xml                                 | 33 +-----------
 ...AvoidTransactionalOnPrivateMethodsCheck.java | 55 --------------------
 .../src/main/resources/checkstyle_packages.xml  | 15 ------
 ...dTransactionalOnPrivateMethodsCheckTest.java | 49 -----------------
 .../InputTransactionalOnPrivateMethods.java     | 46 ----------------
 19 files changed, 15 insertions(+), 274 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-project/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-project/pom.xml b/ambari-project/pom.xml
index 52c9992..a38c6a2 100644
--- a/ambari-project/pom.xml
+++ b/ambari-project/pom.xml
@@ -30,8 +30,6 @@
     <ambari.dir>${project.parent.basedir}</ambari.dir>
     <powermock.version>1.6.3</powermock.version>
     <jetty.version>8.1.19.v20160209</jetty.version>
-    <checkstyle.version>6.19</checkstyle.version> <!-- last version that does 
not require Java 8 -->
-    <checkstyle.skip>false</checkstyle.skip>
   </properties>
   <profiles>
     <profile>
@@ -479,11 +477,6 @@
         <artifactId>jline</artifactId>
         <version>2.11</version>
       </dependency>
-      <dependency>
-        <groupId>com.puppycrawl.tools</groupId>
-        <artifactId>checkstyle</artifactId>
-        <version>${checkstyle.version}</version>
-      </dependency>
     </dependencies>
   </dependencyManagement>
   <build>
@@ -493,40 +486,6 @@
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-surefire-plugin</artifactId>
         </plugin>
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>2.17</version>
-          <executions>
-            <execution>
-              <id>checkstyle</id>
-              <phase>test</phase>
-              <configuration>
-                
<configLocation>${project.basedir}/checkstyle.xml</configLocation>
-                <encoding>UTF-8</encoding>
-                <consoleOutput>true</consoleOutput>
-                <failsOnError>true</failsOnError>
-                <linkXRef>false</linkXRef>
-                <skip>${checkstyle.skip}</skip>
-              </configuration>
-              <goals>
-                <goal>check</goal>
-              </goals>
-            </execution>
-          </executions>
-          <dependencies>
-            <dependency>
-              <groupId>com.puppycrawl.tools</groupId>
-              <artifactId>checkstyle</artifactId>
-              <version>${checkstyle.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>utility</groupId>
-              <artifactId>utility</artifactId>
-              <version>1.0.0.0-SNAPSHOT</version>
-            </dependency>
-          </dependencies>
-        </plugin>
       </plugins>
     </pluginManagement>
     <plugins>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/checkstyle.xml
----------------------------------------------------------------------
diff --git a/ambari-server/checkstyle.xml b/ambari-server/checkstyle.xml
deleted file mode 100644
index 81f6380..0000000
--- a/ambari-server/checkstyle.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<!-- Licensed under the Apache License, Version 2.0 (the "License"); you
-  may not use this file except in compliance with the License. You may obtain
-  a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
-  required by applicable law or agreed to in writing, software distributed
-  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
-  OR CONDITIONS OF ANY KIND, either express or implied. See the License for
-  the specific language governing permissions and limitations under the 
License.
-  See accompanying LICENSE file. -->
-<!DOCTYPE module PUBLIC
-  "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
-  "http://www.puppycrawl.com/dtds/configuration_1_3.dtd";>
-<module name="Checker">
-  <module name="TreeWalker">
-    <module name="AvoidTransactionalOnPrivateMethodsCheck"/>
-  </module>
-</module>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 08757a2..d1277c3 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -686,10 +686,6 @@
         <artifactId>jetty-maven-plugin</artifactId>
         <version>${jetty.version}</version>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-      </plugin>
     </plugins>
     <resources>
       <resource>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
index 4010528..8e5674e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProvider.java
@@ -374,7 +374,7 @@ public class AlertTargetResourceProvider extends
    */
   @Transactional
   @SuppressWarnings("unchecked")
-  void updateAlertTargets(long alertTargetId,
+  private void updateAlertTargets(long alertTargetId,
       Map<String, Object> requestMap)
       throws AmbariException {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index d417ec2..42aae84 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -442,7 +442,7 @@ public class ClusterStackVersionResourceProvider extends 
AbstractControllerResou
   }
 
   @Transactional
-  void createHostVersions(Cluster cluster, List<Host> hosts, StackId stackId,
+  private void createHostVersions(Cluster cluster, List<Host> hosts, StackId 
stackId,
       String desiredRepoVersion, RepositoryVersionState repoState)
       throws AmbariException, SystemException {
     final String clusterName = cluster.getClusterName();
@@ -482,7 +482,7 @@ public class ClusterStackVersionResourceProvider extends 
AbstractControllerResou
   }
 
   @Transactional
-  RequestStageContainer createOrchestration(Cluster cluster, StackId stackId,
+  private RequestStageContainer createOrchestration(Cluster cluster, StackId 
stackId,
       List<Host> hosts, RepositoryVersionEntity repoVersionEnt, Map<String, 
Object> propertyMap)
       throws AmbariException, SystemException {
     final AmbariManagementController managementController = 
getManagementController();

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
index a45ccff..fd38d17 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeResourceProvider.java
@@ -956,7 +956,7 @@ public class UpgradeResourceProvider extends 
AbstractControllerResourceProvider
    * @throws AmbariException
    */
   @Transactional
-  UpgradeEntity createUpgradeInsideTransaction(Cluster cluster,
+  private UpgradeEntity createUpgradeInsideTransaction(Cluster cluster,
       RequestStageContainer request,
       UpgradeEntity upgradeEntity) throws AmbariException {
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java
index e8c4b5f..d187947 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/AlertsDAO.java
@@ -1492,7 +1492,7 @@ public class AlertsDAO implements Cleanable {
    * @return a long representing the number of affected (deleted) records
    */
   @Transactional
-  int cleanAlertNoticesForClusterBeforeDate(Long clusterId, long 
beforeDateMillis) {
+  private int cleanAlertNoticesForClusterBeforeDate(Long clusterId, long 
beforeDateMillis) {
     LOG.info("Deleting AlertNotice entities before date " + new 
Date(beforeDateMillis));
     EntityManager entityManager = m_entityManagerProvider.get();
     List<Integer> ids = findAllAlertHistoryIdsBeforeDate(clusterId, 
beforeDateMillis);
@@ -1523,7 +1523,7 @@ public class AlertsDAO implements Cleanable {
    * @return a long representing the number of affected (deleted) records
    */
   @Transactional
-  int cleanAlertCurrentsForClusterBeforeDate(long clusterId, long 
beforeDateMillis) {
+  private int cleanAlertCurrentsForClusterBeforeDate(long clusterId, long 
beforeDateMillis) {
     LOG.info("Deleting AlertCurrent entities before date " + new 
Date(beforeDateMillis));
     EntityManager entityManager = m_entityManagerProvider.get();
     List<Integer> ids = findAllAlertHistoryIdsBeforeDate(clusterId, 
beforeDateMillis);
@@ -1553,7 +1553,7 @@ public class AlertsDAO implements Cleanable {
    */
 
   @Transactional
-  int cleanAlertHistoriesForClusterBeforeDate(Long clusterId, long 
beforeDateMillis) {
+  private int cleanAlertHistoriesForClusterBeforeDate(Long clusterId, long 
beforeDateMillis) {
     return executeQuery("AlertHistoryEntity.removeInClusterBeforeDate", 
AlertHistoryEntity.class, clusterId, beforeDateMillis);
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java 
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
index e223eed..f87b99c 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
@@ -451,7 +451,7 @@ public class ServiceImpl implements Service {
   }
 
   @Transactional
-  void persistEntities(ClusterServiceEntity serviceEntity) {
+  private void persistEntities(ClusterServiceEntity serviceEntity) {
     long clusterId = cluster.getClusterId();
     ClusterEntity clusterEntity = clusterDAO.findById(clusterId);
     serviceEntity.setClusterEntity(clusterEntity);

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
index 1de10f9..8e5f37e 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
@@ -183,7 +183,7 @@ public class ClustersImpl implements Clusters {
    */
   @Inject
   @Transactional
-  void loadClustersAndHosts() {
+  private void loadClustersAndHosts() {
     List<HostEntity> hostEntities = hostDAO.findAll();
     for (HostEntity hostEntity : hostEntities) {
       Host host = hostFactory.create(hostEntity);

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java 
b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
index a444f5d..dd5e635 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/host/HostImpl.java
@@ -954,7 +954,7 @@ public class HostImpl implements Host {
   }
 
   @Transactional
-  void persistEntities(HostEntity hostEntity) {
+  private void persistEntities(HostEntity hostEntity) {
     hostDAO.create(hostEntity);
     if (!hostEntity.getClusterEntities().isEmpty()) {
       for (ClusterEntity clusterEntity : hostEntity.getClusterEntities()) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
index a92aa04..1ea5558 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/services/RetryUpgradeActionService.java
@@ -190,7 +190,7 @@ public class RetryUpgradeActionService extends 
AbstractScheduledService {
    * @param requestId Request Id to search tasks for.
    */
   @Transactional
-  void retryHoldingCommandsInRequest(Long requestId) {
+  private void retryHoldingCommandsInRequest(Long requestId) {
     if (requestId == null) {
       return;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
index 5225598..c1655aa 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
@@ -1313,7 +1313,7 @@ public class ServiceComponentHostImpl implements 
ServiceComponentHost {
   }
 
   @Transactional
-  void persistEntities(HostEntity hostEntity, HostComponentStateEntity 
stateEntity,
+  private void persistEntities(HostEntity hostEntity, HostComponentStateEntity 
stateEntity,
       HostComponentDesiredStateEntity desiredStateEntity) {
     ServiceComponentDesiredStateEntity serviceComponentDesiredStateEntity = 
serviceComponentDesiredStateDAO.findByName(
         serviceComponent.getClusterId(), serviceComponent.getServiceName(),

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
----------------------------------------------------------------------
diff --git 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
index 063c295..25b6360 100644
--- 
a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
+++ 
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
@@ -1553,7 +1553,7 @@ public class UpgradeCatalog240 extends 
AbstractUpgradeCatalog {
    * @throws SQLException
    */
   @Transactional
-  void updateServiceComponentDesiredStateTableDDL() throws SQLException {
+  private void updateServiceComponentDesiredStateTableDDL() throws 
SQLException {
     if (dbAccessor.tableHasPrimaryKey(SERVICE_COMPONENT_DS_TABLE, ID)) {
       LOG.info("Skipping {} table Primary Key modifications since the new {} 
column already exists",
           SERVICE_COMPONENT_DS_TABLE, ID);
@@ -2755,7 +2755,7 @@ public class UpgradeCatalog240 extends 
AbstractUpgradeCatalog {
    *  instead of cluster_name
    */
   @Transactional
-  void updateViewInstanceTable() throws SQLException {
+  private void updateViewInstanceTable() throws SQLException {
     try {
       if (Long.class.equals(dbAccessor.getColumnClass(VIEWINSTANCE_TABLE, 
CLUSTER_HANDLE_COLUMN))) {
         LOG.info(String.format("%s column is already numeric. Skipping an 
update of %s table.", CLUSTER_HANDLE_COLUMN, VIEWINSTANCE_TABLE));

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index b400268..95465d5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -266,7 +266,6 @@
             
<exclude>contrib/agent-simulator/docker_image/package_list.txt</exclude>
             <exclude>contrib/agent-simulator/config/cluster.txt</exclude>
             <exclude>version</exclude>
-            <exclude>**/target/surefire-reports/</exclude>
             <!--IDE and GIT files-->
             <exclude>**/.idea/</exclude>
             <exclude>**/.classpath/</exclude>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/utility/pom.xml
----------------------------------------------------------------------
diff --git a/utility/pom.xml b/utility/pom.xml
index 6f60206..2febb83 100644
--- a/utility/pom.xml
+++ b/utility/pom.xml
@@ -20,13 +20,6 @@
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
   <modelVersion>4.0.0</modelVersion>
 
-  <parent>
-    <groupId>org.apache.ambari</groupId>
-    <artifactId>ambari-project</artifactId>
-    <version>2.0.0.0-SNAPSHOT</version>
-    <relativePath>../ambari-project</relativePath>
-  </parent>
-
   <artifactId>utility</artifactId>
   <groupId>utility</groupId>
   <version>1.0.0.0-SNAPSHOT</version>
@@ -35,25 +28,9 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
+      <version>4.12</version>
       <scope>compile</scope>    <!-- has to be compile-time dependency on 
junit -->
     </dependency>
-    <dependency>
-      <groupId>com.puppycrawl.tools</groupId>
-      <artifactId>checkstyle</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>com.puppycrawl.tools</groupId>
-      <artifactId>checkstyle</artifactId>
-      <type>test-jar</type>
-      <version>${checkstyle.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-      <version>19.0</version> <!-- required for checkstyle -->
-      <scope>test</scope>
-    </dependency>
   </dependencies>
 
   <build>
@@ -68,14 +45,6 @@
         </configuration>
       </plugin>
       <plugin>
-        <artifactId>maven-assembly-plugin</artifactId>
-        <configuration>
-          <descriptors>
-            
<descriptor>${project.parent.basedir}/src/main/assemblies/empty.xml</descriptor>
-          </descriptors>
-        </configuration>
-      </plugin>
-      <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>rpm-maven-plugin</artifactId>
         <version>2.0.1</version>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/utility/src/main/java/org/apache/ambari/checkstyle/AvoidTransactionalOnPrivateMethodsCheck.java
----------------------------------------------------------------------
diff --git 
a/utility/src/main/java/org/apache/ambari/checkstyle/AvoidTransactionalOnPrivateMethodsCheck.java
 
b/utility/src/main/java/org/apache/ambari/checkstyle/AvoidTransactionalOnPrivateMethodsCheck.java
deleted file mode 100644
index 80da103..0000000
--- 
a/utility/src/main/java/org/apache/ambari/checkstyle/AvoidTransactionalOnPrivateMethodsCheck.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.checkstyle;
-
-import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
-import com.puppycrawl.tools.checkstyle.api.DetailAST;
-import com.puppycrawl.tools.checkstyle.api.TokenTypes;
-
-/**
- * Detects private methods annotated as <code>Transactional</code>.
- * See https://github.com/google/guice/wiki/Transactions for why this should be
- * avoided.
- */
-public class AvoidTransactionalOnPrivateMethodsCheck extends AbstractCheck {
-
-  private static final String ANNOTATION_NAME = "Transactional";
-  public static final String MSG_TRANSACTIONAL_ON_PRIVATE_METHOD = "@" + 
ANNOTATION_NAME + " should not be used on private methods";
-
-  @Override
-  public int[] getDefaultTokens() {
-    return new int[] { TokenTypes.METHOD_DEF };
-  }
-
-  @Override
-  public void visitToken(DetailAST ast) {
-    DetailAST modifiers = ast.findFirstToken(TokenTypes.MODIFIERS);
-    if (modifiers.findFirstToken(TokenTypes.LITERAL_PRIVATE) != null) {
-      DetailAST annotation = modifiers.findFirstToken(TokenTypes.ANNOTATION);
-      while (annotation != null) {
-        DetailAST name = annotation.findFirstToken(TokenTypes.IDENT);
-        if (name != null && ANNOTATION_NAME.equals(name.getText())) {
-          log(ast.getLineNo(), MSG_TRANSACTIONAL_ON_PRIVATE_METHOD);
-          break;
-        }
-        annotation = annotation.getNextSibling();
-      }
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/utility/src/main/resources/checkstyle_packages.xml
----------------------------------------------------------------------
diff --git a/utility/src/main/resources/checkstyle_packages.xml 
b/utility/src/main/resources/checkstyle_packages.xml
deleted file mode 100644
index 8cf4a44..0000000
--- a/utility/src/main/resources/checkstyle_packages.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Licensed under the Apache License, Version 2.0 (the "License"); you
-  may not use this file except in compliance with the License. You may obtain
-  a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless
-  required by applicable law or agreed to in writing, software distributed
-  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
-  OR CONDITIONS OF ANY KIND, either express or implied. See the License for
-  the specific language governing permissions and limitations under the 
License.
-  See accompanying LICENSE file. -->
-<!DOCTYPE checkstyle-packages PUBLIC
-  "-//Puppy Crawl//DTD Package Names 1.0//EN"
-  "http://www.puppycrawl.com/dtds/packages_1_0.dtd";>
-<checkstyle-packages>
-  <package name="org.apache.ambari.checkstyle"/>
-</checkstyle-packages>

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/utility/src/test/java/org/apache/ambari/checkstyle/AvoidTransactionalOnPrivateMethodsCheckTest.java
----------------------------------------------------------------------
diff --git 
a/utility/src/test/java/org/apache/ambari/checkstyle/AvoidTransactionalOnPrivateMethodsCheckTest.java
 
b/utility/src/test/java/org/apache/ambari/checkstyle/AvoidTransactionalOnPrivateMethodsCheckTest.java
deleted file mode 100644
index 14d7486..0000000
--- 
a/utility/src/test/java/org/apache/ambari/checkstyle/AvoidTransactionalOnPrivateMethodsCheckTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.checkstyle;
-
-import static 
org.apache.ambari.checkstyle.AvoidTransactionalOnPrivateMethodsCheck.MSG_TRANSACTIONAL_ON_PRIVATE_METHOD;
-
-import java.io.File;
-import java.io.IOException;
-
-import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
-import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-
-import org.junit.Test;
-
-public class AvoidTransactionalOnPrivateMethodsCheckTest extends 
BaseCheckTestSupport {
-
-  @Override
-  protected String getPath(String filename) throws IOException {
-    return new File("src/test/resources/org/apache/ambari/checkstyle/" + 
filename)
-      .getCanonicalPath();
-  }
-
-  @Test
-  public void transactionalOnPrivateMethod() throws Exception {
-    final DefaultConfiguration config = 
createCheckConfig(AvoidTransactionalOnPrivateMethodsCheck.class);
-    final String[] expected = {
-      "32: " + MSG_TRANSACTIONAL_ON_PRIVATE_METHOD,
-      "41: " + MSG_TRANSACTIONAL_ON_PRIVATE_METHOD,
-    };
-
-    verify(config, getPath("InputTransactionalOnPrivateMethods.java"), 
expected);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/ambari/blob/5287ab11/utility/src/test/resources/org/apache/ambari/checkstyle/InputTransactionalOnPrivateMethods.java
----------------------------------------------------------------------
diff --git 
a/utility/src/test/resources/org/apache/ambari/checkstyle/InputTransactionalOnPrivateMethods.java
 
b/utility/src/test/resources/org/apache/ambari/checkstyle/InputTransactionalOnPrivateMethods.java
deleted file mode 100644
index 2ea5444..0000000
--- 
a/utility/src/test/resources/org/apache/ambari/checkstyle/InputTransactionalOnPrivateMethods.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.ambari.checkstyle;
-
-import com.google.inject.persist.Transactional;
-
-/**
- * Input file for AvoidTransactionalOnPrivateMethodsCheckTest.
- */
-public class InputTransactionalOnPrivateMethods {
-
-  @Transactional
-  public void publicMethodWithTransactional() {
-    ;
-  }
-
-  @Transactional
-  private void privateMethodWithTransactional() {
-    ;
-  }
-
-  private void privateMethodWithoutTransactional() {
-    ;
-  }
-
-  @Transactional
-  private void otherPrivateMethodWithTransactional() {
-    ;
-  }
-
-}

Reply via email to