Merge pull request #322 from bsinno/fix_optimize_repository
Removed external artifact from repository.
This commit is contained in:
@@ -56,9 +56,6 @@ public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest
|
||||
@Autowired
|
||||
protected ActionStatusRepository actionStatusRepository;
|
||||
|
||||
@Autowired
|
||||
protected ExternalArtifactRepository externalArtifactRepository;
|
||||
|
||||
@Autowired
|
||||
protected LocalArtifactRepository artifactRepository;
|
||||
|
||||
|
||||
@@ -55,9 +55,6 @@ public abstract class AbstractJpaIntegrationTestWithMongoDB extends AbstractInte
|
||||
@Autowired
|
||||
protected ActionStatusRepository actionStatusRepository;
|
||||
|
||||
@Autowired
|
||||
protected ExternalArtifactRepository externalArtifactRepository;
|
||||
|
||||
@Autowired
|
||||
protected LocalArtifactRepository artifactRepository;
|
||||
|
||||
|
||||
@@ -40,22 +40,21 @@ public class ArtifactManagementFailedMongoDBTest extends AbstractJpaIntegrationT
|
||||
"version 1", null, null);
|
||||
sm = softwareModuleRepository.save(sm);
|
||||
|
||||
final Artifact result = artifactManagement.createLocalArtifact(new RandomGeneratedInputStream(5 * 1024),
|
||||
sm.getId(), "file1", false);
|
||||
final Artifact result = artifactManagement.createArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(),
|
||||
"file1", false);
|
||||
|
||||
assertThat(artifactRepository.findAll()).hasSize(1);
|
||||
|
||||
mongodExecutable.stop();
|
||||
try {
|
||||
artifactManagement.deleteLocalArtifact(result.getId());
|
||||
artifactManagement.deleteArtifact(result.getId());
|
||||
fail("deletion should have failed");
|
||||
} catch (final ArtifactDeleteFailedException e) {
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
artifactManagement.createLocalArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(), "file2",
|
||||
false);
|
||||
artifactManagement.createArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(), "file2", false);
|
||||
fail("Should not have worked with MongoDb down.");
|
||||
} catch (final ArtifactUploadFailedException e) {
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
package org.eclipse.hawkbit.repository.jpa;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
@@ -22,13 +21,9 @@ import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission;
|
||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||
import org.eclipse.hawkbit.repository.exception.InsufficientPermissionException;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaExternalArtifact;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaExternalArtifactProvider;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaLocalArtifact;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaArtifact;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.ExternalArtifactProvider;
|
||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.test.util.HashGeneratorUtils;
|
||||
import org.eclipse.hawkbit.repository.test.util.WithUser;
|
||||
@@ -57,7 +52,7 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.eclipse.hawkbit.repository.ArtifactManagement#createLocalArtifact(java.io.InputStream)}
|
||||
* {@link org.eclipse.hawkbit.repository.ArtifactManagement#createArtifact(java.io.InputStream)}
|
||||
* .
|
||||
*
|
||||
* @throws IOException
|
||||
@@ -65,7 +60,7 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
*/
|
||||
@Test
|
||||
@Description("Test if a local artifact can be created by API including metadata.")
|
||||
public void createLocalArtifact() throws NoSuchAlgorithmException, IOException {
|
||||
public void createArtifact() throws NoSuchAlgorithmException, IOException {
|
||||
// checkbaseline
|
||||
assertThat(softwareModuleRepository.findAll()).hasSize(0);
|
||||
assertThat(artifactRepository.findAll()).hasSize(0);
|
||||
@@ -84,33 +79,32 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
final byte random[] = RandomStringUtils.random(5 * 1024).getBytes();
|
||||
|
||||
final Artifact result = artifactManagement.createLocalArtifact(new ByteArrayInputStream(random), sm.getId(),
|
||||
"file1", false);
|
||||
final Artifact result11 = artifactManagement.createLocalArtifact(new ByteArrayInputStream(random), sm.getId(),
|
||||
final Artifact result = artifactManagement.createArtifact(new ByteArrayInputStream(random), sm.getId(), "file1",
|
||||
false);
|
||||
final Artifact result11 = artifactManagement.createArtifact(new ByteArrayInputStream(random), sm.getId(),
|
||||
"file11", false);
|
||||
final Artifact result12 = artifactManagement.createLocalArtifact(new ByteArrayInputStream(random), sm.getId(),
|
||||
final Artifact result12 = artifactManagement.createArtifact(new ByteArrayInputStream(random), sm.getId(),
|
||||
"file12", false);
|
||||
final Artifact result2 = artifactManagement.createLocalArtifact(new ByteArrayInputStream(random), sm2.getId(),
|
||||
final Artifact result2 = artifactManagement.createArtifact(new ByteArrayInputStream(random), sm2.getId(),
|
||||
"file2", false);
|
||||
|
||||
assertThat(result).isInstanceOf(LocalArtifact.class);
|
||||
assertThat(result).isInstanceOf(Artifact.class);
|
||||
assertThat(result.getSoftwareModule().getId()).isEqualTo(sm.getId());
|
||||
assertThat(result2.getSoftwareModule().getId()).isEqualTo(sm2.getId());
|
||||
assertThat(((JpaLocalArtifact) result).getFilename()).isEqualTo("file1");
|
||||
assertThat(((JpaLocalArtifact) result).getGridFsFileName()).isNotNull();
|
||||
assertThat(((JpaArtifact) result).getFilename()).isEqualTo("file1");
|
||||
assertThat(((JpaArtifact) result).getGridFsFileName()).isNotNull();
|
||||
assertThat(result).isNotEqualTo(result2);
|
||||
assertThat(((JpaLocalArtifact) result).getGridFsFileName())
|
||||
.isEqualTo(((JpaLocalArtifact) result2).getGridFsFileName());
|
||||
assertThat(((JpaArtifact) result).getGridFsFileName()).isEqualTo(((JpaArtifact) result2).getGridFsFileName());
|
||||
|
||||
assertThat(artifactManagement.findLocalArtifactByFilename("file1").get(0).getSha1Hash())
|
||||
assertThat(artifactManagement.findArtifactByFilename("file1").get(0).getSha1Hash())
|
||||
.isEqualTo(HashGeneratorUtils.generateSHA1(random));
|
||||
assertThat(artifactManagement.findLocalArtifactByFilename("file1").get(0).getMd5Hash())
|
||||
assertThat(artifactManagement.findArtifactByFilename("file1").get(0).getMd5Hash())
|
||||
.isEqualTo(HashGeneratorUtils.generateMD5(random));
|
||||
|
||||
assertThat(artifactRepository.findAll()).hasSize(4);
|
||||
assertThat(softwareModuleRepository.findAll()).hasSize(3);
|
||||
|
||||
assertThat(softwareManagement.findSoftwareModuleWithDetails(sm.getId()).getArtifacts()).hasSize(3);
|
||||
assertThat(softwareManagement.findSoftwareModuleById(sm.getId()).getArtifacts()).hasSize(3);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -122,7 +116,7 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
final byte random[] = RandomStringUtils.random(5 * 1024).getBytes();
|
||||
|
||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(random), sm.getId(), "file1", false);
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(random), sm.getId(), "file1", false);
|
||||
assertThat(artifactRepository.findAll()).hasSize(1);
|
||||
|
||||
softwareModuleRepository.deleteAll();
|
||||
@@ -131,63 +125,7 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.eclipse.hawkbit.repository.ArtifactManagement#createExternalArtifact(org.eclipse.hawkbit.repository.model.ExternalArtifactProvider, java.lang.String)}
|
||||
* .
|
||||
*/
|
||||
@Test
|
||||
@Description("Tests the creation of an external artifact metadata element.")
|
||||
public void createExternalArtifact() {
|
||||
JpaSoftwareModule sm = new JpaSoftwareModule(softwareManagement.findSoftwareModuleTypeByKey("os"), "name 1",
|
||||
"version 1", null, null);
|
||||
sm = softwareModuleRepository.save(sm);
|
||||
|
||||
JpaSoftwareModule sm2 = new JpaSoftwareModule(softwareManagement.findSoftwareModuleTypeByKey("os"), "name 2",
|
||||
"version 2", null, null);
|
||||
sm2 = softwareModuleRepository.save(sm2);
|
||||
|
||||
final ExternalArtifactProvider provider = artifactManagement.createExternalArtifactProvider("provider X", null,
|
||||
"https://fhghdfjgh", "/{version}/");
|
||||
|
||||
JpaExternalArtifact result = (JpaExternalArtifact) artifactManagement.createExternalArtifact(provider, null,
|
||||
sm.getId());
|
||||
|
||||
assertNotNull("The result of an external artifact should not be null", result);
|
||||
assertThat(externalArtifactRepository.findAll()).contains(result).hasSize(1);
|
||||
assertThat(result.getSoftwareModule().getId()).isEqualTo(sm.getId());
|
||||
assertThat(result.getUrl()).isEqualTo("https://fhghdfjgh/{version}/");
|
||||
assertThat(result.getExternalArtifactProvider()).isEqualTo(provider);
|
||||
|
||||
result = (JpaExternalArtifact) artifactManagement.createExternalArtifact(provider, "/test", sm2.getId());
|
||||
assertNotNull("The newly created external artifact should not be null", result);
|
||||
assertThat(externalArtifactRepository.findAll()).contains(result).hasSize(2);
|
||||
assertThat(result.getUrl()).isEqualTo("https://fhghdfjgh/test");
|
||||
assertThat(result.getExternalArtifactProvider()).isEqualTo(provider);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests deletio of an external artifact metadata element.")
|
||||
public void deleteExternalArtifact() {
|
||||
assertThat(artifactRepository.findAll()).isEmpty();
|
||||
|
||||
JpaSoftwareModule sm = new JpaSoftwareModule(softwareManagement.findSoftwareModuleTypeByKey("os"), "name 1",
|
||||
"version 1", null, null);
|
||||
sm = softwareModuleRepository.save(sm);
|
||||
|
||||
final JpaExternalArtifactProvider provider = (JpaExternalArtifactProvider) artifactManagement
|
||||
.createExternalArtifactProvider("provider X", null, "https://fhghdfjgh", "/{version}/");
|
||||
|
||||
final JpaExternalArtifact result = (JpaExternalArtifact) artifactManagement.createExternalArtifact(provider,
|
||||
null, sm.getId());
|
||||
assertNotNull("The newly created external artifact should not be null", result);
|
||||
assertThat(externalArtifactRepository.findAll()).contains(result).hasSize(1);
|
||||
|
||||
artifactManagement.deleteExternalArtifact(result.getId());
|
||||
assertThat(externalArtifactRepository.findAll()).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.eclipse.hawkbit.repository.ArtifactManagement#deleteLocalArtifact(java.lang.Long)}
|
||||
* {@link org.eclipse.hawkbit.repository.ArtifactManagement#deleteArtifact(java.lang.Long)}
|
||||
* .
|
||||
*
|
||||
* @throws IOException
|
||||
@@ -195,7 +133,7 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
*/
|
||||
@Test
|
||||
@Description("Tests the deletion of a local artifact including metadata.")
|
||||
public void deleteLocalArtifact() throws NoSuchAlgorithmException, IOException {
|
||||
public void deleteArtifact() throws NoSuchAlgorithmException, IOException {
|
||||
JpaSoftwareModule sm = new JpaSoftwareModule(softwareManagement.findSoftwareModuleTypeByKey("os"), "name 1",
|
||||
"version 1", null, null);
|
||||
sm = softwareModuleRepository.save(sm);
|
||||
@@ -206,34 +144,35 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
assertThat(artifactRepository.findAll()).isEmpty();
|
||||
|
||||
final Artifact result = artifactManagement.createLocalArtifact(new RandomGeneratedInputStream(5 * 1024),
|
||||
sm.getId(), "file1", false);
|
||||
final Artifact result2 = artifactManagement.createLocalArtifact(new RandomGeneratedInputStream(5 * 1024),
|
||||
final Artifact result = artifactManagement.createArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(),
|
||||
"file1", false);
|
||||
final Artifact result2 = artifactManagement.createArtifact(new RandomGeneratedInputStream(5 * 1024),
|
||||
sm2.getId(), "file2", false);
|
||||
|
||||
assertThat(artifactRepository.findAll()).hasSize(2);
|
||||
|
||||
assertThat(result.getId()).isNotNull();
|
||||
assertThat(result2.getId()).isNotNull();
|
||||
assertThat(((JpaLocalArtifact) result).getGridFsFileName())
|
||||
.isNotEqualTo(((JpaLocalArtifact) result2).getGridFsFileName());
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result).getGridFsFileName()))))
|
||||
assertThat(((JpaArtifact) result).getGridFsFileName())
|
||||
.isNotEqualTo(((JpaArtifact) result2).getGridFsFileName());
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result).getGridFsFileName()))))
|
||||
.isNotNull();
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result2).getGridFsFileName()))))
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result2).getGridFsFileName()))))
|
||||
.isNotNull();
|
||||
|
||||
artifactManagement.deleteLocalArtifact(result.getId());
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result).getGridFsFileName())))).isNull();
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result2).getGridFsFileName()))))
|
||||
artifactManagement.deleteArtifact(result.getId());
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result).getGridFsFileName()))))
|
||||
.isNull();
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result2).getGridFsFileName()))))
|
||||
.isNotNull();
|
||||
|
||||
artifactManagement.deleteLocalArtifact(result2.getId());
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result2).getGridFsFileName()))))
|
||||
artifactManagement.deleteArtifact(result2.getId());
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result2).getGridFsFileName()))))
|
||||
.isNull();
|
||||
|
||||
assertThat(artifactRepository.findAll()).hasSize(0);
|
||||
@@ -253,33 +192,33 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
final byte random[] = RandomStringUtils.random(5 * 1024).getBytes();
|
||||
|
||||
final Artifact result = artifactManagement.createLocalArtifact(new ByteArrayInputStream(random), sm.getId(),
|
||||
"file1", false);
|
||||
final Artifact result2 = artifactManagement.createLocalArtifact(new ByteArrayInputStream(random), sm2.getId(),
|
||||
final Artifact result = artifactManagement.createArtifact(new ByteArrayInputStream(random), sm.getId(), "file1",
|
||||
false);
|
||||
final Artifact result2 = artifactManagement.createArtifact(new ByteArrayInputStream(random), sm2.getId(),
|
||||
"file2", false);
|
||||
|
||||
assertThat(artifactRepository.findAll()).hasSize(2);
|
||||
assertThat(result.getId()).isNotNull();
|
||||
assertThat(result2.getId()).isNotNull();
|
||||
assertThat(((JpaLocalArtifact) result).getGridFsFileName())
|
||||
.isEqualTo(((JpaLocalArtifact) result2).getGridFsFileName());
|
||||
assertThat(((JpaArtifact) result).getGridFsFileName()).isEqualTo(((JpaArtifact) result2).getGridFsFileName());
|
||||
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result).getGridFsFileName()))))
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result).getGridFsFileName()))))
|
||||
.isNotNull();
|
||||
artifactManagement.deleteLocalArtifact(result.getId());
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result).getGridFsFileName()))))
|
||||
artifactManagement.deleteArtifact(result.getId());
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result).getGridFsFileName()))))
|
||||
.isNotNull();
|
||||
|
||||
artifactManagement.deleteLocalArtifact(result2.getId());
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result).getGridFsFileName())))).isNull();
|
||||
artifactManagement.deleteArtifact(result2.getId());
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result).getGridFsFileName()))))
|
||||
.isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.eclipse.hawkbit.repository.ArtifactManagement#findLocalArtifact(java.lang.Long)}
|
||||
* {@link org.eclipse.hawkbit.repository.ArtifactManagement#findArtifact(java.lang.Long)}
|
||||
* .
|
||||
*
|
||||
* @throws IOException
|
||||
@@ -287,20 +226,20 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
*/
|
||||
@Test
|
||||
@Description("Loads an local artifact based on given ID.")
|
||||
public void findLocalArtifact() throws NoSuchAlgorithmException, IOException {
|
||||
public void findArtifact() throws NoSuchAlgorithmException, IOException {
|
||||
SoftwareModule sm = new JpaSoftwareModule(softwareManagement.findSoftwareModuleTypeByKey("os"), "name 1",
|
||||
"version 1", null, null);
|
||||
sm = softwareManagement.createSoftwareModule(sm);
|
||||
|
||||
final LocalArtifact result = artifactManagement.createLocalArtifact(new RandomGeneratedInputStream(5 * 1024),
|
||||
sm.getId(), "file1", false);
|
||||
final Artifact result = artifactManagement.createArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(),
|
||||
"file1", false);
|
||||
|
||||
assertThat(artifactManagement.findLocalArtifact(result.getId())).isEqualTo(result);
|
||||
assertThat(artifactManagement.findArtifact(result.getId())).isEqualTo(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for
|
||||
* {@link org.eclipse.hawkbit.repository.ArtifactManagement#loadLocalArtifactBinary(java.lang.Long)}
|
||||
* {@link org.eclipse.hawkbit.repository.ArtifactManagement#loadArtifactBinary(java.lang.Long)}
|
||||
* .
|
||||
*
|
||||
* @throws IOException
|
||||
@@ -308,26 +247,26 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
*/
|
||||
@Test
|
||||
@Description("Loads an artifact binary based on given ID.")
|
||||
public void loadStreamOfLocalArtifact() throws NoSuchAlgorithmException, IOException {
|
||||
public void loadStreamOfArtifact() throws NoSuchAlgorithmException, IOException {
|
||||
SoftwareModule sm = new JpaSoftwareModule(softwareManagement.findSoftwareModuleTypeByKey("os"), "name 1",
|
||||
"version 1", null, null);
|
||||
sm = softwareManagement.createSoftwareModule(sm);
|
||||
|
||||
final byte random[] = RandomStringUtils.random(5 * 1024).getBytes();
|
||||
|
||||
final LocalArtifact result = artifactManagement.createLocalArtifact(new ByteArrayInputStream(random),
|
||||
sm.getId(), "file1", false);
|
||||
final Artifact result = artifactManagement.createArtifact(new ByteArrayInputStream(random), sm.getId(), "file1",
|
||||
false);
|
||||
|
||||
assertTrue("The stored binary matches the given binary", IOUtils.contentEquals(new ByteArrayInputStream(random),
|
||||
artifactManagement.loadLocalArtifactBinary(result).getFileInputStream()));
|
||||
artifactManagement.loadArtifactBinary(result).getFileInputStream()));
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithUser(allSpPermissions = true, removeFromAllPermission = { SpPermission.DOWNLOAD_REPOSITORY_ARTIFACT })
|
||||
@Description("Trys and fails to load an artifact without required permission. Checks if expected InsufficientPermissionException is thrown.")
|
||||
public void loadLocalArtifactBinaryWithoutDownloadArtifactThrowsPermissionDenied() {
|
||||
public void loadArtifactBinaryWithoutDownloadArtifactThrowsPermissionDenied() {
|
||||
try {
|
||||
artifactManagement.loadLocalArtifactBinary(new JpaLocalArtifact());
|
||||
artifactManagement.loadArtifactBinary(new JpaArtifact());
|
||||
fail("Should not have worked with missing permission.");
|
||||
} catch (final InsufficientPermissionException e) {
|
||||
|
||||
@@ -336,19 +275,19 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
@Test
|
||||
@Description("Searches an artifact through the relations of a software module.")
|
||||
public void findLocalArtifactBySoftwareModule() {
|
||||
public void findArtifactBySoftwareModule() {
|
||||
SoftwareModule sm = new JpaSoftwareModule(osType, "name 1", "version 1", null, null);
|
||||
sm = softwareManagement.createSoftwareModule(sm);
|
||||
|
||||
SoftwareModule sm2 = new JpaSoftwareModule(osType, "name 2", "version 2", null, null);
|
||||
sm2 = softwareManagement.createSoftwareModule(sm2);
|
||||
|
||||
assertThat(artifactManagement.findLocalArtifactBySoftwareModule(pageReq, sm.getId())).isEmpty();
|
||||
assertThat(artifactManagement.findArtifactBySoftwareModule(pageReq, sm.getId())).isEmpty();
|
||||
|
||||
final Artifact result = artifactManagement.createLocalArtifact(new RandomGeneratedInputStream(5 * 1024),
|
||||
sm.getId(), "file1", false);
|
||||
final Artifact result = artifactManagement.createArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(),
|
||||
"file1", false);
|
||||
|
||||
assertThat(artifactManagement.findLocalArtifactBySoftwareModule(pageReq, sm.getId())).hasSize(1);
|
||||
assertThat(artifactManagement.findArtifactBySoftwareModule(pageReq, sm.getId())).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -359,8 +298,8 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
assertThat(artifactManagement.findByFilenameAndSoftwareModule("file1", sm.getId())).isEmpty();
|
||||
|
||||
artifactManagement.createLocalArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(), "file1", false);
|
||||
artifactManagement.createLocalArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(), "file2", false);
|
||||
artifactManagement.createArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(), "file1", false);
|
||||
artifactManagement.createArtifact(new RandomGeneratedInputStream(5 * 1024), sm.getId(), "file2", false);
|
||||
|
||||
assertThat(artifactManagement.findByFilenameAndSoftwareModule("file1", sm.getId())).hasSize(1);
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ import javax.validation.ConstraintViolationException;
|
||||
import org.apache.commons.lang3.RandomUtils;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaArtifact;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaLocalArtifact;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModuleType;
|
||||
@@ -237,24 +237,29 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
ds = (JpaDistributionSet) assignSet(target, ds).getDistributionSet();
|
||||
|
||||
// standard searches
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "poky", osType).getContent()).hasSize(1);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "poky", osType).getContent().get(0))
|
||||
.isEqualTo(os);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "oracle%", runtimeType).getContent())
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "poky", osType.getId()).getContent())
|
||||
.hasSize(1);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "oracle%", runtimeType).getContent().get(0))
|
||||
.isEqualTo(jvm);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0.1", appType).getContent()).hasSize(1);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0.1", appType).getContent().get(0))
|
||||
.isEqualTo(ah);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0%", appType).getContent()).hasSize(2);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "poky", osType.getId()).getContent().get(0))
|
||||
.isEqualTo(os);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "oracle%", runtimeType.getId()).getContent())
|
||||
.hasSize(1);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "oracle%", runtimeType.getId()).getContent()
|
||||
.get(0)).isEqualTo(jvm);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0.1", appType.getId()).getContent())
|
||||
.hasSize(1);
|
||||
assertThat(
|
||||
softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0.1", appType.getId()).getContent().get(0))
|
||||
.isEqualTo(ah);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0%", appType.getId()).getContent())
|
||||
.hasSize(2);
|
||||
|
||||
// no we search with on entity marked as deleted
|
||||
softwareManagement.deleteSoftwareModule(
|
||||
softwareManagement.findSoftwareModuleByAssignedToAndType(pageReq, ds, appType).getContent().get(0));
|
||||
softwareModuleRepository.findByAssignedToAndType(pageReq, ds, appType).getContent().get(0).getId());
|
||||
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0%", appType).getContent()).hasSize(1);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0%", appType).getContent().get(0))
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0%", appType.getId()).getContent())
|
||||
.hasSize(1);
|
||||
assertThat(softwareManagement.findSoftwareModuleByFilters(pageReq, "1.0%", appType.getId()).getContent().get(0))
|
||||
.isEqualTo(ah);
|
||||
}
|
||||
|
||||
@@ -294,11 +299,11 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
final SoftwareModule two = softwareManagement
|
||||
.createSoftwareModule(new JpaSoftwareModule(osType, "two", "two", null, ""));
|
||||
// ignored
|
||||
softwareManagement.deleteSoftwareModule(
|
||||
softwareManagement.createSoftwareModule(new JpaSoftwareModule(osType, "deleted", "deleted", null, "")));
|
||||
softwareManagement.deleteSoftwareModule(softwareManagement
|
||||
.createSoftwareModule(new JpaSoftwareModule(osType, "deleted", "deleted", null, "")).getId());
|
||||
softwareManagement.createSoftwareModule(new JpaSoftwareModule(appType, "three", "3.0.2", null, ""));
|
||||
|
||||
assertThat(softwareManagement.findSoftwareModulesByType(pageReq, osType).getContent())
|
||||
assertThat(softwareManagement.findSoftwareModulesByType(pageReq, osType.getId()).getContent())
|
||||
.as("Expected to find the following number of modules:").hasSize(2).as("with the following elements")
|
||||
.contains(two, one);
|
||||
}
|
||||
@@ -310,29 +315,13 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
softwareManagement.createSoftwareModule(new JpaSoftwareModule(osType, "one", "one", null, ""));
|
||||
softwareManagement.createSoftwareModule(new JpaSoftwareModule(appType, "two", "two", null, ""));
|
||||
// ignored
|
||||
softwareManagement.deleteSoftwareModule(
|
||||
softwareManagement.createSoftwareModule(new JpaSoftwareModule(osType, "deleted", "deleted", null, "")));
|
||||
softwareManagement.deleteSoftwareModule(softwareManagement
|
||||
.createSoftwareModule(new JpaSoftwareModule(osType, "deleted", "deleted", null, "")).getId());
|
||||
|
||||
assertThat(softwareManagement.countSoftwareModulesAll()).as("Expected to find the following number of modules:")
|
||||
.isEqualTo(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Counts for software modules by type.")
|
||||
public void countSoftwareModulesByType() {
|
||||
// found in test
|
||||
softwareManagement.createSoftwareModule(new JpaSoftwareModule(osType, "one", "one", null, ""));
|
||||
softwareManagement.createSoftwareModule(new JpaSoftwareModule(osType, "two", "two", null, ""));
|
||||
|
||||
// ignored
|
||||
softwareManagement.deleteSoftwareModule(
|
||||
softwareManagement.createSoftwareModule(new JpaSoftwareModule(osType, "deleted", "deleted", null, "")));
|
||||
softwareManagement.createSoftwareModule(new JpaSoftwareModule(appType, "three", "3.0.2", null, ""));
|
||||
|
||||
assertThat(softwareManagement.countSoftwareModulesByType(osType))
|
||||
.as("Expected to find the following number of modules:").isEqualTo(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Tests the successfull deletion of software module types. Both unused (hard delete) and used ones (soft delete).")
|
||||
public void deleteAssignedAndUnassignedSoftwareModuleTypes() {
|
||||
@@ -382,7 +371,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
final Artifact artifact2 = artifactsIt.next();
|
||||
|
||||
// [STEP2]: Delete unassigned SoftwareModule
|
||||
softwareManagement.deleteSoftwareModule(unassignedModule);
|
||||
softwareManagement.deleteSoftwareModule(unassignedModule.getId());
|
||||
|
||||
// [VERIFY EXPECTED RESULT]:
|
||||
// verify: SoftwareModule is deleted
|
||||
@@ -412,7 +401,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
distributionSetManagement.assignSoftwareModules(disSet, Sets.newHashSet(assignedModule));
|
||||
|
||||
// [STEP3]: Delete the assigned SoftwareModule
|
||||
softwareManagement.deleteSoftwareModule(assignedModule);
|
||||
softwareManagement.deleteSoftwareModule(assignedModule.getId());
|
||||
|
||||
// [VERIFY EXPECTED RESULT]:
|
||||
// verify: assignedModule is marked as deleted
|
||||
@@ -454,7 +443,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
distributionSetManagement.deleteDistributionSet(disSet);
|
||||
|
||||
// [STEP5]: Delete the assigned SoftwareModule
|
||||
softwareManagement.deleteSoftwareModule(assignedModule);
|
||||
softwareManagement.deleteSoftwareModule(assignedModule.getId());
|
||||
|
||||
// [VERIFY EXPECTED RESULT]:
|
||||
// verify: assignedModule is marked as deleted
|
||||
@@ -488,23 +477,23 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
SoftwareModule moduleX = createSoftwareModuleWithArtifacts(osType, "modulex", "v1.0", 0);
|
||||
|
||||
// [STEP2]: Create newArtifactX and add it to SoftwareModuleX
|
||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
||||
moduleX = softwareManagement.findSoftwareModuleWithDetails(moduleX.getId());
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
||||
moduleX = softwareManagement.findSoftwareModuleById(moduleX.getId());
|
||||
final Artifact artifactX = moduleX.getArtifacts().iterator().next();
|
||||
|
||||
// [STEP3]: Create SoftwareModuleY and add the same ArtifactX
|
||||
SoftwareModule moduleY = createSoftwareModuleWithArtifacts(osType, "moduley", "v1.0", 0);
|
||||
|
||||
// [STEP4]: Assign the same ArtifactX to SoftwareModuleY
|
||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
||||
moduleY = softwareManagement.findSoftwareModuleWithDetails(moduleY.getId());
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
||||
moduleY = softwareManagement.findSoftwareModuleById(moduleY.getId());
|
||||
final Artifact artifactY = moduleY.getArtifacts().iterator().next();
|
||||
|
||||
// verify: that only one entry was created in mongoDB
|
||||
assertThat(operations.find(new Query())).hasSize(1);
|
||||
|
||||
// [STEP5]: Delete SoftwareModuleX
|
||||
softwareManagement.deleteSoftwareModule(moduleX);
|
||||
softwareManagement.deleteSoftwareModule(moduleX.getId());
|
||||
|
||||
// [VERIFY EXPECTED RESULT]:
|
||||
// verify: SoftwareModuleX is deleted, and ModuelY still exists
|
||||
@@ -540,15 +529,15 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
// [STEP1]: Create SoftwareModuleX and add a new ArtifactX
|
||||
SoftwareModule moduleX = createSoftwareModuleWithArtifacts(osType, "modulex", "v1.0", 0);
|
||||
|
||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
||||
moduleX = softwareManagement.findSoftwareModuleWithDetails(moduleX.getId());
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleX.getId(), "artifactx", false);
|
||||
moduleX = softwareManagement.findSoftwareModuleById(moduleX.getId());
|
||||
final Artifact artifactX = moduleX.getArtifacts().iterator().next();
|
||||
|
||||
// [STEP2]: Create SoftwareModuleY and add the same ArtifactX
|
||||
SoftwareModule moduleY = createSoftwareModuleWithArtifacts(osType, "moduley", "v1.0", 0);
|
||||
|
||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
||||
moduleY = softwareManagement.findSoftwareModuleWithDetails(moduleY.getId());
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(source), moduleY.getId(), "artifactx", false);
|
||||
moduleY = softwareManagement.findSoftwareModuleById(moduleY.getId());
|
||||
final Artifact artifactY = moduleY.getArtifacts().iterator().next();
|
||||
|
||||
// verify: that only one entry was created in mongoDB
|
||||
@@ -563,10 +552,10 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
deploymentManagement.assignDistributionSet(disSetY, Lists.newArrayList(target));
|
||||
|
||||
// [STEP5]: Delete SoftwareModuleX
|
||||
softwareManagement.deleteSoftwareModule(moduleX);
|
||||
softwareManagement.deleteSoftwareModule(moduleX.getId());
|
||||
|
||||
// [STEP6]: Delete SoftwareModuleY
|
||||
softwareManagement.deleteSoftwareModule(moduleY);
|
||||
softwareManagement.deleteSoftwareModule(moduleY.getId());
|
||||
|
||||
// [VERIFY EXPECTED RESULT]:
|
||||
moduleX = softwareManagement.findSoftwareModuleById(moduleX.getId());
|
||||
@@ -597,12 +586,12 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
new JpaSoftwareModule(type, name, version, "description of artifact " + name, ""));
|
||||
|
||||
for (int i = 0; i < numberArtifacts; i++) {
|
||||
artifactManagement.createLocalArtifact(new RandomGeneratedInputStream(5 * 1024), softwareModule.getId(),
|
||||
artifactManagement.createArtifact(new RandomGeneratedInputStream(5 * 1024), softwareModule.getId(),
|
||||
"file" + (i + 1), false);
|
||||
}
|
||||
|
||||
// Verify correct Creation of SoftwareModule and corresponding artifacts
|
||||
softwareModule = softwareManagement.findSoftwareModuleWithDetails(softwareModule.getId());
|
||||
softwareModule = softwareManagement.findSoftwareModuleById(softwareModule.getId());
|
||||
assertThat(softwareModuleRepository.findAll()).hasSize((int) countSoftwareModule + 1);
|
||||
|
||||
final List<Artifact> artifacts = softwareModule.getArtifacts();
|
||||
@@ -622,16 +611,16 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
assertThat(artifactRepository.findAll()).hasSize(results.length);
|
||||
for (final Artifact result : results) {
|
||||
assertThat(result.getId()).isNotNull();
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result).getGridFsFileName()))))
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result).getGridFsFileName()))))
|
||||
.isNotNull();
|
||||
}
|
||||
}
|
||||
|
||||
private void assertArtfiactNull(final Artifact... results) {
|
||||
for (final Artifact result : results) {
|
||||
assertThat(operations.findOne(new Query()
|
||||
.addCriteria(Criteria.where("filename").is(((JpaLocalArtifact) result).getGridFsFileName()))))
|
||||
assertThat(operations.findOne(
|
||||
new Query().addCriteria(Criteria.where("filename").is(((JpaArtifact) result).getGridFsFileName()))))
|
||||
.isNull();
|
||||
}
|
||||
}
|
||||
@@ -664,18 +653,18 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
|
||||
final DistributionSet set = distributionSetManagement.createDistributionSet(new JpaDistributionSet("set", "1",
|
||||
"desc", testDsType, Lists.newArrayList(one, two, deleted, four, differentName)));
|
||||
softwareManagement.deleteSoftwareModule(deleted);
|
||||
softwareManagement.deleteSoftwareModule(deleted.getId());
|
||||
|
||||
// with filter on name, version and module type
|
||||
assertThat(softwareManagement.findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(pageReq,
|
||||
set.getId(), "found", testType).getContent())
|
||||
set.getId(), "found", testType.getId()).getContent())
|
||||
.as("Found modules with given name, given module type and the assigned ones first")
|
||||
.containsExactly(new AssignedSoftwareModule(one, true), new AssignedSoftwareModule(two, true),
|
||||
new AssignedSoftwareModule(unassigned, false));
|
||||
|
||||
// with filter on module type only
|
||||
assertThat(softwareManagement.findSoftwareModuleOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(pageReq,
|
||||
set.getId(), null, testType).getContent())
|
||||
set.getId(), null, testType.getId()).getContent())
|
||||
.as("Found modules with given module type and the assigned ones first").containsExactly(
|
||||
new AssignedSoftwareModule(differentName, true), new AssignedSoftwareModule(one, true),
|
||||
new AssignedSoftwareModule(two, true), new AssignedSoftwareModule(unassigned, false));
|
||||
@@ -715,12 +704,12 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
.createSoftwareModule(new JpaSoftwareModule(testType, "deleted", "deleted", null, ""));
|
||||
distributionSetManagement.createDistributionSet(new JpaDistributionSet("set", "1", "desc", testDsType,
|
||||
Lists.newArrayList(one, two, deleted, four, differentName)));
|
||||
softwareManagement.deleteSoftwareModule(deleted);
|
||||
softwareManagement.deleteSoftwareModule(deleted.getId());
|
||||
|
||||
// test
|
||||
assertThat(softwareManagement.countSoftwareModuleByFilters("found", testType))
|
||||
assertThat(softwareManagement.countSoftwareModuleByFilters("found", testType.getId()))
|
||||
.as("Number of modules with given name or version and type").isEqualTo(3);
|
||||
assertThat(softwareManagement.countSoftwareModuleByFilters(null, testType))
|
||||
assertThat(softwareManagement.countSoftwareModuleByFilters(null, testType.getId()))
|
||||
.as("Number of modules with given type").isEqualTo(4);
|
||||
assertThat(softwareManagement.countSoftwareModuleByFilters(null, null)).as("Number of modules overall")
|
||||
.isEqualTo(5);
|
||||
@@ -742,7 +731,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
.createSoftwareModule(new JpaSoftwareModule(testType, "deleted", "deleted", null, ""));
|
||||
distributionSetManagement.createDistributionSet(
|
||||
new JpaDistributionSet("set", "1", "desc", testDsType, Lists.newArrayList(deleted, four)));
|
||||
softwareManagement.deleteSoftwareModule(deleted);
|
||||
softwareManagement.deleteSoftwareModule(deleted.getId());
|
||||
|
||||
assertThat(softwareManagement.countSoftwareModulesAll()).as("Number of undeleted modules").isEqualTo(1);
|
||||
assertThat(softwareModuleRepository.count()).as("Number of all modules").isEqualTo(2);
|
||||
@@ -829,7 +818,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
.createSoftwareModule(new JpaSoftwareModule(testType, "deleted", "deleted", null, ""));
|
||||
final DistributionSet set = distributionSetManagement.createDistributionSet(
|
||||
new JpaDistributionSet("set", "1", "desc", testDsType, Lists.newArrayList(one, deleted)));
|
||||
softwareManagement.deleteSoftwareModule(deleted);
|
||||
softwareManagement.deleteSoftwareModule(deleted.getId());
|
||||
|
||||
assertThat(softwareManagement.findSoftwareModuleByAssignedTo(pageReq, set).getContent())
|
||||
.as("Found this number of modules").hasSize(2);
|
||||
@@ -946,13 +935,13 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
ah = softwareManagement.createSoftwareModuleMetadata(new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1))
|
||||
.getSoftwareModule();
|
||||
|
||||
assertThat(softwareManagement.findSoftwareModuleById(ah.getId()).getMetadata())
|
||||
assertThat(softwareManagement.findSoftwareModuleMetadataBySoftwareModuleId(ah.getId()))
|
||||
.as("Contains the created metadata element")
|
||||
.containsExactly(new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1));
|
||||
|
||||
softwareManagement.deleteSoftwareModuleMetadata(ah, knownKey1);
|
||||
assertThat(softwareManagement.findSoftwareModuleById(ah.getId()).getMetadata()).as("Metadata elemenets are")
|
||||
.isEmpty();
|
||||
softwareManagement.deleteSoftwareModuleMetadata(ah.getId(), knownKey1);
|
||||
assertThat(softwareManagement.findSoftwareModuleMetadataBySoftwareModuleId(ah.getId()))
|
||||
.as("Metadata elemenets are").isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -968,7 +957,7 @@ public class SoftwareManagementTest extends AbstractJpaIntegrationTestWithMongoD
|
||||
.getSoftwareModule();
|
||||
|
||||
try {
|
||||
softwareManagement.findSoftwareModuleMetadata(ah, "doesnotexist");
|
||||
softwareManagement.findSoftwareModuleMetadata(ah.getId(), "doesnotexist");
|
||||
fail("should not have worked as module metadata with that key does not exist");
|
||||
} catch (final EntityNotFoundException e) {
|
||||
|
||||
|
||||
@@ -136,14 +136,14 @@ public class SystemManagementTest extends AbstractJpaIntegrationTestWithMongoDB
|
||||
"version 1", null, null);
|
||||
sm = softwareModuleRepository.save(sm);
|
||||
|
||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(random), sm.getId(), "file1", false);
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(random), sm.getId(), "file1", false);
|
||||
}
|
||||
|
||||
private void createDeletedTestArtifact(final byte[] random) {
|
||||
final DistributionSet ds = testdataFactory.createDistributionSet("deleted garbage", true);
|
||||
ds.getModules().stream().forEach(module -> {
|
||||
artifactManagement.createLocalArtifact(new ByteArrayInputStream(random), module.getId(), "file1", false);
|
||||
softwareManagement.deleteSoftwareModule(module);
|
||||
artifactManagement.createArtifact(new ByteArrayInputStream(random), module.getId(), "file1", false);
|
||||
softwareManagement.deleteSoftwareModule(module.getId());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,11 @@ spring.datasource.driverClassName=org.h2.Driver
|
||||
spring.datasource.username=sa
|
||||
spring.datasource.password=sa
|
||||
|
||||
spring.datasource.eclipselink.logging.logger=JavaLogger
|
||||
spring.jpa.properties.eclipselink.logging.level=FINE
|
||||
spring.jpa.properties.eclipselink.logging.level.sql=FINE
|
||||
spring.jpa.properties.eclipselink.logging.parameters=true
|
||||
|
||||
flyway.enabled=true
|
||||
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
|
||||
#spring.jpa.show-sql=true
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
-->
|
||||
<configuration>
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
||||
|
||||
<!-- <logger name="org.eclipse.persistence" level="DEBUG" /> -->
|
||||
|
||||
<Root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
|
||||
Reference in New Issue
Block a user