Code Monkey home page Code Monkey logo

esdk-training's Introduction

geolocationApp

This is the source code of geolocationApp, an abas Essentials App build on the abas Essentials SDK.

General setup

If you are using proxies, add a gradle.properties file to your $GRADLE_USER_HOME.

#If you use a proxy add it here
systemProp.http.proxyHost=<webproxy>
systemProp.http.proxyPort=<port>
systemProp.https.proxyHost=<webproxy>
systemProp.https.proxyPort=<port>

Run ./initGradleProperties.sh in your terminal (use Git Bash on Windows)

Use your favorite IDE to import the project.

Installation

To install the project make sure you are running the docker-compose.yml file or else change the gradle.properties file accordingly to use another erp client (you will still need a nexus server, but it can of course also be installed in your erp installation or elsewhere as long as it is configured in the gradle.properties file).

To use the project's docker-compose.yml file, in the project's root directory run:

docker login --username <extranet user> --password <extranet password> sdp.registry.abas.sh
docker-compose up

Now you can install the project as follows:

./gradlew fullInstall

Development

If you want to make changes to the project before installing you still need to run the docker-compose.yml file or at least have a Nexus Server set up to work with.

Then run

./gradlew publishHomeDirJars

You also need to run

./gradlew publishClientDirJars

to upload the $MANDANTDIR/java/lib dependencies to the Nexus Server and set your IDE up to work with the uploaded dependencies.

After that the code should compile both with gradle and in your IDE and you are set up to work on the code or resource files as you want.

esdk-training's People

Contributors

tschasmine avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

esdk-training's Issues

Select based on zip code

Display all trading partners who's zip code matches the value in zipcodesel or the search word pattern in customersel.

Create Infosystem G30L0

Create an Infosystem with search word G30L0, classname GeoLocation, working directory ow1 with the following fields:

  • iscustomersel: GL20 (Suchwort) (K)
  • iszipcodesel: GL20 (Postleitzahl) (K)
  • iscustomer: VPKS17 (Geschäftspartner) (T)
  • isstate: PS97:1 (Land) (T)
  • iszipcode: GL20 (Postleitzahl) (T)
  • istown: GL20 (Stadt) (T)
  • islongitude: GL30 (Längengrad) (T)
  • islatitude: GL30 (Breitengrad) (T)

Add licensing

A valid license is required upon pressing the start button in the G30L0 Infosystem and upon pressing the yg30l0calcgeoloc button in the Customer screen.
Use the [ESDK client api] (https://documentation.abas.cloud/en/esdk/#_use_the_esdk_client_api) for validating the license.

To make the tests run a cloud-connect installation is necessary, for Travis CI add the following to the .travis.yml file:

- mkdir -p cloud-connect
- wget -qO- 'https://esdk-hybrid.eu.abas.cloud/cloud-connect.tgz' | tar xfz - --directory cloud-connect
- sed -e "s/hostname/$(hostname)/g" ci/configuration.json > cloud-connect/configuration.json
- cloud-connect/setup.sh -n --tenant-configuration $TENANT_SECRET
- cloud-connect/run.sh

Also add the file configuration.json to the ci directory within your project:

{
  "version": 1,
  "installation_mode": 2,
  "tenant": "esdk-hybrid",
  "domain": "eu.abas.cloud",
  "aws_region": "eu-central-1",
  "stage": "prod",
  "options": {
    "useSSH": true,
    "docker_host": "hostname",
    "cloud_connect_host": "hostname",
    "awslogsEnabled": "true"
  },
  "apps": {
    "screenFetcher": {
      "install": false,
      "generate_all_screens": false
    }
  },
  "add_ons": {
    "fts": {
      "install": false
    }
  },
  "services": {
    "environment": {},
    "license_server": {
      "enabled": true
    },
    "jwt": {
      "port": 19951,
      "userSyncMode": "full",
      "workspaces": "26a",
      "permissions": "26"
    },
    "workflow": {
      "host": "localhost",
      "port": 8088,
      "enabled": false
    },
    "bapps": {
      "host": "localhost",
      "port": 9990,
      "enabled": false
    },
    "search": {
      "host": "localhost",
      "port": 9200,
      "enabled": false
    },
    "erp": {
      "host": "hostname",
      "port": 6560,
      "user": null,
      "ssh": {
        "user": "s3",
        "port": 2205
      },
      "password": "sy"
    }
  }
}

Due to an open issue you have to add the following lines to your build.gradle file in order to have the test coverage calculated correctly:

test {
	jacoco {
		excludes += ['**/*']
	}
}

calculateCodeCoverage {
	...
	afterEvaluate {
		classDirectories = files(classDirectories.files.collect {
			fileTree(it).matching {
				include "de/abas/esdk/g30l0/**/*.class"
			}
		})
	}
}

codeCoverageVerification {
	afterEvaluate {
		classDirectories = files(classDirectories.files.collect {
			fileTree(it).matching {
				include "de/abas/esdk/g30l0/**/*.class"
			}
		})
	}
}

Display customer info

For all customers matching the search word pattern provided in customersel display the basic information (reference to customer object, zip code, town, country).

Display geo location

Display the geo location (longitude and latitude) for each table row in the infosystem.
Use PowerMock to write a unit test that mocks both, the TradingPartner object and the Nominatim web service:

testCompile "org.powermock:powermock-module-junit4:1.6.2"
testCompile "org.powermock:powermock-api-mockito:1.6.2"

Use the Nominatim Java API by adding the following dependency to your build.gradle file:
compile "fr.dudie:nominatim-api:3.3".
Using the Nominatim Java API:

NominatimClient jsonNominatimClient = new JsonNominatimClient(new DefaultHttpClient(), "[email protected]");
return jsonNominatimClient.search("searchString");

In order for Jacoco to pick up on the code coverage of a PowerMocked test, the classes need to be instrumented before the tests are run. Since Gradle does not support this yet, the following is needed in the build.gradle file:

task instrument(dependsOn: [classes, project.configurations.jacocoAnt]) {

	inputs.files classes.outputs.files
	File outputDir = new File(project.buildDir, 'instrumentedClasses')
	outputs.dir outputDir
	doFirst {
		project.delete(outputDir)
		ant.taskdef(
				resource: 'org/jacoco/ant/antlib.xml',
				classpath: project.configurations.jacocoAnt.asPath,
				uri: 'jacoco'
		)
		def instrumented = false
			if (file(sourceSets.main.java.outputDir).exists()) {
				def instrumentedClassedDir = "${outputDir}/${sourceSets.main.java}"
				ant.'jacoco:instrument'(destdir: instrumentedClassedDir) {
					fileset(dir: sourceSets.main.java.outputDir, includes: '**/*.class')
				}
				//Replace the classes dir in the test classpath with the instrumented one
				sourceSets.test.runtimeClasspath -= files(sourceSets.main.java.outputDir)
				sourceSets.test.runtimeClasspath += files(instrumentedClassedDir)
				instrumented = true
			}
		if (instrumented) {
			//Disable class verification based on https://github.com/jayway/powermock/issues/375
			test.jvmArgs += '-noverify'
		}
	}
}
test.dependsOn instrument

Display trading partner info

For all trading partners matching the search word specified in customersel display the basic info in the infosystem (reference to trading partner, zip code, town, country).
Make use of the TradingPartner interface, which is applied to Customer, CustomerContact, Vendor and VendorContact.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.