ProductionRequest implements XmlConvertible { public String getStagingDirectory(String productionId) { String remoteUser; try { remoteUser = getParameter("calvalus.wps.remote.user", true); } catch (ProductionException exception) { return userName + "/" + productionId; } if (remoteUser.equalsIgnoreCase(userName)) { return userName + "/" + productionId; } else { return userName + "/" + remoteUser + "/" + productionId; } } private  ProductionRequest();  ProductionRequest(String productionType,
                             String userName,
                             String... productionParametersKeyValuePairs);  ProductionRequest(String productionType,
                             String userName,
                             Map<String, String> productionParameters); String getProductionType(); String getUserName(); Map<String, String> getParameters(); String getParameter(String name, boolean mandatory); void setParameter(String key, String value); void ensureParameterSet(String name); static DateFormat getDateFormat(); String getString(String name); String getString(String name, String def); boolean getBoolean(String name); Boolean getBoolean(String name, Boolean def); int getInteger(String name); Integer getInteger(String name, Integer def); float getFloat(String name); Float getFloat(String name, Float def); double getDouble(String name); Double getDouble(String name, Double def); Date getDate(String name); Date getDate(String name, Date def); Date[] getDates(String name, Date[] def); Geometry getGeometry(String name); Geometry getGeometry(String name, Geometry def); String getProductionName(String defaultProductionName); boolean isAutoStaging(); String getStagingDirectory(String productionId); String getRegionName(); Geometry getRegionGeometry(); Geometry getRegionGeometry(Geometry defaultGeometry); List<DateRange> getDateRanges(); DateRange createFromMinMax(); String getXmlDecodedString(String name, String def); @Override String toXml(); static ProductionRequest fromXml(String xml); static final String DATE_PATTERN; static final DateFormat DATE_FORMAT; }
@Test public void testGetStagingDirectoryWithoutRemoteUser() throws Exception { ProductionRequest request = new ProductionRequest("L2Plus", "systemUser"); assertThat(request.getStagingDirectory("product-00"), equalTo("systemUser/product-00")); }
@Test public void testGetStagingDirectoryWhenRemoteUserIsSystemUser() throws Exception { ProductionRequest request = new ProductionRequest("L2Plus", "systemUser", "calvalus.wps.remote.user", "systemUser"); assertThat(request.getStagingDirectory("product-00"), equalTo("systemUser/product-00")); }
@Test public void testGetStagingDirectoryWithRemoteUser() throws Exception { ProductionRequest request = new ProductionRequest("L2Plus", "systemUser", "calvalus.wps.remote.user", "remoteUser"); assertThat(request.getStagingDirectory("product-00"), equalTo("systemUser/remoteUser/product-00")); }