Skip to content

Commit

Permalink
After review of Chris Rüger
Browse files Browse the repository at this point in the history
---
 Signed-off-by: Peter Kriens <Peter.Kriens@aQute.biz>

Signed-off-by: Peter Kriens <Peter.Kriens@aQute.biz>
  • Loading branch information
pkriens committed Apr 19, 2024
1 parent 9240c05 commit b37787f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 7 deletions.
22 changes: 22 additions & 0 deletions biz.aQute.bndlib.tests/test/test/bndmodel/BndModelTest.java
@@ -1,5 +1,6 @@
package test.bndmodel;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
Expand All @@ -14,6 +15,7 @@
import org.junit.jupiter.api.Test;

import aQute.bnd.build.model.BndEditModel;
import aQute.bnd.build.model.clauses.ExportedPackage;
import aQute.bnd.build.model.clauses.VersionedClause;
import aQute.bnd.osgi.Constants;
import aQute.bnd.osgi.Processor;
Expand Down Expand Up @@ -120,4 +122,24 @@ public void testParent() throws Exception {
assertEquals("framework", p.getProperty(Constants.RUNFW), "Changes, refers to macro");

}

/**
* Check if we can get a processor of the model and verify that we get the
* proper properties.
*/
@Test
public void testTypes() throws Exception {

File f = IO.getFile("testresources/bndmodel/test-01.bndrun");
BndEditModel model = new BndEditModel();
model.setBndResource(f);
model.load();
model.add("Export-Package", "foo;version=1,bar;version=2;xyz=1");

List<ExportedPackage> exportedPackages = model.getExportedPackages();
assertThat(exportedPackages).hasSize(2);
model.add("Export-Package", "foo2;version=2,bar2;version=2;xyz=2");
exportedPackages = model.getExportedPackages();
assertThat(exportedPackages).hasSize(4);
}
}
8 changes: 4 additions & 4 deletions biz.aQute.bndlib/src/aQute/bnd/build/model/BndEditModel.java
Expand Up @@ -88,7 +88,7 @@ public class BndEditModel {
public static final String NEWLINE_LINE_SEPARATOR = "\\n\\\n\t";
public static final String LIST_SEPARATOR = ",\\\n\t";

private static String[] KNOWN_PROPERTIES = new String[] {
static String[] KNOWN_PROPERTIES = new String[] {
Constants.BUNDLE_LICENSE, Constants.BUNDLE_CATEGORY, Constants.BUNDLE_NAME, Constants.BUNDLE_DESCRIPTION,
Constants.BUNDLE_COPYRIGHT, Constants.BUNDLE_UPDATELOCATION, Constants.BUNDLE_VENDOR,
Constants.BUNDLE_CONTACTADDRESS, Constants.BUNDLE_DOCURL, Constants.BUNDLE_SYMBOLICNAME,
Expand All @@ -106,8 +106,8 @@ public class BndEditModel {
public static final String PROP_WORKSPACE = "_workspace";
public static final String BUNDLE_VERSION_MACRO = "${"
+ Constants.BUNDLE_VERSION + "}";
private static final Map<String, Converter<? extends Object, String>> converters = new HashMap<>();
private static final Map<String, Converter<String, ? extends Object>> formatters = new HashMap<>();
static final Map<String, Converter<? extends Object, String>> converters = new HashMap<>();
static final Map<String, Converter<String, ? extends Object>> formatters = new HashMap<>();
private final static Converter<List<VersionedClause>, String> buildPathConverter = new HeaderClauseListConverter<>(
new Converter<VersionedClause, HeaderClause>() {
@Override
Expand All @@ -132,7 +132,7 @@ public VersionedClause error(

private final static Converter<List<VersionedClause>, String> clauseListConverter = new HeaderClauseListConverter<>(
new VersionedClauseConverter());
private final static Converter<String, String> stringConverter = new NoopConverter<>();
final static Converter<String, String> stringConverter = new NoopConverter<>();
private final static Converter<Boolean, String> includedSourcesConverter = new Converter<Boolean, String>() {
@Override
public Boolean convert(
Expand Down
2 changes: 1 addition & 1 deletion biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java
Expand Up @@ -1063,7 +1063,7 @@ public int compareTo(PropertyKey o) {
* among the {@code PropertyKey} objects with the same key, only the one
* with the lowest floor number is included in the result.
*
* @param keys sorted keys defined by {@link #compareTo(PropertyKey)}
* @param keys
* @return only unique keys which are visible (lowest floor value)
*/
public static List<PropertyKey> findVisible(Collection<PropertyKey> keys) {
Expand Down
4 changes: 2 additions & 2 deletions bndtools.core/_plugin.xml
Expand Up @@ -904,7 +904,7 @@
<property name="snapshotUrl" type="string" description="The urls to the remote snapshot repository." default="https://repository.apache.org/snapshots/" />
<property name="local" type="string" description="The path to the local repository" default="~/.m2/repository" />
<property name="readOnly" type="boolean" description="" default="false" />
<property name="index" type="string" description="The path to the index file" default="${.}/cnf/central.maven" />
<property name="index" type="string" description="The path to the index file" default="${workspace}/cnf/central.maven" />
<property name="source" type="string" description="Content added to the index file. Content maybe one line without CR/LF as long as there is a comma or whitespace separating the GAVs. Further same format as the index file." />
<property name="noupdateOnRelease" type="boolean" description="Do not update the index when a file is released" />
<property name="poll_time" type="int" description="Sets the time in seconds when to check for changes in the pom-files" default="5" />
Expand Down Expand Up @@ -932,7 +932,7 @@
<property name="local" type="string" description="The path to the local repository" default="~/.m2/repository" />
<property name="revision" type="string" description="Coordinates of a maven revision. I.e. group:artifactid[:c]:version. Can be a comma separated list of GAVs." />
<property name="location" type="string" description="Points to a file that is used as the cache. It will be in OSGi format." />
<property name="pom" type="string" description="Points to a pom.xml file. This is exclusive with revision. Can be a comma separated list of files." default="${.}/cnf/pom.xml" />
<property name="pom" type="string" description="Points to a pom.xml file. This is exclusive with revision. Can be a comma separated list of files." default="${workspace}/cnf/pom.xml" />
<property name="query" type="string" description="The query used to search Maven Central Search." />
<property name="queryUrl" type="string" description="The url of the Maven Central Search." />
<property name="transitive" type="boolean" description="Allow transitive dependencies" />
Expand Down

0 comments on commit b37787f

Please sign in to comment.