archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1483315 - in /archiva/sandbox/trunk/metadata-store-cassandra: ./ src/main/java/org/apache/archiva/metadata/repository/jpa/ src/test/java/org/apache/archiva/metadata/repository/jpa/
Date Thu, 16 May 2013 12:18:51 GMT
Author: olamy
Date: Thu May 16 12:18:51 2013
New Revision: 1483315

URL: http://svn.apache.org/r1483315
Log:
remove kundera tests

Modified:
    archiva/sandbox/trunk/metadata-store-cassandra/pom.xml
    archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/ArchivaEntityManagerFactory.java
    archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraMetadataRepository.java
    archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraRepositorySessionFactory.java
    archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/DefaultArchivaEntityManagerFactory.java
    archiva/sandbox/trunk/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/jpa/RepositoriesNamespaceTest.java

Modified: archiva/sandbox/trunk/metadata-store-cassandra/pom.xml
URL: http://svn.apache.org/viewvc/archiva/sandbox/trunk/metadata-store-cassandra/pom.xml?rev=1483315&r1=1483314&r2=1483315&view=diff
==============================================================================
--- archiva/sandbox/trunk/metadata-store-cassandra/pom.xml (original)
+++ archiva/sandbox/trunk/metadata-store-cassandra/pom.xml Thu May 16 12:18:51 2013
@@ -63,6 +63,7 @@
       <version>1.1</version>
     </dependency>
 
+    <!--
     <dependency>
       <groupId>com.impetus.client</groupId>
       <artifactId>kundera-cassandra</artifactId>
@@ -87,7 +88,7 @@
         </exclusion>
       </exclusions>
     </dependency>
-
+    -->
     <dependency>
       <groupId>com.netflix.astyanax</groupId>
       <artifactId>astyanax-entity-mapper</artifactId>
@@ -97,6 +98,10 @@
           <groupId>stax</groupId>
           <artifactId>stax-api</artifactId>
         </exclusion>
+        <exclusion>
+          <groupId>log4j</groupId>
+          <artifactId>log4j</artifactId>
+        </exclusion>
       </exclusions>
     </dependency>
 

Modified: archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/ArchivaEntityManagerFactory.java
URL: http://svn.apache.org/viewvc/archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/ArchivaEntityManagerFactory.java?rev=1483315&r1=1483314&r2=1483315&view=diff
==============================================================================
--- archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/ArchivaEntityManagerFactory.java
(original)
+++ archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/ArchivaEntityManagerFactory.java
Thu May 16 12:18:51 2013
@@ -21,15 +21,11 @@ package org.apache.archiva.metadata.repo
 
 import com.netflix.astyanax.Keyspace;
 
-import javax.persistence.EntityManager;
-
 /**
  * @author Olivier Lamy
  */
 public interface ArchivaEntityManagerFactory
 {
-    EntityManager getEntityManager();
-
     Keyspace getKeyspace();
 
 }

Modified: archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraMetadataRepository.java
URL: http://svn.apache.org/viewvc/archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraMetadataRepository.java?rev=1483315&r1=1483314&r2=1483315&view=diff
==============================================================================
--- archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraMetadataRepository.java
(original)
+++ archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraMetadataRepository.java
Thu May 16 12:18:51 2013
@@ -22,6 +22,7 @@ package org.apache.archiva.metadata.repo
 import com.google.common.base.Function;
 import com.netflix.astyanax.Keyspace;
 import com.netflix.astyanax.entitystore.DefaultEntityManager;
+import com.netflix.astyanax.entitystore.EntityManager;
 import org.apache.archiva.configuration.ArchivaConfiguration;
 import org.apache.archiva.metadata.model.ArtifactMetadata;
 import org.apache.archiva.metadata.model.MetadataFacet;
@@ -38,9 +39,7 @@ import org.apache.commons.lang.StringUti
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.persistence.EntityManager;
 import javax.persistence.PersistenceException;
-import javax.persistence.TypedQuery;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
@@ -59,25 +58,22 @@ public class CassandraMetadataRepository
 
     private Logger logger = LoggerFactory.getLogger( getClass() );
 
-    private EntityManager entityManager;
-
     private ArchivaConfiguration configuration;
 
     private final Map<String, MetadataFacetFactory> metadataFacetFactories;
 
     private Keyspace keyspace;
 
-    com.netflix.astyanax.entitystore.EntityManager<Repository, String> repositoryEntityManager;
+    private EntityManager<Repository, String> repositoryEntityManager;
 
-    com.netflix.astyanax.entitystore.EntityManager<Namespace, String> namespaceEntityManager;
+    private EntityManager<Namespace, String> namespaceEntityManager;
 
     public CassandraMetadataRepository( Map<String, MetadataFacetFactory> metadataFacetFactories,
-                                        ArchivaConfiguration configuration, EntityManager
entityManager,
-                                        Keyspace keyspace )
+                                        ArchivaConfiguration configuration, Keyspace keyspace
)
     {
         this.metadataFacetFactories = metadataFacetFactories;
         this.configuration = configuration;
-        this.entityManager = entityManager;
+
         this.keyspace = keyspace;
 
         repositoryEntityManager =
@@ -93,12 +89,12 @@ public class CassandraMetadataRepository
         namespaceEntityManager.createStorage( null );
     }
 
-    public com.netflix.astyanax.entitystore.EntityManager<Repository, String> getRepositoryEntityManager()
+    public EntityManager<Repository, String> getRepositoryEntityManager()
     {
         return repositoryEntityManager;
     }
 
-    public com.netflix.astyanax.entitystore.EntityManager<Namespace, String> getNamespaceEntityManager()
+    public EntityManager<Namespace, String> getNamespaceEntityManager()
     {
         return namespaceEntityManager;
     }
@@ -130,40 +126,6 @@ public class CassandraMetadataRepository
     }
 
 
-    public void updateNamespaceKundera( String repositoryId, String namespaceId )
-        throws MetadataRepositoryException
-    {
-
-        Repository repository = this.entityManager.find( Repository.class, repositoryId );
-
-        if ( repository == null )
-        {
-            repository = new Repository( repositoryId );
-
-            Namespace namespace = new Namespace( namespaceId, repository );
-            //namespace.setRepository( repository );
-            //repository.getNamespaces().add( namespace );
-            this.entityManager.persist( repository );
-            this.entityManager.persist( namespace );
-        }
-        else
-        {
-
-            Namespace namespace = new Namespace( namespaceId, repository );
-            //namespace.setRepository( repository );
-            entityManager.persist( namespace );
-            // contains the namespace ?
-            /*
-            if ( !repository.getNamespaces().contains( namespace ) )
-            {
-                repository.getNamespaces().add( namespace );
-                entityManager.merge( repository );
-                entityManager.persist( namespace );
-            }
-            */
-        }
-    }
-
     @Override
     public void removeNamespace( String repositoryId, String namespaceId )
         throws MetadataRepositoryException
@@ -176,20 +138,6 @@ public class CassandraMetadataRepository
     }
 
 
-    public void removeNamespaceKundera( String repositoryId, String namespace )
-        throws MetadataRepositoryException
-    {
-        TypedQuery<Namespace> typedQuery =
-            this.entityManager.createQuery( "select n from namespace n where n.id=:id and
n.repository.id=:repoid",
-                                            Namespace.class );
-
-        typedQuery = typedQuery.setParameter( "id", namespace ).setParameter( "repoid", repositoryId
);
-
-        Namespace n = typedQuery.getSingleResult();
-
-        this.entityManager.remove( n );
-    }
-
     @Override
     public void removeRepository( String repositoryId )
         throws MetadataRepositoryException
@@ -223,26 +171,6 @@ public class CassandraMetadataRepository
     }
 
 
-    public Collection<String> getRepositoriesKundera()
-        throws MetadataRepositoryException
-    {
-        logger.debug( "getRepositories" );
-        TypedQuery<Repository> typedQuery = entityManager.createQuery( "select r from
Repository r", Repository.class );
-        List<Repository> repositories = typedQuery.getResultList();
-        if ( repositories == null )
-        {
-            return Collections.emptyList();
-        }
-        List<String> repoIds = new ArrayList<String>( repositories.size() );
-        for ( Repository repository : repositories )
-        {
-            repoIds.add( repository.getName() );
-        }
-        logger.debug( "getRepositories found: {}", repoIds );
-        return repoIds;
-
-    }
-
     @Override
     public Collection<String> getRootNamespaces( String repoId )
         throws MetadataResolutionException
@@ -319,32 +247,6 @@ public class CassandraMetadataRepository
         }
     }
 
-    public List<String> getNamespacesKundera( String repoId )
-        throws MetadataResolutionException
-    {
-        logger.debug( "getNamespaces for repository '{}'", repoId );
-        //TypedQuery<Repository> typedQuery =
-        //    entityManager.createQuery( "select n from Namespace n where n.repository_id=:id",
Namespace.class );
-
-        //List<Repository> namespaces = typedQuery.setParameter( "id", repoId ).getResultList();
-
-        Repository repository = entityManager.find( Repository.class, repoId );
-
-        if ( repository == null || repository.getNamespaces().isEmpty() )
-        {
-            return Collections.emptyList();
-        }
-        List<String> namespaceIds = new ArrayList<String>( repository.getNamespaces().size()
);
-
-        for ( Namespace n : repository.getNamespaces() )
-        {
-            namespaceIds.add( n.getName() );
-        }
-
-        logger.debug( "getNamespaces for repository '{}' found {}", repoId, namespaceIds.size()
);
-        return namespaceIds;
-    }
-
 
     @Override
     public void updateProject( String repositoryId, ProjectMetadata project )

Modified: archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraRepositorySessionFactory.java
URL: http://svn.apache.org/viewvc/archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraRepositorySessionFactory.java?rev=1483315&r1=1483314&r2=1483315&view=diff
==============================================================================
--- archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraRepositorySessionFactory.java
(original)
+++ archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/CassandraRepositorySessionFactory.java
Thu May 16 12:18:51 2013
@@ -49,7 +49,7 @@ import java.util.Map;
 /**
  * @author Olivier Lamy
  */
-@Service("repositorySessionFactory#cassandra")
+@Service( "repositorySessionFactory#cassandra" )
 public class CassandraRepositorySessionFactory
     implements RepositorySessionFactory
 {
@@ -57,7 +57,7 @@ public class CassandraRepositorySessionF
     private Map<String, MetadataFacetFactory> metadataFacetFactories;
 
     @Inject
-    @Named(value = "archivaConfiguration#default")
+    @Named( value = "archivaConfiguration#default" )
     private ArchivaConfiguration configuration;
 
     @Inject
@@ -69,14 +69,9 @@ public class CassandraRepositorySessionF
     @Inject
     private ArchivaEntityManagerFactory archivaEntityManagerFactory;
 
-    private EntityManager entityManager;
-
-
     @PostConstruct
     public void initialize()
     {
-        entityManager = archivaEntityManagerFactory.getEntityManager();
-
         Map<String, MetadataFacetFactory> tmpMetadataFacetFactories =
             applicationContext.getBeansOfType( MetadataFacetFactory.class );
         // olamy with spring the "id" is now "metadataFacetFactory#hint"
@@ -96,7 +91,7 @@ public class CassandraRepositorySessionF
     public RepositorySession createSession()
     {
         CassandraMetadataRepository metadataRepository =
-            new CassandraMetadataRepository( metadataFacetFactories, configuration, entityManager,
+            new CassandraMetadataRepository( metadataFacetFactories, configuration,
                                              archivaEntityManagerFactory.getKeyspace() );
         return new RepositorySession( metadataRepository, metadataResolver );
     }

Modified: archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/DefaultArchivaEntityManagerFactory.java
URL: http://svn.apache.org/viewvc/archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/DefaultArchivaEntityManagerFactory.java?rev=1483315&r1=1483314&r2=1483315&view=diff
==============================================================================
--- archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/DefaultArchivaEntityManagerFactory.java
(original)
+++ archiva/sandbox/trunk/metadata-store-cassandra/src/main/java/org/apache/archiva/metadata/repository/jpa/DefaultArchivaEntityManagerFactory.java
Thu May 16 12:18:51 2013
@@ -34,14 +34,11 @@ import org.springframework.stereotype.Se
 
 import javax.annotation.PostConstruct;
 import javax.inject.Inject;
-import javax.persistence.EntityManager;
-import javax.persistence.Persistence;
-import java.util.Properties;
 
 /**
  * @author Olivier Lamy
  */
-@Service( "archivaEntityManagerFactory#jpa-archiva" )
+@Service("archivaEntityManagerFactory#jpa-archiva")
 public class DefaultArchivaEntityManagerFactory
     implements ArchivaEntityManagerFactory
 {
@@ -49,8 +46,6 @@ public class DefaultArchivaEntityManager
     @Inject
     private ApplicationContext applicationContext;
 
-    private EntityManager entityManager;
-
     private static final String CLUSTER_NAME = "archiva";
 
     private static final String KEYSPACE_NAME = "ArchivaKeySpace";
@@ -90,11 +85,6 @@ public class DefaultArchivaEntityManager
 
     }
 
-    @Override
-    public EntityManager getEntityManager()
-    {
-        return entityManager;
-    }
 
     @Override
     public Keyspace getKeyspace()

Modified: archiva/sandbox/trunk/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/jpa/RepositoriesNamespaceTest.java
URL: http://svn.apache.org/viewvc/archiva/sandbox/trunk/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/jpa/RepositoriesNamespaceTest.java?rev=1483315&r1=1483314&r2=1483315&view=diff
==============================================================================
--- archiva/sandbox/trunk/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/jpa/RepositoriesNamespaceTest.java
(original)
+++ archiva/sandbox/trunk/metadata-store-cassandra/src/test/java/org/apache/archiva/metadata/repository/jpa/RepositoriesNamespaceTest.java
Thu May 16 12:18:51 2013
@@ -44,10 +44,6 @@ public class RepositoriesNamespaceTest
 
     private Logger logger = LoggerFactory.getLogger( getClass() );
 
-    //@Inject
-    //private ThriftEntityManager em;
-    //EntityManagerImpl em;
-
     @Inject
     @Named( value = "archivaEntityManagerFactory#jpa-archiva" )
     ArchivaEntityManagerFactory archivaEntityManagerFactory;
@@ -60,7 +56,7 @@ public class RepositoriesNamespaceTest
         throws Exception
     {
 
-        cmr = new CassandraMetadataRepository( null, null, null, archivaEntityManagerFactory.getKeyspace()
);
+        cmr = new CassandraMetadataRepository( null, null, archivaEntityManagerFactory.getKeyspace()
);
 
     }
 



Mime
View raw message