Java Code Examples for org.testng.annotations.BeforeMethod

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project airlift, under directory /discovery/src/test/java/io/airlift/discovery/client/.

Source file: TestAnnouncer.java

  19 
vote

@BeforeMethod protected void setUp() throws Exception {
  nodeInfo=new NodeInfo(new NodeConfig().setEnvironment("test").setPool("pool"));
  discoveryClient=new InMemoryDiscoveryClient(nodeInfo,MAX_AGE);
  serviceAnnouncement=ServiceAnnouncement.serviceAnnouncement(serviceType.value()).addProperty("a","apple").build();
  announcer=new Announcer(discoveryClient,ImmutableSet.of(serviceAnnouncement));
}
 

Example 2

From project amplafi-sworddance, under directory /src/test/java/com/sworddance/util/.

Source file: TestPredicatedTransformingIterator.java

  19 
vote

@BeforeMethod() protected void setUp(){
  ints=new ArrayList<Integer>();
  ints.add(0);
  ints.add(1);
  ints.add(2);
  ints.add(3);
  ints.add(4);
  ints.add(5);
  predicate=new Predicate(){
    public boolean evaluate(    Object object){
      return ((Integer)object) % 2 == 0;
    }
  }
;
}
 

Example 3

From project anadix, under directory /anadix-tests/src/test/java/org/anadix/factories/.

Source file: AbstractSourceTest.java

  19 
vote

@BeforeMethod public void prepareMocks(){
  is=mock(InputStream.class);
  as=new AbstractSource(description){
    public InputStream getStream(){
      return is;
    }
  }
;
}
 

Example 4

From project android-rackspacecloud, under directory /extensions/gae/src/test/java/org/jclouds/gae/.

Source file: GaeHttpCommandExecutorServiceIntegrationTest.java

  19 
vote

@BeforeMethod void setupApiProxy(){
  ApiProxy.setEnvironmentForCurrentThread(new TestEnvironment());
  ApiProxy.setDelegate(new ApiProxyLocalImpl(new File(".")){
  }
);
}
 

Example 5

From project Arecibo, under directory /alert-data-support/src/test/java/com/ning/arecibo/alert/confdata/dao/.

Source file: TestConfDataDAO.java

  19 
vote

@BeforeMethod(alwaysRun=true) public void setUp() throws Exception {
  final String ddl=IOUtils.toString(MysqlTestingHelper.class.getResourceAsStream("/com/ning/arecibo/alert/confdata/create_alert_config_tables.sql"));
  helper.startMysql();
  helper.initDb(ddl);
  dao=dbi.onDemand(ConfDataQueries.class);
  confDataDAO=new ConfDataDAO(dbi);
}
 

Example 6

From project arquillian-rusheye, under directory /rusheye-impl/src/test/java/org/jboss/rusheye/parser/.

Source file: AbstractVisualSuiteDefinitionTest.java

  19 
vote

@BeforeMethod public void prepareEnvironment() throws IOException, SAXException {
  stub=new VisualSuiteStub();
  PipedInputStream in=new PipedInputStream();
  PipedOutputStream writerOut=new PipedOutputStream(in);
  documentOutputStream=new ByteArrayOutputStream();
  TeeOutputStream out=new TeeOutputStream(writerOut,documentOutputStream);
  OutputFormat format=new OutputFormat("\t",true);
  writer=new XMLWriter(out,format);
  inputStream=in;
  parser=new Parser();
  handler=parser.getHandler();
}
 

Example 7

From project cloud-management, under directory /src/test/java/com/proofpoint/cloudmanagement/service/inventoryclient/.

Source file: TestClient.java

  19 
vote

@BeforeMethod public void setup() throws Exception {
  Injector inventoryServerInjector=Guice.createInjector(new TestingHttpServerModule(),new TestingNodeModule(),new JaxrsModule(),new JsonModule(),new MockInventoryServerModule());
  server=inventoryServerInjector.getInstance(TestingHttpServer.class);
  inventoryServer=inventoryServerInjector.getInstance(MockInventoryServer.class);
  server.start();
  Injector injector=Guice.createInjector(new JsonModule(),new InventoryClientModule(),new ConfigurationModule(new ConfigurationFactory(ImmutableMap.<String,String>builder().put("inventory.user",INVENTORY_USER).put("inventory.password",INVENTORY_PASSWORD).put("inventory.base-uri",UriBuilder.fromUri(server.getBaseUrl()).path("/inv_api/v1").build().toString()).build())));
  client=injector.getInstance(InventoryClient.class);
}
 

Example 8

From project collector, under directory /src/test/java/com/ning/metrics/collector/endpoint/.

Source file: TestParsedRequest.java

  19 
vote

@BeforeMethod(alwaysRun=true) public void setup(){
  host="appname.ning.com";
  path="/bazel/path/here";
  userAgent="the-user-agent";
  referer=String.format("http://%s%s",host,path);
  ip="167.1.2.3";
}
 

Example 9

From project D2-Java-Persistence, under directory /src/test/java/org/d2/test/cascade/.

Source file: TestD2Cascade.java

  19 
vote

@BeforeMethod public void setup(){
  storage=new LocalFileStorageFactory("testdb");
  indexer=new LuceneIndexerFactory("testdb");
  d2=new D2Impl(storage,indexer,new XStreamSerializerFactory());
  d2.registerBucket(new Bucket(Person2.class));
}
 

Example 10

From project elasticsearch-hadoop, under directory /src/test/java/org/elasticsearch/hadoop/gateway/.

Source file: HdfsGatewayTests.java

  19 
vote

@BeforeMethod void setUpNodes() throws Exception {
  node=buildNode();
  ((InternalNode)node).injector().getInstance(Gateway.class).reset();
  node.close();
  node=buildNode().start();
}
 

Example 11

From project elasticsearch-osem, under directory /src/test/java/org/elasticsearch/osem/integration/.

Source file: ObjectContextIntegrationTest.java

  19 
vote

@BeforeMethod() public void doStart(){
  context=ObjectContextFactory.create();
  ImmutableSettings.Builder settings=NodeBuilder.nodeBuilder().settings();
  settings.put("gateway.type","none");
  settings.put("path.data","build/tmp/data");
  settings.put("index.refreshInterval","-1");
  node=NodeBuilder.nodeBuilder().settings(settings).build();
  node.start();
}
 

Example 12

From project event-collector, under directory /event-collector/src/test/java/com/proofpoint/event/collector/.

Source file: TestLocalEventClient.java

  19 
vote

@BeforeMethod public void setup(){
  JsonEventSerializer eventSerializer=new JsonEventSerializer(TestEvent.class);
  ObjectMapper objectMapper=new ObjectMapper();
  eventWriter=new InMemoryEventWriter();
  ImmutableSet<EventWriter> eventWriters=ImmutableSet.of((EventWriter)eventWriter);
  eventClient=new LocalEventClient(eventWriters,eventSerializer,objectMapper);
}
 

Example 13

From project eventtracker, under directory /common/src/test/java/com/ning/metrics/eventtracker/.

Source file: TestConfigTypes.java

  19 
vote

@BeforeMethod(alwaysRun=true) public void setUp(){
  p=new Properties();
  p.put("eventtracker.directory",tmpDir.getAbsolutePath());
  if (!tmpDir.exists() && !tmpDir.mkdirs()) {
    throw new RuntimeException("Failed to create: " + tmpDir);
  }
  if (!tmpDir.isDirectory()) {
    throw new RuntimeException("Path points to something that's not a directory: " + tmpDir);
  }
  tmpDir.deleteOnExit();
}
 

Example 14

From project exo.social.client, under directory /src/test/java/org/exoplatform/social/client/core/service/.

Source file: PropertyChangeListenerTest.java

  19 
vote

@BeforeMethod public void setUp() throws Exception {
  super.setUp();
  capturePropertyChange=new MockPropertyChangeListener();
  mockModel=new MockModel();
  mockModel.addPropertyChangeListener(capturePropertyChange);
}
 

Example 15

From project flexmojos, under directory /flexmojos-generator/flexmojos-generator-internal-compiler-iface/src/test/java/net/flexmojos/oss/generator/iface/.

Source file: IFaceGeneratorTest.java

  19 
vote

@BeforeMethod public void setUp() throws Exception {
  DefaultPlexusContainer plexus=new DefaultPlexusContainer();
  this.generator=plexus.lookup(Generator.class,"internal-ifaces");
  files=new File("./target/files");
  FileUtils.forceDelete(files);
}
 

Example 16

From project flumebase, under directory /src/test/java/com/odiago/flumebase/testutil/.

Source file: RtsqlTestCase.java

  19 
vote

@BeforeMethod public void setUp(){
  mSymbolTable=new HashSymbolTable(new BuiltInSymbolTable());
  mConf=new Configuration();
  mOutputs=Collections.synchronizedMap(new HashMap<String,MemoryOutputElement>());
  mFlumeConfig=new EmbeddedFlumeConfig(mConf);
  mEnvironment=new LocalEnvironment(mConf,mSymbolTable,mOutputs,mFlumeConfig);
}
 

Example 17

From project infinispan-arquillian-container, under directory /examples/embedded-infinispan/testng/src/test/java/org/infinispan/jmx/.

Source file: CacheManagerMBeanTest.java

  19 
vote

@BeforeMethod public void setUp() throws Exception {
  EmbeddedCacheManager cacheManager=TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(JMX_DOMAIN,true,false);
  dm.registerCacheManagers(cacheManager);
  name=getCacheManagerObjectName(JMX_DOMAIN);
  server=PerThreadMBeanServerLookup.getThreadMBeanServer();
  server.invoke(name,"startCache",new Object[]{},new String[]{});
}
 

Example 18

From project Ivory, under directory /common/src/test/java/org/apache/ivory/entity/parser/.

Source file: FeedEntityParserTest.java

  19 
vote

@BeforeMethod public void setUp() throws Exception {
  cleanupStore();
  ConfigurationStore store=ConfigurationStore.get();
  Unmarshaller unmarshaller=EntityType.CLUSTER.getUnmarshaller();
  Cluster cluster=(Cluster)unmarshaller.unmarshal(this.getClass().getResourceAsStream(CLUSTER_XML));
  cluster.setName("testCluster");
  store.publish(EntityType.CLUSTER,cluster);
  cluster=(Cluster)unmarshaller.unmarshal(this.getClass().getResourceAsStream(CLUSTER_XML));
  cluster.setName("backupCluster");
  store.publish(EntityType.CLUSTER,cluster);
  modifiableFeed=(Feed)parser.parseAndValidate(this.getClass().getResourceAsStream(FEED_XML));
}
 

Example 19

From project jagger, under directory /chassis/coordinator.zookeeper/src/test/java/com/griddynamics/jagger/coordinator/zookeeper/.

Source file: ZookeeperCoordinatorTest.java

  19 
vote

@BeforeMethod public void setUp() throws Exception {
  root=mockZnode();
  when(root.hasChild(CoordinationUtil.STATUSES_NODE_NAME)).thenReturn(true);
  master=mockZnode();
  when(root.child("master")).thenReturn(master);
  kernel=mockZnode();
  when(root.child("kernel")).thenReturn(kernel);
  agent=mockZnode();
  when(root.child("agent")).thenReturn(agent);
  coordinator=new ZookeeperCoordinator(root,Executors.newSingleThreadExecutor());
}
 

Example 20

From project jclouds-abiquo, under directory /core/src/test/java/org/jclouds/abiquo/compute/functions/.

Source file: VirtualMachineToNodeMetadataTest.java

  19 
vote

@BeforeMethod public void setup(){
  vm=new VirtualMachineWithNodeExtendedDto();
  vm.setNodeName("VM");
  vm.setName("Internal name");
  vm.setId(5);
  vm.setVdrpPort(22);
  vm.setRam(2048);
  vm.setCpu(2);
  vm.setState(VirtualMachineState.ON);
  vm.addLink(new RESTLink("edit","http://foo/bar"));
  privNic=new PrivateIpDto();
  privNic.setIp("192.168.1.2");
  privNic.setMac("2a:6e:40:69:84:e0");
  pubNic=new PublicIpDto();
  pubNic.setIp("80.80.80.80");
  pubNic.setMac("2a:6e:40:69:84:e1");
  extNic=new ExternalIpDto();
  extNic.setIp("10.10.10.10");
  extNic.setMac("2a:6e:40:69:84:e2");
  hardware=new HardwareBuilder().ids("1").build();
  function=new VirtualMachineToNodeMetadata(templateToImage(),templateToHardware(),stateToNodeState(),datacenterToLocation());
}
 

Example 21

From project jDcHub, under directory /jdchub-core/src/main/test/ru/sincore/cmd/.

Source file: CommandEngineTest.java

  19 
vote

@BeforeMethod public void setUp() throws Exception {
  PropertyConfigurator.configure(ConfigurationManager.getInstance().getHubConfigDir() + "/log4j.properties");
  engine=new CommandEngine();
  engine.removeAllCommands();
  engine.registerCommand("about",new AboutCommand());
  engine.registerCommand("help",new HelpCommand());
  engine.registerCommand("regme",new RegmeCommand());
  engine.registerCommand("info",new InfoCommand());
  engine.registerCommand("kick",new KickCommand());
  engine.registerCommand("grant",new GrantCommand());
  engine.registerCommand("reload",new ReloadCommand());
  engine.registerCommand("restart",new RestartCommand());
  engine.registerCommand("shutdown",new ShutdownCommand());
}
 

Example 22

From project jmxmonitor, under directory /jmxmonitor/src/test/java/uk/co/gidley/jmxmonitor/monitoring/.

Source file: BaseMonitoringTest.java

  19 
vote

@BeforeMethod public void setup() throws InitialisationException, JoranException, InterruptedException, MalformedObjectNameException, MBeanRegistrationException, InstanceAlreadyExistsException, NotCompliantMBeanException {
  registryManager=new RegistryManager(getConfiguration());
  registerTestMBeans();
  jmxMonitorThread=new Thread(new JmxRunner(),"JmxRunner");
  jmxMonitorThread.start();
  while (!registryManager.isReadyToRun()) {
    Thread.sleep(100);
  }
  LoggerContext lc=(LoggerContext)LoggerFactory.getILoggerFactory();
  JoranConfigurator configurator=new JoranConfigurator();
  configurator.setContext(lc);
  lc.reset();
  configurator.doConfigure("src/test/resources/logback-inMemory.xml");
  StatusPrinter.printInCaseOfErrorsOrWarnings(lc);
  while (TestAppender.getEvents().size() < waitForEvents()) {
    Thread.sleep(100);
  }
}
 

Example 23

From project jmxutils, under directory /src/test/java/org/weakref/jmx/.

Source file: TestExporter.java

  19 
vote

@BeforeMethod void setup() throws IOException, MalformedObjectNameException, NotBoundException {
  server=new TestingMBeanServer();
  objects=new ArrayList<Pair<ObjectName,?>>(2);
  objects.add(Pair.of(getUniqueObjectName(),new SimpleObject()));
  objects.add(Pair.of(getUniqueObjectName(),new CustomAnnotationObject()));
  objects.add(Pair.of(getUniqueObjectName(),new FlattenObject()));
  objects.add(Pair.of(getUniqueObjectName(),new CustomFlattenAnnotationObject()));
  objects.add(Pair.of(getUniqueObjectName(),new NestedObject()));
  objects.add(Pair.of(getUniqueObjectName(),new CustomNestedAnnotationObject()));
  MBeanExporter exporter=new MBeanExporter(server);
  for (  Pair<ObjectName,?> pair : objects) {
    exporter.export(pair.left.getCanonicalName(),pair.right);
  }
}
 

Example 24

From project joda-money, under directory /src/test/java/org/joda/money/format/.

Source file: TestMoneyFormatter.java

  19 
vote

@BeforeMethod public void beforeMethod(){
  Locale.setDefault(TEST_GB_LOCALE);
  iPrintTest=new MoneyFormatterBuilder().appendCurrencyCode().appendLiteral(" hello").toFormatter();
  iCannotPrint=new MoneyFormatterBuilder().append(null,new MoneyParser(){
    public void parse(    MoneyParseContext context){
    }
  }
).toFormatter();
  iParseTest=new MoneyFormatterBuilder().appendAmountLocalized().appendLiteral(" ").appendCurrencyCode().toFormatter();
  iCannotParse=new MoneyFormatterBuilder().append(new MoneyPrinter(){
    public void print(    MoneyPrintContext context,    Appendable appendable,    BigMoney money) throws IOException {
    }
  }
,null).toFormatter();
}
 

Example 25

From project jolokia, under directory /agent/core/src/test/java/org/jolokia/backend/.

Source file: MBeanServerHandlerTest.java

  19 
vote

@BeforeMethod public void setup() throws MalformedObjectNameException {
  TestDetector.reset();
  Map<ConfigKey,String> config=new HashMap<ConfigKey,String>();
  config.put(ConfigKey.MBEAN_QUALIFIER,"qualifier=test");
  handler=new MBeanServerHandler(config,getEmptyLogHandler());
  request=new JmxRequestBuilder(RequestType.READ,"java.lang:type=Memory").attribute("HeapMemoryUsage").build();
}
 

Example 26

From project json-schema-validator, under directory /src/test/java/org/eel/kitchen/jsonschema/keyword/.

Source file: BasicKeywordValidatorTest.java

  19 
vote

@BeforeMethod public void initContext(){
  final KeywordBundle bundle=KeywordBundles.defaultBundle();
  final URIManager manager=new URIManager();
  final SchemaRegistry registry=new SchemaRegistry(manager,URI.create(""));
  final JsonValidatorCache cache=new JsonValidatorCache(bundle,registry);
  context=new ValidationContext(cache);
  report=new ValidationReport();
  validator=spy(new BasicKeywordValidator());
}
 

Example 27

From project kryo-serializers, under directory /src/test/java/de/javakaffee/kryoserializers/.

Source file: SubListSerializerTest.java

  19 
vote

@BeforeMethod public void beforeMethod(){
  _kryo=new KryoReflectionFactorySupport(){
    @Override @SuppressWarnings({"rawtypes","unchecked"}) public Serializer newSerializer(    final Class type){
      if (SubListSerializer.canSerialize(type)) {
        return new SubListSerializer(this,type);
      }
      return super.newSerializer(type);
    }
  }
;
  _kryo.setRegistrationOptional(true);
}
 

Example 28

From project lightweightEE, under directory /backend/src/test/java/de/jaxenter/eesummit/caroline/backend/test/.

Source file: CdiContainerTest.java

  19 
vote

/** 
 * Starts container
 * @throws Exception in case of severe problem
 */
@BeforeMethod public final void setUp() throws Exception {
  containerRefCount++;
  if (cdiContainer == null) {
    ProjectStageProducer.setProjectStage(runInProjectStage());
    cdiContainer=CdiContainerLoader.getCdiContainer();
    cdiContainer.boot();
    cdiContainer.getContextControl().startContexts();
  }
 else {
    cleanInstances();
  }
}
 

Example 29

From project managed-ledger, under directory /src/test/java/org/apache/bookkeeper/test/.

Source file: BookKeeperClusterTestCase.java

  19 
vote

@BeforeMethod public void setUp() throws Exception {
  try {
    startBookKeeper();
  }
 catch (  Exception e) {
    LOG.error("Error setting up",e);
    throw e;
  }
}
 

Example 30

From project memcached-session-manager, under directory /core/src/test/java/de/javakaffee/web/msm/integration/.

Source file: MemcachedFailoverIntegrationTest.java

  19 
vote

@BeforeMethod public void setUp() throws Throwable {
  _portTomcat1=18888;
  _address1=new InetSocketAddress("localhost",21211);
  _daemon1=createDaemon(_address1);
  _daemon1.start();
  _address2=new InetSocketAddress("localhost",21212);
  _daemon2=createDaemon(_address2);
  _daemon2.start();
  _address3=new InetSocketAddress("localhost",21213);
  _daemon3=createDaemon(_address3);
  _daemon3.start();
  _nodeId1="n1";
  _nodeId2="n2";
  _nodeId3="n3";
  try {
    final String memcachedNodes=toString(_nodeId1,_address1) + " " + toString(_nodeId2,_address2)+ " "+ toString(_nodeId3,_address3);
    _tomcat1=getTestUtils().createCatalina(_portTomcat1,10,memcachedNodes);
    getManager(_tomcat1).setSticky(true);
    _tomcat1.start();
  }
 catch (  final Throwable e) {
    LOG.error("could not start tomcat.",e);
    throw e;
  }
  _httpClient=new DefaultHttpClient();
}
 

Example 31

From project MetaHeuristics4Java, under directory /MetaHeuristics4Java/src/test/java/de/mh4j/solver/genetic/genepool/.

Source file: GenePoolTest.java

  19 
vote

@BeforeMethod public void setUp(){
  genome1=mock(Genome.class);
  genome2=mock(Genome.class);
  genome3=mock(Genome.class);
  when(genome1.getFitness()).thenReturn(genome1Fitness);
  when(genome2.getFitness()).thenReturn(genome2Fitness);
  when(genome3.getFitness()).thenReturn(genome3Fitness);
  for (  Genome genome : Arrays.asList(genome1,genome2,genome3)) {
    for (    Genome otherGenome : Arrays.asList(genome1,genome2,genome3)) {
      makeGenomeMockComparable(genome,otherGenome);
    }
  }
  genePool=new GenePool<>();
  genePool.addGenome(genome1);
  genePool.addGenome(genome2);
  genePool.addGenome(genome3);
}
 

Example 32

From project modelmapper, under directory /core/src/test/java/org/modelmapper/functional/converter/.

Source file: CustomConversion.java

  19 
vote

@Override @BeforeMethod protected void initContext(){
  super.initContext();
  modelMapper.addMappings(new PropertyMap<ModelObject,ModelDTO>(){
    protected void configure(){
      using(converter1).map().setValue2(source.getValue2());
    }
  }
);
  result=modelMapper.map(new ModelObject(),ModelDTO.class);
}
 

Example 33

From project mongo-java-driver, under directory /src/test/com/mongodb/.

Source file: LazyDBObjectTest.java

  19 
vote

@BeforeMethod public void beforeMethod(){
  e=new BasicBSONEncoder();
  buf=new BasicOutputBuffer();
  e.set(buf);
  bios=new ByteArrayOutputStream();
  lazyDBDecoder=new LazyDBDecoder();
  defaultDBDecoder=new DefaultDBDecoder();
}
 

Example 34

From project monitor-event-tap, under directory /src/test/java/com/proofpoint/event/monitor/.

Source file: TestMonitorsResource.java

  19 
vote

@BeforeMethod public void setUp() throws Exception {
  InMemoryAlerter alerter=new InMemoryAlerter();
  fooMonitor=new Monitor("foo","event",executor,new EventPredicate("event","true"),1.0,2.0,alerter);
  barMonitor=new Monitor("bar","event",executor,new EventPredicate("event","true"),1.0,2.0,alerter);
  resource=new MonitorsResource(ImmutableSet.of(fooMonitor,barMonitor));
}
 

Example 35

From project myfaces-extcdi, under directory /core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/util/.

Source file: ContainerTestBase.java

  19 
vote

/** 
 * Starts container or clean contextual instances before each test.
 * @throws Exception in case of severe problem
 */
@BeforeMethod public final void setUp() throws Exception {
  log=Logger.getLogger(this.getClass().getName());
  containerRefCount++;
  if (containerStarter == null) {
    ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
    containerStarter=CdiTestContainerLoader.getCdiContainer();
    containerStarter.bootContainer();
  }
 else {
    cleanInstances();
  }
}
 

Example 36

From project nettosphere, under directory /server/src/test/java/org/atmosphere/nettosphere/test/.

Source file: NettyJerseyTest.java

  19 
vote

@BeforeMethod public void startServer() throws IOException {
  port=findFreePort();
  urlTarget=getUrlTarget(port);
  Config config=new Config.Builder().port(port).host("127.0.0.1").resource(Resource.class).build();
  server=new Nettosphere.Builder().config(config).build();
  server.start();
}
 

Example 37

From project nexus-p2-repository-plugin, under directory /src/test/java/org/sonatype/nexus/plugins/p2/repository/its/nxcm0794/.

Source file: NXCM0794WebProxiedP2IT.java

  19 
vote

@BeforeMethod(alwaysRun=true) public void startWebProxy() throws Exception {
  try {
    webProxyServer=(ProxyServer)lookup(ProxyServer.ROLE);
    webProxyServer.start();
  }
 catch (  Exception e) {
    fail("Current properties:\n" + TestProperties.getAll(),e);
  }
  assertThat(downloadFile(new URL(baseProxyURL + "nxcm0794/artifacts.xml"),"./target/downloads/nxcm0794/artifacts.xml.temp"),exists());
}
 

Example 38

From project objectos-comuns-jdbc, under directory /src/test/java/br/com/objectos/comuns/relational/jdbc/.

Source file: MysqlSQLBuilderSelectPageTest.java

  19 
vote

@BeforeMethod public void reset(){
  dbunit.load(new MiniComunsJdbcTruncateXml());
  dbunit.load(new MiniComunsJdbcXml());
  sql=sqlProvider.get();
  sql.select("*").from("COMUNS_RELATIONAL.MANY").as("MANY").andLoadWith(loader);
  sql.order("ID").ascending();
}
 

Example 39

From project overthere, under directory /src/test/java/com/xebialabs/overthere/ssh/.

Source file: RegularExpressionPasswordResponseProviderTest.java

  19 
vote

@BeforeMethod public void setup(){
  provider=new RegularExpressionPasswordResponseProvider(new PasswordFinder(){
    @Override public char[] reqPassword(    Resource<?> resource){
      return SECRET_PASSWORD;
    }
    @Override public boolean shouldRetry(    Resource<?> resource){
      return false;
    }
  }
,INTERACTIVE_KEYBOARD_AUTH_PROMPT_REGEX_DEFAULT);
  provider.init(mock(Resource.class),null,null);
}
 

Example 40

From project parasim, under directory /core/src/test/java/org/sybila/parasim/core/extension/configuration/impl/.

Source file: TestExtensionDescriptorMapperImpl.java

  19 
vote

@BeforeMethod public void prepare(){
  descriptor=new ExtensionDescriptorImpl("my-extension");
  descriptor.setProperty("intNumber","20");
  descriptor.setProperty("floatNumber","20.5");
  descriptor.setProperty("bool","true");
  descriptor.setProperty("intNumbers",new String[]{"1","2","3"});
  descriptor.setProperty("color","Black");
  descriptor.setProperty("unit","hours");
  descriptor.setProperty("file","/tmp");
  configBean=new ConfigBean();
}
 

Example 41

From project platform_3, under directory /discovery/src/test/java/com/proofpoint/discovery/client/.

Source file: TestAnnouncer.java

  19 
vote

@BeforeMethod protected void setUp() throws Exception {
  nodeInfo=new NodeInfo(new NodeConfig().setEnvironment("test").setPool("pool"));
  discoveryClient=new InMemoryDiscoveryClient(nodeInfo,MAX_AGE);
  serviceAnnouncement=ServiceAnnouncement.serviceAnnouncement(serviceType.value()).addProperty("a","apple").build();
  announcer=new Announcer(discoveryClient,ImmutableSet.of(serviceAnnouncement));
}
 

Example 42

From project Please, under directory /modules/core/src/test/groovy/com/atoito/please/test/unit/.

Source file: ArchivesTest.java

  19 
vote

@BeforeMethod public void initMethod() throws Exception {
  Directories.ensureExists(sourcesDirectory);
  Directories.clean(sourcesDirectory);
  Directories.ensureExists(archivesDirectory);
  Directories.clean(archivesDirectory);
  Directories.ensureExists(expandesDirectory);
  Directories.clean(expandesDirectory);
  assertThat(sourcesDirectory).as("sourcesDirectory").exists();
  assertThat(archivesDirectory).as("archivesDirectory").exists();
  assertThat(expandesDirectory).as("expandesDirectory").exists();
}
 

Example 43

From project richrates, under directory /src/test/java/org/richfaces/examples/richrates/ui/.

Source file: AbstractWebDriverTest.java

  19 
vote

@BeforeMethod(dependsOnGroups={"arquillian"}) public void preparePage() throws MalformedURLException {
  page=createPage(getRoot());
  if (driver instanceof AndroidDriver) {
    driver.get(getPage().getUrl().toString().replace("faces","faces/mobile"));
  }
 else {
    driver.get(getPage().getUrl().toString());
  }
  FieldDecorator decoraor=new StaleReferenceAwareFieldDecorator(new DefaultElementLocatorFactory(driver),5);
  PageFactory.initElements(decoraor,page);
}
 

Example 44

From project serengeti-ws, under directory /common/src/test/java/com/vmware/bdd/apitypes/.

Source file: AppConfigValidationFactoryTest.java

  19 
vote

@BeforeMethod public void setup(){
  cluster=new ClusterCreate();
  Map<String,Object> hadoopMap=new HashMap<String,Object>();
  Map<String,Object> fileMap=new HashMap<String,Object>();
  Map<String,Object> corePopertysMap=new HashMap<String,Object>();
  Map<String,Object> hdfsPopertysMap=new HashMap<String,Object>();
  Map<String,Object> mapredPopertysMap=new HashMap<String,Object>();
  corePopertysMap.put("hadoop.tmp.dir","/tmp");
  hdfsPopertysMap.put("dfs.http.address","localhost");
  mapredPopertysMap.put("mapred.job.tracker","127.0.1.2");
  fileMap.put("core-site.xml",corePopertysMap);
  fileMap.put("hdfs-site.xml",hdfsPopertysMap);
  fileMap.put("mapred-site.xml",mapredPopertysMap);
  hadoopMap.put("hadoop",fileMap);
  cluster.setConfiguration(hadoopMap);
  NodeGroupCreate nodeGroup=new NodeGroupCreate();
  hadoopMap=new HashMap<String,Object>();
  fileMap=new HashMap<String,Object>();
  corePopertysMap=new HashMap<String,Object>();
  hdfsPopertysMap=new HashMap<String,Object>();
  mapredPopertysMap=new HashMap<String,Object>();
  corePopertysMap.put("hadoop.tmp.dir","/tmp");
  hdfsPopertysMap.put("dfs.namenode.test.level",4);
  hdfsPopertysMap.put("dfs.namenode.logger.level",5);
  mapredPopertysMap.put("mapred.cluster.map.memory.mb",200);
  fileMap.put("core-site.xml",corePopertysMap);
  fileMap.put("hdfs-site.xml",hdfsPopertysMap);
  fileMap.put("mapred-site.xml",mapredPopertysMap);
  hadoopMap.put("hadoop",fileMap);
  nodeGroup.setConfiguration(hadoopMap);
  cluster.setNodeGroups(new NodeGroupCreate[]{nodeGroup});
}
 

Example 45

From project serialization, under directory /writer/src/test/java/com/ning/metrics/serialization/writer/.

Source file: TestDiskSpoolEventWriter.java

  19 
vote

@BeforeMethod(alwaysRun=true) void setup(){
  spoolPath=System.getProperty("java.io.tmpdir") + "/diskspooleventwriter-" + System.currentTimeMillis();
  spoolDir=new File(spoolPath);
  tmpDir=new File(spoolDir,"_tmp");
  quarantineDir=new File(spoolDir,"_quarantine");
  lockDir=new File(spoolDir,"_lock");
  prepareSpoolDirs();
}
 

Example 46

From project sitebricks, under directory /sitebricks/src/test/java/com/google/sitebricks/compiler/.

Source file: FreemarkerTemplateCompilerTest.java

  19 
vote

@BeforeMethod public void pre(){
  methods.put("get",Get.class);
  methods.put("post",Post.class);
  methods.put("put",Put.class);
  methods.put("patch",Patch.class);
  methods.put("delete",Delete.class);
  injector=Guice.createInjector(new AbstractModule(){
    protected void configure(){
      bind(HttpServletRequest.class).toProvider(mockRequestProviderForContext());
      bind(new TypeLiteral<Map<String,Class<? extends Annotation>>>(){
      }
).annotatedWith(Bricks.class).toInstance(methods);
    }
  }
);
  pageBook=createNiceMock(PageBook.class);
  metrics=createNiceMock(SystemMetrics.class);
}
 

Example 47

From project tapestry-monitoring, under directory /src/test/java/com/joshcanfield/tapestry5/monitor/integration/.

Source file: MonitorTests.java

  19 
vote

@BeforeMethod public void resetSimon(){
  Collection<String> strings=SimonManager.simonNames();
  for (  String string : strings) {
    SimonManager.getSimon(string).reset();
  }
}
 

Example 48

From project teamcity-nuget-support, under directory /nuget-tests/src/jetbrains/buildServer/nuget/tests/agent/.

Source file: CommandlineBuildProcessFactoryTest.java

  19 
vote

@BeforeMethod @Override protected void setUp() throws Exception {
  super.setUp();
  m=new Mockery();
  myWorkDir=createTempDir();
  myFacade=m.mock(BuildProcessFacade.class);
  myRootContext=m.mock(BuildRunnerContext.class,"root-context");
  mySubContext=m.mock(BuildRunnerContext.class,"sub-context");
  myBuild=m.mock(AgentRunningBuild.class);
  myProcess=m.mock(BuildProcess.class);
  myLogger=m.mock(BuildProgressLogger.class);
  myFactory=new CommandlineBuildProcessFactoryImpl(myFacade);
  m.checking(new Expectations(){
{
      oneOf(myFacade).createBuildRunnerContext(myBuild,SimpleRunnerConstants.TYPE,myWorkDir.getPath(),myRootContext);
      will(returnValue(mySubContext));
      allowing(myRootContext).getBuild();
      will(returnValue(myBuild));
      allowing(mySubContext).getBuild();
      will(returnValue(myBuild));
      allowing(myBuild).getBuildLogger();
      will(returnValue(myLogger));
      allowing(myLogger).message(with(any(String.class)));
      oneOf(myFacade).createExecutable(myBuild,mySubContext);
      will(returnValue(myProcess));
    }
  }
);
}
 

Example 49

From project zanata, under directory /zanata-war/src/test/java/org/zanata/model/.

Source file: DocumentJPATest.java

  19 
vote

@BeforeMethod(firstTimeOnly=true) public void beforeMethod(){
  dao=new DocumentDAO((Session)getEm().getDelegate());
  localeDAO=new LocaleDAO((Session)em.getDelegate());
  en_US=localeDAO.findByLocaleId(LocaleId.EN_US);
  de_DE=localeDAO.findByLocaleId(new LocaleId("de"));
}
 

Example 50

From project zookeeper-common, under directory /src/test/java/com/edmunds/zookeeper/election/.

Source file: ZooKeeperElectionTest.java

  19 
vote

@BeforeMethod public void setup(){
  this.callbackCreatePrimary=new Capture<AsyncCallback.StringCallback>();
  this.zooKeeperElectionContextCapture=new Capture<ZooKeeperElectionContext>();
  this.callbackListChildren=new Capture<AsyncCallback.Children2Callback>();
  this.callbackGetDataWatcher=new Capture<Watcher>();
  this.callbackGetData=new Capture<AsyncCallback.DataCallback>();
  this.control=EasyMock.createControl();
  this.connection=control.createMock("connection",ZooKeeperConnection.class);
  this.listener=control.createMock("listener",ZooKeeperElectionListener.class);
}