refactored DdiDeploymentBaseTest.java (#853)
* refactored DdiDeploymentBaseTest.java * removed hardcoded variables, moved createArtifact() to TestDataFactory Signed-off-by: Ahmed Sayed <ahmed.sayed@bosch-si.com>
This commit is contained in:
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository.test.util;
|
|||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
@@ -492,6 +493,29 @@ public class TestdataFactory {
|
|||||||
.create(new ArtifactUpload(stubInputStream, moduleId, filename, false, artifactData.length()));
|
.create(new ArtifactUpload(stubInputStream, moduleId, filename, false, artifactData.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an {@link Artifact} for given {@link SoftwareModule} with a small
|
||||||
|
* text payload.
|
||||||
|
*
|
||||||
|
* @param artifactData
|
||||||
|
* the {@link Artifact} Inputstream
|
||||||
|
*
|
||||||
|
* @param moduleId
|
||||||
|
* the {@link Artifact} belongs to
|
||||||
|
*
|
||||||
|
* @param filename
|
||||||
|
* that was provided during upload.
|
||||||
|
*
|
||||||
|
* @param fileSize
|
||||||
|
* the file size
|
||||||
|
*
|
||||||
|
* @return {@link Artifact} entity.
|
||||||
|
*/
|
||||||
|
public Artifact createArtifact(final byte[] artifactData, final Long moduleId, final String filename, final int fileSize) {
|
||||||
|
return artifactManagement
|
||||||
|
.create(new ArtifactUpload(new ByteArrayInputStream(artifactData), moduleId, filename, false, fileSize));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates {@link SoftwareModule} with {@link #DEFAULT_VENDOR} and
|
* Creates {@link SoftwareModule} with {@link #DEFAULT_VENDOR} and
|
||||||
* {@link #DEFAULT_VERSION} and random generated
|
* {@link #DEFAULT_VERSION} and random generated
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user