Search Results

Search found 22139 results on 886 pages for 'security testing'.

Page 44/886 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • problem in handling menu - submenu based on spring security

    - by Nirmal
    Hi All... I have configured spring security core plugin using requestmap table inside the database.. Now inside requestmap table I have all the possible urls and it's equivalent roles who can access that url... Now I want to generate menus and submenus based on the urls stored in requestmap table... So my requirement is to check the urls of menu & submenus against the logged in users privileges... And if logged in user has any one privilege then I need to display that main menu and the available submenus.... For e.g. I have a menu in my project called user which has a following submenus : **Users (main menu)** Manage Users (sub menu) Import Users (sub menu) Now inside my header.gsp I have successfully achieved the above requirement using if else condition, like : if ( privs.contains("/users/manageUsers") || privs.contains("/users/importUsers")) here privs are the list of urls from requestmap table for logged in user. But I want to achieve these using spring security tag lib, so for comparing urls I have find following tag from spring security core documentation : <sec:access url="/users/manageUsers"> But i am bit confuse that how I can replace or condition using tag library.. Is there any tag available which checks from multiple urls and evaluate it to true or false ? Of course I can do using sec:access tag with some flag logic, but is there any tags available which can fulfill my requirement directly ? Thanks in advance...

    Read the article

  • Web Applications Development: Security practices for Application design

    - by Shyam
    Hi, As I am creating more web applications that are targeted for multiple users, I figured out that I have to start thinking about user management and security. At a glance and in my ideal world, all users belong to a group. Permissions and access is thus defined per group (and inherited by the users of that group). Logically, I have my group of administrators, which are identified with a level "7" (integer) clearance. A group of webusers have for example level "1". This in generally all works great for me, but I need some kind of list that I have to keep in mind how I secure my system, and some general practices. I am not looking for a specific environment; I want to learn the why's and how's. An example is privilege escalation. If someone would be able to "push" themselves inside a group with higher privileges, for example the Administration, how can I prevent this, or what measures should I take to have some sort of precaution? I don't like in that case to walk into a caveat. My question is basically: where can I find a good resource, list, policy, book that explains the security of web applications, the why's, the how's and readable if you don't have any experience in the realm of advanced security? I prefer a free resource, as I believe I couldn't be the first one who thought about this. Thank you for your answers, comments and feedback.

    Read the article

  • SOA Suite 11g Asynchronous Testing with soapUI

    - by Greg Mally
    Overview The Enterprise Manager test harness that comes bundled with SOA Suite 11g is a great tool for doing smoke tests and some minor load testing. When a more robust testing tool is needed, often times soapUI is leveraged for many reasons ranging from ease of use to cost effective. However, when you want to start doing some more complex testing other than synchronous web services with static content, then the free version of soapUI becomes a bit more challenging. In this blog I will show you how to test asynchronous web services with soapUI free edition. The following assumes that you have a working knowledge of soapUI and will not go into concepts like setting up a project etc. For the basics, please review the documentation for soapUI: http://www.soapui.org/Getting-Started/ Asynchronous Web Service Testing in soapUI When invoking an asynchronous web service, the caller must provide a callback for the response. Since our testing will originate from soapUI, then it is only natural that soapUI would provide the callback mechanism. This mechanism in soapUI is called a MockService. In a nutshell, a soapUI MockService is a simulation of a Web Service (aka, a process listening on a port). We will go through the steps in setting up the MockService for a simple asynchronous BPEL process. After creating your soapUI project based on an asynchronous BPEL process, you will see something like the following: Notice that soapUI created an interface for both the request and the response (i.e., callback). The interface that was created for the callback will be used to create the MockService. Right-click on the callback interface and select the Generate MockService menu item: You will be presented with the Generate MockService dialogue where we will tweak the Path and possibly the port (depends upon what ports are available on the machine where soapUI will be running). We will adjust the Path to include the operation name (append /processResponse in this example) and the port of 8088 is fine: Once the MockService is created, you should have something like the following in soapUI: This window acts as a console/view into the callback process. When the play button is pressed (green triangle in the upper left-hand corner), soapUI will start a process running on the configured Port that will accept web service invocations on the configured Path: At this point we are “almost” ready to try out the asynchronous test. But first we must provide the web service addressing (WS-A) configuration on the request message. We will edit the message for the request interface that was generated when the project was created (SimpleAsyncBPELProcessBinding > process > Request 1 in this example). At the bottom of the request message editor you will find the WS-A configuration by left-clicking on the WS-A label: Here we will setup WS-A by changing the default values to: Must understand: TRUE Add default wsa:Action: Add default wsa:Action (checked) Reply to: ${host where soapUI is running}:${MockService Port}${MockService Path} … in this example: http://192.168.1.181:8088/mockSimpleAsyncBPELProcessCallbackBinding/processResponse We now are ready to run the asynchronous test from soapUI free edition. Make sure that the MockService you created is running and then push the play button for the request (green triangle in the upper left-hand corner of the request editor). If everything is configured correctly, you should see the response show up in the MockService window: To view the response message/payload, just double-click on a response message in the Message Log window of the MockService: At this point you can now expand the project to include a Test Suite for some load balance tests etc. This same topic has been covered in various detail on other sites/blogs, but I wanted to simplify and detail how this is done in the context of SOA Suite 11g. It also serves as a nice introduction to another blog of mine: SOA Suite 11g Dynamic Payload Testing with soapUI Free Edition.

    Read the article

  • ASP.NET Unit Testing - WatiN and Windows 7 / Internet Explorer 8

    - by tyndall
    Any tricks in getting WatiN to run on Win7/IE8? My code: browser = new IE(); browser.GoTo("http://testserver"); browser.TextField(Find.ByName("txtUser")).TypeText("tyndall"); The third line never really runs and I get an error back: System.Runtime.InteropServices.COMException : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) The second line seems to run. IE8 appears and is navigated to the correct URL.

    Read the article

  • Unit testing methods decorated with custom attributes

    - by Joel Cunningham
    I am trying to retrofit unit tests on to some existing code base. Both the class and method I want to unit test is decorated with custom attributes. These attributes are fairly sophisticated and I dont want them to run as part of the unit test. The only solution I have come up with is to compile the attribute out when I want to unit test. I dont really like this solution and would prefer to either replace it with a mocked attribute at runtime or prevent the attribute from running in a more elegant way. How do you unit test code that has class and method attributes that you dont want to run as part of a unit test? Thanks in advance.

    Read the article

  • Unit testing Monorail's RenderText method

    - by MikeWyatt
    I'm doing some maintenance on an older web application written in Monorail v1.0.3. I want to unit test an action that uses RenderText(). How do I extract the content in my test? Reading from controller.Response.OutputStream doesn't work, since the response stream is either not setup properly in PrepareController(), or is closed in RenderText(). Example Action public DeleteFoo( int id ) { var success= false; var foo = Service.Get<Foo>( id ); if( foo != null && CurrentUser.IsInRole( "CanDeleteFoo" ) ) { Service.Delete<Foo>( id ); success = true; } CancelView(); RenderText( "{ success: " + success + " }" ); } Example Test (using Moq) [Test] public void DeleteFoo() { var controller = new FooController (); PrepareController ( controller ); var foo = new Foo { Id = 123 }; var mockService = new Mock < Service > (); mockService.Setup ( s => s.Get<Foo> ( foo.Id ) ).Returns ( foo ); controller.Service = mockService.Object; controller.DeleteTicket ( foo.Id ); mockService.Verify ( s => s.Delete<Foo> ( foo.Id ) ); Assert.AreEqual ( "{success:true}", GetResponse ( Response ) ); } // response.OutputStream.Seek throws an "System.ObjectDisposedException: Cannot access a closed Stream." exception private static string GetResponse( IResponse response ) { response.OutputStream.Seek ( 0, SeekOrigin.Begin ); var buffer = new byte[response.OutputStream.Length]; response.OutputStream.Read ( buffer, 0, buffer.Length ); return Encoding.ASCII.GetString ( buffer ); }

    Read the article

  • Performance Testing a .NET Smart Client Application (.NET ClickOnce technology)

    - by jn29098
    Has anyone ever had to run performance tests on a ClickOnce application? I have engaged with a vendor who had trouble setting up their toolset with our software because it is Smart Client based. They are understandably more geared toward purely browser-based applications. I wonder if anyone has had to tackle this before and if so would you recommend any vendors who use industry standard tools such as Load Runner (which i assume can handle the smart client)? Thanks

    Read the article

  • testing Clojure in Maven

    - by Ralph
    I am new at Maven and even newer at Clojure. As an exercise to learn the language, I am writing a spider solitaire player program. I also plan on writing a similar program in Scala to compare the implementations (see my post http://stackoverflow.com/questions/2571267/modern-java-alternatives-closed). I have configured a Maven directory structure containing the usual src/main/clojure and src/test/clojure directories. My pom.xml file includes the clojure-maven-plugin. When I run "mvn test", it displays "No tests to run", despite my having test code in the src/test/clojure directory. As I misnaming something? Here is my 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> <groupId>SpiderPlayer</groupId> <artifactId>SpiderPlayer</artifactId> <version>1.0.0-SNAPSHOT</version> <inceptionYear>2010</inceptionYear> <packaging>jar</packaging> <properties> <maven.build.timestamp.format>yyMMdd.HHmm</maven.build.timestamp.format> <main.dir>org/dogdaze/spider_player</main.dir> <main.package>org.dogdaze.spider_player</main.package> <main.class>${main.package}.Main</main.class> </properties> <build> <sourceDirectory>src/main/clojure</sourceDirectory> <testSourceDirectory>src/main/clojure</testSourceDirectory> <plugins> <plugin> <groupId>com.theoryinpractise</groupId> <artifactId>clojure-maven-plugin</artifactId> <version>1.3.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.3</version> <executions> <execution> <goals> <goal>run</goal> </goals> <phase>generate-sources</phase> <configuration> <tasks> <echo file="${project.build.sourceDirectory}/${main.dir}/Version.clj" message="(ns ${main.package})${line.separator}"/> <echo file="${project.build.sourceDirectory}/${main.dir}/Version.clj" append="true" message="(def version &quot;${maven.build.timestamp}&quot;)${line.separator}"/> </tasks> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.1</version> <executions> <execution> <goals> <goal>single</goal> </goals> <phase>package</phase> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>${main.class}</mainClass> </manifest> </archive> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <redirectTestOutputToFile>true</redirectTestOutputToFile> <skipTests>false</skipTests> <skip>false</skip> </configuration> <executions> <execution> <id>surefire-it</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> <skip>false</skip> </configuration> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.2</version> <scope>compile</scope> </dependency> </dependencies> </project> Here is my Clojure source file (src/main/clojure/org/dogdaze/spider_player/Deck.clj): ; Copyright 2010 Dogdaze (ns org.dogdaze.spider_player.Deck (:use [clojure.contrib.seq-utils :only (shuffle)])) (def suits [:clubs :diamonds :hearts :spades]) (def ranks [:ace :two :three :four :five :six :seven :eight :nine :ten :jack :queen :king]) (defn suit-seq "Return 4 suits: if number-of-suits == 1: :clubs :clubs :clubs :clubs if number-of-suits == 2: :clubs :diamonds :clubs :diamonds if number-of-suits == 4: :clubs :diamonds :hearts :spades." [number-of-suits] (take 4 (cycle (take number-of-suits suits)))) (defstruct card :rank :suit) (defn unshuffled-deck "Create an unshuffled deck containing all cards from the number of suits specified." [number-of-suits] (for [rank ranks suit (suit-seq number-of-suits)] (struct card rank suit))) (defn deck "Create a shuffled deck containing all cards from the number of suits specified." [number-of-suits] (shuffle (unshuffled-deck number-of-suits))) Here is my test case (src/test/clojure/org/dogdaze/spider_player/TestDeck.clj): ; Copyright 2010 Dogdaze (ns org.dogdaze.spider_player (:use clojure.set clojure.test org.dogdaze.spider_player.Deck)) (deftest test-suit-seq (is (= (suit-seq 1) [:clubs :clubs :clubs :clubs])) (is (= (suit-seq 2) [:clubs :diamonds :clubs :diamonds])) (is (= (suit-seq 4) [:clubs :diamonds :hearts :spades]))) (def one-suit-deck [{:rank :ace, :suit :clubs} {:rank :ace, :suit :clubs} {:rank :ace, :suit :clubs} {:rank :ace, :suit :clubs} {:rank :two, :suit :clubs} {:rank :two, :suit :clubs} {:rank :two, :suit :clubs} {:rank :two, :suit :clubs} {:rank :three, :suit :clubs} {:rank :three, :suit :clubs} {:rank :three, :suit :clubs} {:rank :three, :suit :clubs} {:rank :four, :suit :clubs} {:rank :four, :suit :clubs} {:rank :four, :suit :clubs} {:rank :four, :suit :clubs} {:rank :five, :suit :clubs} {:rank :five, :suit :clubs} {:rank :five, :suit :clubs} {:rank :five, :suit :clubs} {:rank :six, :suit :clubs} {:rank :six, :suit :clubs} {:rank :six, :suit :clubs} {:rank :six, :suit :clubs} {:rank :seven, :suit :clubs} {:rank :seven, :suit :clubs} {:rank :seven, :suit :clubs} {:rank :seven, :suit :clubs} {:rank :eight, :suit :clubs} {:rank :eight, :suit :clubs} {:rank :eight, :suit :clubs} {:rank :eight, :suit :clubs} {:rank :nine, :suit :clubs} {:rank :nine, :suit :clubs} {:rank :nine, :suit :clubs} {:rank :nine, :suit :clubs} {:rank :ten, :suit :clubs} {:rank :ten, :suit :clubs} {:rank :ten, :suit :clubs} {:rank :ten, :suit :clubs} {:rank :jack, :suit :clubs} {:rank :jack, :suit :clubs} {:rank :jack, :suit :clubs} {:rank :jack, :suit :clubs} {:rank :queen, :suit :clubs} {:rank :queen, :suit :clubs} {:rank :queen, :suit :clubs} {:rank :queen, :suit :clubs} {:rank :king, :suit :clubs} {:rank :king, :suit :clubs} {:rank :king, :suit :clubs} {:rank :king, :suit :clubs}]) (def two-suits-deck [{:rank :ace, :suit :clubs} {:rank :ace, :suit :diamonds} {:rank :ace, :suit :clubs} {:rank :ace, :suit :diamonds} {:rank :two, :suit :clubs} {:rank :two, :suit :diamonds} {:rank :two, :suit :clubs} {:rank :two, :suit :diamonds} {:rank :three, :suit :clubs} {:rank :three, :suit :diamonds} {:rank :three, :suit :clubs} {:rank :three, :suit :diamonds} {:rank :four, :suit :clubs} {:rank :four, :suit :diamonds} {:rank :four, :suit :clubs} {:rank :four, :suit :diamonds} {:rank :five, :suit :clubs} {:rank :five, :suit :diamonds} {:rank :five, :suit :clubs} {:rank :five, :suit :diamonds} {:rank :six, :suit :clubs} {:rank :six, :suit :diamonds} {:rank :six, :suit :clubs} {:rank :six, :suit :diamonds} {:rank :seven, :suit :clubs} {:rank :seven, :suit :diamonds} {:rank :seven, :suit :clubs} {:rank :seven, :suit :diamonds} {:rank :eight, :suit :clubs} {:rank :eight, :suit :diamonds} {:rank :eight, :suit :clubs} {:rank :eight, :suit :diamonds} {:rank :nine, :suit :clubs} {:rank :nine, :suit :diamonds} {:rank :nine, :suit :clubs} {:rank :nine, :suit :diamonds} {:rank :ten, :suit :clubs} {:rank :ten, :suit :diamonds} {:rank :ten, :suit :clubs} {:rank :ten, :suit :diamonds} {:rank :jack, :suit :clubs} {:rank :jack, :suit :diamonds} {:rank :jack, :suit :clubs} {:rank :jack, :suit :diamonds} {:rank :queen, :suit :clubs} {:rank :queen, :suit :diamonds} {:rank :queen, :suit :clubs} {:rank :queen, :suit :diamonds} {:rank :king, :suit :clubs} {:rank :king, :suit :diamonds} {:rank :king, :suit :clubs} {:rank :king, :suit :diamonds}]) (def four-suits-deck [{:rank :ace, :suit :clubs} {:rank :ace, :suit :diamonds} {:rank :ace, :suit :hearts} {:rank :ace, :suit :spades} {:rank :two, :suit :clubs} {:rank :two, :suit :diamonds} {:rank :two, :suit :hearts} {:rank :two, :suit :spades} {:rank :three, :suit :clubs} {:rank :three, :suit :diamonds} {:rank :three, :suit :hearts} {:rank :three, :suit :spades} {:rank :four, :suit :clubs} {:rank :four, :suit :diamonds} {:rank :four, :suit :hearts} {:rank :four, :suit :spades} {:rank :five, :suit :clubs} {:rank :five, :suit :diamonds} {:rank :five, :suit :hearts} {:rank :five, :suit :spades} {:rank :six, :suit :clubs} {:rank :six, :suit :diamonds} {:rank :six, :suit :hearts} {:rank :six, :suit :spades} {:rank :seven, :suit :clubs} {:rank :seven, :suit :diamonds} {:rank :seven, :suit :hearts} {:rank :seven, :suit :spades} {:rank :eight, :suit :clubs} {:rank :eight, :suit :diamonds} {:rank :eight, :suit :hearts} {:rank :eight, :suit :spades} {:rank :nine, :suit :clubs} {:rank :nine, :suit :diamonds} {:rank :nine, :suit :hearts} {:rank :nine, :suit :spades} {:rank :ten, :suit :clubs} {:rank :ten, :suit :diamonds} {:rank :ten, :suit :hearts} {:rank :ten, :suit :spades} {:rank :jack, :suit :clubs} {:rank :jack, :suit :diamonds} {:rank :jack, :suit :hearts} {:rank :jack, :suit :spades} {:rank :queen, :suit :clubs} {:rank :queen, :suit :diamonds} {:rank :queen, :suit :hearts} {:rank :queen, :suit :spades} {:rank :king, :suit :clubs} {:rank :king, :suit :diamonds} {:rank :king, :suit :hearts} {:rank :king, :suit :spades}]) (deftest test-unshuffled-deck (is (= (unshuffled-deck 1) one-suit-deck)) (is (= (unshuffled-deck 2) two-suits-deck)) (is (= (unshuffled-deck 4) four-suits-deck))) (deftest test-shuffled-deck (is (= (set (deck 1)) (set one-suit-deck))) (is (= (set (deck 2)) (set two-suits-deck))) (is (= (set (deck 4)) (set four-suits-deck)))) (run-tests) Any idea why the test is not running? BTW, feel free to suggest improvements to the Clojure code. Thanks, Ralph

    Read the article

  • Automated testing with Ruby on Rails - best practices

    - by randombits
    Curious, what are you folks doing in as far as automating your unit tests with ruby on rails? Do you create a script that run a rake job in cron and have it mail you results? a pre-commit hook in git? just manual invokation? I understand tests completely, but wondering what are best practices to catch errors before they happen. Let's take for granted that the tests themselves are flawless and work as they should. What's the next step to make sure they reach you with the potentially detrimental results at the right time?

    Read the article

  • Unit Testing UrlHelper Extension Methods

    - by fregas
    I'm trying to create unit tests to make sure my extension methods for UrlHelper work? Does anyone know how to do this? I'm using MVC 1.0 and MvcContrib. I can test the routes but can't test code like this: public static string MoreFloorplans(this UrlHelper urlHelper, long productID, int pageIndex) { return urlHelper.Action<CatalogController>(x => x.GetRelatedProducts(productID, pageIndex)); }

    Read the article

  • Load testing multipart form

    - by JacobM
    I'm trying to load-test a Rails application using JMeter. A critical part of the application involves a form that includes both text inputs and file uploads. It works fine in a browser, but when I try to post that page in JMeter, Rails is saving all of the parts of the multipart form as temp files, which causes things to break when it's looking for a string and gets a tempfile instead. It appears that the difference is that, from a browser, the piece of the multipart request that contains a text input looks like this: -----------------------------7d93b4186074c Content-Disposition: form-data; name="field_name" test -----------------------------7d93b4186074c while from JMeter it looks like this: -----------------------------7d159c1302d0y0 Content-Disposition: form-data; name="field_name" Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit test -----------------------------7d159c1302d0y0 So apparently Rails sees the former and interprets it as a plain text value and treats it as a string, but sees the latter and saves it to a temp file. I have not been able to find a setting to convince JMeter not to send the additional headers in the multipart form for non-file fields. Is there a way to convince Rails to ignore those headers and treat the text/plain text as strings instead of text files? Or a quick way to put a filter in front of my controller that will strip the extra headers? Alternately, is there a better tool to load-test a Rails application that includes file upload?

    Read the article

  • Testing injected dependencies into your struts2 actions

    - by Barry
    Hi, I am wondering how others might have accomplished this. I found in the Spring documentation @required which I attempted to use in a 'test' but got this stmt INFO XmlConfigurationProvider:380 - Unable to verify action class [xxx] exists at initialization I have found another way in spring to do this is to write custom init methods and declare those on the bean but it almost seems like this is a strange thing to do to a struts2 action. In my application I inject through spring different web services (via setter injection) into different actions. I want to ensure on startup these are not null and set.

    Read the article

  • Testing Visual Studio 2008 Package

    - by Dave Swersky
    I'm developing a Visual Studio Integration Package. When I try to run the Unit Tests that are included in the unit test project that is included in the template I get the following failure on the first test: The test adapter 'VsIdeHostAdapter' threw an exception while running test 'MenuItemCallback'. Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED)) It's intermittent- a new instance of Visual Studio always spins up, then sometimes it works but usually fails.

    Read the article

  • Unit Testing & Fake Repository implementation with cascading CRUD operations

    - by Erik Ashepa
    Hi, i'm having trouble writing integration tests which use a fake repository, For example : Suppose I have a classroom entity, which aggregates students... var classroom = new Classroom(); classroom.Students.Add(new Student("Adam")); _fakeRepository.Save(classroom); _fakeRepostiory.GetAll<Student>().Where((student) => student.Name == "Adam")); // This query will return null... When using my real implementation for repository (NHibernate based), the above code works (because the save operation would cascade to the student added at the previous line), Do you know of any fake repository implementation which support this behaviour? Ideas on how to implement one myself? Or do you have any other suggestions which could help me avoid this issue? Thanks in advance, Erik.

    Read the article

  • Testing Python Decorators?

    - by Jama22
    I'm writing some unit tests for a Django project, and I was wondering if its possible (or necessary?) to test some of the decorators that I wrote for it. Here is an example of a decorator that I wrote: class login_required(object): def __init__(self, f): self.f = f def __call__(self, *args): request = args[0] if request.user and request.user.is_authenticated(): return self.f(*args) return redirect('/login')

    Read the article

  • google appengine local datastore integration testing with spring

    - by mirror303
    Hi all, I want to write some integration tests to see how my spring-managed DAO's behave when talking to the appengine datastore. Following the spring manual I will be providing my test-classes with the proper annotations: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:applicationContext.xml" }) After a lot of browsing I found this blog post dating back to august '09 from somebody doing exactly what I want to achieve. It involves writing a TestEnvironment class that implements ApiProxy.Environment plus talking to ApiProxyLocalImpl. However, if I look at the current docs (for version 1.3.1), it seems that this has been replaced by newing an instance of the framework provided LocalDatastoreServiceTestConfig which is passed to a LocalServiceTestHelper. It is too bad that the appengine docs don't show an example how to do this with JPA because then the spring wiring would be trivial. Trying to follow the route outlined in the blog posting has me running into a compiler messages telling me that classes such as ApiProxyLocalImpl are not visible by me. Hence, there must be a new way of doing it, which probably involves the LocalServiceTestHelper. My question: Does anybody know how? I know I will need to configure an EntityManagerFactory and provide it with the Datastore connection somehow... but how? :)

    Read the article

  • Testing Watir on Firefox throws JsshSocket::JSReferenceError

    - by picardo
    I am using Watir on Windows and when my script tries to run on Firefox, I see this error on my console: JsshSocket::JSReferenceError: Components is not definedReferenceError: Components is not defined C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/jssh_socket.rb:12:in `js_eval' C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb:195:in `goto' C:/xampp/Ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/firefox.rb:164:in `start' C:/xampp/Ruby/lib/ruby/gems/1.8/gems/commonwatir-1.6.5/lib/watir/browser.rb:71:in `start' ./test.rb:12:in `test_prepare' Does this happen to anyone else? What can I do to fix it?

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Unit testing JSON output module, best practices

    - by Banang
    I am currently working on a module that takes one of our business objects and returns a json representation of that object to the caller. Due to limitations in our environment I am unable to use any existing json writer, so I have written my own, which is then used by the business object writer to serialize my objects. The json writer is tested in a way similar to this @Test public void writeEmptyArrayTest() { String expected = "[ ]"; writer.array().endArray(); assertEquals(expected, writer.toString()); } which is only manageable because of the small output each instruction produces, even though I keep feeling there must be a better way. The problem I am now facing is writing tests for the object writer module, where the output is much larger and much less manageable. The risk of spelling mistakes in the expected strings mucking up my tests seem too great, and writing code in this fashion seems both silly and unmanageable in a long term perspective. I keep feeling like I want to write tests to ensure that my tests are behaving correctly, and this feeling worries me. Therefore, is there a better way of doing this? Surely there must be? Does anyone know of any good literature in regard to this specific case (doesn't have to be json, but you know what I mean)? Grateful for all help.

    Read the article

  • appengine local datastore integration testing with spring

    - by mirror303
    Hi all, I want to write some integration tests to see how my spring-managed DAO's behave when talking to the appengine datastore. Following the spring manual I will be providing my test-classes with the proper annotations: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "classpath:applicationContext.xml" }) After a lot of browsing I found this blog post dating back to august '09 from somebody doing exactly what I want to achieve. It involves writing a TestEnvironment class that implements ApiProxy.Environment plus talking to ApiProxyLocalImpl. However, if I look at the current docs (for version 1.3.1), it seems that this has been replaced by newing an instance of the framework provided LocalDatastoreServiceTestConfig which is passed to a LocalServiceTestHelper. It is too bad that the appengine docs don't show an example how to do this with JPA because then the spring wiring would be trivial. Trying to follow the route outlined in the blog posting has me running into a compiler messages telling me that classes such as ApiProxyLocalImpl are not visible by me. Hence, there must be a new way of doing it, which probably involves the LocalServiceTestHelper. My question: Does anybody know how? I know I will need to configure an EntityManagerFactory and provide it with the Datastore connection somehow... but how? :)

    Read the article

  • Easiest way of unit testing C code with Python

    - by Jon Mills
    I've got a pile of C code that I'd like to unit test using Python's unittest library (in Windows), but I'm trying to work out the best way of interfacing the C code so that Python can execute it (and get the results back). Does anybody have any experience in the easiest way to do it? Some ideas include: Wrapping the code as a Python C extension using the Python API Wrap the C code using SWIG Add a DLL wrapper to the C code and load it into Python using ctypes Add a small XML-RPC server to the c-code and call it using xmlrpclib (yes, I know this seems a bit far-out!) Is there a canonical way of doing this? I'm going to be doing this quite a lot, with different C modules, so I'd like to find a way which is least effort.

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >