I am trying to run a selenium test case file written in java using Apache Ant. To setup this configuration, i followed this tutorial.
below is my ant config in build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="Hello World Project" default="info">
<target name="info">
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<pathelement path="lib\junit-4.10.jar" />
</classpath>
<test name="com.lo.test.selenium.AssignCampaignTestCase" haltonfailure="no" outfile="result">
<formatter type="plain"/>
<formatter type="xml"/>
</test>
</junit>
</target>
</project>
But it is showing error like :
Testsuite: com.lo.test.selenium.AssignCampaignTestCase
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec
Caused an ERROR
com.lo.test.selenium.AssignCampaignTestCase
java.lang.ClassNotFoundException: com.lo.test.selenium.AssignCampaignTestCase
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
Test case code in AssignCampaignTestCase.java
package com.lo.test.selenium;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.Properties;
import java.util.ResourceBundle;
import javax.mail.Flags;
import javax.mail.Folder;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.NoSuchProviderException;
import javax.mail.Session;
import javax.mail.Store;
import javax.ws.rs.core.MediaType;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
import com.sun.jersey.multipart.FormDataMultiPart;
import com.sun.jersey.multipart.impl.MultiPartWriter;
/**
* #author Ashutosh
*
*/
public class AssignCampaignTestCase {
private static ResourceBundle rb = ResourceBundle.getBundle("global-messages");
static WebDriver driver = new FirefoxDriver(); //Make it static in order to make one instance of this class(helps to avoid opening of 2 browsers at once)
#Test
public void campaignEmailTestCase() throws InterruptedException {
AssignCampaignTestCase emTesObj=new AssignCampaignTestCase();
// CommonMethods commonMethods=new CommonMethods();
String fName="test LO";
Integer LeadId=570903;
String campaignName="2GetMoreLeads";
String SubjName="Welcome to your 5-day challenge and tips"; //NOTE: No problem,Type without double quotes. It will work for you
doLogin(driver);
emTesObj.goToLeadsListPage();
emTesObj.searchByFirstName(fName);//without this also,it will work but Gives you the correct navigation on UI
emTesObj.waitBeforePageLoads(LeadId.toString()); //pass the Id attribute which you aspect to see after the page is loaded
emTesObj.assignCampaign(LeadId, campaignName);
emTesObj.readRecentEmail(SubjName);
}
//shows you the leads List Page
public void goToLeadsListPage(){
driver.get("http://www.xxxxx.com/orderManagement/xxxx.action");
}
.................
.................
.................
Here is my project structure::::
Please help me to run my project using Ant.
Try adding selenium jar file in you classpath. Currently you only added junit.
Related
I use eclipese 2018-09 (4.9.0) I'm try to use jfreechart, I added the jars in the module path(jcommon,jfreechart), I do organize import
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.data.general.PieDataset;
import org.jfree.util.Rotation;
i get "The import org.jfree.chart cannot be resolved" for all imports and the consequential errors, what's the problem?Thanks
I'm trying to generate API documentation using SpringRestDocs and SpringBootTest and MockMVC.
Our service uses MongoDB as storage and we have various services that talk to MongoDB using repositories.
In my test I'm mocking the services to not rely on MongoDB or data.
Though my tests run fine only if I've a local mongo running on my machine, otherwise tests fail because org.mongodb.driver.cluster is not able to connect.
Here is the error I get:
018-03-06 11:42:05.620 INFO 56095 --- [localhost:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongodb-driver-core-3.4.3.jar:na]
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongodb-driver-core-3.4.3.jar:na]
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongodb-driver-core-3.4.3.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_144]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_144]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_144]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_144]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_144]
at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:57) ~[mongodb-driver-core-3.4.3.jar:na]
at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongodb-driver-core-3.4.3.jar:na]
... 3 common frames omitted
2018-03-06 11:42:05.724 INFO 56095 --- [ main] org.mongodb.driver.cluster : No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]}. Waiting for 30000 ms before timing out
I would like to totally bypass MongoDB because I don't need it to build my documentation.
I've tried to use #MockBean on all the repositories that use Mongo and disable autoconfiguration, but still not working properly
Any suggestion on what shoudl I do to mock the MongoDB client/template?
Here is my ApiDocumentation.java class, without
package uk.ac.ebi.biosamples.docs;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.data.domain.*;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
import org.springframework.restdocs.JUnitRestDocumentation;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import uk.ac.ebi.biosamples.model.Curation;
import uk.ac.ebi.biosamples.model.CurationLink;
import uk.ac.ebi.biosamples.model.Sample;
import uk.ac.ebi.biosamples.model.filter.Filter;
import uk.ac.ebi.biosamples.service.*;
import java.util.Collections;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static org.mockito.Matchers.*;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.*;
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
import static org.springframework.restdocs.request.RequestDocumentation.requestParameters;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
#RunWith(SpringRunner.class)
#SpringBootTest
public class ApiDocumentation {
#Rule
public final JUnitRestDocumentation restDocumentation = new JUnitRestDocumentation("target/generated-snippets");
#Autowired
private WebApplicationContext context;
private ObjectMapper mapper;
#MockBean
private SamplePageService samplePageService;
#MockBean
private SampleService sampleService;
#MockBean
CurationPersistService curationPersistService;
#MockBean
CurationReadService curationReadService;
#MockBean
private BioSamplesAapService aapService;
private DocumentationHelper faker;
private MockMvc mockMvc;
#Before
public void setUp() {
this.faker = new DocumentationHelper();
this.mapper = new ObjectMapper();
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
.apply(documentationConfiguration(this.restDocumentation).uris()
.withScheme("https")
.withHost("www.myhost.com")
.withPort(443)
)
.build();
}
/**
* Generate the snippets for the API root
* #throws Exception
*/
#Test
public void getIndex() throws Exception {
this.mockMvc.perform(get("/").accept(MediaTypes.HAL_JSON))
.andExpect(status().isOk())
.andDo(document("get-index", preprocessRequest(prettyPrint()), preprocessResponse(prettyPrint())));
}
/* Bunch of other similar tests */
}
I was able to solve my issue using an embedded mongodb instance.
For my specific needs this was sufficient to solve my issues with autoconfiguration.
In my pom I've added a dependence to de.flapdoodle.embed.mongo
<dependency>
<groupId>de.flapdoodle.embed</groupId>
<artifactId>de.flapdoodle.embed.mongo</artifactId>
<scope>test</scope>
</dependency>
and add a plugin to start/stop the embedded mongodb before/after mvn build
<plugin>
<groupId>com.github.joelittlejohn.embedmongo</groupId>
<artifactId>embedmongo-maven-plugin</artifactId>
<version>0.3.5</version>
<executions>
<execution>
<id>start</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
I have a Spring Boot application which use MongoDB. I would like to use the embedded FongoDB for my JUnit tests. I follow some articles, for example:
http://dontpanic.42.nl/2015/02/in-memory-mongodb-for-unit-and.html
My Fongo test configuration looks like
package com.myproject.rest;
import com.github.fakemongo.Fongo;
import com.mongodb.Mongo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.mongodb.config.AbstractMongoConfiguration;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;
#Profile("test")
#ComponentScan(basePackages = "com.myproject.service.data")
#EnableMongoRepositories(basePackages = "com.myproject.service.data.repository")
#Configuration
public class MongoTestConfig extends AbstractMongoConfiguration {
#Override
protected String getDatabaseName() {
return "demo-test";
}
#Bean
#Override
public Mongo mongo() {
return new Fongo("mongo-test").getMongo();
}
}
I have this dependency for that:
<dependency>
<groupId>com.github.fakemongo</groupId>
<artifactId>fongo</artifactId>
<version>2.1.0</version>
<scope>test</scope>
</dependency>
I would like to test my services which autowired a repository interface which extends MongoRepository
package com.myproject.service.data.repository;
import com.myproject.service.data.entity.JournalData;
import org.springframework.data.mongodb.repository.MongoRepository;
import java.util.List;
public interface JournalRepository extends MongoRepository<JournalData, String> {
#Override
public List<JournalData> findAll(Iterable<String> ids);
}
My tests class are inherited from the class below:
package com.myproject.rest;
import com.lordofthejars.nosqlunit.mongodb.MongoDbRule;
import cz.csas.services.commons.api.RequestMetadata;
import org.junit.Before;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.modules.junit4.PowerMockRunnerDelegate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.data.mongo.DataMongoTest;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.MockMvc;
import static org.mockito.Mockito.when;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static com.lordofthejars.nosqlunit.mongodb.MongoDbRule.MongoDbRuleBuilder.newMongoDbRule;
#RunWith(PowerMockRunner.class)
#PowerMockRunnerDelegate(SpringJUnit4ClassRunner.class)
#SpringBootTest
#AutoConfigureMockMvc
#PowerMockIgnore({"javax.xml.*", "org.xml.*", "org.w3c.*", "javax.management.*", "javax.net.ssl.*"})
#PrepareForTest({RequestMetadata.class})
#ActiveProfiles("test")
public class EndpointTestContext {
#Autowired
protected MockMvc mockMvc;
//#Rule
//public MongoDbRule mongoDbRule = newMongoDbRule().defaultSpringMongoDb("demo-test");
#Before
public void setup() {
mockStatic(RequestMetadata.class);
when(RequestMetadata.builder()).thenCallRealMethod();
RequestMetadata m = RequestMetadata.builder()
.workingMode("TEST")
.build();
when(RequestMetadata.getMetadata()).thenReturn(m);
}
}
But when I run the Maven tests I recieve the following:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.mongodb.MongoClientOptions
at com.mongodb.MockMongoClient.create(MockMongoClient.java:42)
at com.github.fakemongo.Fongo.createMongo(Fongo.java:175)
at com.github.fakemongo.Fongo.<init>(Fongo.java:88)
at com.github.fakemongo.Fongo.<init>(Fongo.java:75)
at com.github.fakemongo.Fongo.<init>(Fongo.java:67)
at com.myproject.rest.MongoTestConfig.mongo(MongoTestConfig.java:30)
at com.myproject.rest.MongoTestConfig$$EnhancerBySpringCGLIB$$bf18b1d4.CGLIB$mongo$1(<generated>)
at com.myproject.rest.MongoTestConfig$$EnhancerBySpringCGLIB$$bf18b1d4$$FastClassBySpringCGLIB$$3ab8bfd7.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
at com.myproject.rest.MongoTestConfig$$EnhancerBySpringCGLIB$$bf18b1d4.mongo(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
... 115 common frames omitted
Can anyone suggest how to fix it? Thank you in advance.
Fongo can't find class from mongo-java-driver artifact. It declares
<!-- https://mvnrepository.com/artifact/org.mongodb/mongo-java-driver -->
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.4.2</version>
</dependency>
as provided dependency. You should have mongo-java-driver on your test classpath. Most probably
<scope>runtime</scope>
or test will be enough for you.
Check if you have multiple version of mongo java driver (version conflicts). To check this, you can use mvn dependency tree to trace the path from where each jar is coming to your project.
mvn dependency:tree
Just need to find out the right version on mongo java driver and make sure you are not having version conflicts. I have used spring data and used fongo to write in-memory test case for mongodb queries.
<fongo-version>1.6.3</fongo-version>
<spring-data-mongodb-version>1.7.2.RELEASE</spring-data-mongodb-version>
<spring-framework-version>4.1.5.RELEASE</spring-framework-version>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>${spring-data-mongodb-version}</version>
</dependency>
<dependency>
<groupId>com.github.fakemongo</groupId>
<artifactId>fongo</artifactId>
<version>${fongo-version}</version>
<scope>test</scope>
</dependency>
Version conflict can come from may source (can confirm using above mvc dependency:tree command, one such source is mongobee, so if you are using it, please exclude mongo-java-drive by using exclusion
<dependency>
<groupId>com.github.mongobee</groupId>
<artifactId>mongobee</artifactId>
<version>${mongobee-version}</version>
<exclusions>
<exclusion>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
I am trying to test java methods within a multiple package project that has numerous imports. It works fine until it gets to the javax imports. Tnen it complains that it cannot find the class definition for this import. Do I need to explicitly import a jar even though it was part of the maven dependencies when I complied the jars that this project is using?
This is the declarations section of my code package
package com.fietrade.swtf.swreconcilation.beans;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import javax.faces.application.FacesMessage;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIComponent;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import javax.faces.validator.ValidatorException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
import org.apache.log4j.Logger;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.xml.sax.SAXException;
import com.fietrade.swtf.persistance.factories.DBMgrFactory;
import com.fietrade.swtf.persistance.factories.ReconciliationDBMgr;
import com.fietrade.swtf.persistance.swapswire.Reconciliation;
public class ReconciliationEditor {
And this is the error:
__EXCEPTION__:java.lang.NoClassDefFoundError: javax/faces/validator/ValidatorException
at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_40]
at java.lang.Class.forName(Class.java:190) [rt.jar:1.7.0_40]
at fitnesse.slim.SlimExecutionContext.getClass(SlimExecutionContext.java:139) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimExecutionContext.searchPathsForClass(SlimExecutionContext.java:129) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimExecutionContext.createInstanceOfConstructor(SlimExecutionContext.java:100) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimExecutionContext.create(SlimExecutionContext.java:42) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.StatementExecutor.create(StatementExecutor.java:75) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.instructions.MakeInstruction.executeInternal(MakeInstruction.java:26) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.instructions.Instruction.execute(Instruction.java:30) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:50) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:44) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.ListExecutor.execute(ListExecutor.java:84) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:106) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.processTheInstructions(SlimServer.java:93) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:68) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:54) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimServer.serve(SlimServer.java:40) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.handle(SlimService.java:164) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.acceptOne(SlimService.java:172) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.accept(SlimService.java:134) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.startWithFactory(SlimService.java:65) [fitnesse-standalone-20140903.jar]
at fitnesse.slim.SlimService.main(SlimService.java:51) [fitnesse-standalone-20140903.jar]
Caused by: java.lang.ClassNotFoundException: javax.faces.validator.ValidatorException
Can someone explain what this error is and how to resolve it?
Thanks
Basically it says It is not able to find a dependancy for your project to work ..
include jsf-api
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1</version>
</dependency>
Add this to your project and error will be resolved.
First of all I want to say this is kind of a follow up of a question I posted yesterday which I solved myself (How to add Jess in Maven project?).
This time, it's Jess' turn to have problems finding the project's classes. More specifically, everything runs fine until the execution of the 1st line of engine.batch("rules.clp"), where I get a "Class not found exception".
(import cz.cuni.amis.pogamut.ut2004.examples.huntbot)
(deftemplate HunterBot (declare (from-class HunterBot)))
The package structure is:
-cz.cuni.amis.pogamut.ut2004.examples.huntbot
-- HunterBot.java
Below are the first lines of the HunterBot.java file:
package cz.cuni.amis.pogamut.ut2004.examples.huntbot;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import jess.*;
import cz.cuni.amis.introspection.java.JProp;
import cz.cuni.amis.pogamut.base.agent.navigation.IPathExecutorState;
import cz.cuni.amis.pogamut.base.communication.worldview.listener.annotation.EventListener;
import cz.cuni.amis.pogamut.base.utils.Pogamut;
import cz.cuni.amis.pogamut.base.utils.guice.AgentScoped;
import cz.cuni.amis.pogamut.base.utils.math.DistanceUtils;
import cz.cuni.amis.pogamut.base3d.worldview.object.ILocated;
import cz.cuni.amis.pogamut.ut2004.agent.module.utils.TabooSet;
import cz.cuni.amis.pogamut.ut2004.agent.navigation.UT2004PathAutoFixer;
import cz.cuni.amis.pogamut.ut2004.agent.navigation.stuckdetector.UT2004DistanceStuckDetector;
import cz.cuni.amis.pogamut.ut2004.agent.navigation.stuckdetector.UT2004PositionStuckDetector;
import cz.cuni.amis.pogamut.ut2004.agent.navigation.stuckdetector.UT2004TimeStuckDetector;
import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot;
import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController;
import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType;
import cz.cuni.amis.pogamut.ut2004.communication.messages.UT2004ItemType;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Initialize;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Move;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Rotate;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Stop;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.StopShooting;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotDamaged;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotKilled;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Item;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.NavPoint;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Player;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerDamaged;
import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.PlayerKilled;
import cz.cuni.amis.pogamut.ut2004.utils.UT2004BotRunner;
import cz.cuni.amis.utils.exception.PogamutException;
import cz.cuni.amis.utils.flag.FlagListener;
import java.util.logging.Logger;
/**
* Example of Simple Pogamut bot, that randomly walks around the map searching for preys shooting at everything that is in its way.
*
* #author Rudolf Kadlec aka ik
* #author Jimmy
*/
#AgentScoped
public class HunterBot extends UT2004BotModuleController<UT2004Bot> {
Rete engine;
...
And finally this is the pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cz.cuni.amis.pogamut.ut2004</groupId>
<artifactId>pogamut-ut2004-bot-pom</artifactId>
<version>3.6.1</version>
</parent>
<groupId>cz.cuni.amis.pogamut.ut2004.examples</groupId>
<artifactId>huntbot</artifactId>
<version>3.3.1</version>
<packaging>jar</packaging>
<name>04-hunter-bot</name>
<url>http://pogamut.cuni.cz</url>
<properties>
<bot.main.class>cz.cuni.amis.pogamut.ut2004.examples.huntbot.HunterBot</bot.main.class>
</properties>
<repositories>
<repository>
<id>amis-artifactory</id>
<name>AMIS Artifactory</name>
<url>http://diana.ms.mff.cuni.cz:8081/artifactory/repo</url>
</repository>
<repository>
<id>data-local</id>
<name>data</name>
<url>file://${project.basedir}/repo</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.dstovall</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
<configuration>
<mainClass>${bot.main.class}</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>gov.sandia</groupId>
<artifactId>jess</artifactId>
<version>7.1p2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
The jess-7.1p2.jar file is located at (base.dir)\repo\gov\sandia\jess\7.1p2\ . It is recognized without problems.
PS: I tried to make this question as detailed as possible. If more info is needed, I can provide it immediately.
The import function permits both for importing a single class or all classes in a package. A package alone can't be imported - it doesn't make sense.
(import some.pack.SomeClass)
and
(import another.pack.*)
If you need access to the static members of a class you must use the specific form. The statics are then available as if they were a user function:
(SomeClass.MAX_NUMBER_OF_X)