1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.extension.repository.aether.internal

File AetherExtensionDependency.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

2
10
3
1
74
37
4
0.4
3.33
3
1.33

Classes

Class Line # Actions
AetherExtensionDependency 37 10 0% 4 1
0.9333333493.3%
 

Contributing tests

This file is covered by 10 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.extension.repository.aether.internal;
21   
22    import java.util.ArrayList;
23    import java.util.List;
24   
25    import org.eclipse.aether.graph.Dependency;
26    import org.xwiki.extension.DefaultExtensionDependency;
27    import org.xwiki.extension.ExtensionDependency;
28    import org.xwiki.extension.internal.maven.DefaultMavenExtensionDependency;
29    import org.xwiki.extension.internal.maven.MavenUtils;
30    import org.xwiki.extension.repository.ExtensionRepositoryDescriptor;
31    import org.xwiki.extension.version.internal.DefaultVersionConstraint;
32   
33    /**
34    * @version $Id: e3a05cb4bc93de42e894afec3ccd652154e161a1 $
35    * @since 4.0M1
36    */
 
37    public class AetherExtensionDependency extends DefaultMavenExtensionDependency
38    {
39    public static final String PKEY_AETHER_DEPENDENCY = "aether.Dependency";
40   
 
41  1029 toggle public AetherExtensionDependency(ExtensionDependency extensionDependency, Dependency aetherDependency,
42    ExtensionRepositoryDescriptor extensionRepository)
43    {
44  1029 super(extensionDependency);
45   
46    // Make sure the dependency will be resolved in the extension repository first
47  1029 if (extensionRepository != null) {
48  1029 List<ExtensionRepositoryDescriptor> newRepositories = new ArrayList<>(getRepositories().size() + 1);
49   
50  1029 newRepositories.add(extensionRepository);
51  1029 newRepositories.addAll(getRepositories());
52   
53  1029 setRepositories(newRepositories);
54    }
55   
56    // Custom properties
57  1029 putProperty(PKEY_AETHER_DEPENDENCY, aetherDependency);
58    }
59   
 
60  4 toggle public AetherExtensionDependency(Dependency aetherDependency)
61    {
62  4 super(new DefaultExtensionDependency(MavenUtils.toExtensionId(aetherDependency.getArtifact().getGroupId(),
63    aetherDependency.getArtifact().getArtifactId(), aetherDependency.getArtifact().getClassifier()),
64    new DefaultVersionConstraint(aetherDependency.getArtifact().getVersion()), null));
65   
66    // custom properties
67  4 putProperty(PKEY_AETHER_DEPENDENCY, aetherDependency);
68    }
69   
 
70  10 toggle public Dependency getAetherDependency()
71    {
72  10 return (Dependency) this.getProperty(PKEY_AETHER_DEPENDENCY);
73    }
74    }