Mercurial > dive4elements > river
diff gwt-client/src/test/java/test/AbstractModuleRunner.java @ 9424:da19f1f58d72
jUnit test uinfo salix regional
author | gernotbelger |
---|---|
date | Fri, 17 Aug 2018 14:29:05 +0200 |
parents | e567fac95e3d |
children | ce0a48b93f4b |
line wrap: on
line diff
--- a/gwt-client/src/test/java/test/AbstractModuleRunner.java Fri Aug 17 11:45:34 2018 +0200 +++ b/gwt-client/src/test/java/test/AbstractModuleRunner.java Fri Aug 17 14:29:05 2018 +0200 @@ -79,7 +79,7 @@ private static final String IGNORE_BEARBEITER = "NEIN_DOCH_NICHT";// "# Bearbeiter:"; private final Infotype infotype; - private final String userUuid; + private static String userUuid; private Collection collection; private Artifact artifact; private final IFilenameMapper fileName; @@ -104,14 +104,15 @@ // init this.client = new HttpClientImpl(this.serverUrl, this.locale); - this.userUuid = makeUserUuid(); + if (AbstractModuleRunner.userUuid == null) + AbstractModuleRunner.userUuid = makeUserUuid(this.serverUrl); this.collection = getCollection(); this.artifact = getArtifact(); } - private String makeUserUuid() throws ConnectionException { - final User user = new DefaultUser(this.USERNAME, this.PASSWORD, null, false, new ArrayList<String>(), new ArrayList<String>()); - final UserClient userClient = new UserClient(this.serverUrl); + private static String makeUserUuid(final String serverUrl) throws ConnectionException { + final User user = new DefaultUser(USERNAME, PASSWORD, null, false, new ArrayList<String>(), new ArrayList<String>()); + final UserClient userClient = new UserClient(serverUrl); Element userElement; userElement = userClient.findUser(user); @@ -132,7 +133,7 @@ if (this.collection == null) { // lazy-Loading final Document create = ClientProtocolUtils.newCreateCollectionDocument(null); - final Document doc = (Document) this.client.createCollection(create, this.userUuid, new DocumentResponseHandler()); + final Document doc = (Document) this.client.createCollection(create, userUuid, new DocumentResponseHandler()); final String uuid = XMLUtils.xpathString(doc, CreateCollectionServiceImpl.XPATH_COLLECTION_UUID, ArtifactNamespaceContext.INSTANCE); final String ttlStr = XMLUtils.xpathString(doc, CreateCollectionServiceImpl.XPATH_COLLECTION_TTL, ArtifactNamespaceContext.INSTANCE); this.collection = new DefaultCollection(uuid, Long.valueOf(ttlStr), uuid); @@ -164,7 +165,6 @@ protected final void feedAndGo(final Data[] data, final int reachableStateIndex) throws ConnectionException, ServerException { feed(data); advance(getReachableStateByIndex(getArtifact(), reachableStateIndex)); // reachablestate könnte auch String sein. - } private final String getReachableStateByIndex(final Artifact artifact, final int index) { @@ -312,10 +312,16 @@ } protected final void selectRange() throws ConnectionException, ServerException { - final String fromStr = String.valueOf(this.from); - final String toStr = String.valueOf(this.to); - final Data dataFrom = new StringOptionsData("ld_from", "ld_from", new DataItem[] { new DefaultDataItem(fromStr, fromStr, fromStr) }); - final Data dataTo = new StringOptionsData("ld_to", "ld_to", new DataItem[] { new DefaultDataItem(toStr, toStr, toStr) }); + makeKmRange(this.from, this.to, "ld_from", "ld_to"); + + } + + protected final void makeKmRange(final double from, final double to, final String from_key, final String to_key) + throws ConnectionException, ServerException { + final String fromStr = String.valueOf(from); + final String toStr = String.valueOf(to); + final Data dataFrom = new StringOptionsData(from_key, from_key, new DataItem[] { new DefaultDataItem(fromStr, fromStr, fromStr) }); + final Data dataTo = new StringOptionsData(to_key, to_key, new DataItem[] { new DefaultDataItem(toStr, toStr, toStr) }); final Data[] rangeFromToDetermined = new Data[] { dataFrom, dataTo }; feedAndGo(rangeFromToDetermined, 0); @@ -347,4 +353,10 @@ return rec1.getRecommendationPairString(rec2, getCollection(), this.serverUrl, this.locale); } + + protected final void feedSimpleTextInput(final String key, final String value) throws ConnectionException, ServerException { + final Data data = new StringOptionsData(key, key, new DataItem[] { new DefaultDataItem(value, value, value) }); + feedAndGo(new Data[] { data }, 0); + } + } \ No newline at end of file