How to import only en impex during system update in Hybris - sap-commerce-cloud

I did system update only with Create essential data checkbox selected. I noticed there are many impex get imported. For example essential-data.impex, essential-data_en.impex, essential-data_de.impex, essential-data_ch.impex ja, br etc. Nearly 7 different language specific impex are get imported. But I wanted to import only en version of it and other I don't want to import. Could you please suggest me how to achieve this. Thank you.

You can create a method in the SystemSetup class.[hybris\bin\custom\training\src\com\training\setup\TrainingSystemSetup.java]
#SystemSetup(extension = MyExtension.EXTENSIONNAME, process = Process.UPDATE,type = Type.ESSENTIAL)
public class NaoCoreInitializer
{
#SystemSetup(type = Type.ESSENTIAL)
public static void setupEssential()
{
ImpexUtils.impex("essentialdata-en.impex");
ImpexUtils.impex("essentialdata-de.impex");// you can add as many impex scripts you can
}
}

If you do a Platform Update, it will always include all languages.
If you need to import 1 localized impex only, you can import via:
HAC: Console > Impex Import
Backoffice: System > Tools > Import

Related

Tenant Not availalbe exception despite the use of the workaround

I have implented GetAllBusinessPartnerCommand and also customized the code in the BusinessPartnerServlet. When I try to call the application with the customized code, I always get this error.
Code GetAllBusinessPartnersCommand
package com.sap.cloud.s4hana.examples.commands;
import java.util.Collections;
import java.util.List;
import org.slf4j.Logger;
import com.sap.cloud.s4hana.examples.BusinessPartnerServlet;
import com.sap.cloud.sdk.cloudplatform.logging.CloudLoggerFactory;
import com.sap.cloud.sdk.frameworks.hystrix.HystrixUtil;
import com.sap.cloud.sdk.s4hana.connectivity.ErpCommand;
import com.sap.cloud.sdk.s4hana.datamodel.odata.helper.Order;
import com.sap.cloud.sdk.s4hana.datamodel.odata.namespaces.businesspartner.BusinessPartner;
import com.sap.cloud.sdk.s4hana.datamodel.odata.services.DefaultBusinessPartnerService;
public class GetAllBusinessPartnersCommand extends ErpCommand<List<BusinessPartner>>{
private static final Logger logger = CloudLoggerFactory.getLogger(BusinessPartnerServlet.class);
public static final String CATEGORY_PERSON ="1";
public GetAllBusinessPartnersCommand() {
super(HystrixUtil.getDefaultErpCommandSetter(
GetAllBusinessPartnersCommand.class,
HystrixUtil.getDefaultErpCommandProperties().withExecutionTimeoutInMilliseconds(10000)));
}
#Override
protected List<BusinessPartner> run() throws Exception {
// TODO Auto-generated method stub
return new DefaultBusinessPartnerService().getAllBusinessPartner()
.select(BusinessPartner.BUSINESS_PARTNER,
BusinessPartner.LAST_NAME,
BusinessPartner.FIRST_NAME,
BusinessPartner.IS_MALE,
BusinessPartner.IS_FEMALE,
BusinessPartner.CREATION_DATE)
.filter(BusinessPartner.BUSINESS_PARTNER_CATEGORY.eq(CATEGORY_PERSON))
.orderBy(BusinessPartner.LAST_NAME, Order.ASC)
.execute();
}
#Override
protected List<BusinessPartner> getFallback() {
logger.warn("Fallback called because of exception:",
getExecutionException());
return Collections.emptyList();
}
}
n the following you can see the commands and the offered workaround for the problem set ALLOW_MOCKED_AUTH_HEADER=true. Before testing I checked if all variables are set correctly and set ALLOW_MOCKED_AUTH_HEADER=true again because I set it too early before.
After this steps i build my project like i always do and get the error from above when im calling the service. I also read this post where someone have the same problem and used the mentioned workaround. But this doesnt work for me and i have no clue why. TenantNotAvailableException, when trying to call business partner from s4 CF SDK
error when call page
Starting mock-server
set variables and workaround plus check
Unfortunately SAP Cloud SDK 2.x is no longer supported. Please use our migration guide to move to the latest version 3.43.0 You can find my blog post on this topic too. If you face any issues, please create another StackOverflow question (with tag sap-cloud-sdk) or comment to the blog post. For more details, please find our documentation.

How to get 'Step' name by using Cucumber with Java to use in Extent report

I want to use Step name which is mentioned in Scenario/Scenario Outline feature file. So please help me how to get the step information in Cucumber java.
You can use Hooks to get the scenario object and then its name.
Should be something like this
package util;
import cucumber.api.java.Before;
public class Hooks {
public String scenario_name;
#Before
public void getScenario(Scenario){
scenario_name = Scenario.getName();
}
}
and then, don't forget to add util, in that case, to your glue
#CucumberOptions(...glue = {"yourStepPackage","util"}...)
Hope it helps!

jmeter: access testplan name in sampler

We are developing some test cases using JSR-223 samplers ( groovy lanquage). We have some configuration information that is loaded at run time that keys off the TestPlan name. I don't see a means for accessing the testplan or name from the sampler, or sampler result. Is there a means to do so?
Here it is:
import org.apache.jmeter.services.FileServer;
String script = FileServer.getFileServer().getScriptName();
You can do the same using __TestPlanName() function passing via "Parameters" section
References:
FileServer class JavaDoc
How to Use JMeter Functions
UPDATE
Theoretically it is possible to access JMeter Test Plan tree, but remember, every time you bypass Java limitation using Reflection somewhere somehow a kitten dies.
Example code:
import org.apache.jmeter.engine.StandardJMeterEngine;
import org.apache.jmeter.testelement.TestPlan;
import org.apache.jorphan.collections.HashTree;
import org.apache.jorphan.collections.SearchByClass;
import java.lang.reflect.Field;
import java.util.Collection;
StandardJMeterEngine engine = ctx.getEngine();
Field test = engine.getClass().getDeclaredField("test");
test.setAccessible(true);
HashTree testPlanTree = (HashTree) test.get(engine);
SearchByClass<TestPlan> testPlans = new SearchByClass<>(TestPlan.class);
testPlanTree.traverse(testPlans);
Collection<TestPlan> testPlansRes = testPlans.getSearchResults();
for (TestPlan testPlan : testPlansRes) {
log.info(testPlan.getProperty("TestElement.name").toString());
}
Demo:
You can check out How to Use BeanShell: JMeter's Favorite Built-in Component for more information on using JMeter and Java API.

Develop/Organize a node module in TypeScript

I want to develop a node module in TypeScript, but I'm having some problems with all the possible options to require, import, etc.
What I'm doing right now is having every class and interface in it's own file. So I would need to require all the dependencies which is kind of stupid, because I'm typing the class name twice, like this:
import Target = require('./Target');
export interface IFace {
getTarget(): Target.Target
}
I could write import t = require('./Target'); instead but then I need to write t.Target which I think is also pretty ugly.
And also I can't give it a module name (like FaceApp), because when I need to import two files, there's a naming conflict.
Obviously that would not be needed if everything would live in one file, but this is far from optimal I think.
So how do you guys organize your node module in TypeScript? I'd be happy to hear your suggestions.
You can avoid the name duplication by using the export = syntax. i.e. Do:
class Target{}
export = Target;
instead of export class Target.
Also grunt-ts transformers can help you with the import statement explosion : https://github.com/grunt-ts/grunt-ts/issues/85#issue-29515541
The way recommended by TypeScript is to do
export default class Target {}
and then you can do a true typescript import with
import Target from './Target'
alternatively, you can rename it
import NewName from './Target'
Also note that you can export multiple things from a file if they are related
export class SomeClass {}
export class OtherClass {}
And that on import, you can change the names
import { SomeClass as MySomeClass, OtherClass as MyOtherClass } from './Target'

GWTP Nested Presenter : Type<RevealContentHandler<?>> Cannot be resolved

I'm trying to make the nested presenter in GWT.
I've been "copy & paste" code from the sample GWTP project #http://code.google.com/p/gwt-platform/wiki/SimpleNestedSample
At one point the code
#ContentSlot
public static final Type<RevealContentHandler<?>> contentSlot = new Type<RevealContentHandler<?>>();
gave me error and i am not able to find which package to import by eclipse suggestion to resolve error by Type.
(Been trying all the possible "Type" packages by eclipse suggestion such as
import com.google.gwt.i18n.server.Type;
import com.google.gwt.dev.asm.Type;
import com.sun.tools.javac.code.Type;
)
Can anyone tell what package to import?
import com.google.gwt.event.shared.GwtEvent.Type;

Resources