+import org.apache.http.HttpResponse;
import org.junit.Rule;
import org.junit.rules.TestName;
+import org.openecomp.sdc.be.datatypes.enums.AssetTypeEnum;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.Resource;
import org.openecomp.sdc.be.model.Service;
import org.openecomp.sdc.ci.tests.datatypes.enums.LifeCycleStatesEnum;
import org.openecomp.sdc.ci.tests.datatypes.enums.UserRoleEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
+import org.openecomp.sdc.ci.tests.utils.CsarToscaTester;
import org.openecomp.sdc.ci.tests.utils.general.AtomicOperationUtils;
import org.openecomp.sdc.ci.tests.utils.general.ElementFactory;
import org.openecomp.sdc.ci.tests.utils.general.OnboardingUtillViaApis;
+import org.openecomp.sdc.ci.tests.utils.rest.AssetRestUtils;
+import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Optional;
import org.testng.annotations.Parameters;
import fj.data.Either;
-
-
-
+import java.io.File;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
public class Onboard extends ComponentBaseTest {
}
protected String makeDistributionValue;
+ protected ISdcCsarHelper fdntCsarHelper;
+ protected SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
ExtentTestActions.log(Status.INFO, String.format("Certify Service"));
service = (Service) AtomicOperationUtils.changeComponentState(service, UserRoleEnum.DESIGNER, LifeCycleStatesEnum.CERTIFY, true).getLeft();
+
// ExtentTestActions.log(Status.INFO, String.format("Distribute Service"));
// AtomicOperationUtils.distributeService(service, true);
-
- ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
- }
+ try{
+// HttpResponse assetResponse = AssetRestUtils.getComponentToscaModel(AssetTypeEnum.SERVICES, service.getUUID());
+// InputStream inputStream = assetResponse.getEntity().getContent();
+ File csarFile = AssetRestUtils.getToscaModelCsarFile(AssetTypeEnum.SERVICES, service.getUUID());
+
+ ExtentTestActions.log(Status.INFO, "Tosca parser is going to convert service csar file to ISdcCsarHelper object...");
+ fdntCsarHelper = factory.getSdcCsarHelper(csarFile.getAbsolutePath());
+ CsarToscaTester.processCsar(fdntCsarHelper);
+ ExtentTestActions.log(Status.INFO, String.format("Tosca parser successfully parsed service CSAR"));
+ ExtentTestActions.log(Status.INFO, String.format("The onboarding %s test is passed ! ", vnfFile));
+
+ }catch(Exception e){
+ ExtentTestActions.log(Status.ERROR, "Tosca parser FAILED to convert service csar file to ISdcCsarHelper object...");
+ ExtentTestActions.log(Status.FAIL, e);
+
+ }
+
+
+
+ }
}