Clear all

[Solved] Testing UI upload inbound interfaces


Topic starter

Need a way to test UI Upload inbound interfaces. The UI upload interfaces is a special version of inbound interface that uses User context to pre-populate some field values ( eg: creation org) 

This is what I tried. 

PlatformUserContext productionManagerContext = ucs.createContext(vc.user.sysId, vc.role.sysId)

csvLoader = new CsvLoader(productionManagerContext);

def results = csvLoader.load("MFG.Production_Order_Upload", "5.0", csvRows)

However , inside the transformer, only VC Admin Context is availble. 

Is there any easy way to mimic the UI upload  in server tests so that  ?


This topic was modified 2 weeks ago by Prasanth Mallaya

@pmallaya @gmerrill,

Can you give user-role access to an upload/action framework, but process it behind the scenes as another role (like VC Admin above which may have been reserved to be the only allowed role to process inbound B2B feeds)

I know this may add a security challenge, but could we support VC level properties for this, e.g. is Demo env. etc.?

2 Answers

Can you see if setUseProcessingContextForDequeue(true) helps?

Topic starter

I extended CsvLoader in my module so that I can setUseProcessingContextForDequeue(true) 

Here's the code I used to extend the CsvLoader


import java.util.List;
import java.util.Map;

import com.onenetwork.platform.common.usercontext.PlatformUserContext;
import com.transcendsys.platform.base.context.DvceContext;
import com.transcendsys.platform.server.csv.UploadInboundInterfaceCsvFiles;
import com.transcendsys.platform.server.csv.UploadInboundInterfaceCsvFiles.Mode;

public class CsvLoader extends com.transcendsys.platform.server.csv.CsvLoader {
boolean useProcessingContextForDequeue = false;

public boolean isUseProcessingContextForDequeue() {
return useProcessingContextForDequeue;

* @param useProcessingContextForDequeue
* the useProcessingContextForDequeue to set
public void setUseProcessingContextForDequeue(boolean useProcessingContextForDequeue) {
this.useProcessingContextForDequeue = useProcessingContextForDequeue;

CsvLoader(PlatformUserContext context, boolean useProcessingContextForDequeue) {
this.useProcessingContextForDequeue = useProcessingContextForDequeue;

public List<Map<String, String>> load(String interfaceName, String interfaceVersion, List<Map<String, String>> values, boolean useQueue) {
try {
String csv = valMapListToString(interfaceName, interfaceVersion, values);
File csvFile = File.createTempFile("" + System.currentTimeMillis(), ".csv");
Writer writer = null;
try {
writer = new FileWriter(csvFile);
Writer temp = writer;
} finally {
UploadInboundInterfaceCsvFiles uploadFiles = new UploadInboundInterfaceCsvFiles((DvceContext) getContext(), useQueue ? Mode.MESSAGE : Mode.SIMPLE, getQueueRef());
String resultStr = uploadFiles.process(interfaceName, interfaceVersion, csvFile, null, null);
return parseResultString(interfaceName, interfaceVersion, resultStr);

}catch(Exception e) {
return null;

* TODO complete method documentation
* @param writer
private void closeWithWarning(Writer c) {
if (c != null) {
try {
} catch (IOException e) {
System.out.println("Caught exception during close(): " + e);

I have modified CsvLoader in Neo 3.5 for supporting useProcessingContextForDequeue

Thanks Piyush.

© 2020 One Network Enterprises. All rights reserved. Privacy Policy